#include <SketcherPrs_Tools.h>
#include <Events_Loop.h>
+#include <Events_MessageBool.h>
#include <Config_PropManager.h>
#include <Config_Keywords.h>
Events_Loop* aLoop = Events_Loop::loop();
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED));
+ aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENTS_CLOSED));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_LICENSE_VALID));
void PartSet_Module::createFeatures()
{
ModuleBase_IModule::createFeatures();
+
+ // send signal to initialization plugin about the state of the preferences: to create part or not
+ 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();
+
myRoot = new PartSet_RootNode();
myRoot->setWorkshop(workshop());
ModuleBase_IModule::loadProprietaryPlugins();
//******************************************************
void PartSet_Module::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
- if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_DOCUMENT_CHANGED)) {
+ if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_DOCUMENTS_CLOSED)) {
+ closeDocument();
+ } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_DOCUMENT_CHANGED)) {
SessionPtr aMgr = ModelAPI_Session::get();
if (!aMgr->hasModuleDocument()) // if document is closed, do not call the document creation
return;