From 8bdc9b0f0981d37a9c425675fd31dd1e4f405c94 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 24 Sep 2014 18:49:19 +0200 Subject: [PATCH] + add option to disable automatic fit to view when loading data file --- src/Gui/Application.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index 9e690237a7..71b3c2b285 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -496,9 +496,12 @@ void Application::open(const char* FileName, const char* Module) // load the file with the module Command::doCommand(Command::App, "%s.open(\"%s\")", Module, File.filePath().c_str()); // ViewFit - if (!File.hasExtension("FCStd") && sendHasMsgToActiveView("ViewFit")) - //Command::doCommand(Command::Gui, "Gui.activeDocument().activeView().fitAll()"); - Command::doCommand(Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); + if (!File.hasExtension("FCStd") && sendHasMsgToActiveView("ViewFit")) { + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath + ("User parameter:BaseApp/Preferences/View"); + if (hGrp->GetBool("AutoFitToView", true)) + Command::doCommand(Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); + } // the original file name is required getMainWindow()->appendRecentFile(QString::fromUtf8(File.filePath().c_str())); } @@ -538,7 +541,10 @@ void Application::importFrom(const char* FileName, const char* DocName, const ch else { Command::doCommand(Command::App, "%s.insert(\"%s\",\"%s\")" , Module, File.filePath().c_str(), DocName); - Command::doCommand(Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath + ("User parameter:BaseApp/Preferences/View"); + if (hGrp->GetBool("AutoFitToView", true)) + Command::doCommand(Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); if (getDocument(DocName)) getDocument(DocName)->setModified(true); }