From 86d91fbad5ff355ef5f801ec1e37e5a31343b0fc Mon Sep 17 00:00:00 2001 From: azv Date: Wed, 17 Sep 2014 11:58:44 +0400 Subject: [PATCH] Issue #141 fix: Undo for constraints The "Delete" message should be send before "Update" message --- src/Model/Model_Document.cpp | 6 +++--- src/SketchSolver/SketchSolver_ConstraintManager.cpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 9057ab82f..d2fcb36eb 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -729,9 +729,9 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated) aFIter.Next(); myObjs.UnBind(aLab); // event: model is updated - if (aFeature->isInHistory()) { + //if (aFeature->isInHistory()) { ModelAPI_EventCreator::get()->sendDeleted(aThis, ModelAPI_Feature::group()); - } + //} // results of this feature must be redisplayed (hided) static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); const std::list >& aResults = aFeature->results(); @@ -752,10 +752,10 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated) aLoop->activateFlushes(true); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); + aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); if (theMarkUpdated) { aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); } - aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); boost::static_pointer_cast(Model_Session::get()) ->setCheckTransactions(true); diff --git a/src/SketchSolver/SketchSolver_ConstraintManager.cpp b/src/SketchSolver/SketchSolver_ConstraintManager.cpp index 45ead10f9..ea7a29bcd 100644 --- a/src/SketchSolver/SketchSolver_ConstraintManager.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintManager.cpp @@ -110,7 +110,8 @@ void SketchSolver_ConstraintManager::processEvent( // Find SketchPlugin_Sketch::ID() in groups. The constraint groups should be updated when an object removed from Sketch std::set::const_iterator aFGrIter; for (aFGrIter = aFeatureGroups.begin(); aFGrIter != aFeatureGroups.end(); aFGrIter++) - if (aFGrIter->compare(ModelAPI_ResultConstruction::group()) == 0) + if (aFGrIter->compare(ModelAPI_ResultConstruction::group()) == 0 || + aFGrIter->compare(ModelAPI_Feature::group()) == 0) break; if (aFGrIter != aFeatureGroups.end()) { -- 2.39.2