]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Working with pre-selection in all operations
authorvsv <vitaly.smetannikov@opencascade.com>
Mon, 6 Oct 2014 14:45:09 +0000 (18:45 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Mon, 6 Oct 2014 14:45:09 +0000 (18:45 +0400)
src/FeaturesPlugin/extrusion_widget.xml
src/ModuleBase/ModuleBase_Operation.cpp
src/ModuleBase/ModuleBase_Operation.h
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
src/PartSet/PartSet_OperationSketchBase.cpp
src/PartSet/PartSet_OperationSketchBase.h

index 698905a7fd4a7f9f588c6f043518fbe679eceed5..0bcf41643e799e782f2f921cafcf460e4f5748cc 100644 (file)
@@ -6,7 +6,7 @@
     activate="true"
     shape_types="face"
   />
-  <doublevalue id="extrusion_size" label="Size" min="0" step="1.0" default="10" icon=":icons/dimension_v.png" tooltip="Set size of extrusion">
+  <doublevalue id="extrusion_size" label="Size" min="0" step="1.0" default="0" icon=":icons/dimension_v.png" tooltip="Set size of extrusion">
     <validator id="GeomValidators_Positive"/>
   </doublevalue>
   <boolvalue id="extrusion_reverse" label="Reverse" default="false" tooltip="Reverse default direction"/>
index 718ded61a83a8b56f2667c16d895507ac81540d0..d8f50a4cd51e1a94f8d264df51c001741676dae5 100644 (file)
@@ -238,13 +238,7 @@ void ModuleBase_Operation::activateByPreselection()
     aValue.setObject(aPrs.object());
     if (aActiveWgt->setValue(&aValue)) {
       myPreSelection.remove(aPrs);
-      if(isValid()) {
-        //myActiveWidget = NULL;
-        commit();
-      } else {
-        myPropertyPanel->activateNextWidget();
-        //emit activateNextWidget(myActiveWidget);
-      }
+      myPropertyPanel->activateNextWidget();
     }
     // If preselection is enough to make a valid feature - apply it immediately
   }
index 910bd6eaed26dfdee57c11bfbbeb69bfd20c40af..dbf2b3406c1851ab1c91e25e4ea96e3603220528 100644 (file)
@@ -202,7 +202,7 @@ signals:
   /// Returns pointer to the root document.
   boost::shared_ptr<ModelAPI_Document> document() const;
 
-  ///
+  /// Activates widgets by preselection if it is accepted
   virtual void activateByPreselection();
 
   /// Set value to the active widget
index 47471dab3ef16e2046636f43debc39712a180931..da84fe6cac3bd27bcfe422f622a814e378c1fd69 100644 (file)
@@ -152,6 +152,7 @@ void ModuleBase_WidgetShapeSelector::onSelectionChanged()
       return;
 
     setObject(aObject);
+    emit focusOutWidget(this);
   }
 }
 
@@ -170,7 +171,6 @@ void ModuleBase_WidgetShapeSelector::setObject(ObjectPtr theObj)
   updateSelectionName();
   activateSelection(false);
   emit valuesChanged();
-  emit focusOutWidget(this);
 }
 
 //********************************************************************
index e8f081e4d581d19beab5a3cf4f46dc48dd91e42d..2ce61d8efc8250d67e8182a00f91f7dcc1ad34c0 100644 (file)
@@ -6,6 +6,10 @@
 #include <PartSet_Tools.h>
 #include <ModelAPI_ResultBody.h>
 
+#include <ModuleBase_IPropertyPanel.h>
+#include <ModuleBase_ModelWidget.h>
+#include <ModuleBase_WidgetValueFeature.h>
+
 #include <SketchPlugin_Feature.h>
 #include <V3d_View.hxx>
 #include <AIS_Shape.hxx>
@@ -104,3 +108,28 @@ void PartSet_OperationSketchBase::restartOperation(const std::string& theType, O
   }
   emit restartRequired(theType, theFeature);
 }
+
+
+
+void PartSet_OperationSketchBase::activateByPreselection()
+{
+  if (!myPropertyPanel)
+    return;
+  ModuleBase_ModelWidget* aActiveWgt = myPropertyPanel->activeWidget();
+  if ((myPreSelection.size() > 0) && aActiveWgt) {
+    const ModuleBase_ViewerPrs& aPrs = myPreSelection.front();
+    ModuleBase_WidgetValueFeature aValue;
+    aValue.setObject(aPrs.object());
+    if (aActiveWgt->setValue(&aValue)) {
+      myPreSelection.remove(aPrs);
+      if(isValid()) {
+        //myActiveWidget = NULL;
+        commit();
+      } else {
+        myPropertyPanel->activateNextWidget();
+        //emit activateNextWidget(myActiveWidget);
+      }
+    }
+    // If preselection is enough to make a valid feature - apply it immediately
+  }
+}
index 356765cc43046f32ce120f140a6289a68320e399..25f71483089973ff0bf6ddc9117db2f68676eee6 100644 (file)
@@ -149,6 +149,9 @@ signals:
   /// \param theFlushMessage the flag whether the create message should be flushed
   /// \returns the created feature
   virtual FeaturePtr createFeature(const bool theFlushMessage = true);
+
+  /// Activates widgets by preselection if it is accepted
+  virtual void activateByPreselection();
 };
 
 #endif