X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_Application.cpp;h=a825e747104b6482f68a0b14a7bbbbcc4b13d182;hb=cf042069d9ec6ec86389945f6973d338b6e6d753;hp=128f6ee4dffa76228158d713d4a5967ffabb6d8b;hpb=d150af3c6e788269822b07b3bf344a66b71b523f;p=modules%2Fshaper.git diff --git a/src/Model/Model_Application.cpp b/src/Model/Model_Application.cpp index 128f6ee4d..a825e7471 100644 --- a/src/Model/Model_Application.cpp +++ b/src/Model/Model_Application.cpp @@ -7,6 +7,8 @@ #include #include +#include + IMPLEMENT_STANDARD_HANDLE(Model_Application, TDocStd_Application) IMPLEMENT_STANDARD_RTTIEXT(Model_Application, TDocStd_Application) @@ -28,13 +30,21 @@ const std::shared_ptr& Model_Application::getDocument(string the static const std::string thePartSetKind("PartSet"); static const std::string thePartKind("Part"); + bool isRoot = theDocID == "root"; // the document is root std::shared_ptr aNew( - new Model_Document(theDocID, theDocID == "root" ? thePartSetKind : thePartKind)); + new Model_Document(theDocID, isRoot ? thePartSetKind : thePartKind)); myDocs[theDocID] = aNew; + // load it if it must be loaded by demand if (myLoadedByDemand.find(theDocID) != myLoadedByDemand.end() && !myPath.empty()) { aNew->load(myPath.c_str()); myLoadedByDemand.erase(theDocID); // done, don't do it anymore + } else { + static Events_ID anId = ModelAPI_DocumentCreatedMessage::eventId(); + std::shared_ptr aMessage = std::shared_ptr + (new ModelAPI_DocumentCreatedMessage(anId, this)); + aMessage->setDocument(aNew); + Events_Loop::loop()->send(aMessage); } return myDocs[theDocID];