X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_ContextMenuMgr.cpp;h=fe220b6578c83044f9938a0b15e9f4329e7be525;hb=4cb749258f33b7de231da5bb50140407c0599d30;hp=3c5146ffcfaffd7f49285e134e6a20363b00bbc8;hpb=845faaf1f35a4054431eb57656ab52b5c1d6655a;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index 3c5146ffc..fe220b657 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -140,10 +140,14 @@ void XGUI_ContextMenuMgr::createActions() aDesktop); addAction("WIREFRAME_CMD", aAction); - aAction = ModuleBase_Tools::createAction(QIcon(":pictures/iso_lines.png"), tr("Iso-lines..."), + aAction = ModuleBase_Tools::createAction(QIcon(":pictures/iso_lines.png"), tr("Define Isos..."), aDesktop); addAction("ISOLINES_CMD", aAction); + aAction = ModuleBase_Tools::createAction(QIcon(), tr("Show Isos..."), aDesktop); + aAction->setCheckable(true); + addAction("SHOW_ISOLINES_CMD", aAction); + mySeparator1 = ModuleBase_Tools::createAction(QIcon(), "", aDesktop); mySeparator1->setSeparator(true); @@ -306,22 +310,25 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu() //Process Feature if (aSelected == 1) { // single selection ObjectPtr aObject = aObjects.first(); + ResultPtr aResult; + if (hasResult) + aResult = std::dynamic_pointer_cast(aObject); if (aObject) { if (hasResult && myWorkshop->canBeShaded(aObject)) { 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); - action("ISOLINES_CMD")->setEnabled(true); } else { action("WIREFRAME_CMD")->setEnabled(true); action("SHADING_CMD")->setEnabled(true); - action("ISOLINES_CMD")->setEnabled(true); } + action("SHOW_ISOLINES_CMD")->setEnabled(true); + action("SHOW_ISOLINES_CMD")->setChecked(ModelAPI_Tools::isShownIsoLines(aResult)); + action("ISOLINES_CMD")->setEnabled(true); } if (!hasFeature) { - bool aHasSubResults = ModelAPI_Tools::hasSubResults( - std::dynamic_pointer_cast(aObject)); + bool aHasSubResults = ModelAPI_Tools::hasSubResults(aResult); if (aHasSubResults) { action("HIDE_CMD")->setEnabled(true); action("SHOW_CMD")->setEnabled(true); @@ -358,6 +365,7 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu() action("SHOW_ONLY_CMD")->setEnabled(true); action("SHADING_CMD")->setEnabled(true); action("WIREFRAME_CMD")->setEnabled(true); + action("SHOW_ISOLINES_CMD")->setEnabled(true); action("ISOLINES_CMD")->setEnabled(true); } if (hasFeature && myWorkshop->canMoveFeature()) { @@ -544,11 +552,18 @@ void XGUI_ContextMenuMgr::updateViewerMenu() if (aMode != XGUI_Displayer::NoMode) { action("WIREFRAME_CMD")->setEnabled(aMode == XGUI_Displayer::Shading); action("SHADING_CMD")->setEnabled(aMode == XGUI_Displayer::Wireframe); - action("ISOLINES_CMD")->setEnabled(true); } else { action("WIREFRAME_CMD")->setEnabled(true); action("SHADING_CMD")->setEnabled(true); - action("ISOLINES_CMD")->setEnabled(true); + } + action("ISOLINES_CMD")->setEnabled(true); + + if (aPrsList.size() == 1) { + ResultPtr aResult = std::dynamic_pointer_cast(aObject); + if (aResult.get()) { + action("SHOW_ISOLINES_CMD")->setEnabled(true); + action("SHOW_ISOLINES_CMD")->setChecked(ModelAPI_Tools::isShownIsoLines(aResult)); + } } } action("SHOW_ONLY_CMD")->setEnabled(true); @@ -664,6 +679,7 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu() aList.append(action("COLOR_CMD")); aList.append(action("DEFLECTION_CMD")); aList.append(action("TRANSPARENCY_CMD")); + aList.append(action("SHOW_ISOLINES_CMD")); aList.append(action("ISOLINES_CMD")); aList.append(action("SHOW_FEATURE_CMD")); aList.append(mySeparator3); @@ -740,6 +756,7 @@ void XGUI_ContextMenuMgr::buildViewerMenu() aList.append(action("COLOR_CMD")); aList.append(action("DEFLECTION_CMD")); aList.append(action("TRANSPARENCY_CMD")); + aList.append(action("SHOW_ISOLINES_CMD")); aList.append(action("ISOLINES_CMD")); aList.append(mySeparator3); aList.append(action("SET_VIEW_NORMAL_CMD")); @@ -794,6 +811,7 @@ void XGUI_ContextMenuMgr::addObjBrowserMenu(QMenu* theMenu) const aActions.append(action("COLOR_CMD")); aActions.append(action("DEFLECTION_CMD")); aActions.append(action("TRANSPARENCY_CMD")); + aActions.append(action("SHOW_ISOLINES_CMD")); aActions.append(action("ISOLINES_CMD")); aActions.append(action("CLEAN_HISTORY_CMD")); aActions.append(action("DELETE_CMD"));