]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for internal setting of current feature
authormpv <mpv@opencascade.com>
Fri, 22 May 2015 09:15:41 +0000 (12:15 +0300)
committermpv <mpv@opencascade.com>
Fri, 22 May 2015 09:15:41 +0000 (12:15 +0300)
src/Model/Model_Document.cpp
src/Model/Model_Objects.cpp

index 985c401ae47e5315ce5309ad93bcad9a955e1e8f..df85c6e4b7ad3bc2c45cd6b72ec77b4b4660e945 100644 (file)
@@ -449,9 +449,9 @@ void Model_Document::undoInternal(const bool theWithSubs, const bool theSynchron
   }
   // after redo of all sub-documents to avoid updates on not-modified data (issue 370)
   if (theSynchronize) {
+    myObjs->synchronizeFeatures(true, true, isRoot());
     // update the current features status
     setCurrentFeature(currentFeature(false), false);
-    myObjs->synchronizeFeatures(true, true, isRoot());
   }
 }
 
@@ -489,10 +489,10 @@ void Model_Document::redo()
   for (; aSubIter != aSubs.end(); aSubIter++)
     subDoc(*aSubIter)->redo();
 
-  // update the current features status
-  setCurrentFeature(currentFeature(false), false);
   // after redo of all sub-documents to avoid updates on not-modified data (issue 370)
   myObjs->synchronizeFeatures(true, true, isRoot());
+  // update the current features status
+  setCurrentFeature(currentFeature(false), false);
 }
 
 std::list<std::string> Model_Document::undoList() const
@@ -567,13 +567,8 @@ void Model_Document::removeFeature(FeaturePtr theFeature)
 {
   // if this feature is current, make the current the previous feature
   if (theFeature == currentFeature(false)) {
-    int aCurrentIndex = index(theFeature);
-    if (aCurrentIndex != -1) {
-      ObjectPtr aPrevObj;
-      if (aCurrentIndex != 0)
-        aPrevObj = object(ModelAPI_Feature::group(), aCurrentIndex - 1);
-      setCurrentFeature(std::dynamic_pointer_cast<ModelAPI_Feature>(aPrevObj), false);
-    }
+    FeaturePtr aPrev = myObjs->nextFeature(theFeature, true);
+    setCurrentFeature(aPrev, false);
   }
   myObjs->removeFeature(theFeature);
 }
index 2356a20537c7b0e12758f70dfcd11a50aeda74f5..98ead6c683a63cca7fdcce4127b58a5fdc24fdb1 100644 (file)
@@ -227,9 +227,7 @@ void Model_Objects::removeFeature(FeaturePtr theFeature)
     // erase all attributes under the label of feature
     aFeatureLabel.ForgetAllAttributes();
     // remove it from the references array
-    if (theFeature->isInHistory()) {
-      RemoveFromRefArray(featuresLabel(), aFeatureLabel);
-    }
+    RemoveFromRefArray(featuresLabel(), aFeatureLabel);
     // event: feature is deleted
     ModelAPI_EventCreator::get()->sendDeleted(theFeature->document(), ModelAPI_Feature::group());
     // the redisplay signal should be flushed in order to erase the feature presentation in the viewer