}
TCollection_ExtendedString aPath(DocFileName(theFileName, myID));
PCDM_ReaderStatus aStatus = (PCDM_ReaderStatus) -1;
+ Handle(TDocStd_Document) aLoaded;
try {
- aStatus = anApp->Open(aPath, myDoc);
+ aStatus = anApp->Open(aPath, aLoaded);
} catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
Events_Error::send(
break;
}
}
+ std::shared_ptr<Model_Session> aSession =
+ std::dynamic_pointer_cast<Model_Session>(Model_Session::get());
if (!isError) {
+ myDoc = aLoaded;
myDoc->SetUndoLimit(UNDO_LIMIT);
// to avoid the problem that feature is created in the current, not this, document
- std::shared_ptr<Model_Session> aSession =
- std::dynamic_pointer_cast<Model_Session>(Model_Session::get());
aSession->setActiveDocument(anApp->getDocument(myID), false);
aSession->setCheckTransactions(false);
if (myObjs)
aSession->setActiveDocument(Model_Session::get()->moduleDocument(), false);
// this is done in Part result "activate", so no needed here. Causes not-blue active part.
// aSession->setActiveDocument(anApp->getDocument(myID), true);
- }
+ } else { // open failed, but new documnet was created to work with it: inform the model
+ aSession->setActiveDocument(Model_Session::get()->moduleDocument(), false);
+ }
return !isError;
}
return std::shared_ptr<ModelAPI_Feature>(); // null feature means the higher than first
}
-void Model_Document::setCurrentFeature(std::shared_ptr<ModelAPI_Feature> theCurrent,
- const bool theVisible)
+void Model_Document::setCurrentFeature(
+ std::shared_ptr<ModelAPI_Feature> theCurrent, const bool theVisible)
{
// blocks the flush signals to avoid each objects visualization in the viewer
// they should not be shown once after all modifications are performed
}
// unblock the flush signals and up them after this
aLoop->activateFlushes(isActive);
-
- aLoop->flush(aCreateEvent);
- aLoop->flush(aRedispEvent);
- aLoop->flush(aDeleteEvent);
}
void Model_Document::setCurrentFeatureUp()
FeaturePtr aCurrent = currentFeature(false);
if (aCurrent.get()) { // if not, do nothing because null is the upper
FeaturePtr aPrev = myObjs->nextFeature(aCurrent, true);
+ // do not flush: it is called only on remove, it will be flushed in the end of transaction
setCurrentFeature(aPrev, false);
}
}
}*/
}
-// Feature that is used for selection in the Part document by the external request
+/// Feature that is used for selection in the Part document by the external request
class Model_SelectionInPartFeature : public ModelAPI_Feature {
public:
/// Nothing to do in constructor