From: mpv Date: Thu, 22 Jan 2015 14:11:09 +0000 (+0300) Subject: Fix for Issue #375: abort of nested operation problem X-Git-Tag: V_1.0.0~26^2~2^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f37788c806a371d84963c1fd72e1a2050258372b;p=modules%2Fshaper.git Fix for Issue #375: abort of nested operation problem --- diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index fb6ebf8e4..f1f10b103 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -370,7 +370,7 @@ void Model_Document::abortOperation() { if (!myNestedNum.empty() && !myDoc->HasOpenCommand()) { // abort all what was done in nested compactNested(); - undo(); + undoInternal(false); myDoc->ClearRedos(); myRedos.clear(); } else { // abort the current @@ -418,7 +418,7 @@ bool Model_Document::canUndo() return false; } -void Model_Document::undo() +void Model_Document::undoInternal(const bool theWithSubs) { int aNumTransactions = *myTransactions.rbegin(); myTransactions.pop_back(); @@ -429,12 +429,19 @@ void Model_Document::undo() for(int a = 0; a < aNumTransactions; a++) myDoc->Undo(); - synchronizeFeatures(true, true); - // undo for all subs - const std::set aSubs = subDocuments(true); - std::set::iterator aSubIter = aSubs.begin(); - for (; aSubIter != aSubs.end(); aSubIter++) - subDoc(*aSubIter)->undo(); + if (theWithSubs) { + synchronizeFeatures(true, true); + // undo for all subs + const std::set aSubs = subDocuments(true); + std::set::iterator aSubIter = aSubs.begin(); + for (; aSubIter != aSubs.end(); aSubIter++) + subDoc(*aSubIter)->undo(); + } +} + +void Model_Document::undo() +{ + undoInternal(true); } bool Model_Document::canRedo() diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h index 2c9dd2123..56490a15c 100644 --- a/src/Model/Model_Document.h +++ b/src/Model/Model_Document.h @@ -189,6 +189,9 @@ class Model_Document : public ModelAPI_Document //! Returns all sub documents const std::set subDocuments(const bool theActivatedOnly) const; + //! The implementation of undo: with or without recoursive calls in the sub-documents + void undoInternal(const bool theWithSubs); + friend class Model_Application; friend class Model_Session; friend class Model_Update;