Salome HOME
Preparations for Split operation. It includes:
[modules/shaper.git] / src / XGUI / XGUI_Workshop.cpp
index cffb0d4b088296aba150e06c0c990a2c4b02f5cc..fd3b111b61e1cc307b3822606074d6982a90db17 100755 (executable)
@@ -70,6 +70,7 @@
 #include <ModuleBase_PagedContainer.h>
 #include <ModuleBase_WidgetValidated.h>
 #include <ModuleBase_ModelWidget.h>
+#include <ModuleBase_ResultPrs.h>
 
 #include <Config_Common.h>
 #include <Config_FeatureMessage.h>
@@ -176,8 +177,6 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
 
   myErrorMgr = new XGUI_ErrorMgr(this, aWorkshop);
 
-  connect(myOperationMgr, SIGNAL(operationStarted(ModuleBase_Operation*)), 
-          SLOT(onOperationStarted(ModuleBase_Operation*)));
   connect(myOperationMgr, SIGNAL(operationResumed(ModuleBase_Operation*)),
           SLOT(onOperationResumed(ModuleBase_Operation*)));
   connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)),
@@ -213,6 +212,9 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
     myViewerSelMode.append(TopAbs_EDGE);
   if (ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "vertex-selection", true))
     myViewerSelMode.append(TopAbs_VERTEX);
+  //IMP: an attempt to use result selection with other selection modes
+  myViewerSelMode.append(ModuleBase_ResultPrs::Sel_Result);//TopAbs_VERTEX);
+  myViewerSelMode.append(TopAbs_COMPSOLID);
 }
 
 //******************************************************
@@ -484,7 +486,7 @@ bool XGUI_Workshop::isFeatureOfNested(const FeaturePtr& theFeature)
   return aHasNested;
 }
 
-void XGUI_Workshop::setPropertyPanel(ModuleBase_Operation* theOperation)
+void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation)
 {
   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
   if (!aFOperation)
@@ -579,20 +581,13 @@ void XGUI_Workshop::connectToPropertyPanel(const bool isToConnect)
   }
 }
 
-//******************************************************
-void XGUI_Workshop::onOperationStarted(ModuleBase_Operation* theOperation)
-{
-  setGrantedFeatures(theOperation);
-  myModule->operationStarted(theOperation);
-}
-
 //******************************************************
 void XGUI_Workshop::onOperationResumed(ModuleBase_Operation* theOperation)
 {
   setGrantedFeatures(theOperation);
 
   if (theOperation->getDescription()->hasXmlRepresentation()) {  //!< No need for property panel
-    setPropertyPanel(theOperation);
+    fillPropertyPanel(theOperation);
     connectToPropertyPanel(true);
   }
   updateCommandStatus();
@@ -675,10 +670,7 @@ void XGUI_Workshop::setGrantedFeatures(ModuleBase_Operation* theOperation)
   aFOperation->setGrantedOperationIds(aGrantedIds);
 }
 
-
-/*
- * Saves document with given name.
- */
+//******************************************************
 void XGUI_Workshop::saveDocument(const QString& theName, std::list<std::string>& theFileNames)
 {
   QApplication::restoreOverrideCursor();
@@ -687,11 +679,24 @@ void XGUI_Workshop::saveDocument(const QString& theName, std::list<std::string>&
   QApplication::restoreOverrideCursor();
 }
 
+//******************************************************
 bool XGUI_Workshop::abortAllOperations()
 {
   return myOperationMgr->abortAllOperations();
 }
 
+//******************************************************
+void XGUI_Workshop::operationStarted(ModuleBase_Operation* theOperation)
+{
+  setGrantedFeatures(theOperation);
+  if (!theOperation->getDescription()->hasXmlRepresentation()) {  //!< No need for property panel
+    updateCommandStatus();
+  }
+  else {
+    myModule->operationStarted(theOperation);
+  }
+}
+
 //******************************************************
 void XGUI_Workshop::onOpen()
 {
@@ -1254,7 +1259,10 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
   } else if (theId == "SELECT_FACE_CMD") {
     setViewerSelectionMode(TopAbs_FACE);
   } else if (theId == "SELECT_RESULT_CMD") {
-    setViewerSelectionMode(-1);
+    //setViewerSelectionMode(-1);
+    //IMP: an attempt to use result selection with other selection modes
+    setViewerSelectionMode(ModuleBase_ResultPrs::Sel_Result);
+    setViewerSelectionMode(TopAbs_COMPSOLID);
   } else if (theId == "SHOW_RESULTS_CMD") {
     highlightResults(aObjects);
   } else if (theId == "SHOW_FEATURE_CMD") {