From: vsv Date: Fri, 8 Dec 2017 12:43:41 +0000 (+0300) Subject: Issue #2344: Fix cleared selection on Cancel of Undo/Redo command X-Git-Tag: V_2.10.0RC~69 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=00a3c1675ca0ead43040cafa3a99f984e1d8177b;p=modules%2Fshaper.git Issue #2344: Fix cleared selection on Cancel of Undo/Redo command --- diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 495ecfc29..dc5a12f43 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1030,15 +1030,19 @@ void XGUI_Workshop::onUndo(int theTimes) return; } - objectBrowser()->treeView()->setCurrentIndex(QModelIndex()); SessionPtr aMgr = ModelAPI_Session::get(); - std::list aUndoList = aMgr->undoList(); if (aMgr->isOperation()) { + XGUI_OperationMgr* aOpMgr = operationMgr(); /// this is important for nested operations /// when sketch operation is active, this condition is false and /// the sketch operation is not aborted - operationMgr()->onAbortOperation(); + if (aOpMgr->canStopOperation(aOpMgr->currentOperation())) + aOpMgr->abortOperation(aOpMgr->currentOperation()); + else + return; } + objectBrowser()->treeView()->setCurrentIndex(QModelIndex()); + std::list aUndoList = aMgr->undoList(); std::list::const_iterator aIt = aUndoList.cbegin(); for (int i = 0; (i < theTimes) && (aIt != aUndoList.cend()); ++i, ++aIt) { aMgr->undo(); @@ -1067,15 +1071,19 @@ void XGUI_Workshop::onRedo(int theTimes) // until redo of all possible objects happens bool isUpdateEnabled = myDisplayer->enableUpdateViewer(false); - objectBrowser()->treeView()->setCurrentIndex(QModelIndex()); SessionPtr aMgr = ModelAPI_Session::get(); - std::list aRedoList = aMgr->redoList(); if (aMgr->isOperation()) { + XGUI_OperationMgr* aOpMgr = operationMgr(); /// this is important for nested operations /// when sketch operation is active, this condition is false and /// the sketch operation is not aborted - operationMgr()->onAbortOperation(); + if (aOpMgr->canStopOperation(aOpMgr->currentOperation())) + aOpMgr->abortOperation(aOpMgr->currentOperation()); + else + return; } + objectBrowser()->treeView()->setCurrentIndex(QModelIndex()); + std::list aRedoList = aMgr->redoList(); std::list::const_iterator aIt = aRedoList.cbegin(); for (int i = 0; (i < theTimes) && (aIt != aRedoList.cend()); ++i, ++aIt) { aMgr->redo();