Salome HOME
The first activate widget should be deactivated by edited operation is stopped.
authornds <nds@opencascade.com>
Tue, 3 Nov 2015 06:04:35 +0000 (09:04 +0300)
committernds <nds@opencascade.com>
Tue, 3 Nov 2015 06:04:35 +0000 (09:04 +0300)
src/ModuleBase/ModuleBase_OperationFeature.cpp
src/PartSet/PartSet_SketcherReetntrantMgr.cpp
src/PartSet/PartSet_SketcherReetntrantMgr.h

index c7dc8ed3a0f9da86f115adf6c43915e85ca48289..35fa3a02dc2128f5f3a73a2e1f75756a908e66ef 100755 (executable)
@@ -251,6 +251,7 @@ void ModuleBase_OperationFeature::abort()
 bool ModuleBase_OperationFeature::commit()
 {
   if (canBeCommitted()) {
+    emit beforeCommitted();
     // the widgets of property panel should not process any events come from data mode
     // after commit clicked. Some signal such as redisplay/create influence on content
     // of the object browser and viewer context. Therefore it influence to the current
@@ -265,7 +266,6 @@ bool ModuleBase_OperationFeature::commit()
     SessionPtr aMgr = ModelAPI_Session::get();
     /// Set current feature and remeber old current feature
 
-    emit beforeCommitted();
     commitOperation();
     aMgr->finishOperation();
 
index af2723111d3e85872fccf2dbe9691df9deeb02ef..302dbded4fcf7dc9431689ec5d1334e3c271ad0f 100755 (executable)
@@ -228,6 +228,30 @@ void PartSet_SketcherReetntrantMgr::onEnterReleased()
     myRestartingMode = RM_EmptyFeatureUsed;
 }
 
+void PartSet_SketcherReetntrantMgr::onBeforeStopped()
+{
+  ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+                                                      (myWorkshop->currentOperation());
+  if (aFOperation) {
+    disconnect(aFOperation, SIGNAL(beforeCommitted()), this, SLOT(onBeforeStopped()));
+    disconnect(aFOperation, SIGNAL(beforeAborted()), this, SLOT(onBeforeStopped()));
+  }
+  if (!isActiveMgr())
+    return;
+
+  if (!myIsInternalEditOperation)
+    return;
+
+  PartSet_Module* aModule = module();
+  ModuleBase_ModelWidget* aFirstWidget = aModule->activeWidget();
+  ModuleBase_IPropertyPanel* aPanel = aModule->currentOperation()->propertyPanel();
+  if (aFirstWidget != aPanel->activeWidget()) {
+    ModuleBase_WidgetSelector* aWSelector = dynamic_cast<ModuleBase_WidgetSelector*>(aFirstWidget);
+    if (aWSelector)
+      aWSelector->activateSelectionAndFilters(false);
+  }
+}
+
 bool PartSet_SketcherReetntrantMgr::canBeCommittedByPreselection()
 {
   return !isActiveMgr() || myRestartingMode == RM_None;
@@ -251,6 +275,9 @@ void PartSet_SketcherReetntrantMgr::startInternalEdit(const std::string& thePrev
   if (anOperationFeature.get() != NULL) {
 
     myIsInternalEditOperation = true;
+    connect(aFOperation, SIGNAL(beforeCommitted()), this, SLOT(onBeforeStopped()));
+    connect(aFOperation, SIGNAL(beforeAborted()), this, SLOT(onBeforeStopped()));
+
     // activate selection filters of the first widget in the viewer
     onWidgetActivated();
 
index f8f9ae0f9c4852caa7f5a2ebc241761192922c80..b72cc047deb5717be41230b78836531550bb96bc 100755 (executable)
@@ -105,6 +105,10 @@ private slots:
   /// for initialization of a new started operation.
   void onEnterReleased();
 
+  /// Deactivates selection and filters of the first operation widget if it is an internal
+  /// 'edit' operation
+  void onBeforeStopped();
+
 private:
   /// Returns true if the current operation is a sketch or a nested sketch operation
   bool isActiveMgr() const;