]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #120: Hide All command added into pop-up menu
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 24 Sep 2014 08:35:34 +0000 (12:35 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 24 Sep 2014 08:35:34 +0000 (12:35 +0400)
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_Displayer.h
src/XGUI/XGUI_Workshop.cpp

index c278646e0cb04fb89265337edc7e26994a81e7f5..84bf0d7beaea67bbcafb0bb59a3ae0ea4f75740a 100644 (file)
@@ -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"));
index f3236af3069d26c135025fee1c8495c153401427..6337a4096857145b008f1d419057e251d438db97 100644 (file)
@@ -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
index 1f3bee21adc295a453990955c459f5f996f9a8f9..ceff7c72031772bffe75004ea262f7cb0b04ce95 100644 (file)
@@ -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();
 }
 
 //**************************************************************