]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Nested operations
authormpv <mikhail.ponikarov@opencascade.com>
Thu, 15 May 2014 05:21:38 +0000 (09:21 +0400)
committermpv <mikhail.ponikarov@opencascade.com>
Thu, 15 May 2014 05:21:38 +0000 (09:21 +0400)
src/Model/Model_Document.cpp
src/Model/Model_Document.h
src/PartSetPlugin/PartSetPlugin_Part.h

index 9d8c2c12a664609e8630e685e1a8e840fa24036c..274fc6f1b02719f206957a6048cf024abb870d8a 100644 (file)
@@ -168,6 +168,10 @@ void Model_Document::close()
 
 void Model_Document::startOperation()
 {
+  // check is it nested or not
+  if (myDoc->HasOpenCommand()) {
+    myIsNested = true;
+  }
   // new command for this
   myDoc->NewCommand();
   // new command for all subs
@@ -181,6 +185,7 @@ void Model_Document::finishOperation()
   // returns false if delta is empty and no transaction was made
   myIsEmptyTr[myTransactionsAfterSave] = !myDoc->CommitCommand();
   myTransactionsAfterSave++;
+  myIsNested = false;
   // finish for all subs
   set<string>::iterator aSubIter = mySubs.begin();
   for(; aSubIter != mySubs.end(); aSubIter++)
@@ -393,6 +398,8 @@ Model_Document::Model_Document(const std::string theID)
 {
   myDoc->SetUndoLimit(UNDO_LIMIT);
   myTransactionsAfterSave = 0;
+  myIsNested = false;
+  myDoc->SetNestedTransactionMode();
   // to have something in the document and avoid empty doc open/save problem
   TDataStd_Integer::Set(myDoc->Main().Father(), 0);
 }
index 0bf22b98e5b450e9dcbf1ef7771a64d82a267ba9..b314d9dc896c1bd9ca4f5081dd3008a3c32fa58e 100644 (file)
@@ -120,6 +120,8 @@ private:
   std::set<std::string> mySubs; ///< set of identifiers of sub-documents of this document
   /// transaction indexes (related to myTransactionsAfterSave) which were empty in this doc
   std::map<int, bool> myIsEmptyTr;
+  /// true if the current operation is nested
+  bool myIsNested;
 };
 
 #endif
index 25af3bea7bb586245b7c1def4c684911e9630114..eaae463ad2831260dc75a595e9c8a761f645e09c 100644 (file)
@@ -34,6 +34,9 @@ public:
 
   PARTSETPLUGIN_EXPORT virtual boost::shared_ptr<ModelAPI_Document> documentToAdd();
 
+  /// Returns true if this feature must be displayed in the history (top level of Part tree)
+  PARTSETPLUGIN_EXPORT virtual bool isInHistory() {return false;}
+
   /// Use plugin manager for features creation
   PartSetPlugin_Part();
 };