X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_Session.cpp;h=159b7a2f678b19e60ac6fac4862c1881100dbeca;hb=a352874d231ad2b117f55cf384c18361a0dfe67a;hp=94f6cf2a87ca245ac8dce804f76e0ae36381f841;hpb=47c024e673a2da5094f8f233124c412d0fcdc9b4;p=modules%2Fshaper.git diff --git a/src/Model/Model_Session.cpp b/src/Model/Model_Session.cpp index 94f6cf2a8..159b7a2f6 100644 --- a/src/Model/Model_Session.cpp +++ b/src/Model/Model_Session.cpp @@ -53,6 +53,9 @@ void Model_Session::startOperation() static std::shared_ptr aStartedMsg (new Events_Message(Events_Loop::eventByName("StartOperation"))); Events_Loop::loop()->send(aStartedMsg); + // remove all useless documents that has been closed: on start of operation undo/redo is cleared + std::list > aUsedDocs = allOpenedDocuments(); + Model_Application::getApplication()->removeUselessDocuments(aUsedDocs); } void Model_Session::finishOperation() @@ -63,9 +66,15 @@ void Model_Session::finishOperation() void Model_Session::abortOperation() { ROOT_DOC->abortOperation(); + // here the update mechanism may work after abort, so, supress the warnings about + // modifications outside of the transactions + bool aWasCheck = myCheckTransactions; + myCheckTransactions = false; static std::shared_ptr anAbortMsg (new Events_Message(Events_Loop::eventByName("AbortOperation"))); Events_Loop::loop()->send(anAbortMsg); + myCheckTransactions = true; + myCheckTransactions = aWasCheck; } bool Model_Session::isOperation() @@ -100,8 +109,9 @@ void Model_Session::redo() FeaturePtr Model_Session::createFeature(string theFeatureID) { - if (this != myImpl) + if (this != myImpl) { return myImpl->createFeature(theFeatureID); + } // load all information about plugins, features and attributes LoadPluginsInfo(); @@ -117,7 +127,7 @@ FeaturePtr Model_Session::createFeature(string theFeatureID) myCurrentPluginName = aPlugin.first; if (myPluginObjs.find(myCurrentPluginName) == myPluginObjs.end()) { // load plugin library if not yet done - Config_ModuleReader::loadLibrary(myCurrentPluginName); + Config_ModuleReader::loadPlugin(myCurrentPluginName); } if (myPluginObjs.find(myCurrentPluginName) != myPluginObjs.end()) { FeaturePtr aCreated = myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID); @@ -183,8 +193,9 @@ std::list > Model_Session::allOpenedDocuments DocumentPtr anAPIDoc = *aDoc; std::shared_ptr aDoc = std::dynamic_pointer_cast(anAPIDoc); if (aDoc) { - std::set::const_iterator aSubIter = aDoc->subDocuments().cbegin(); - for(; aSubIter != aDoc->subDocuments().cend(); aSubIter++) { + const std::set aSubs = aDoc->subDocuments(true); + std::set::const_iterator aSubIter = aSubs.cbegin(); + for(; aSubIter != aSubs.cend(); aSubIter++) { if (!Model_Application::getApplication()->isLoadByDemand(*aSubIter)) { aResult.push_back(Model_Application::getApplication()->getDocument(*aSubIter)); }