From eaf9448af11e82a567a82aafba95f65e984d9942 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 10 May 2015 17:57:44 +0300 Subject: Improve setup window resize speed. --- src/gui/windows/setupwindow.cpp | 14 +++++++------- src/gui/windows/setupwindow.h | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gui/windows/setupwindow.cpp b/src/gui/windows/setupwindow.cpp index 95b4c50cd..be76b478f 100644 --- a/src/gui/windows/setupwindow.cpp +++ b/src/gui/windows/setupwindow.cpp @@ -68,7 +68,8 @@ SetupWindow::SetupWindow() : mQuickTab(nullptr), mResetWindows(nullptr), mPanel(new TabbedArea(this)), - mVersion(new Label(this, FULL_VERSION)) + mVersion(new Label(this, FULL_VERSION)), + mButtonPadding(5) { mPanel->postInit(); setCloseButton(true); @@ -101,13 +102,13 @@ void SetupWindow::postInit() nullptr }; int x = width; - const int buttonPadding = getOption("buttonPadding", 5); + mButtonPadding = getOption("buttonPadding", 5); for (const char ** curBtn = buttonNames; *curBtn; ++ curBtn) { Button *const btn = new Button(this, gettext(*curBtn), *curBtn, this); mButtons.push_back(btn); - x -= btn->getWidth() + buttonPadding; - btn->setPosition(x, height - btn->getHeight() - buttonPadding); + x -= btn->getWidth() + mButtonPadding; + btn->setPosition(x, height - btn->getHeight() - mButtonPadding); add(btn); // Store this button, as it needs to be enabled/disabled @@ -303,13 +304,12 @@ void SetupWindow::widgetResized(const Event &event) int x = area.width; const int height = area.height; const int width = area.width; - const int buttonPadding = getOption("buttonPadding", 5); mPanel->setDimension(Rect(5, 5, width - 10, height - 40)); FOR_EACH (std::vector::iterator, it, mButtons) { Button *const btn = *it; - x -= btn->getWidth() + buttonPadding; - btn->setPosition(x, height - btn->getHeight() - buttonPadding); + x -= btn->getWidth() + mButtonPadding; + btn->setPosition(x, height - btn->getHeight() - mButtonPadding); } if (mResetWindows) { diff --git a/src/gui/windows/setupwindow.h b/src/gui/windows/setupwindow.h index adf0cca43..a21341cec 100644 --- a/src/gui/windows/setupwindow.h +++ b/src/gui/windows/setupwindow.h @@ -88,6 +88,7 @@ class SetupWindow final : public Window, Button *mResetWindows; TabbedArea *mPanel; Label *mVersion; + int mButtonPadding; }; extern SetupWindow* setupWindow; -- cgit v1.2.3-60-g2f50