]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
1. Circle creation - when 'internal' edit operation is active, the first click should...
authornds <nds@opencascade.com>
Thu, 29 Oct 2015 05:46:34 +0000 (08:46 +0300)
committernds <nds@opencascade.com>
Thu, 29 Oct 2015 05:46:34 +0000 (08:46 +0300)
2. onNoMoreWidgets is moved to sketch reentrant manager.

src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_SketcherReetntrantMgr.cpp
src/PartSet/PartSet_SketcherReetntrantMgr.h
src/XGUI/XGUI_PropertyPanel.cpp
src/XGUI/XGUI_Workshop.cpp

index d55095a44a6c1df1dc646df3161de63a52bc8ac7..16119db3758f6b2554a5c00534d00f0b2add6282 100755 (executable)
@@ -525,16 +525,6 @@ void PartSet_Module::onOperationActivatedByPreselection()
   }
 }
 
-void PartSet_Module::onNoMoreWidgets(const std::string& thePreviousAttributeID)
-{
-  mySketchReentrantMgr->noMoreWidgets(thePreviousAttributeID);
-}
-
-void PartSet_Module::onVertexSelected()
-{
-  mySketchReentrantMgr->vertexSelected();
-}
-
 ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget* theParent,
                                             Config_WidgetAPI* theWidgetApi, std::string theParentId)
 {
@@ -554,13 +544,13 @@ ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& th
     PartSet_WidgetPoint2D* aPointWgt = new PartSet_WidgetPoint2D(theParent, aWorkshop,
                                                                  theWidgetApi, theParentId);
     aPointWgt->setSketch(mySketchMgr->activeSketch());
-    connect(aPointWgt, SIGNAL(vertexSelected()), this, SLOT(onVertexSelected()));
+    connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), SLOT(onVertexSelected()));
     aWgt = aPointWgt;
   } else if (theType == "sketch-2dpoint_flyout_selector") {
     PartSet_WidgetPoint2DFlyout* aPointWgt = new PartSet_WidgetPoint2DFlyout(theParent, aWorkshop,
                                                                  theWidgetApi, theParentId);
     aPointWgt->setSketch(mySketchMgr->activeSketch());
-    connect(aPointWgt, SIGNAL(vertexSelected()), this, SLOT(onVertexSelected()));
+    connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), SLOT(onVertexSelected()));
     aWgt = aPointWgt;
   } else if (theType == "point2ddistance") {
     PartSet_WidgetPoint2dDistance* aDistanceWgt = new PartSet_WidgetPoint2dDistance(theParent,
index 8db2d83052fce596706389ca42463c960a9c9364..e5a37bcda5fe453eecf18eb1c381d07ed93f1b5a 100644 (file)
@@ -212,10 +212,6 @@ public:
   virtual void grantedOperationIds(ModuleBase_Operation* theOperation, QStringList& theIds) const;
 
 public slots:
-  /// SLOT, that is called by no more widget signal emitted by property panel
-  /// Set a specific flag to restart the sketcher operation
-  void onNoMoreWidgets(const std::string& thePreviousAttributeID);
-
   /// Redefines the parent method in order to customize the next case:
   /// If the sketch nested operation is active and the presentation is not visualized in the viewer,
   /// the operation should be always aborted.
@@ -266,9 +262,6 @@ protected slots:
   virtual void registerProperties();
 
  private slots:
-   /// Processing of vertex selected
-   void onVertexSelected();
-
    void onTreeViewDoubleClick(const QModelIndex&);
 
  private:
index 62a37589cb8fbbbb7ffc5c4ed255e00c12a12955..bf034c85abf97a0091d03f390b0a4c5f0d3cf69b 100644 (file)
@@ -632,6 +632,12 @@ void PartSet_SketcherMgr::onApplicationStarted()
   if (aPropertyPanel) {
     connect(aPropertyPanel, SIGNAL(beforeWidgetActivated(ModuleBase_ModelWidget*)),
             this, SLOT(onBeforeWidgetActivated(ModuleBase_ModelWidget*)));
+
+    PartSet_SketcherReetntrantMgr* aReentranceMgr = myModule->sketchReentranceMgr();
+    connect(aPropertyPanel, SIGNAL(noMoreWidgets(const std::string&)),
+            aReentranceMgr, SLOT(onNoMoreWidgets(const std::string&)));
+    connect(aPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)),
+            aReentranceMgr, SLOT(onWidgetActivated()));
   }
 
   XGUI_ViewerProxy* aViewerProxy = aWorkshop->viewer();
