]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #408 : don't allow undo during the operation if there is nothing to undo behind...
authormpv <mpv@opencascade.com>
Tue, 17 Feb 2015 11:35:38 +0000 (14:35 +0300)
committermpv <mpv@opencascade.com>
Tue, 17 Feb 2015 11:35:38 +0000 (14:35 +0300)
src/Model/Model_Document.cpp

index fe4a17309aa4b432fa244af8b4a55000730981e9..b6221cc4c38004413759c2e6f404f4babe9e3bb5 100644 (file)
@@ -419,8 +419,11 @@ bool Model_Document::isModified()
 
 bool Model_Document::canUndo()
 {
-  if (myDoc->GetAvailableUndos() > 0 && (myNestedNum.empty() || *myNestedNum.rbegin() != 0) &&
-      !myTransactions.empty() /* for omitting the first useless transaction */)
+  // issue 406 : if transaction is opened, but nothing to undo behind, can not undo
+  int aCurrentNum = isOperation() ? 1 : 0;
+  if (myDoc->GetAvailableUndos() > 0 && 
+      (myNestedNum.empty() || *myNestedNum.rbegin() - aCurrentNum > 0) && // there is something to undo in nested
+      myTransactions.size() - aCurrentNum > 0 /* for omitting the first useless transaction */)
     return true;
   // check other subs contains operation that can be undoed
   const std::set<std::string> aSubs = subDocuments(true);