[Scummvm-git-logs] scummvm master -> b444f53685b777998287b6d801268780b6eb32ec
ccawley2011
ccawley2011 at gmail.com
Tue Oct 12 22:27:10 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b444f53685 GUI: Specify the spacing for checkboxes and radio buttons in the theme files
Commit: b444f53685b777998287b6d801268780b6eb32ec
https://github.com/scummvm/scummvm/commit/b444f53685b777998287b6d801268780b6eb32ec
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-10-12T23:27:07+01:00
Commit Message:
GUI: Specify the spacing for checkboxes and radio buttons in the theme files
Changed paths:
gui/ThemeEngine.cpp
gui/ThemeEngine.h
gui/themes/default.inc
gui/themes/residualvm/remastered_layout.stx
gui/themes/residualvm/remastered_layout_lowres.stx
gui/themes/scummclassic/classic_layout.stx
gui/themes/scummclassic/classic_layout_lowres.stx
gui/themes/scummmodern/scummmodern_layout.stx
gui/themes/scummmodern/scummmodern_layout_lowres.stx
gui/themes/scummremastered/remastered_layout.stx
gui/themes/scummremastered/remastered_layout_lowres.stx
gui/widget.cpp
gui/widget.h
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index f43bf458bd..9dbc256bb8 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1053,7 +1053,7 @@ void ThemeEngine::drawLineSeparator(const Common::Rect &r) {
drawDD(kDDSeparator, r);
}
-void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::U32String &str, bool checked, WidgetStateInfo state, bool rtl) {
+void ThemeEngine::drawCheckbox(const Common::Rect &r, int spacing, const Common::U32String &str, bool checked, WidgetStateInfo state, bool rtl) {
if (!ready())
return;
@@ -1075,10 +1075,10 @@ void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::U32String &s
drawDD(dd, r2);
if (rtl) {
- r2.right = r2.left - checkBoxSize;
+ r2.right -= checkBoxSize + spacing;
r2.left = r.left;
} else {
- r2.left = r2.right + checkBoxSize;
+ r2.left += checkBoxSize + spacing;
r2.right = r.right;
}
@@ -1088,7 +1088,7 @@ void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::U32String &s
}
}
-void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::U32String &str, bool checked, WidgetStateInfo state, bool rtl) {
+void ThemeEngine::drawRadiobutton(const Common::Rect &r, int spacing, const Common::U32String &str, bool checked, WidgetStateInfo state, bool rtl) {
if (!ready())
return;
@@ -1110,10 +1110,10 @@ void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::U32String
drawDD(dd, r2);
if (rtl) {
- r2.right = r2.left - checkBoxSize;
+ r2.right -= checkBoxSize + spacing;
r2.left = r.left;
} else {
- r2.left = r2.right + checkBoxSize;
+ r2.left += checkBoxSize + spacing;
r2.right = MAX(r2.left, r.right);
}
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 509f62590d..cd91f393ca 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -458,10 +458,10 @@ public:
void drawSlider(const Common::Rect &r, int width, WidgetStateInfo state = kStateEnabled, bool rtl = false);
- void drawCheckbox(const Common::Rect &r, const Common::U32String &str, bool checked,
+ void drawCheckbox(const Common::Rect &r, int spacing, const Common::U32String &str, bool checked,
WidgetStateInfo state = kStateEnabled, bool rtl = false);
- void drawRadiobutton(const Common::Rect &r, const Common::U32String &str, bool checked,
+ void drawRadiobutton(const Common::Rect &r, int spacing, const Common::U32String &str, bool checked,
WidgetStateInfo state = kStateEnabled, bool rtl = false);
void drawTab(const Common::Rect &r, int tabHeight, const Common::Array<int> &tabWidths,
diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index cd20e89a0e..cf29265d9b 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -1437,6 +1437,8 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"<def var='Predictive.Button.Width' value='60' scalable='yes'/>"
"<def var='Predictive.ShowDeletePic' value='0'/>"
"<def var='DropdownButton.Width' value='17' scalable='yes'/>"
+"<def var='Checkbox.Spacing' value='15' scalable='yes'/>"
+"<def var='Radiobutton.Spacing' value='15' scalable='yes'/>"
"<widget name='OptionsLabel' "
"size='120,Globals.Line.Height' "
"textalign='end' "
@@ -3295,6 +3297,8 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"<def var='Predictive.Button.Height' value='15' scalable='yes'/>"
"<def var='Predictive.ShowDeletePic' value='0' scalable='yes'/>"
"<def var='DropdownButton.Width' value='7' scalable='yes'/>"
+"<def var='Checkbox.Spacing' value='5' scalable='yes'/>"
+"<def var='Radiobutton.Spacing' value='5' scalable='yes'/>"
"<widget name='OptionsLabel' "
"size='120,Globals.Line.Height' "
"textalign='end' "
diff --git a/gui/themes/residualvm/remastered_layout.stx b/gui/themes/residualvm/remastered_layout.stx
index baedc99e6e..9de0a8c9d5 100644
--- a/gui/themes/residualvm/remastered_layout.stx
+++ b/gui/themes/residualvm/remastered_layout.stx
@@ -66,6 +66,9 @@
<def var = 'DropdownButton.Width' value = '13' scalable = 'yes'/>
+ <def var = 'Checkbox.Spacing' value = '15' scalable = 'yes'/>
+ <def var = 'Radiobutton.Spacing' value = '15' scalable = 'yes'/>
+
<widget name = 'OptionsLabel'
size = '115, Globals.Line.Height'
textalign = 'end'
diff --git a/gui/themes/residualvm/remastered_layout_lowres.stx b/gui/themes/residualvm/remastered_layout_lowres.stx
index cdd1300d46..ee82801273 100644
--- a/gui/themes/residualvm/remastered_layout_lowres.stx
+++ b/gui/themes/residualvm/remastered_layout_lowres.stx
@@ -59,6 +59,9 @@
<def var = 'DropdownButton.Width' value = '7' scalable = 'yes'/>
+ <def var = 'Checkbox.Spacing' value = '5' scalable = 'yes'/>
+ <def var = 'Radiobutton.Spacing' value = '5' scalable = 'yes'/>
+
<widget name = 'OptionsLabel'
size = '100, Globals.Line.Height'
textalign = 'end'
diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx
index 9b78662974..751e246f42 100644
--- a/gui/themes/scummclassic/classic_layout.stx
+++ b/gui/themes/scummclassic/classic_layout.stx
@@ -56,6 +56,9 @@
<def var = 'DropdownButton.Width' value = '17' scalable = 'yes'/>
+ <def var = 'Checkbox.Spacing' value = '15' scalable = 'yes'/>
+ <def var = 'Radiobutton.Spacing' value = '15' scalable = 'yes'/>
+
<widget name = 'OptionsLabel'
size = '120, Globals.Line.Height'
textalign = 'end'
diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx
index 6c242a7d0d..7577920cd9 100644
--- a/gui/themes/scummclassic/classic_layout_lowres.stx
+++ b/gui/themes/scummclassic/classic_layout_lowres.stx
@@ -57,6 +57,9 @@
<def var = 'DropdownButton.Width' value = '7' scalable = 'yes'/>
+ <def var = 'Checkbox.Spacing' value = '5' scalable = 'yes'/>
+ <def var = 'Radiobutton.Spacing' value = '5' scalable = 'yes'/>
+
<widget name = 'OptionsLabel'
size = '120, Globals.Line.Height'
textalign = 'end'
diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx
index 94ee322bd7..5183c6d335 100644
--- a/gui/themes/scummmodern/scummmodern_layout.stx
+++ b/gui/themes/scummmodern/scummmodern_layout.stx
@@ -64,6 +64,9 @@
<def var = 'DropdownButton.Width' value = '13' scalable = 'yes'/>
+ <def var = 'Checkbox.Spacing' value = '15' scalable = 'yes'/>
+ <def var = 'Radiobutton.Spacing' value = '15' scalable = 'yes'/>
+
<widget name = 'OptionsLabel'
size = '115, Globals.Line.Height'
textalign = 'end'
diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
index ef78612fe8..671e3ae1ba 100644
--- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx
+++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
@@ -57,6 +57,9 @@
<def var = 'DropdownButton.Width' value = '7' scalable = 'yes'/>
+ <def var = 'Checkbox.Spacing' value = '5' scalable = 'yes'/>
+ <def var = 'Radiobutton.Spacing' value = '5' scalable = 'yes'/>
+
<widget name = 'OptionsLabel'
size = '100, Globals.Line.Height'
textalign = 'end'
diff --git a/gui/themes/scummremastered/remastered_layout.stx b/gui/themes/scummremastered/remastered_layout.stx
index baedc99e6e..9de0a8c9d5 100644
--- a/gui/themes/scummremastered/remastered_layout.stx
+++ b/gui/themes/scummremastered/remastered_layout.stx
@@ -66,6 +66,9 @@
<def var = 'DropdownButton.Width' value = '13' scalable = 'yes'/>
+ <def var = 'Checkbox.Spacing' value = '15' scalable = 'yes'/>
+ <def var = 'Radiobutton.Spacing' value = '15' scalable = 'yes'/>
+
<widget name = 'OptionsLabel'
size = '115, Globals.Line.Height'
textalign = 'end'
diff --git a/gui/themes/scummremastered/remastered_layout_lowres.stx b/gui/themes/scummremastered/remastered_layout_lowres.stx
index cdd1300d46..ee82801273 100644
--- a/gui/themes/scummremastered/remastered_layout_lowres.stx
+++ b/gui/themes/scummremastered/remastered_layout_lowres.stx
@@ -59,6 +59,9 @@
<def var = 'DropdownButton.Width' value = '7' scalable = 'yes'/>
+ <def var = 'Checkbox.Spacing' value = '5' scalable = 'yes'/>
+ <def var = 'Radiobutton.Spacing' value = '5' scalable = 'yes'/>
+
<widget name = 'OptionsLabel'
size = '100, Globals.Line.Height'
textalign = 'end'
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 1b09f13d14..36745b4aee 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -675,12 +675,14 @@ CheckboxWidget::CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, cons
: ButtonWidget(boss, x, y, w, h, label, tooltip, cmd, hotkey), _state(false) {
setFlags(WIDGET_ENABLED);
_type = kCheckboxWidget;
+ _spacing = g_gui.xmlEval()->getVar("Globals.Checkbox.Spacing", 15);
}
CheckboxWidget::CheckboxWidget(GuiObject *boss, const Common::String &name, const Common::U32String &label, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)
: ButtonWidget(boss, name, label, tooltip, cmd, hotkey), _state(false) {
setFlags(WIDGET_ENABLED);
_type = kCheckboxWidget;
+ _spacing = g_gui.xmlEval()->getVar("Globals.Checkbox.Spacing", 15);
}
void CheckboxWidget::handleMouseUp(int x, int y, int button, int clickCount) {
@@ -700,7 +702,7 @@ void CheckboxWidget::setState(bool state) {
}
void CheckboxWidget::drawWidget() {
- g_gui.theme()->drawCheckbox(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state, Widget::_state, (g_gui.useRTL() && _useRTL));
+ g_gui.theme()->drawCheckbox(Common::Rect(_x, _y, _x + _w, _y + _h), _spacing, _label, _state, Widget::_state, (g_gui.useRTL() && _useRTL));
}
#pragma mark -
@@ -738,6 +740,7 @@ RadiobuttonWidget::RadiobuttonWidget(GuiObject *boss, int x, int y, int w, int h
setFlags(WIDGET_ENABLED);
_type = kRadiobuttonWidget;
_group->addButton(this);
+ _spacing = g_gui.xmlEval()->getVar("Globals.Radiobutton.Spacing", 15);
}
RadiobuttonWidget::RadiobuttonWidget(GuiObject *boss, const Common::String &name, RadiobuttonGroup *group, int value, const Common::U32String &label, const Common::U32String &tooltip, uint8 hotkey)
@@ -745,6 +748,7 @@ RadiobuttonWidget::RadiobuttonWidget(GuiObject *boss, const Common::String &name
setFlags(WIDGET_ENABLED);
_type = kRadiobuttonWidget;
_group->addButton(this);
+ _spacing = g_gui.xmlEval()->getVar("Globals.Radiobutton.Spacing", 15);
}
void RadiobuttonWidget::handleMouseUp(int x, int y, int button, int clickCount) {
@@ -769,7 +773,7 @@ void RadiobuttonWidget::setState(bool state, bool setGroup) {
}
void RadiobuttonWidget::drawWidget() {
- g_gui.theme()->drawRadiobutton(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state, Widget::_state, (g_gui.useRTL() && _useRTL));
+ g_gui.theme()->drawRadiobutton(Common::Rect(_x, _y, _x + _w, _y + _h), _spacing, _label, _state, Widget::_state, (g_gui.useRTL() && _useRTL));
}
#pragma mark -
diff --git a/gui/widget.h b/gui/widget.h
index 01c933c634..6f7ffa2613 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -313,6 +313,7 @@ protected:
class CheckboxWidget : public ButtonWidget {
protected:
bool _state;
+ int _spacing;
public:
CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0);
CheckboxWidget(GuiObject *boss, const Common::String &name, const Common::U32String &label, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0, uint8 hotkey = 0);
@@ -357,6 +358,7 @@ protected:
class RadiobuttonWidget : public ButtonWidget {
protected:
bool _state;
+ int _spacing;
int _value;
public:
More information about the Scummvm-git-logs
mailing list