OpenToonz - An open-source full-featured 2D animation creation software
C
fix fx settings geometry restoration (#2779)
shun-iwasawa831596b6896c
diff --git a/toonz/sources/toonz/pane.h b/toonz/sources/toonz/pane.hindex 333cd3d9d..70388b4c4 100644--- a/toonz/sources/toonz/pane.h+++ b/toonz/sources/toonz/pane.h@@ -232,7 +232,7 @@ public:return false;};- void restoreFloatingPanelState();+ virtual void restoreFloatingPanelState();protected:void paintEvent(QPaintEvent *) override;diff --git a/toonz/sources/toonz/tpanels.cpp b/toonz/sources/toonz/tpanels.cppindex 4e5a6c1f5..f800f34d0 100644--- a/toonz/sources/toonz/tpanels.cpp+++ b/toonz/sources/toonz/tpanels.cpp@@ -73,6 +73,7 @@#include "toonz/palettecmd.h"#include "toonz/preferences.h"#include "tw/stringtable.h"+#include "toonz/toonzfolders.h"// TnzBase includes#include "trasterfx.h"@@ -1383,6 +1384,26 @@ FxSettingsPanel::FxSettingsPanel(QWidget *parent) : TPanel(parent) {setWidget(m_fxSettings);}+// FxSettings will adjust its size according to the current fx+// so we only restore position of the panel.+void FxSettingsPanel::restoreFloatingPanelState() {+ TFilePath savePath = ToonzFolder::getMyModuleDir() + TFilePath("popups.ini");+ QSettings settings(QString::fromStdWString(savePath.getWideString()),+ QSettings::IniFormat);+ settings.beginGroup("Panels");++ if (!settings.childGroups().contains("FxSettings")) return;++ settings.beginGroup("FxSettings");++ QRect geom = settings.value("geometry", saveGeometry()).toRect();+ // check if it can be visible in the current screen+ if (!(geom & QApplication::desktop()->availableGeometry(this)).isEmpty())+ move(geom.topLeft());++ // FxSettings has no optional settings (SaveLoadQSettings) to load+}+//=============================================================================// FxSettingsFactory//-----------------------------------------------------------------------------diff --git a/toonz/sources/toonz/tpanels.h b/toonz/sources/toonz/tpanels.hindex 904902b20..60e59cd4f 100644--- a/toonz/sources/toonz/tpanels.h+++ b/toonz/sources/toonz/tpanels.h@@ -280,6 +280,9 @@ class FxSettingsPanel final : public TPanel {public:FxSettingsPanel(QWidget *parent);+ // FxSettings will adjust its size according to the current fx+ // so we only restore position of the panel.+ void restoreFloatingPanelState() override;};#endif