if (!isError) {
myDoc->SetUndoLimit(UNDO_LIMIT);
// to avoid the problem that feature is created in the current, not this, document
- Model_Session::get()->setActiveDocument(anApp->getDocument(myID));
+ Model_Session::get()->setActiveDocument(anApp->getDocument(myID), false);
synchronizeFeatures(false, true);
+ Model_Session::get()->setActiveDocument(Model_Session::get()->moduleDocument(), false);
+ Model_Session::get()->setActiveDocument(anApp->getDocument(myID), true);
}
return !isError;
}
return myCurrentDoc;
}
-void Model_Session::setActiveDocument(boost::shared_ptr<ModelAPI_Document> theDoc)
+void Model_Session::setActiveDocument(
+ boost::shared_ptr<ModelAPI_Document> theDoc, bool theSendSignal)
{
if (myCurrentDoc != theDoc) {
myCurrentDoc = theDoc;
- static boost::shared_ptr<Events_Message> aMsg(new Events_Message(Events_Loop::eventByName("CurrentDocumentChanged")));
- Events_Loop::loop()->send(aMsg);
+ if (theSendSignal) {
+ static boost::shared_ptr<Events_Message> aMsg(new Events_Message(Events_Loop::eventByName("CurrentDocumentChanged")));
+ Events_Loop::loop()->send(aMsg);
+ }
}
}
MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> activeDocument();
/// Defines the current document that used for current work in the application
- MODEL_EXPORT virtual void setActiveDocument(boost::shared_ptr<ModelAPI_Document> theDoc);
+ MODEL_EXPORT virtual void setActiveDocument(
+ boost::shared_ptr<ModelAPI_Document> theDoc, bool theSendSignal = true);
/// Returns all the opened documents of the session (without postponed)
MODEL_EXPORT virtual std::list<boost::shared_ptr<ModelAPI_Document> > allOpenedDocuments();
virtual boost::shared_ptr<ModelAPI_Document> activeDocument() = 0;
/// Defines the current document that used for current work in the application
- virtual void setActiveDocument(boost::shared_ptr<ModelAPI_Document> theDoc) = 0;
+ virtual void setActiveDocument(
+ boost::shared_ptr<ModelAPI_Document> theDoc, bool theSendSignal = true) = 0;
/// Returns all the opened documents of the session (without postponed)
virtual std::list<boost::shared_ptr<ModelAPI_Document> > allOpenedDocuments() = 0;
setResult(aResult);
aResult->activate();
}
- /*
- boost::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = aResult->data()->docRef(
- ModelAPI_ResultPart::DOC_REF());
-
- if (!aDocRef->value()) { // create a document if not yet created
- boost::shared_ptr<ModelAPI_Document> aPartSetDoc =
- ModelAPI_Session::get()->moduleDocument();
- aDocRef->setValue(aPartSetDoc->subDocument(data()->name()));
- }
- */
}
boost::shared_ptr<ModelAPI_Document> PartSetPlugin_Part::documentToAdd()