From 0a120ba84def7a4fe01721eb565aa5b2dd99596d Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 26 Nov 2015 20:24:00 +0100 Subject: [PATCH] + do view fit only on file import if document was empty --- src/Gui/CommandDoc.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index 572b6a9992..2d23ea2618 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -209,6 +209,8 @@ 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(), @@ -216,9 +218,12 @@ void StdCmdImport::activated(int iMsg) it.value().toAscii()); } - std::list views = getActiveGuiDocument()->getMDIViewsOfType(Gui::View3DInventor::getClassTypeId()); - for (std::list::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 views = getActiveGuiDocument()->getMDIViewsOfType(Gui::View3DInventor::getClassTypeId()); + for (std::list::iterator it = views.begin(); it != views.end(); ++it) { + (*it)->viewAll(); + } } } }