From: nds Date: Mon, 25 May 2015 13:06:58 +0000 (+0300) Subject: do not call reset for the number of copies control in translation and rotation controls. X-Git-Tag: V_1.2.0~95 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6f5b63de242e0c3e14ea13cd8eb478b67728b0bd;p=modules%2Fshaper.git do not call reset for the number of copies control in translation and rotation controls. --- diff --git a/src/Config/Config_Keywords.h b/src/Config/Config_Keywords.h index 2827d269c..96adf95b2 100644 --- a/src/Config/Config_Keywords.h +++ b/src/Config/Config_Keywords.h @@ -65,6 +65,8 @@ const static char* ATTR_DEFAULT = "default"; const static char* ATTR_INTERNAL = "internal"; const static char* ATTR_OBLIGATORY = "obligatory"; const static char* ATTR_CONCEALMENT = "concealment"; +const static char* ATTR_USE_RESET = "use_reset"; + // WDG_INFO properties const static char* INFO_WDG_TEXT = FEATURE_TEXT; const static char* INFO_WDG_TOOLTIP = FEATURE_TOOLTIP; diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index 130e89404..b22c1f3b1 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -30,6 +30,7 @@ ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent, myIsEditing(false) { myDefaultValue = theData->getProperty(ATTR_DEFAULT); + myUseReset = theData->getBooleanAttribute(ATTR_USE_RESET, true); myIsComputedDefault = theData->getProperty(ATTR_DEFAULT) == DOUBLE_WDG_DEFAULT_COMPUTED; myAttributeID = theData ? theData->widgetId() : ""; myIsObligatory = theData->getBooleanAttribute(ATTR_OBLIGATORY, true); diff --git a/src/ModuleBase/ModuleBase_ModelWidget.h b/src/ModuleBase/ModuleBase_ModelWidget.h index a6ad2ca97..81196b2cc 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.h +++ b/src/ModuleBase/ModuleBase_ModelWidget.h @@ -64,6 +64,10 @@ Q_OBJECT /// \return the boolean result bool isObligatory() const { return myIsObligatory; } + /// Returns this parameter value in the xml file + /// \return the boolean result + bool isUseReset() const { return myUseReset; } + /// Defines if it is supposed that the widget should interact with the viewer. virtual bool isViewerSelector() { return false; } @@ -216,6 +220,9 @@ private: /// the default value, which is defined in the XML for this attribute std::string myDefaultValue; + + /// the reset state. If it is false, the reset method of the widget is not performed + bool myUseReset; }; #endif diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index e2e8fa4e5..904df9408 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -95,6 +95,9 @@ ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue() void ModuleBase_WidgetDoubleValue::reset() { + if (!isUseReset()) + return; + if (isComputedDefault() || mySpinBox->hasVariable()) { return; //if (myFeature->compute(myAttributeID)) diff --git a/src/ModuleBase/ModuleBase_WidgetIntValue.cpp b/src/ModuleBase/ModuleBase_WidgetIntValue.cpp index aab5d1dd9..f09f9c056 100644 --- a/src/ModuleBase/ModuleBase_WidgetIntValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetIntValue.cpp @@ -93,6 +93,9 @@ ModuleBase_WidgetIntValue::~ModuleBase_WidgetIntValue() void ModuleBase_WidgetIntValue::reset() { + if (!isUseReset()) + return; + if (isComputedDefault()) { return; //if (myFeature->compute(myAttributeID)) diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index 3d8c89ad1..a44b8c9ee 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -101,6 +101,9 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, void PartSet_WidgetPoint2D::reset() { + if (!isUseReset()) + return; + if (isComputedDefault()) { //return; if (myFeature->compute(myAttributeID)) diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index e8e95315d..9e3f411c5 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -281,7 +281,7 @@ + default="1" min="1" use_reset="false"> @@ -310,7 +310,7 @@ + default="1" min="1" use_reset="false">