Salome HOME
Correct misprint
[modules/shaper.git] / src / PartSet / PartSet_SketcherReentrantMgr.cpp
index 6fbeaa5d187c04b5aed49d0883851450036749d8..d861c2b52a210dd4738a937476dc076a4c32752a 100644 (file)
@@ -44,7 +44,6 @@
 #include <ModuleBase_OperationDescription.h>
 #include "ModuleBase_ToolBox.h"
 #include "ModuleBase_ISelection.h"
-#include "ModuleBase_ISelectionActivate.h"
 
 #include <SketchPlugin_Feature.h>
 #include <SketchPlugin_Line.h>
@@ -71,7 +70,6 @@ PartSet_SketcherReentrantMgr::PartSet_SketcherReentrantMgr(ModuleBase_IWorkshop*
   myRestartingMode(RM_None),
   myIsFlagsBlocked(false),
   myIsInternalEditOperation(false),
-  myInternalActiveWidget(0),
   myNoMoreWidgetsAttribute("")
 {
 }
@@ -80,24 +78,6 @@ PartSet_SketcherReentrantMgr::~PartSet_SketcherReentrantMgr()
 {
 }
 
-ModuleBase_ModelWidget* PartSet_SketcherReentrantMgr::internalActiveWidget() const
-{
-  ModuleBase_ModelWidget* aWidget = 0;
-  if (!isActiveMgr())
-    return aWidget;
-
-  ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
-  if (anOperation) {
-    ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
-    if (aPanel) { // check for case when the operation is started but property panel is not filled
-      ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
-      if (myIsInternalEditOperation && (!anActiveWidget || !anActiveWidget->isViewerSelector()))
-        aWidget = myInternalActiveWidget;
-    }
-  }
-  return aWidget;
-}
-
 bool PartSet_SketcherReentrantMgr::isInternalEditActive() const
 {
   return myIsInternalEditOperation;
@@ -264,8 +244,9 @@ bool PartSet_SketcherReentrantMgr::processMouseReleased(ModuleBase_IViewWindow*
         if (aPointWidget) {
           GeomShapePtr aShape;
           aPointWidget->getGeomSelection_(aValue, mySelectedObject, aShape);
-          ObjectPtr anExternalObject = aPointWidget->getExternalObjectMgr()->getExternalObjectValidated();
-          // if external object has been created before staring new operation and is used as a parameter,
+          ObjectPtr anExternalObject =
+            aPointWidget->getExternalObjectMgr()->getExternalObjectValidated();
+          // if external object is during reentrant operation and is used as a parameter of feature
           // it should be removed after the operation is restarted. (Circle feature, Projection)
           if (anExternalObject.get())
             anExternalCreatedFeature = ModelAPI_Feature::feature(anExternalObject);
@@ -669,7 +650,7 @@ void PartSet_SketcherReentrantMgr::createInternalFeature()
     ModuleBase_ModelWidget* aFirstWidget = ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget
                                                                                         (aWidgets);
     if (aFirstWidget)
-      myInternalActiveWidget = aFirstWidget;
+      setInternalActiveWidget(aFirstWidget);
   }
 }
 
@@ -679,8 +660,7 @@ void PartSet_SketcherReentrantMgr::deleteInternalFeature()
   std::cout << "PartSet_SketcherReentrantMgr::deleteInternalFeature: "
             << myInternalFeature->data()->name() << std::endl;
 #endif
-  if (myInternalActiveWidget)
-    myInternalActiveWidget = 0;
+  setInternalActiveWidget(0);
   delete myInternalWidget;
   myInternalWidget = 0;
 
@@ -829,3 +809,16 @@ PartSet_Module* PartSet_SketcherReentrantMgr::module() const
 {
   return dynamic_cast<PartSet_Module*>(myWorkshop->module());
 }
+
+void PartSet_SketcherReentrantMgr::setInternalActiveWidget(ModuleBase_ModelWidget* theWidget)
+{
+  ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+    (myWorkshop->currentOperation());
+  if (aFOperation)
+  {
+    XGUI_PropertyPanel* aPropertyPanel = dynamic_cast<XGUI_PropertyPanel*>
+      (aFOperation->propertyPanel());
+    if (aPropertyPanel)
+      aPropertyPanel->setInternalActiveWidget(theWidget);
+  }
+}