index 96050b8781136b0a8118daa7f8f72d00116d1961..de4baeee1c96e658b301113a857a5179bed0892c 100755 (executable)
@@ -89,7 +89,7 @@ bool PartSet_SketcherReetntrantMgr::operationCommitted(ModuleBase_Operation* the
 
           myIsInternalEditOperation = true;
           // activate selection filters of the first widget in the viewer
-          onInternalActivateFirstWidgetSelection();
+          onWidgetActivated();
 
           // activate the last active widget in the Property Panel
           if (!myPreviousAttributeID.empty()) {
@@ -135,6 +135,8 @@ void PartSet_SketcherReetntrantMgr::operationAborted(ModuleBase_Operation* theOp
     SessionPtr aMgr = ModelAPI_Session::get();
     if (aMgr->hasModuleDocument() && aMgr->canUndo()) {
       aMgr->undo();
+      workshop()->operationMgr()->updateApplyOfOperations();
+      workshop()->updateCommandStatus();
     }
   }
   myIsInternalEditOperation = false;
@@ -152,7 +154,6 @@ bool PartSet_SketcherReetntrantMgr::processMouseMoved(ModuleBase_IViewWindow*/*
     PartSet_WidgetPoint2D* aPoint2DWdg = dynamic_cast<PartSet_WidgetPoint2D*>(module()->activeWidget());
     if (aPoint2DWdg && aPoint2DWdg->canBeActivatedByMove()) {
     ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
-      //if (operationMgr()->isApplyEnabled())
       anOperation->commit();
       aProcessed = true;
     }
@@ -175,14 +176,17 @@ bool PartSet_SketcherReetntrantMgr::processMouseReleased(ModuleBase_IViewWindow*
 
   if (myIsInternalEditOperation) {
     ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
-    //if (operationMgr()->isApplyEnabled())
-    anOperation->commit();
-    aProcessed = true;
 
-    // fill the widget by the mouse event point
-    PartSet_WidgetPoint2D* aPoint2DWdg = dynamic_cast<PartSet_WidgetPoint2D*>(module()->activeWidget());
-    if (aPoint2DWdg) {
-      aPoint2DWdg->onMouseRelease(theWnd, theEvent);
+    ModuleBase_ModelWidget* anActiveWidget = anOperation->propertyPanel()->activeWidget();
+    if (!anActiveWidget || !anActiveWidget->isViewerSelector()) {
+      anOperation->commit();
+      aProcessed = true;
+
+      // fill the widget by the mouse event point
+      PartSet_WidgetPoint2D* aPoint2DWdg = dynamic_cast<PartSet_WidgetPoint2D*>(module()->activeWidget());
+      if (aPoint2DWdg) {
+        aPoint2DWdg->onMouseRelease(theWnd, theEvent);
+      }
     }
   }
 
@@ -215,7 +219,7 @@ void PartSet_SketcherReetntrantMgr::propertyPanelDefined(ModuleBase_Operation* t
   }
 }
 
-void PartSet_SketcherReetntrantMgr::noMoreWidgets(const std::string& thePreviousAttributeID)
+void PartSet_SketcherReetntrantMgr::onNoMoreWidgets(const std::string& thePreviousAttributeID)
 {
   if (!isActiveMgr())
     return;
@@ -236,7 +240,7 @@ void PartSet_SketcherReetntrantMgr::noMoreWidgets(const std::string& thePrevious
   }
 }
 
-void PartSet_SketcherReetntrantMgr::vertexSelected()
+void PartSet_SketcherReetntrantMgr::onVertexSelected()
 {
   if (!isActiveMgr())
     return;
@@ -277,7 +281,7 @@ bool PartSet_SketcherReetntrantMgr::canBeCommittedByPreselection()
   return !isActiveMgr() || myRestartingMode == RM_None;
 }
 
-void PartSet_SketcherReetntrantMgr::onInternalActivateFirstWidgetSelection()
+void PartSet_SketcherReetntrantMgr::onWidgetActivated()
 {
   if (!isActiveMgr())
     return;
index 0c232eef02d8c1ca9ba01781d4a94bfac7c33e66..54cdfd20c5dbf1987d41d2a99ebb1db6d7399473 100755 (executable)
@@ -81,9 +81,6 @@ public:
   /// Activates the operation widgets relatively the internal reentrant flags
   void propertyPanelDefined(ModuleBase_Operation* theOperation);
 
-  /// It is called by no more widget signal emitted by property panel
-  /// Set a specific flag to restart the sketcher operation
-  void noMoreWidgets(const std::string& thePreviousAttributeID);
 
   /// Processing of vertex selected, if the feature is line, save flags to stop reentrant operation
   void vertexSelected();
@@ -96,8 +93,17 @@ public:
   /// Returns false if the reentrant mode of the operation is not empty.
   bool canBeCommittedByPreselection();
 
-public slots:
-  void onInternalActivateFirstWidgetSelection();
+private slots:
+  /// SLOT, that is called by a widget activating in the property panel
+  /// If the 'internal' edit operation is started, it activates the first control selection
+  void onWidgetActivated();
+
+  /// SLOT, that is called by no more widget signal emitted by property panel
+  /// Set a specific flag to restart the sketcher operation
+  void onNoMoreWidgets(const std::string& thePreviousAttributeID);
+
+  /// Processing of vertex selected
+  void onVertexSelected();
 
 private:
   /// Returns true if the current operation is a sketch or a nested sketch operation
index d1eea76877338175fb693231fc0153611709a193..73cdab5a25fd5729e1c275941e12b3ac2311a9af 100644 (file)
@@ -209,11 +209,9 @@ void XGUI_PropertyPanel::activateWidget(ModuleBase_ModelWidget* theWidget)
     theWidget->activate();
   }
   myActiveWidget = theWidget;
-  if (myActiveWidget) {
-    emit widgetActivated(theWidget);
-  } else if (!isEditingMode()) {
+  emit widgetActivated(theWidget);
+  if (!myActiveWidget && !isEditingMode()) {
     emit noMoreWidgets(aPreviosAttributeID);
-    //setFocusOnOkButton();
   }
 }
 
index cb6e77a0ed0840c6f2c6e2328b11dcc24e37c69f..71af25fb300786460cd8a1c4ff9530fc02558a95 100644 (file)
@@ -1010,14 +1010,10 @@ void XGUI_Workshop::createDockWidgets()
 
   QAction* aCancelAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Abort);
   connect(aCancelAct, SIGNAL(triggered()), myOperationMgr, SLOT(onAbortOperation()));
-  connect(myPropertyPanel, SIGNAL(noMoreWidgets(const std::string&)),
-          myModule, SLOT(onNoMoreWidgets(const std::string&)));
   connect(myPropertyPanel, SIGNAL(keyReleased(QKeyEvent*)),
           myOperationMgr,  SLOT(onKeyReleased(QKeyEvent*)));
   //connect(myOperationMgr,  SIGNAL(validationStateChanged(bool)),
   //        this, SLOT(onValidationStateChanged(bool)));
-  connect(myPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)),
-          myModule, SLOT(onInternalActivateFirstWidgetSelection()));
 }
 
 //******************************************************