]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
#1352 Selection mode is invalid on edit Partition
authornds <nds@opencascade.com>
Wed, 2 Mar 2016 07:25:40 +0000 (10:25 +0300)
committernds <nds@opencascade.com>
Wed, 2 Mar 2016 07:25:40 +0000 (10:25 +0300)
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetSelector.cpp
src/ModuleBase/ModuleBase_WidgetSelector.h
src/ModuleBase/ModuleBase_WidgetValidated.cpp
src/ModuleBase/ModuleBase_WidgetValidated.h
src/PartSet/PartSet_WidgetShapeSelector.cpp
src/PartSet/PartSet_WidgetShapeSelector.h

index 88062dbad4ed694a79413d567c1ee62c8e1a20b3..40518a2ca9dcfc573c8af708a769180f931f51dd 100755 (executable)
@@ -479,12 +479,12 @@ void ModuleBase_WidgetMultiSelector::setCurrentShapeType(const TopAbs_ShapeEnum
     aShapeTypeName = myTypeCombo->itemText(idx);
     TopAbs_ShapeEnum aRefType = ModuleBase_Tools::shapeType(aShapeTypeName);
     if(aRefType == theShapeType && idx != myTypeCombo->currentIndex()) {
-      activateSelectionAndFilters(false);
+      bool aWasActivated = activateSelectionAndFilters(false);
       bool isBlocked = myTypeCombo->blockSignals(true);
       myTypeCombo->setCurrentIndex(idx);
       myTypeCombo->blockSignals(isBlocked);
-
-      activateSelectionAndFilters(true);
+      if (aWasActivated)
+        activateSelectionAndFilters(true);
       break;
     }
   }
index 53a7b5da8a35a154a8342778bbe64956c2305cf1..e8c6093438fc650319046cad21c6f5ddeeb31844 100755 (executable)
@@ -115,7 +115,7 @@ bool ModuleBase_WidgetSelector::acceptSubShape(const GeomShapePtr& theShape,
 }
 
 //********************************************************************
-void ModuleBase_WidgetSelector::activateSelectionAndFilters(bool toActivate)
+bool ModuleBase_WidgetSelector::activateSelectionAndFilters(bool toActivate)
 {
   updateSelectionName();
 
@@ -124,7 +124,7 @@ void ModuleBase_WidgetSelector::activateSelectionAndFilters(bool toActivate)
   } else {
     myWorkshop->deactivateSubShapesSelection();
   }
-  activateFilters(toActivate);
+  return activateFilters(toActivate);
 }
 
 //********************************************************************
index e44a2dde367fc8b78dbbed3dbe1383ac8e86af74..9756b3633e13c78af6f2b7ef4f7ee224e85f632e 100755 (executable)
@@ -44,7 +44,8 @@ Q_OBJECT
   virtual bool isViewerSelector() { return true; }
 
   /// Activate or deactivate selection and selection filters
-  virtual void activateSelectionAndFilters(bool toActivate);
+  /// \return true if the selection filter of the widget is activated in viewer context
+  virtual bool activateSelectionAndFilters(bool toActivate);
 
   /// Checks the widget validity. By default, it returns true.
   /// \param thePrs a selected presentation in the view
index 995c6671778053fa6fdce03c9d190f06af6a25b5..6e4873753fb1b3b9d04b688a1142255720b86661 100644 (file)
@@ -202,17 +202,21 @@ bool ModuleBase_WidgetValidated::isFilterActivated() const
   return aViewer->hasSelectionFilter(aSelFilter);
 }
 
-void ModuleBase_WidgetValidated::activateFilters(const bool toActivate)
+bool ModuleBase_WidgetValidated::activateFilters(const bool toActivate)
 {
   ModuleBase_IViewer* aViewer = myWorkshop->viewer();
 
   Handle(SelectMgr_Filter) aSelFilter = myWorkshop->validatorFilter();
+  bool aHasSelectionFilter = aViewer->hasSelectionFilter(aSelFilter);
+
   if (toActivate)
     aViewer->addSelectionFilter(aSelFilter);
   else {
     aViewer->removeSelectionFilter(aSelFilter);
     clearValidState();
   }
+
+  return aHasSelectionFilter;
 }
 
 //********************************************************************
index ecd107e99481be25bc7a387e3b250f5c6ab03be9..e7c84a942ad5a8763c945a71c88ceaa001c45b00 100644 (file)
@@ -124,7 +124,8 @@ protected:
 
   /// It obtains selection filters from the workshop and activates them in the active viewer
   /// \param toActivate a flag about activation or deactivation the filters
-  void activateFilters(const bool toActivate);
+  /// \return true if the selection filter of the widget is activated in viewer context
+  bool activateFilters(const bool toActivate);
 
   /// Block the model flush of update and intialization of attribute
   /// \param theToBlock flag whether the model is blocked or unblocked
index 305337337408e02ea7933f51fe8d5b9f6b886580..6f841163a7b271f4bbb442c507e01f1752e211a1 100755 (executable)
@@ -42,15 +42,17 @@ PartSet_WidgetShapeSelector::~PartSet_WidgetShapeSelector()
 }
 
 //********************************************************************
-void PartSet_WidgetShapeSelector::activateSelectionAndFilters(bool toActivate)
+bool PartSet_WidgetShapeSelector::activateSelectionAndFilters(bool toActivate)
 {
-  ModuleBase_WidgetShapeSelector::activateSelectionAndFilters(toActivate);
+  bool aHasSelectionFilter = ModuleBase_WidgetShapeSelector::activateSelectionAndFilters
+                                                                           (toActivate);
   if (!myUseSketchPlane) {
     XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop);
     PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(aWorkshop->module());
     bool isUsePlaneFilterOnly = !toActivate;
     aModule->sketchMgr()->activatePlaneFilter(isUsePlaneFilterOnly);
   }
+  return aHasSelectionFilter;
 }
 
 //********************************************************************
index 9af349389ed90423e5024d99f58072e4ce3b9cf3..93cf342d77248d5524a6dd0b9c6dfa401ef85a78 100644 (file)
@@ -44,7 +44,7 @@ Q_OBJECT
 
   /// Activate or deactivate selection and selection filters
   /// \param toActivate boolean state whether it should be activated/deactivated
-  virtual void activateSelectionAndFilters(bool toActivate);
+  virtual bool activateSelectionAndFilters(bool toActivate);
 
 protected:
   /// Checks the widget validity. By default, it returns true.