]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/SHAPERGUI/SHAPERGUI.cpp
Salome HOME
bos #29475 Option to create new part on study open
[modules/shaper.git] / src / SHAPERGUI / SHAPERGUI.cpp
index daa467a94f7d3b7eef77870808ea5c320d141461..c5702bf206bb46341523fda4359688169d1caad7 100644 (file)
@@ -76,6 +76,7 @@
 #include <QToolBar>
 
 #include <ModelAPI_Session.h>
+#include <Events_MessageBool.h>
 
 #if OCC_VERSION_HEX < 0x070400
   #define SALOME_PATCH_FOR_CTRL_WHEEL
@@ -946,6 +947,8 @@ void SHAPERGUI::preferencesChanged(const QString& theSection, const QString& the
   QString aVal = aResMgr->stringValue(theSection, theParam);
   Config_Prop* aProp = Config_PropManager::findProp(theSection.toStdString(),
                                                     theParam.toStdString());
+  if (!aProp)
+    return; // invalid case, the property default value must be registered in XML file
   std::string aValue = aVal.toStdString();
   if (aValue.empty()) {
     aValue = aProp->defaultValue();
@@ -991,6 +994,13 @@ void SHAPERGUI::preferencesChanged(const QString& theSection, const QString& the
       }
     }
   }
+  else if (theSection == ModuleBase_Preferences::GENERAL_SECTION && theParam == "create_init_part") {
+    bool aCreate = ModuleBase_Preferences::resourceMgr()->booleanValue(
+      ModuleBase_Preferences::GENERAL_SECTION, "create_init_part", true);
+    Events_MessageBool aCreateMsg(Events_Loop::eventByName(EVENT_CREATE_PART_ON_START), aCreate);
+    aCreateMsg.send();
+  }
+
   myWorkshop->displayer()->redisplayObjects();
 }