From e3d440a45b4c48ca7d1cd04bdf2de8bb56365696 Mon Sep 17 00:00:00 2001 From: mpv Date: Fri, 23 May 2014 17:41:30 +0400 Subject: [PATCH] Issue #66 : update all features on undo/redo/abort --- src/Model/Model_Document.cpp | 15 +++++++++++---- src/Model/Model_Document.h | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index f1f67b7b6..2c29b6535 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -232,7 +232,7 @@ void Model_Document::abortOperation() if (myNestedNum == 0) myNestedNum = -1; myDoc->AbortCommand(); - synchronizeFeatures(); + synchronizeFeatures(true); // abort for all subs set::iterator aSubIter = mySubs.begin(); for(; aSubIter != mySubs.end(); aSubIter++) @@ -269,7 +269,7 @@ void Model_Document::undo() if (myNestedNum > 0) myNestedNum--; if (!myIsEmptyTr[myTransactionsAfterSave]) myDoc->Undo(); - synchronizeFeatures(); + synchronizeFeatures(true); // undo for all subs set::iterator aSubIter = mySubs.begin(); for(; aSubIter != mySubs.end(); aSubIter++) @@ -294,7 +294,7 @@ void Model_Document::redo() if (!myIsEmptyTr[myTransactionsAfterSave]) myDoc->Redo(); myTransactionsAfterSave++; - synchronizeFeatures(); + synchronizeFeatures(true); // redo for all subs set::iterator aSubIter = mySubs.begin(); for(; aSubIter != mySubs.end(); aSubIter++) @@ -566,7 +566,7 @@ boost::shared_ptr Model_Document::objectByFeature( return boost::shared_ptr(); // not found } -void Model_Document::synchronizeFeatures() +void Model_Document::synchronizeFeatures(const bool theMarkUpdated) { boost::shared_ptr aThis = Model_Application::getApplication()->getDocument(myID); // update features @@ -628,6 +628,11 @@ void Model_Document::synchronizeFeatures() // feature for this label is added, so go to the next label aFLabIter.Next(); } else { // nothing is changed, both iterators are incremented + if (theMarkUpdated) { + static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_UPDATED); + Model_FeatureUpdatedMessage aMsg(*aFIter, anEvent); + Events_Loop::loop()->send(aMsg); + } aFIter++; aFLabIter.Next(); } @@ -636,6 +641,8 @@ void Model_Document::synchronizeFeatures() boost::static_pointer_cast(Model_PluginManager::get())-> setCheckTransactions(false); Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_CREATED)); + if (theMarkUpdated) + Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED)); Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_DELETED)); boost::static_pointer_cast(Model_PluginManager::get())-> setCheckTransactions(true); diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h index d8fee7e01..097a3ba24 100644 --- a/src/Model/Model_Document.h +++ b/src/Model/Model_Document.h @@ -103,7 +103,7 @@ protected: const boost::shared_ptr theFeature); //! Synchronizes myFeatures list with the updated document - void synchronizeFeatures(); + void synchronizeFeatures(const bool theMarkUpdated = false); //! Creates new document with binary file format Model_Document(const std::string theID); -- 2.39.2