From 5e1e1260c83cb48e15bd8f0f39e9b641da7302a2 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Fri, 18 May 2018 10:46:21 -0300 Subject: [PATCH] Remember background type in Tools->Save picture dialog --- src/Gui/CommandView.cpp | 3 +++ src/Gui/DlgSettingsImageImp.cpp | 9 +++++++++ src/Gui/DlgSettingsImageImp.h | 1 + 3 files changed, 13 insertions(+) diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 7c7ff4c4f8..aa31a97819 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -1732,6 +1732,7 @@ void StdViewScreenShot::activated(int iMsg) Base::Reference hExt = App::GetApplication().GetUserParameter().GetGroup("BaseApp") ->GetGroup("Preferences")->GetGroup("General"); QString ext = QString::fromLatin1(hExt->GetASCII("OffscreenImageFormat").c_str()); + int backtype = hExt->GetInt("OffscreenImageBackground",0); QStringList filter; QString selFilter; @@ -1754,6 +1755,7 @@ void StdViewScreenShot::activated(int iMsg) DlgSettingsImageImp* opt = new DlgSettingsImageImp(&fd); SbVec2s sz = vp.getWindowSize(); opt->setImageSize((int)sz[0], (int)sz[1]); + opt->setBackgroundType(backtype); fd.setOptionsWidget(FileOptionsDialog::ExtensionRight, opt); fd.setConfirmOverwrite(true); @@ -1794,6 +1796,7 @@ void StdViewScreenShot::activated(int iMsg) case 3: background="Transparent"; break; default: background="Current"; break; } + hExt->SetInt("OffscreenImageBackground",opt->backgroundType()); QString comment = opt->comment(); if (!comment.isEmpty()) { diff --git a/src/Gui/DlgSettingsImageImp.cpp b/src/Gui/DlgSettingsImageImp.cpp index 2b9a07730c..752fef12e7 100644 --- a/src/Gui/DlgSettingsImageImp.cpp +++ b/src/Gui/DlgSettingsImageImp.cpp @@ -139,6 +139,15 @@ int DlgSettingsImageImp::backgroundType() const return comboBackground->currentIndex(); } +/** + * Sets the image size to (\a w, \a h). + */ +void DlgSettingsImageImp::setBackgroundType(int t) +{ + if ( t < comboBackground->count() ) + comboBackground->setCurrentIndex(t); +} + bool DlgSettingsImageImp::addWatermark() const { return checkWatermark->isChecked(); diff --git a/src/Gui/DlgSettingsImageImp.h b/src/Gui/DlgSettingsImageImp.h index 8421f723b9..8ba8dd3eb9 100644 --- a/src/Gui/DlgSettingsImageImp.h +++ b/src/Gui/DlgSettingsImageImp.h @@ -57,6 +57,7 @@ public: //@{ QString comment() const; int backgroundType() const; + void setBackgroundType( int ); bool addWatermark() const; //@}