From: mpv Date: Mon, 28 Jul 2014 14:28:37 +0000 (+0400) Subject: Debug of working with transactions in different parts X-Git-Tag: V_0.4.4~136^2~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3a30c7642633632b05849439e4ae1239915b8314;p=modules%2Fshaper.git Debug of working with transactions in different parts --- diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index a69ef1a93..a4c9729ae 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -214,7 +214,7 @@ void Model_Document::startOperation() myIsEmptyTr[myTransactionsAfterSave] = false; myTransactionsAfterSave++; myDoc->NewCommand(); - } else { // start of simple command + } else { // start the simple command myDoc->NewCommand(); } // new command for all subs @@ -224,12 +224,16 @@ void Model_Document::startOperation() } void Model_Document::compactNested() { + bool allWasEmpty = true; while(myNestedNum != -1) { myTransactionsAfterSave--; + if (!myIsEmptyTr[myTransactionsAfterSave]) { + allWasEmpty = false; + } myIsEmptyTr.erase(myTransactionsAfterSave); myNestedNum--; } - myIsEmptyTr[myTransactionsAfterSave] = false; + myIsEmptyTr[myTransactionsAfterSave] = allWasEmpty; myTransactionsAfterSave++; myDoc->PerformDeltaCompaction(); } @@ -258,7 +262,7 @@ void Model_Document::finishOperation() } } else { // returns false if delta is empty and no transaction was made - myIsEmptyTr[myTransactionsAfterSave] = !myDoc->CommitCommand() && (myNestedNum == -1); + myIsEmptyTr[myTransactionsAfterSave] = !myDoc->CommitCommand();// && (myNestedNum == -1); myTransactionsAfterSave++; } @@ -681,10 +685,12 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated) std::list >::const_iterator aRIter = aResults.begin(); for(; aRIter != aResults.cend(); aRIter++) { boost::shared_ptr aRes = *aRIter; - aRes->setData(boost::shared_ptr()); // deleted flag + //aRes->setData(boost::shared_ptr()); // deleted flag ModelAPI_EventCreator::get()->sendUpdated(aRes, EVENT_DISP); ModelAPI_EventCreator::get()->sendDeleted(aThis, aRes->groupName()); } + // redisplay also removed feature (used for sketch and AISObject) + ModelAPI_EventCreator::get()->sendUpdated(aFeature, EVENT_DISP); } else aFIter.Next(); } @@ -695,6 +701,7 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated) if (theMarkUpdated) Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); + Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); boost::static_pointer_cast(Model_PluginManager::get())-> setCheckTransactions(true); } diff --git a/src/ModelAPI/ModelAPI_Object.h b/src/ModelAPI/ModelAPI_Object.h index 907988393..7eb0cf979 100644 --- a/src/ModelAPI/ModelAPI_Object.h +++ b/src/ModelAPI/ModelAPI_Object.h @@ -32,7 +32,7 @@ public: /// Returns the data manager of this object: attributes virtual boost::shared_ptr data() {return myData;} - /// Returns true if feature refers to the same data model instance + /// Returns true if object refers to the same data model instance virtual bool isSame(const boost::shared_ptr& theObject) {return theObject.get() == this;}