X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2FXGUI%2FXGUI_ContextMenuMgr.cpp;h=27e596a487f6551855bf98a72b2d08d03b0416a5;hb=fc2acc7bd36f7bff6ec1f5095bf7c44be15e2574;hp=c278646e0cb04fb89265337edc7e26994a81e7f5;hpb=1788d3baf9a25806d24754c9f8e32e52ac32d3d3;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index c278646e0..27e596a48 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include #include @@ -52,6 +54,9 @@ void XGUI_ContextMenuMgr::createActions() aAction = new QAction(QIcon(":pictures/eye_pencil_closed.png"), tr("Hide"), this); addAction("HIDE_CMD", aAction); + aAction = new QAction(QIcon(":pictures/eye_pencil_closed.png"), tr("Hide all"), this); + addAction("HIDEALL_CMD", aAction); + aAction = new QAction(QIcon(":pictures/shading.png"), tr("Shading"), this); addAction("SHADING_CMD", aAction); @@ -109,7 +114,7 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const { QMenu* aMenu = new QMenu(); XGUI_SelectionMgr* aSelMgr = myWorkshop->selector(); - QList aObjects = aSelMgr->selection()->selectedObjects(); + QObjectPtrList aObjects = aSelMgr->selection()->selectedObjects(); int aSelected = aObjects.size(); if (aSelected > 0) { SessionPtr aMgr = ModelAPI_Session::get(); @@ -118,20 +123,20 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const bool hasFeature = false; foreach(ObjectPtr aObj, aObjects) { - FeaturePtr aFeature = boost::dynamic_pointer_cast(aObj); - ResultPtr aResult = boost::dynamic_pointer_cast(aObj); + FeaturePtr aFeature = std::dynamic_pointer_cast(aObj); + ResultPtr aResult = std::dynamic_pointer_cast(aObj); if (aResult) hasResult = true; if (aFeature) hasFeature = true; - if (hasFeature && hasResult) + if (hasFeature && hasResult) // && hasGroup) break; } //Process Feature if (aSelected == 1) { ObjectPtr aObject = aObjects.first(); if (aObject) { - ResultPartPtr aPart = boost::dynamic_pointer_cast(aObject); + ResultPartPtr aPart = std::dynamic_pointer_cast(aObject); if (aPart) { if (aMgr->activeDocument() == aPart->partDoc()) aMenu->addAction(action("DEACTIVATE_PART_CMD")); @@ -141,11 +146,12 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const aMenu->addAction(action("EDIT_CMD")); } else { if (aDisplayer->isVisible(aObject)) { - aMenu->addAction(action("HIDE_CMD")); if (aDisplayer->displayMode(aObject) == XGUI_Displayer::Shading) aMenu->addAction(action("WIREFRAME_CMD")); else aMenu->addAction(action("SHADING_CMD")); + aMenu->addSeparator(); + aMenu->addAction(action("HIDE_CMD")); } else { aMenu->addAction(action("SHOW_CMD")); } @@ -168,6 +174,7 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const if (hasFeature) aMenu->addAction(action("DELETE_CMD")); } + aMenu->addSeparator(); aMenu->addActions(myWorkshop->objectBrowser()->actions()); if (aMenu->actions().size() > 0) { return aMenu; @@ -190,7 +197,7 @@ QMenu* XGUI_ContextMenuMgr::viewerMenu() const void XGUI_ContextMenuMgr::addViewerItems(QMenu* theMenu) const { XGUI_SelectionMgr* aSelMgr = myWorkshop->selector(); - QList aObjects = aSelMgr->selection()->selectedObjects(); + QObjectPtrList aObjects = aSelMgr->selection()->selectedObjects(); if (aObjects.size() > 0) { //if (aObjects.size() == 1) // theMenu->addAction(action("EDIT_CMD")); @@ -198,7 +205,7 @@ void XGUI_ContextMenuMgr::addViewerItems(QMenu* theMenu) const bool isShading = false; foreach(ObjectPtr aObject, aObjects) { - ResultPtr aRes = boost::dynamic_pointer_cast(aObject); + ResultPtr aRes = std::dynamic_pointer_cast(aObject); if (aRes && myWorkshop->displayer()->isVisible(aRes)) { isVisible = true; isShading = (myWorkshop->displayer()->displayMode(aObject) == XGUI_Displayer::Shading); @@ -206,16 +213,21 @@ void XGUI_ContextMenuMgr::addViewerItems(QMenu* theMenu) const } } if (isVisible) { - theMenu->addAction(action("HIDE_CMD")); if (isShading) theMenu->addAction(action("WIREFRAME_CMD")); else theMenu->addAction(action("SHADING_CMD")); + theMenu->addSeparator(); + theMenu->addAction(action("SHOW_ONLY_CMD")); + theMenu->addAction(action("HIDE_CMD")); } else theMenu->addAction(action("SHOW_CMD")); //theMenu->addAction(action("DELETE_CMD")); } + if (myWorkshop->displayer()->objectsCount() > 0) + theMenu->addAction(action("HIDEALL_CMD")); if (!myWorkshop->isSalomeMode()) { + theMenu->addSeparator(); QMdiArea* aMDI = myWorkshop->mainWindow()->mdiArea(); if (aMDI->actions().size() > 0) { QMenu* aSubMenu = theMenu->addMenu(tr("Windows"));