]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #925: Remove Deactivate part command
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 9 Sep 2015 06:45:27 +0000 (09:45 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 9 Sep 2015 06:45:27 +0000 (09:45 +0300)
src/PartSet/PartSet_MenuMgr.cpp
src/PartSet/PartSet_Module.cpp

index f9d7b2153ec2d071851a106f0302fb85b59b0850..a027eb77afb9d7fae36b08872b6b27355056eeee 100644 (file)
@@ -79,10 +79,6 @@ void PartSet_MenuMgr::createActions()
   connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onActivatePart(bool)));
   myActions["ACTIVATE_PART_CMD"] = aAction;
 
-  aAction = new QAction(QIcon(":icons/deactivate.png"), tr("Deactivate"), this);
-  connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onActivatePartSet(bool)));
-  myActions["DEACTIVATE_PART_CMD"] = aAction;
-
   // Activate PartSet
   aAction = new QAction(QIcon(":icons/activate.png"), tr("Activate"), this);
   connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onActivatePartSet(bool)));
index 26858896b19af355830196cee20c8a7b73f2ff8b..1439438c314fe431a1496e02209fde5369c8fc8a 100755 (executable)
@@ -867,6 +867,7 @@ void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const
   QObjectPtrList aObjects = myWorkshop->selection()->selectedObjects();
   int aSelected = aObjects.size();
   SessionPtr aMgr = ModelAPI_Session::get();
+  QAction* aActivatePartAction = myMenuMgr->action("ACTIVATE_PART_CMD");
   if (aSelected == 1) {
     bool hasResult = false;
     bool hasFeature = false;
@@ -887,10 +888,10 @@ void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const
         }
         if (aPart.get()) // this may be null is Part feature is disabled
           aPartDoc = aPart->partDoc();
-        if (aMgr->activeDocument() == aPartDoc)
-          theMenu->addAction(myMenuMgr->action("DEACTIVATE_PART_CMD"));
-        else
-          theMenu->addAction(myMenuMgr->action("ACTIVATE_PART_CMD"));
+          
+        theMenu->addAction(aActivatePartAction);
+        aActivatePartAction->setEnabled((aMgr->activeDocument() != aPartDoc));
+
       } else if (aObject->document() == aMgr->activeDocument()) {
         if (hasParameter || hasFeature)
           theMenu->addAction(myMenuMgr->action("EDIT_CMD"));
@@ -898,9 +899,7 @@ void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const
 
       ResultBodyPtr aResult = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aObject);
       if( aResult.get() )
-      {
         theMenu->addAction(myMenuMgr->action("SELECT_PARENT_CMD"));
-      }
     } else {  // If feature is 0 the it means that selected root object (document)
       if (aMgr->activeDocument() != aMgr->moduleDocument())
         theMenu->addAction(myMenuMgr->action("ACTIVATE_PARTSET_CMD"));
@@ -912,10 +911,10 @@ void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const
       if (aMgr->activeDocument() != aMgr->moduleDocument())
         theMenu->addAction(myMenuMgr->action("ACTIVATE_PARTSET_CMD"));
   }
-  bool aCanDeactivate = (myWorkshop->currentOperation() == 0);
-  myMenuMgr->action("ACTIVATE_PARTSET_CMD")->setEnabled(aCanDeactivate);
-  myMenuMgr->action("DEACTIVATE_PART_CMD")->setEnabled(aCanDeactivate);
-  myMenuMgr->action("ACTIVATE_PART_CMD")->setEnabled(aCanDeactivate);
+  bool aNotDeactivate = (myWorkshop->currentOperation() == 0);
+  myMenuMgr->action("ACTIVATE_PARTSET_CMD")->setEnabled(aNotDeactivate);
+  if (!aNotDeactivate)
+    aActivatePartAction->setEnabled(false);
 }
 
 void PartSet_Module::processEvent(const std::shared_ptr<Events_Message>& theMessage)