remove undo stack by diagram, and add single undo stack for project

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2706 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-01-05 15:00:46 +00:00
parent c7660de89a
commit 1a83a7f2aa
8 changed files with 63 additions and 81 deletions

View File

@@ -119,7 +119,7 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
// connexions signaux / slots pour une interface sensee
connect(&workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(slot_updateWindowsMenu()));
connect(&workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(slot_updateActions()));
connect(&workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(slot_updateUndoStack()));
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(slot_updatePasteAction()));
// lecture des parametres
@@ -1158,23 +1158,24 @@ void QETDiagramEditor::slot_updateActions() {
prj_nomenclature -> setVisible(false);
#endif
// affiche les actions correspondant au diagram view en cours
if (dv) {
if (can_update_actions) {
undo_group.setActiveStack(&(dv -> diagram() -> undoStack()));
undo -> setEnabled(undo_group.canUndo());
redo -> setEnabled(undo_group.canRedo());
}
} else {
undo -> setEnabled(false);
redo -> setEnabled(false);
}
slot_updateModeActions();
slot_updatePasteAction();
slot_updateComplexActions();
}
/**
* @brief QETDiagramEditor::slot_updateUndoStack
* Update the undo stack view
*/
void QETDiagramEditor::slot_updateUndoStack() {
ProjectView *pv = currentProject();
if (pv && can_update_actions) {
undo_group.setActiveStack(pv->project()->undoStack());
undo -> setEnabled(undo_group.canUndo());
redo -> setEnabled(undo_group.canRedo());
}
}
/**
gere les actions ayant des besoins precis pour etre active ou non
Cette methode ne fait rien si aucun document n'est ouvert
@@ -1821,6 +1822,7 @@ void QETDiagramEditor::diagramIsAboutToBeRemoved(DiagramView *dv) {
void QETDiagramEditor::diagramWasRemoved(DiagramView *dv) {
Q_UNUSED(dv);
can_update_actions = true;
slot_updateUndoStack();
}
/**