Salome HOME
Issue #17347: B-Splines in Sketcher
[modules/shaper.git] / src / SHAPERGUI / SHAPERGUI.cpp
index 0ac188e119a9146604c8bf955da901dc15ef4daa..8577d8da136970b014b0e89103155d4cb52cc702 100644 (file)
@@ -168,7 +168,7 @@ void SHAPERGUI::initialize(CAM_Application* theApp)
   }
 
   int aMenu = createMenu(tr("Inspection"), -1, -1, 30);
-  int aSubMenu = createMenu(tr("Information"), aMenu);
+  int aSubMenu = createMenu(tr("Information"), aMenu, -1, -1, 0);
 
   int aId = getNextCommandId();
   myActionsList.append(aId);
@@ -180,7 +180,7 @@ void SHAPERGUI::initialize(CAM_Application* theApp)
   myWhatIsAction->setData("INSPECTION_CMD");
   createMenu(aId, aSubMenu, 0);
 
-  QString aToolName = tr("Inspection tool");
+  QString aToolName = tr("Inspection");
   int aTool = createTool(aToolName);
   int aToolId = createTool(myWhatIsAction, aTool);
   registerCommandToolbar(aToolName, aId);
@@ -322,6 +322,14 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy)
     XGUI_Displayer* aDisp = myWorkshop->displayer();
     QObjectPtrList aObjList = aDisp->displayedObjects();
 
+    //if (myHighlightPointAspect.IsNull()) {
+    //  Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron();
+    //  myHighlightPointAspect =
+    //    new Graphic3d_AspectMarker3d(aTrihedron->getHighlightPointAspect()->Aspect().operator*());
+    //}
+    if (myOldSelectionColor.size() == 0)
+      myOldSelectionColor = aDisp->selectionColor();
+
     AIS_ListOfInteractive aList;
     aContext->DisplayedObjects(aList);
     AIS_ListIteratorOfListOfInteractive aLIt;
@@ -400,6 +408,12 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy)
   }
   // Delete selector because it has to be redefined on next activation
   if (mySelector) {
+    //if (!myHighlightPointAspect.IsNull()) {
+    //  Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron();
+    //  aTrihedron->getHighlightPointAspect()->SetAspect(myHighlightPointAspect);
+    //  myHighlightPointAspect.Nullify();
+    //}
+    myWorkshop->displayer()->setSelectionColor(myOldSelectionColor);
     myProxyViewer->setSelector(0);
     delete mySelector;
     mySelector = 0;
@@ -412,6 +426,8 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy)
   aResMgr->setValue("Study", "store_positions", myIsStorePositions);
   getApp()->setEditEnabled(myIsEditEnabled);
 
+  myOldSelectionColor.clear();
+
   // Post-processing for LoadScriptId to remove created(if it was created) SALOME Object Browser
   disconnect(getApp()->action(LightApp_Application::UserID+1), SIGNAL(triggered(bool)),
              this, SLOT(onScriptLoaded()));
@@ -501,6 +517,7 @@ void SHAPERGUI::onScriptLoaded()
   if (aBrowser)
     delete aBrowser;
   myWorkshop->displayer()->updateViewer();
+  myWorkshop->updateCommandStatus();
 }
 
 //******************************************************
@@ -532,6 +549,12 @@ SHAPERGUI_OCCSelector* SHAPERGUI::createSelector(SUIT_ViewManager* theMgr)
 {
   if (theMgr->getType() == OCCViewer_Viewer::Type()) {
     OCCViewer_Viewer* aViewer = static_cast<OCCViewer_Viewer*>(theMgr->getViewModel());
+
+    //if (myHighlightPointAspect.IsNull()) {
+    //  Handle(AIS_Trihedron) aTrihedron = aViewer->getTrihedron();
+    //  myHighlightPointAspect =
+    //    new Graphic3d_AspectMarker3d(aTrihedron->getHighlightPointAspect()->Aspect().operator*());
+    //}
     SHAPERGUI_OCCSelector* aSelector = new SHAPERGUI_OCCSelector(aViewer,
                                                                  getApp()->selectionMgr());
 #ifdef SALOME_PATCH_FOR_CTRL_WHEEL
@@ -545,6 +568,12 @@ SHAPERGUI_OCCSelector* SHAPERGUI::createSelector(SUIT_ViewManager* theMgr)
       aSel->setEnabled(aSel == aSelector);
     }
     myProxyViewer->setSelector(aSelector);
+
+    if (myOldSelectionColor.size() == 0)
+      myOldSelectionColor = myWorkshop->displayer()->selectionColor();
+
+    std::vector<int> aColor = Config_PropManager::color("Visualization", "selection_color");
+    myWorkshop->displayer()->setSelectionColor(aColor);
     return aSelector;
   }
   return 0;
@@ -857,6 +886,11 @@ void SHAPERGUI::preferencesChanged(const QString& theSection, const QString& the
   }
   aProp->setValue(aValue);
 
+  if ((theSection == "Visualization") && (theParam == "selection_color")) {
+    std::vector<int> aColor = Config_PropManager::color("Visualization", "selection_color");
+    myWorkshop->displayer()->setSelectionColor(aColor);
+  }
+
   myWorkshop->displayer()->redisplayObjects();
 }