Skip to content

Commit

Permalink
+ do view fit only on file import if document was empty
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Nov 26, 2015
1 parent 898e0fb commit 559194e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Gui/CommandDoc.cpp
Expand Up @@ -209,16 +209,21 @@ void StdCmdImport::activated(int iMsg)
if (!fileList.isEmpty()) {
hPath->SetASCII("FileImportFilter", selectedFilter.toLatin1().constData());
SelectModule::Dict dict = SelectModule::importHandler(fileList, selectedFilter);

bool emptyDoc = (getActiveGuiDocument()->getDocument()->countObjects() == 0);
// load the files with the associated modules
for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) {
getGuiApplication()->importFrom(it.key().toUtf8(),
getActiveGuiDocument()->getDocument()->getName(),
it.value().toAscii());
}

std::list<Gui::MDIView*> views = getActiveGuiDocument()->getMDIViewsOfType(Gui::View3DInventor::getClassTypeId());
for (std::list<MDIView*>::iterator it = views.begin(); it != views.end(); ++it) {
(*it)->viewAll();
if (emptyDoc) {
// only do a view fit if the document was empty before. See also parameter 'AutoFitToView' in importFrom()
std::list<Gui::MDIView*> views = getActiveGuiDocument()->getMDIViewsOfType(Gui::View3DInventor::getClassTypeId());
for (std::list<MDIView*>::iterator it = views.begin(); it != views.end(); ++it) {
(*it)->viewAll();
}
}
}
}
Expand Down

0 comments on commit 559194e

Please sign in to comment.