]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Enable change mode items only in case if the object currently has opposite display...
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 7 Oct 2015 14:16:19 +0000 (17:16 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 7 Oct 2015 14:16:19 +0000 (17:16 +0300)
src/XGUI/XGUI_ContextMenuMgr.cpp

index c65481a0879e1cc85c89837a6d71c4cba9873445..406cc673c5671d15309d2c4dbc9bff28b490ae25 100644 (file)
@@ -177,8 +177,14 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
       ObjectPtr aObject = aObjects.first();
       if (aObject) {
         if (hasResult && myWorkshop->canBeShaded(aObject)) {
-          action("WIREFRAME_CMD")->setEnabled(true);
-          action("SHADING_CMD")->setEnabled(true);
+          XGUI_Displayer::DisplayMode aMode = aDisplayer->displayMode(aObject);
+          if (aMode != XGUI_Displayer::NoMode) {
+            action("WIREFRAME_CMD")->setEnabled(aMode == XGUI_Displayer::Shading);
+            action("SHADING_CMD")->setEnabled(aMode == XGUI_Displayer::Wireframe);
+          } else {
+            action("WIREFRAME_CMD")->setEnabled(true);
+            action("SHADING_CMD")->setEnabled(true);
+          }
         }
         if (!hasFeature) {
           bool aHasSubResults = ModelAPI_Tools::hasSubResults(
@@ -278,8 +284,15 @@ void XGUI_ContextMenuMgr::updateViewerMenu()
     }
     if (isVisible) {
       if (canBeShaded) {
-        action("WIREFRAME_CMD")->setEnabled(true);
-        action("SHADING_CMD")->setEnabled(true);
+        XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+        XGUI_Displayer::DisplayMode aMode = aDisplayer->displayMode(aObject);
+        if (aMode != XGUI_Displayer::NoMode) {
+          action("WIREFRAME_CMD")->setEnabled(aMode == XGUI_Displayer::Shading);
+          action("SHADING_CMD")->setEnabled(aMode == XGUI_Displayer::Wireframe);
+        } else {
+          action("WIREFRAME_CMD")->setEnabled(true);
+          action("SHADING_CMD")->setEnabled(true);
+        }
       }
       action("SHOW_ONLY_CMD")->setEnabled(true);
       action("HIDE_CMD")->setEnabled(true);