]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/XGUI/XGUI_ContextMenuMgr.cpp
Salome HOME
Draft of transparency
[modules/shaper.git] / src / XGUI / XGUI_ContextMenuMgr.cpp
index 47c1be475e771f287436cfff9e7e07312f45a41b..1a986b377ff86155065408fccb672b9f0b999a34 100644 (file)
@@ -107,6 +107,12 @@ void XGUI_ContextMenuMgr::createActions()
   aAction = ModuleBase_Tools::createAction(QIcon(""), tr("Deflection..."), aDesktop);
   addAction("DEFLECTION_CMD", aAction);
 
+#ifdef USE_TRANSPARENCY
+  aAction = ModuleBase_Tools::createAction(QIcon(":pictures/transparency.png"),
+                                           tr("Transparency..."), aDesktop);
+  addAction("TRANSPARENCY_CMD", aAction);
+#endif
+
   aAction = ModuleBase_Tools::createAction(QIcon(":pictures/eye_pencil.png"), tr("Show"), aDesktop);
   addAction("SHOW_CMD", aAction);
 
@@ -346,12 +352,11 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
     action("SHOW_ONLY_CMD")->setEnabled(false);
   }
 
-  if (myWorkshop->canChangeColor())
-    action("COLOR_CMD")->setEnabled(true);
-
-  if (myWorkshop->canChangeDeflection())
-    action("DEFLECTION_CMD")->setEnabled(true);
-
+  action("COLOR_CMD")->setEnabled(myWorkshop->canChangeProperty("COLOR_CMD"));
+  action("DEFLECTION_CMD")->setEnabled(myWorkshop->canChangeProperty("DEFLECTION_CMD"));
+#ifdef USE_TRANSPARENCY
+  action("TRANSPARENCY_CMD")->setEnabled(myWorkshop->canChangeProperty("TRANSPARENCY_CMD"));
+#endif
   #ifdef _DEBUG
     #ifdef TINSPECTOR
       action("TINSPECTOR_VIEW")->setEnabled(true);
@@ -449,12 +454,17 @@ void XGUI_ContextMenuMgr::updateViewerMenu()
   if (aModule)
     aModule->updateViewerMenu(myActions);
 
-  if (myWorkshop->canChangeColor())
+  if (myWorkshop->canChangeProperty("COLOR_CMD"))
     action("COLOR_CMD")->setEnabled(true);
 
-  if (myWorkshop->canChangeDeflection())
+  if (myWorkshop->canChangeProperty("DEFLECTION_CMD"))
     action("DEFLECTION_CMD")->setEnabled(true);
 
+#ifdef USE_TRANSPARENCY
+  if (myWorkshop->canChangeProperty("TRANSPARENCY_CMD"))
+    action("TRANSPARENCY_CMD")->setEnabled(true);
+#endif
+
   action("DELETE_CMD")->setEnabled(true);
 }
 
@@ -486,6 +496,9 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu()
   aList.append(action("RENAME_CMD"));
   aList.append(action("COLOR_CMD"));
   aList.append(action("DEFLECTION_CMD"));
+#ifdef USE_TRANSPARENCY
+  aList.append(action("TRANSPARENCY_CMD"));
+#endif
   aList.append(action("SHOW_FEATURE_CMD"));
   myObjBrowserMenus[ModelAPI_ResultConstruction::group()] = aList;
 
@@ -503,6 +516,9 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu()
   aList.append(action("RENAME_CMD"));
   aList.append(action("COLOR_CMD"));
   aList.append(action("DEFLECTION_CMD"));
+#ifdef USE_TRANSPARENCY
+  aList.append(action("TRANSPARENCY_CMD"));
+#endif
   aList.append(action("SHOW_FEATURE_CMD"));
   myObjBrowserMenus[ModelAPI_ResultBody::group()] = aList;
   // Group menu
@@ -539,6 +555,9 @@ void XGUI_ContextMenuMgr::buildViewerMenu()
   aList.append(mySeparator);
   aList.append(action("COLOR_CMD"));
   aList.append(action("DEFLECTION_CMD"));
+#ifdef USE_TRANSPARENCY
+  aList.append(action("TRANSPARENCY_CMD"));
+#endif
   myViewerMenu[ModelAPI_ResultConstruction::group()] = aList;
   // Result part menu
   myViewerMenu[ModelAPI_ResultPart::group()] = aList;
@@ -553,6 +572,9 @@ void XGUI_ContextMenuMgr::buildViewerMenu()
   aList.append(mySeparator);
   aList.append(action("COLOR_CMD"));
   aList.append(action("DEFLECTION_CMD"));
+#ifdef USE_TRANSPARENCY
+  aList.append(action("TRANSPARENCY_CMD"));
+#endif
   myViewerMenu[ModelAPI_ResultBody::group()] = aList;
   // Group menu
   myViewerMenu[ModelAPI_ResultGroup::group()] = aList;
@@ -589,7 +611,9 @@ void XGUI_ContextMenuMgr::addObjBrowserMenu(QMenu* theMenu) const
       //aActions.append(action("MOVE_CMD"));
       aActions.append(action("COLOR_CMD"));
       aActions.append(action("DEFLECTION_CMD"));
-
+#ifdef USE_TRANSPARENCY
+      aActions.append(action("TRANSPARENCY_CMD"));
+#endif
       aActions.append(action("CLEAN_HISTORY_CMD"));
       aActions.append(action("DELETE_CMD"));
   }
@@ -645,7 +669,9 @@ void XGUI_ContextMenuMgr::addViewerMenu(QMenu* theMenu) const
   aActions.append(action("HIDEALL_CMD"));
   aActions.append(action("COLOR_CMD"));
   aActions.append(action("DEFLECTION_CMD"));
-
+#ifdef USE_TRANSPARENCY
+  aActions.append(action("TRANSPARENCY_CMD"));
+#endif
   theMenu->addActions(aActions);
 
   QMap<int, QAction*> aMenuActions;
@@ -702,7 +728,7 @@ QStringList XGUI_ContextMenuMgr::actionObjectGroups(const QString& theName)
 void XGUI_ContextMenuMgr::onRename()
 {
   QObjectPtrList anObjects = myWorkshop->selector()->selection()->selectedObjects();
-  if (!myWorkshop->operationMgr()->abortAllOperations())
+  if (!myWorkshop->abortAllOperations())
     return;
   // restore selection in case if dialog box was shown
   myWorkshop->objectBrowser()->setObjectsSelected(anObjects);
@@ -724,7 +750,7 @@ void XGUI_ContextMenuMgr::addFeatures(QMenu* theMenu) const
   bool aIsRoot = false;
   foreach(QModelIndex aIdx, aSelectedIndexes) {
     // Process only first column
-    if (aIdx.column() == 0) {
+    if (aIdx.column() == 1) {
       aIsRoot = !aIdx.parent().isValid();
       // Exit if the selected index belongs to non active document
       if (aIsRoot && (aActiveDoc != aMgr->moduleDocument()))