Skip to content

Commit

Permalink
Re #8329. Remove unused undo/redo action.
Browse files Browse the repository at this point in the history
This hooked up undo and redo actions to menu items, but these menu
items are long-since removed from MantidPlot. The functionality had
also gone from Matrices, but is still there via the keyboard shortcuts
in Notes (if anyone would ever use it anyway).
  • Loading branch information
RussellTaylor committed Nov 25, 2013
1 parent edc3872 commit e87d251
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 44 deletions.
42 changes: 0 additions & 42 deletions Code/Mantid/MantidPlot/src/ApplicationWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@
#include <QSpinBox>
#include <QMdiArea>
#include <QMdiSubWindow>
#include <QUndoStack>
#include <QUndoView>
#include <QSignalMapper>
#include <QDesktopWidget>
#include <QPair>
Expand Down Expand Up @@ -3410,10 +3408,6 @@ void ApplicationWindow::initMatrix(Matrix* m, const QString& caption)

addMdiSubWindow(m);

QUndoStack *stack = m->undoStack();
connect(stack, SIGNAL(canUndoChanged(bool)), actionUndo, SLOT(setEnabled(bool)));
connect(stack, SIGNAL(canRedoChanged(bool)), actionRedo, SLOT(setEnabled(bool)));

connect(m, SIGNAL(modifiedWindow(MdiSubWindow*)), this, SLOT(updateMatrixPlots(MdiSubWindow *)));

emit modified();
Expand Down Expand Up @@ -9200,26 +9194,6 @@ void ApplicationWindow::fileMenuAboutToShow()

void ApplicationWindow::editMenuAboutToShow()
{
MdiSubWindow *w = activeWindow();
if (!w){
actionUndo->setEnabled(false);
actionRedo->setEnabled(false);
return;
}

if (qobject_cast<Note *>(w)){
QTextDocument* doc = dynamic_cast<Note*>(w)->editor()->document();
actionUndo->setEnabled(doc->isUndoAvailable());
actionRedo->setEnabled(doc->isRedoAvailable());
} else if (qobject_cast<Matrix *>(w)){
QUndoStack *stack = (dynamic_cast<Matrix*>(w))->undoStack();
actionUndo->setEnabled(stack->canUndo());
actionRedo->setEnabled(stack->canRedo());
} else {
actionUndo->setEnabled(false);
actionRedo->setEnabled(false);
}

reloadCustomActions();
}

Expand Down Expand Up @@ -12673,14 +12647,6 @@ void ApplicationWindow::createActions()
actionLoad = new QAction(QIcon(getQPixmap("import_xpm")), tr("&Import ASCII..."), this);
connect(actionLoad, SIGNAL(activated()), this, SLOT(importASCII()));

actionUndo = new QAction(QIcon(getQPixmap("undo_xpm")), tr("&Undo"), this);
actionUndo->setShortcut( tr("Ctrl+Z") );
connect(actionUndo, SIGNAL(activated()), this, SLOT(undo()));

actionRedo = new QAction(QIcon(getQPixmap("redo_xpm")), tr("&Redo"), this);
actionRedo->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_Z));
connect(actionRedo, SIGNAL(activated()), this, SLOT(redo()));

actionCopyWindow = new QAction(QIcon(getQPixmap("duplicate_xpm")), tr("&Duplicate"), this);
connect(actionCopyWindow, SIGNAL(activated()), this, SLOT(clone()));

Expand Down Expand Up @@ -13509,14 +13475,6 @@ void ApplicationWindow::translateActionsStrings()
actionLoad->setToolTip(tr("Import data file(s)"));
actionLoad->setShortcut(tr("Ctrl+K"));

actionUndo->setMenuText(tr("&Undo"));
actionUndo->setToolTip(tr("Undo changes"));
actionUndo->setShortcut(tr("Ctrl+Z"));

actionRedo->setMenuText(tr("&Redo"));
actionRedo->setToolTip(tr("Redo changes"));
actionRedo->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_Z));

actionCopyWindow->setMenuText(tr("&Duplicate"));
actionCopyWindow->setToolTip(tr("Duplicate window"));

Expand Down
3 changes: 1 addition & 2 deletions Code/Mantid/MantidPlot/src/ApplicationWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class QToolBar;
//class QAssistantClient;
class QLocale;
class QMdiArea;
class QUndoView;
class QSignalMapper;

class Matrix;
Expand Down Expand Up @@ -1398,7 +1397,7 @@ public slots:
QAction *actionNewProject, *actionNewNote, *actionNewTable, *actionNewFunctionPlot,*actionSaveFile;
QAction *actionNewSurfacePlot, *actionNewMatrix, *actionNewGraph, *actionNewFolder;
QAction *actionOpen, *actionLoadImage, *actionScriptRepo, *actionSaveProject, *actionSaveProjectAs, *actionImportImage,*actionLoadFile,*actionOpenProj;
QAction *actionLoad, *actionUndo, *actionRedo;
QAction *actionLoad;
QAction *actionCopyWindow, *actionShowAllColumns, *actionHideSelectedColumns;
QAction *actionCutSelection, *actionCopySelection, *actionPasteSelection, *actionClearSelection;
QAction *actionShowExplorer, *actionShowLog, *actionAddLayer, *actionShowLayerDialog, *actionAutomaticLayout,*actionclearAllMemory, *actionreleaseFreeMemory;
Expand Down

0 comments on commit e87d251

Please sign in to comment.