From 4f9d554a5f49bf52756b2e1ea75925cfac969f51 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Sat, 11 Jan 2020 13:02:51 +0100 Subject: [PATCH] aligned SliderWidget parameter default to other defaults --- src/gui/GameInfoDialog.cxx | 3 +-- src/gui/VideoDialog.cxx | 6 ++---- src/gui/Widget.cxx | 2 ++ src/gui/Widget.hxx | 10 +++++----- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx index 0beb000ad..d507174b6 100644 --- a/src/gui/GameInfoDialog.cxx +++ b/src/gui/GameInfoDialog.cxx @@ -137,8 +137,7 @@ GameInfoDialog::GameInfoDialog( ypos += lineHeight + VGAP; t = new StaticTextWidget(myTab, font, HBORDER, ypos + 1, "V-Center "); myVCenter = new SliderWidget(myTab, font, t->getRight() + 2, ypos, "", - 0, kVCenterChanged, 7 * fontWidth, "px", - SliderWidget::DEF_LBL_GAP, true); + 0, kVCenterChanged, 7 * fontWidth, "px", 0, true); myVCenter->setMinValue(TIAConstants::minVcenter); myVCenter->setMaxValue(TIAConstants::maxVcenter); diff --git a/src/gui/VideoDialog.cxx b/src/gui/VideoDialog.cxx index 4f4a4ec2c..8df937e2d 100644 --- a/src/gui/VideoDialog.cxx +++ b/src/gui/VideoDialog.cxx @@ -138,8 +138,7 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent, // Aspect ratio (NTSC mode) myAdjustScanlinesNTSC = new SliderWidget(myTab, font, xpos, ypos-1, swidth, lineHeight, - "NTSC scanlines adjust ", lwidth, 0, - fontWidth * 4, "", SliderWidget::DEF_LBL_GAP, true); + "NTSC scanlines adjust ", lwidth, 0, fontWidth * 4, "", 0, true); myAdjustScanlinesNTSC->setMinValue(-25); myAdjustScanlinesNTSC->setMaxValue(25); myAdjustScanlinesNTSC->setTickmarkIntervals(2); wid.push_back(myAdjustScanlinesNTSC); @@ -148,8 +147,7 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent, // Aspect ratio (PAL mode) myAdjustScanlinesPAL = new SliderWidget(myTab, font, xpos, ypos-1, swidth, lineHeight, - "PAL scanlines adjust ", lwidth, 0, - fontWidth * 4, "", SliderWidget::DEF_LBL_GAP, true); + "PAL scanlines adjust ", lwidth, 0, fontWidth * 4, "", 0, true); myAdjustScanlinesPAL->setMinValue(-25); myAdjustScanlinesPAL->setMaxValue(25); myAdjustScanlinesPAL->setTickmarkIntervals(2); wid.push_back(myAdjustScanlinesPAL); diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx index 2a5658d69..895f68158 100644 --- a/src/gui/Widget.cxx +++ b/src/gui/Widget.cxx @@ -639,6 +639,8 @@ SliderWidget::SliderWidget(GuiObject* boss, const GUI::Font& font, if(_valueLabelWidth == 0) _valueLabelGap = 0; + if(_valueLabelGap == 0) + _valueLabelGap = DEF_LBL_GAP; _w = w + _labelWidth + _valueLabelGap + _valueLabelWidth; } diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx index c57da2a78..aa45a5420 100644 --- a/src/gui/Widget.hxx +++ b/src/gui/Widget.hxx @@ -314,19 +314,16 @@ class CheckboxWidget : public ButtonWidget class SliderWidget : public ButtonWidget { public: - static const int DEF_LBL_GAP = 4; - - SliderWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h, const string& label = "", int labelWidth = 0, int cmd = 0, int valueLabelWidth = 0, const string& valueUnit = "", - int valueLabelGap = DEF_LBL_GAP, bool forceLabelSign = false); + int valueLabelGap = 0, bool forceLabelSign = false); SliderWidget(GuiObject* boss, const GUI::Font& font, int x, int y, const string& label = "", int labelWidth = 0, int cmd = 0, int valueLabelWidth = 0, const string& valueUnit = "", - int valueLabelGap = DEF_LBL_GAP, bool forceLabelSign = false); + int valueLabelGap = 0, bool forceLabelSign = false); virtual ~SliderWidget() = default; void setValue(int value); @@ -345,6 +342,9 @@ class SliderWidget : public ButtonWidget void setTickmarkIntervals(int numIntervals); + protected: + const int DEF_LBL_GAP = 4; + protected: void handleMouseMoved(int x, int y) override; void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;