From: vsv Date: Wed, 24 Sep 2014 08:35:34 +0000 (+0400) Subject: Issue #120: Hide All command added into pop-up menu X-Git-Tag: V_0.4.4~28^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1c1f4028d9d94ed7572ba16cb3f0f9cebea42535;p=modules%2Fshaper.git Issue #120: Hide All command added into pop-up menu --- diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index c278646e0..84bf0d7be 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -52,6 +52,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); @@ -141,11 +144,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 +172,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; @@ -206,16 +211,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")); diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index f3236af30..6337a4096 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -144,6 +144,8 @@ class XGUI_EXPORT XGUI_Displayer DisplayMode displayMode(ObjectPtr theObject) const; + int objectsCount() const { return myResult2AISObjectMap.size(); } + protected: /// Deactivate local selection /// \param isUpdateViewer the state wether the viewer should be updated immediatelly diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 1f3bee21a..ceff7c720 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1093,6 +1093,8 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) setDisplayMode(aObjects, XGUI_Displayer::Shading); else if (theId == "WIREFRAME_CMD") setDisplayMode(aObjects, XGUI_Displayer::Wireframe); + else if (theId == "HIDEALL_CMD") + myDisplayer->eraseAll(); } //**************************************************************