{
if (!myNestedNum.empty() && !myDoc->HasOpenCommand()) { // abort all what was done in nested
compactNested();
- undo();
+ undoInternal(false);
myDoc->ClearRedos();
myRedos.clear();
} else { // abort the current
return false;
}
-void Model_Document::undo()
+void Model_Document::undoInternal(const bool theWithSubs)
{
int aNumTransactions = *myTransactions.rbegin();
myTransactions.pop_back();
for(int a = 0; a < aNumTransactions; a++)
myDoc->Undo();
- synchronizeFeatures(true, true);
- // undo for all subs
- const std::set<std::string> aSubs = subDocuments(true);
- std::set<std::string>::iterator aSubIter = aSubs.begin();
- for (; aSubIter != aSubs.end(); aSubIter++)
- subDoc(*aSubIter)->undo();
+ if (theWithSubs) {
+ synchronizeFeatures(true, true);
+ // undo for all subs
+ const std::set<std::string> aSubs = subDocuments(true);
+ std::set<std::string>::iterator aSubIter = aSubs.begin();
+ for (; aSubIter != aSubs.end(); aSubIter++)
+ subDoc(*aSubIter)->undo();
+ }
+}
+
+void Model_Document::undo()
+{
+ undoInternal(true);
}
bool Model_Document::canRedo()
//! Returns all sub documents
const std::set<std::string> 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;