Salome HOME
Exclude sub-features from history functionality
[modules/shaper.git] / src / XGUI / XGUI_ContextMenuMgr.cpp
index dac0f4625ee444c6b1e152026576d778e892021c..fa76cfa4d9364c0143fa3b62b38628d84defd8df 100644 (file)
@@ -54,6 +54,9 @@ void XGUI_ContextMenuMgr::createActions()
   aAction->setShortcut(Qt::Key_Delete);
   aAction->setShortcutContext(Qt::ApplicationShortcut);
 
+  aAction = new QAction(QIcon(":pictures/move.png"), tr("Move..."), this);
+  addAction("MOVE_CMD", aAction);
+
   aAction = new QAction(QIcon(":pictures/color.png"), tr("Color..."), this);
   addAction("COLOR_CMD", aAction);
 
@@ -160,7 +163,8 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
     bool hasResult = false;
     bool hasFeature = false;
     bool hasParameter = false;
-    ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter);
+    bool hasSubFeature = false;
+    ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter, hasSubFeature);
 
     //Process Feature
     if (aSelected == 1) {
@@ -185,7 +189,9 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
           if (!(hasParameter || hasFeature))
             action("SHOW_ONLY_CMD")->setEnabled(true);
         }
-      } 
+        else if (hasFeature && myWorkshop->canMoveFeature())
+          action("MOVE_CMD")->setEnabled(true);
+      }
     } else {
       if (hasResult && (!hasParameter)) {
         action("SHOW_CMD")->setEnabled(true);
@@ -195,8 +201,10 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
         action("WIREFRAME_CMD")->setEnabled(true);
       }
     }
-    if (hasFeature || hasParameter)
-      action("DELETE_CMD")->setEnabled(true);
+    if (!hasSubFeature) {
+      if (hasFeature || hasParameter)
+        action("DELETE_CMD")->setEnabled(true);
+    }
   }
   if (myWorkshop->canChangeColor())
     action("COLOR_CMD")->setEnabled(true);
@@ -286,7 +294,11 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu()
   // Feature menu
   aList.clear();
   aList.append(action("DELETE_CMD"));
+  aList.append(action("MOVE_CMD"));
   myObjBrowserMenus[ModelAPI_Feature::group()] = aList;
+
+  aList.clear();
+  aList.append(action("DELETE_CMD"));
   myObjBrowserMenus[ModelAPI_ResultParameter::group()] = aList;
   //-------------------------------------
 }
@@ -341,6 +353,7 @@ QMenu* XGUI_ContextMenuMgr::objBrowserMenu() const
       aActions.append(action("SHOW_ONLY_CMD"));
       aActions.append(mySeparator);
       aActions.append(action("DELETE_CMD"));
+      //aActions.append(action("MOVE_CMD"));
   }
   aMenu->addActions(aActions);