From: vsv Date: Thu, 25 Jul 2019 10:40:08 +0000 (+0300) Subject: Issue #2967: Provide Transparency as Int value form 0 to 100 and avoid conflict by... X-Git-Tag: VEDF2019Lot4~93 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=541c126e61b2d6db03c3a21011aea5c8c209c685;p=modules%2Fshaper.git Issue #2967: Provide Transparency as Int value form 0 to 100 and avoid conflict by names with transparency from viewer --- diff --git a/src/Config/Config_PropManager.cpp b/src/Config/Config_PropManager.cpp index e9da0fad1..aa4da4e70 100644 --- a/src/Config/Config_PropManager.cpp +++ b/src/Config/Config_PropManager.cpp @@ -50,8 +50,10 @@ Config_Prop* Config_PropManager::registerProp(const std::string& theSection, aProp->setType(theType); aProp->setTitle(theTitle); } - aProp->setMin(theMin); - aProp->setMax(theMax); + if (theMin != "") + aProp->setMin(theMin); + if (theMax != "") + aProp->setMax(theMax); } else { aProp = diff --git a/src/Config/Config_PropManager.h b/src/Config/Config_PropManager.h index e0b2cd7e9..23e577666 100644 --- a/src/Config/Config_PropManager.h +++ b/src/Config/Config_PropManager.h @@ -44,7 +44,7 @@ class Config_PropManager * \param theType - type of the value. * \param theDefValue - default and initial value of the property * \param theMin - minimal value - * \param theMax - minimal value + * \param theMax - maximal value * Returns True if the property succesfully registered */ CONFIG_EXPORT static Config_Prop* registerProp(const std::string& theSection, diff --git a/src/ModelAPI/ModelAPI_Session.cpp b/src/ModelAPI/ModelAPI_Session.cpp index fb455eb4c..7755b7bf3 100644 --- a/src/ModelAPI/ModelAPI_Session.cpp +++ b/src/ModelAPI/ModelAPI_Session.cpp @@ -80,8 +80,8 @@ std::shared_ptr ModelAPI_Session::get() Config_Prop::Double, ModelAPI_ResultConstruction::DEFAULT_DEFLECTION()); - Config_PropManager::registerProp("Visualization", "default_transparency", - "Default transparency", Config_Prop::Double, "0"); + Config_PropManager::registerProp("Visualization", "shaper_default_transparency", + "Default transparency (%)", Config_Prop::IntSpin, "0", "0", "100"); } return MY_MANAGER; diff --git a/src/ModuleBase/ModuleBase_Preferences.cpp b/src/ModuleBase/ModuleBase_Preferences.cpp index 1cbe486e2..68e275d21 100644 --- a/src/ModuleBase/ModuleBase_Preferences.cpp +++ b/src/ModuleBase/ModuleBase_Preferences.cpp @@ -197,6 +197,16 @@ void ModuleBase_Preferences::createCustomPage(ModuleBase_IPrefMgr* thePref, int thePref->setItemProperty("max", aMax, anId); } } + if (aPrefType == SUIT_PreferenceMgr::IntSpin) { + if (aProp->min() != "") { + int aMin = QString(aProp->min().c_str()).toInt(); + thePref->setItemProperty("min", aMin, anId); + } + if (aProp->max() != "") { + int aMax = QString(aProp->max().c_str()).toInt(); + thePref->setItemProperty("max", aMax, anId); + } + } } } } diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index 7fa6366d6..fa1c50aa1 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -141,7 +141,7 @@ SHAPERGUI::SHAPERGUI() myProxyViewer = new SHAPERGUI_SalomeViewer(this); ModuleBase_Preferences::setResourceMgr(application()->resourceMgr()); - ModuleBase_Preferences::loadCustomProps(); + // ModuleBase_Preferences::loadCustomProps(); - It will be called in XGUI_Workshop::startApplication } //****************************************************** diff --git a/src/SHAPERGUI/resources/LightApp.xml.in b/src/SHAPERGUI/resources/LightApp.xml.in index fb1dbafbd..f7672ab2d 100644 --- a/src/SHAPERGUI/resources/LightApp.xml.in +++ b/src/SHAPERGUI/resources/LightApp.xml.in @@ -34,6 +34,7 @@ +
diff --git a/src/XGUI/XGUI_CustomPrs.cpp b/src/XGUI/XGUI_CustomPrs.cpp index 0090ba420..f3bd68300 100644 --- a/src/XGUI/XGUI_CustomPrs.cpp +++ b/src/XGUI/XGUI_CustomPrs.cpp @@ -133,7 +133,7 @@ double getTransparency(const ResultPtr& theResult) double getDefaultTransparency(const ResultPtr& theResult) { - return Config_PropManager::real("Visualization", "default_transparency"); + return Config_PropManager::integer("Visualization", "shaper_default_transparency") / 100.; } XGUI_CustomPrs::XGUI_CustomPrs(XGUI_Workshop* theWorkshop)