]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2984: Prevent deletion of predefined constructions from viewer and on multi... VEDF2019Lot4
authorvsv <vsv@opencascade.com>
Thu, 5 Sep 2019 13:16:02 +0000 (16:16 +0300)
committervsv <vsv@opencascade.com>
Thu, 5 Sep 2019 13:16:02 +0000 (16:16 +0300)
src/XGUI/XGUI_ContextMenuMgr.cpp

index b0314faece5fa0bb179c6b9c680051b13ad46734..226aa30dda252dfedcba4bca6b533df7f10a1a5d 100644 (file)
@@ -353,6 +353,15 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
         action("SHOW_ONLY_CMD")->setEnabled(true);
         action("SHADING_CMD")->setEnabled(true);
         action("WIREFRAME_CMD")->setEnabled(true);
+
+        foreach(ObjectPtr aObj, aObjects) {
+          FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
+          if (!aFeature->isInHistory()) {
+            canBeDeleted = false;
+            break;
+          }
+        }
+        action("DELETE_CMD")->setEnabled(canBeDeleted);
       }
     } // end multi-selection
 
@@ -600,7 +609,8 @@ void XGUI_ContextMenuMgr::updateViewerMenu()
   if (myWorkshop->canChangeProperty("TRANSPARENCY_CMD"))
     action("TRANSPARENCY_CMD")->setEnabled(true);
 
-  action("DELETE_CMD")->setEnabled(true);
+  // Delete command is not used in viewer pop-up menu
+  action("DELETE_CMD")->setEnabled(false);
 }
 
 void XGUI_ContextMenuMgr::connectObjectBrowser()