0029140: Samples - Viewer is not updated in MFC Modeling and Viewer3D samples
[occt.git] / samples / mfc / standard / Common / OCC_3dBaseDoc.cpp
index cf67968..7578112 100755 (executable)
@@ -292,8 +292,7 @@ void OCC_3dBaseDoc::OnUpdateObjectColor(CCmdUI* pCmdUI)
 
 void OCC_3dBaseDoc::OnObjectErase() 
 {
-  myAISContext->EraseSelected (Standard_False);
-  myAISContext->ClearSelected (Standard_True);
+  myAISContext->EraseSelected (Standard_True);
 }
 void OCC_3dBaseDoc::OnUpdateObjectErase(CCmdUI* pCmdUI) 
 {
@@ -406,17 +405,17 @@ void OCC_3dBaseDoc::OnObjectDisplayall()
 
 void OCC_3dBaseDoc::OnUpdateObjectDisplayall(CCmdUI* pCmdUI) 
 {
-       
-       AIS_ListOfInteractive aList;
-       myAISContext->ObjectsInside(aList,AIS_KOI_Shape);
-       AIS_ListIteratorOfListOfInteractive aLI;
-       Standard_Boolean IS_ANY_OBJECT_ERASED=FALSE;
-       for (aLI.Initialize(aList);aLI.More();aLI.Next()){
-               if(!myAISContext->IsDisplayed(aLI.Value()))
-               IS_ANY_OBJECT_ERASED=TRUE;
-       }
-       pCmdUI->Enable (IS_ANY_OBJECT_ERASED);
-
+  AIS_ListOfInteractive aList;
+  myAISContext->ObjectsInside (aList);
+  for (AIS_ListIteratorOfListOfInteractive aLI (aList);aLI.More();aLI.Next())
+  {
+    if (!myAISContext->IsDisplayed (aLI.Value()))
+    {
+      pCmdUI->Enable (true);
+      return;
+    }
+  }
+  pCmdUI->Enable (false);
 }
 
 void OCC_3dBaseDoc::OnObjectRemove()