From 4838c3a4883dd0f7194d4fe672381a4e82f9469c Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 5 Sep 2019 16:16:02 +0300 Subject: [PATCH] Issue #2984: Prevent deletion of predefined constructions from viewer and on multi-selection --- src/XGUI/XGUI_ContextMenuMgr.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index b0314faec..226aa30dd 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -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() -- 2.39.2