App/Gui: introduce temporary document
Add new argument to Application::newDocument() to create a temporary
document. Also exposed to Python API App.newDocument() with a named
argument 'temp'.
The temporary document is marked with status bit 'TempDoc'. The user
will not be prompt for saving when closing. The undo/redo is disabled.
The AutoSaver skips it. And the tree view will not show it.
PropertyXLink allows linking to/from object within a temporary document
without saving.
This commit is contained in:
@@ -927,17 +927,25 @@ void Application::onLastWindowClosed(Gui::Document* pcDoc)
|
||||
// Call the closing mechanism from Python. This also checks whether pcDoc is the last open document.
|
||||
Command::doCommand(Command::Doc, "App.closeDocument(\"%s\")", pcDoc->getDocument()->getName());
|
||||
if (!d->activeDocument && d->documents.size()) {
|
||||
Document *gdoc = nullptr;
|
||||
for(auto &v : d->documents) {
|
||||
if (v.second->getDocument()->testStatus(App::Document::TempDoc))
|
||||
continue;
|
||||
else if (!gdoc)
|
||||
gdoc = v.second;
|
||||
|
||||
Gui::MDIView* view = v.second->getActiveView();
|
||||
if(view) {
|
||||
if (view) {
|
||||
setActiveDocument(v.second);
|
||||
getMainWindow()->setActiveWindow(view);
|
||||
return;
|
||||
}
|
||||
}
|
||||
auto gdoc = d->documents.begin()->second;
|
||||
setActiveDocument(gdoc);
|
||||
activateView(View3DInventor::getClassTypeId(),true);
|
||||
|
||||
if (gdoc) {
|
||||
setActiveDocument(gdoc);
|
||||
activateView(View3DInventor::getClassTypeId(),true);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
|
||||
Reference in New Issue
Block a user