From: vsv Date: Wed, 7 Oct 2015 14:16:19 +0000 (+0300) Subject: Enable change mode items only in case if the object currently has opposite display... X-Git-Tag: V_1.4.0_demo2~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=269d4ad48285c2848a397a11ee58a1911a795160;p=modules%2Fshaper.git Enable change mode items only in case if the object currently has opposite display mode --- diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index c65481a08..406cc673c 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -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);