[Scummvm-git-logs] scummvm master -> b9722eb04fb2675ce62a79e2e0dd75725348fdf0
sev-
noreply at scummvm.org
Mon Apr 6 16:13:44 UTC 2026
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
7de147ae22 JANITORIAL: Fix indentation
e04e7faf28 GLK: Fix crash when custom color option is selected
43db60276a GUI: Bump theme version
a6184d7877 GUI: Regenerate themes
b9722eb04f GLK: Made font names translatable
Commit: 7de147ae2204ea24b56a0985532ddde3466e648a
https://github.com/scummvm/scummvm/commit/7de147ae2204ea24b56a0985532ddde3466e648a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-04-06T18:13:10+02:00
Commit Message:
JANITORIAL: Fix indentation
Changed paths:
engines/glk/dialogs.cpp
diff --git a/engines/glk/dialogs.cpp b/engines/glk/dialogs.cpp
index 23efdaade39..317e20a968f 100644
--- a/engines/glk/dialogs.cpp
+++ b/engines/glk/dialogs.cpp
@@ -43,1308 +43,1308 @@
#include "common/translation.h"
#define NEW_LABEL(name, text, tooltip) \
- do { \
- auto label = new GUI::StaticTextWidget(widgetsBoss(), name, _(text), _(tooltip)); \
- label->setAlign(Graphics::kTextAlignRight); \
- } while (0)
+ do { \
+ auto label = new GUI::StaticTextWidget(widgetsBoss(), name, _(text), _(tooltip)); \
+ label->setAlign(Graphics::kTextAlignRight); \
+ } while (0)
#define NEW_EDIT(widget, name, tooltip) \
- widget = new GUI::EditTextWidget(widgetsBoss(), name, Common::U32String(), _(tooltip))
+ widget = new GUI::EditTextWidget(widgetsBoss(), name, Common::U32String(), _(tooltip))
#define NEW_CHECKBOX(widget, name, tooltip) \
- widget = new GUI::CheckboxWidget(widgetsBoss(), name, Common::U32String(), _(tooltip))
+ widget = new GUI::CheckboxWidget(widgetsBoss(), name, Common::U32String(), _(tooltip))
#define NEW_POPUP(widget, name, tooltip) \
- widget = new GUI::PopUpWidget(widgetsBoss(), name, _(tooltip))
+ widget = new GUI::PopUpWidget(widgetsBoss(), name, _(tooltip))
#define NEW_SLIDER(widget, name, tooltip) \
- widget = new GUI::SliderWidget(widgetsBoss(), name, _(tooltip))
+ widget = new GUI::SliderWidget(widgetsBoss(), name, _(tooltip))
#define NEW_EDIT_CMD(widget, name, tooltip, cmd) \
- widget = new GUI::EditTextWidget(widgetsBoss(), name, Common::U32String(), _(tooltip), cmd, cmd)
+ widget = new GUI::EditTextWidget(widgetsBoss(), name, Common::U32String(), _(tooltip), cmd, cmd)
#define NEW_POPUP_CMD(widget, name, tooltip, cmd) \
- widget = new GUI::PopUpWidget(widgetsBoss(), name, _(tooltip), cmd)
+ widget = new GUI::PopUpWidget(widgetsBoss(), name, _(tooltip), cmd)
#define NEW_SLIDER_CMD(widget, name, tooltip, cmd) \
- widget = new GUI::SliderWidget(widgetsBoss(), name, _(tooltip), cmd)
+ widget = new GUI::SliderWidget(widgetsBoss(), name, _(tooltip), cmd)
#define INIT_NUM(widget, configMember) \
- if (g_conf && widget) \
- widget->setEditString(Common::U32String(Common::String::format("%d", g_conf->configMember)))
+ if (g_conf && widget) \
+ widget->setEditString(Common::U32String(Common::String::format("%d", g_conf->configMember)))
#define INIT_INT(widget, configMember) \
- if (g_conf && widget) \
- widget->setEditString(Common::U32String(Common::String::format("%d", configMember)))
+ if (g_conf && widget) \
+ widget->setEditString(Common::U32String(Common::String::format("%d", configMember)))
#define INIT_STRING(widget, configExpression) \
- if (g_conf && widget) \
- widget->setEditString(Common::U32String(configExpression))
+ if (g_conf && widget) \
+ widget->setEditString(Common::U32String(configExpression))
#define INIT_BOOL(widget, configMember) \
- if (g_conf && widget) \
- widget->setState(configMember)
+ if (g_conf && widget) \
+ widget->setState(configMember)
#define INIT_POPUP(widget, configValue) \
- if (g_conf && widget) \
- widget->setSelectedTag(configValue)
+ if (g_conf && widget) \
+ widget->setSelectedTag(configValue)
#define INIT_SLIDER_FLOAT(widget, configMember, minV, maxV) \
- if (g_conf && widget) { \
- widget->setMinValue(minV); \
- widget->setMaxValue(maxV); \
- widget->setValue((int)(configMember)); \
- }
+ if (g_conf && widget) { \
+ widget->setMinValue(minV); \
+ widget->setMaxValue(maxV); \
+ widget->setValue((int)(configMember)); \
+ }
#define NEW_LABEL_EDIT(lbl_name, text, edit_widget, edit_name, tooltip) \
- do { \
- NEW_LABEL(lbl_name, text, tooltip); \
- NEW_EDIT(edit_widget, edit_name, tooltip); \
- } while (0)
+ do { \
+ NEW_LABEL(lbl_name, text, tooltip); \
+ NEW_EDIT(edit_widget, edit_name, tooltip); \
+ } while (0)
#define NEW_LABEL_CHECKBOX(lbl_name, text, chk_widget, chk_name, tooltip) \
- do { \
- NEW_LABEL(lbl_name, text, tooltip); \
- NEW_CHECKBOX(chk_widget, chk_name, tooltip); \
- } while (0)
+ do { \
+ NEW_LABEL(lbl_name, text, tooltip); \
+ NEW_CHECKBOX(chk_widget, chk_name, tooltip); \
+ } while (0)
#define NEW_LABEL_POPUP(lbl_name, text, pop_widget, pop_name, tooltip) \
- do { \
- NEW_LABEL(lbl_name, text, tooltip); \
- NEW_POPUP(pop_widget, pop_name, tooltip); \
- } while (0)
+ do { \
+ NEW_LABEL(lbl_name, text, tooltip); \
+ NEW_POPUP(pop_widget, pop_name, tooltip); \
+ } while (0)
#define NEW_LABEL_SLIDER_CMD(lbl_name, text, sld_widget, sld_name, val_widget, val_name, tooltip, cmd) \
- do { \
- NEW_LABEL(lbl_name, text, tooltip); \
- NEW_SLIDER_CMD(sld_widget, sld_name, tooltip, cmd); \
- val_widget = new GUI::StaticTextWidget(widgetsBoss(), val_name, Common::U32String("10"), _(tooltip)); \
- val_widget->setFlags(GUI::WIDGET_CLEARBG); \
- } while (0)
+ do { \
+ NEW_LABEL(lbl_name, text, tooltip); \
+ NEW_SLIDER_CMD(sld_widget, sld_name, tooltip, cmd); \
+ val_widget = new GUI::StaticTextWidget(widgetsBoss(), val_name, Common::U32String("10"), _(tooltip)); \
+ val_widget->setFlags(GUI::WIDGET_CLEARBG); \
+ } while (0)
#define COLOR_EDIT(prefix, varhex, var, labelText, tooltip, hexcmd, colorcmd) \
- do { \
- NEW_LABEL(prefix "HexPrefix", "0x", tooltip); \
- NEW_EDIT_CMD(varhex, prefix "Hex", tooltip, hexcmd); \
- NEW_POPUP_CMD(var, prefix "Color0", tooltip, colorcmd); \
- NEW_LABEL(prefix "Color", labelText, tooltip); \
- } while (0)
+ do { \
+ NEW_LABEL(prefix "HexPrefix", "0x", tooltip); \
+ NEW_EDIT_CMD(varhex, prefix "Hex", tooltip, hexcmd); \
+ NEW_POPUP_CMD(var, prefix "Color0", tooltip, colorcmd); \
+ NEW_LABEL(prefix "Color", labelText, tooltip); \
+ } while (0)
namespace Glk {
struct GlkColor {
- const char *name;
- unsigned int rgb;
+ const char *name;
+ unsigned int rgb;
};
static const GlkColor GLK_COLORS[] = {
- { "white", 0xFFFFFF },
- { "green", 0x00FF00 },
- { "red", 0xFF0000 },
- { "blue", 0x0000FF },
- { "black", 0x000000 },
- { "grey", 0x808080 }
+ { "white", 0xFFFFFF },
+ { "green", 0x00FF00 },
+ { "red", 0xFF0000 },
+ { "blue", 0x0000FF },
+ { "black", 0x000000 },
+ { "grey", 0x808080 }
};
struct BoolOption {
- GUI::CheckboxWidget *widget;
- int *targetInt;
- bool *targetBool;
- const char *confKey;
+ GUI::CheckboxWidget *widget;
+ int *targetInt;
+ bool *targetBool;
+ const char *confKey;
};
struct IntOption {
- GUI::EditTextWidget *widget;
- int *target;
- const char *confKey;
- int minValue;
+ GUI::EditTextWidget *widget;
+ int *target;
+ const char *confKey;
+ int minValue;
};
struct FloatOption {
- GUI::EditTextWidget *widget;
- double *target;
- const char *confKey;
- double minValue;
+ GUI::EditTextWidget *widget;
+ double *target;
+ const char *confKey;
+ double minValue;
};
struct ColorOption {
- GUI::PopUpWidget *popup;
- GUI::EditTextWidget *hexInput;
- WindowStyle *styles; // for t/g/w/b
- PropFontInfo *propInfo; // for caret/link/more
- const char *confKey;
- bool isProp; // true for caret/link/more
+ GUI::PopUpWidget *popup;
+ GUI::EditTextWidget *hexInput;
+ WindowStyle *styles; // for t/g/w/b
+ PropFontInfo *propInfo; // for caret/link/more
+ const char *confKey;
+ bool isProp; // true for caret/link/more
};
struct FontOption {
- GUI::PopUpWidget *popup;
- WindowStyle *styles;
- const char *confKeyPrefix;
+ GUI::PopUpWidget *popup;
+ WindowStyle *styles;
+ const char *confKeyPrefix;
};
static GUI::StaticTextWidget *createHeading(GUI::GuiObject *boss, const char *id, const char *text) {
- auto h = new GUI::StaticTextWidget(boss, id, _(text));
- h->setAlign(Graphics::kTextAlignCenter);
- return h;
+ auto h = new GUI::StaticTextWidget(boss, id, _(text));
+ h->setAlign(Graphics::kTextAlignCenter);
+ return h;
}
GlkOptionsWidget::GlkOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain)
- : GUI::OptionsContainerWidget(boss, name, "GlkOptionsDialog", domain) {
+ : GUI::OptionsContainerWidget(boss, name, "GlkOptionsDialog", domain) {
- static const char *fontLabels[] = { "Monospace Regular", "Monospace Bold", "Monospace Italic", "Monospace Bold Italic", "Proportional Regular", "Proportional Bold", "Proportional Italic", "Proportional Bold Italic" };
+ static const char *fontLabels[] = { "Monospace Regular", "Monospace Bold", "Monospace Italic", "Monospace Bold Italic", "Proportional Regular", "Proportional Bold", "Proportional Italic", "Proportional Bold Italic" };
- for (int f = MONOR; f <= PROPZ; ++f) {
- _tfontPopUps[f] = nullptr;
- _gfontPopUps[f] = nullptr;
- }
+ for (int f = MONOR; f <= PROPZ; ++f) {
+ _tfontPopUps[f] = nullptr;
+ _gfontPopUps[f] = nullptr;
+ }
- _fontHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.FontHeading", "Font");
+ _fontHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.FontHeading", "Font");
- NEW_LABEL_POPUP("GlkOptionsDialog.TFont", _s("Text:"), _tfontPopUps[0], "GlkOptionsDialog.TFont0", _s("Font for the text"));
- for (int f = MONOR; f <= PROPZ; ++f)
- _tfontPopUps[0]->appendEntry(fontLabels[f], f);
+ NEW_LABEL_POPUP("GlkOptionsDialog.TFont", _s("Text:"), _tfontPopUps[0], "GlkOptionsDialog.TFont0", _s("Font for the text"));
+ for (int f = MONOR; f <= PROPZ; ++f)
+ _tfontPopUps[0]->appendEntry(fontLabels[f], f);
- NEW_LABEL_POPUP("GlkOptionsDialog.GFont", _s("Grid:"), _gfontPopUps[0], "GlkOptionsDialog.GFont0", _s("Font for drawn graphics like maps, diagrams, puzzles, etc"));
- for (int f = MONOR; f <= PROPZ; ++f)
- _gfontPopUps[0]->appendEntry(fontLabels[f], f);
+ NEW_LABEL_POPUP("GlkOptionsDialog.GFont", _s("Grid:"), _gfontPopUps[0], "GlkOptionsDialog.GFont0", _s("Font for drawn graphics like maps, diagrams, puzzles, etc"));
+ for (int f = MONOR; f <= PROPZ; ++f)
+ _gfontPopUps[0]->appendEntry(fontLabels[f], f);
- _colorHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.ColorHeading", "Color");
+ _colorHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.ColorHeading", "Color");
- COLOR_EDIT("GlkOptionsDialog.T", _manualTColorHexInput, _tcolorPopUps[0], _s("Text:"), _s("Color of the interactive text"), kTHexChangedCmd, kTColorChangedCmd);
- for (int c = 0; c <= 5; ++c)
- _tcolorPopUps[0]->appendEntry(_(GLK_COLORS[c].name), c);
- _tcolorPopUps[0]->appendEntry("custom", 6);
+ COLOR_EDIT("GlkOptionsDialog.T", _manualTColorHexInput, _tcolorPopUps[0], _s("Text:"), _s("Color of the interactive text"), kTHexChangedCmd, kTColorChangedCmd);
+ for (int c = 0; c <= 5; ++c)
+ _tcolorPopUps[0]->appendEntry(_(GLK_COLORS[c].name), c);
+ _tcolorPopUps[0]->appendEntry("custom", 6);
- COLOR_EDIT("GlkOptionsDialog.G", _manualGColorHexInput, _gcolorPopUps[0], _s("Grid:"), _s("Color for drawn graphics such as maps, diagrams, puzzles, etc"), kGHexChangedCmd, kGColorChangedCmd);
- for (int c = 0; c <= 5; ++c)
- _gcolorPopUps[0]->appendEntry(_(GLK_COLORS[c].name), c);
- _gcolorPopUps[0]->appendEntry("custom", 6);
+ COLOR_EDIT("GlkOptionsDialog.G", _manualGColorHexInput, _gcolorPopUps[0], _s("Grid:"), _s("Color for drawn graphics such as maps, diagrams, puzzles, etc"), kGHexChangedCmd, kGColorChangedCmd);
+ for (int c = 0; c <= 5; ++c)
+ _gcolorPopUps[0]->appendEntry(_(GLK_COLORS[c].name), c);
+ _gcolorPopUps[0]->appendEntry("custom", 6);
- COLOR_EDIT("GlkOptionsDialog.W", _manualWColorHexInput, _wcolorPopUps[0], _s("Window:"), _s("Color of the window(background)"), kWHexChangedCmd, kWColorChangedCmd);
- _wcolorPopUps[0]->appendEntry("<default>", 7);
- for (int c = 0; c <= 5; ++c)
- _wcolorPopUps[0]->appendEntry(_(GLK_COLORS[c].name), c);
- _wcolorPopUps[0]->appendEntry("custom", 6);
+ COLOR_EDIT("GlkOptionsDialog.W", _manualWColorHexInput, _wcolorPopUps[0], _s("Window:"), _s("Color of the window(background)"), kWHexChangedCmd, kWColorChangedCmd);
+ _wcolorPopUps[0]->appendEntry("<default>", 7);
+ for (int c = 0; c <= 5; ++c)
+ _wcolorPopUps[0]->appendEntry(_(GLK_COLORS[c].name), c);
+ _wcolorPopUps[0]->appendEntry("custom", 6);
- COLOR_EDIT("GlkOptionsDialog.B", _manualBColorHexInput, _bcolorPopUps[0], _s("Border:"), _s("Color of the window border"), kBHexChangedCmd, kBColorChangedCmd);
- _bcolorPopUps[0]->appendEntry("<default>", 7);
- for (int c = 0; c <= 5; ++c)
- _bcolorPopUps[0]->appendEntry(_(GLK_COLORS[c].name), c);
- _bcolorPopUps[0]->appendEntry("custom", 6);
+ COLOR_EDIT("GlkOptionsDialog.B", _manualBColorHexInput, _bcolorPopUps[0], _s("Border:"), _s("Color of the window border"), kBHexChangedCmd, kBColorChangedCmd);
+ _bcolorPopUps[0]->appendEntry("<default>", 7);
+ for (int c = 0; c <= 5; ++c)
+ _bcolorPopUps[0]->appendEntry(_(GLK_COLORS[c].name), c);
+ _bcolorPopUps[0]->appendEntry("custom", 6);
- _borderHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.wborderlbl", "Border");
+ _borderHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.wborderlbl", "Border");
- NEW_LABEL_EDIT("GlkOptionsDialog.wborderx", _s("Horizontal:"), _wborderx, "GlkOptionsDialog.wborderhorizontal", _s("Horizontal border size"));
- NEW_LABEL_EDIT("GlkOptionsDialog.wbordery", _s("Vertical:"), _wbordery, "GlkOptionsDialog.wbordervertical", _s("Vertical border size"));
+ NEW_LABEL_EDIT("GlkOptionsDialog.wborderx", _s("Horizontal:"), _wborderx, "GlkOptionsDialog.wborderhorizontal", _s("Horizontal border size"));
+ NEW_LABEL_EDIT("GlkOptionsDialog.wbordery", _s("Vertical:"), _wbordery, "GlkOptionsDialog.wbordervertical", _s("Vertical border size"));
- COLOR_EDIT("GlkOptionsDialog.C", _manualCColorHexInput, _ccolorPopUps[0], _s("Caret:"), _s("Color of the cursor"), kCHexChangedCmd, kCColorChangedCmd);
- _ccolorPopUps[0]->appendEntry("<default>", 7);
- for (int c = 0; c <= 5; ++c)
- _ccolorPopUps[0]->appendEntry(_(GLK_COLORS[c].name), c);
- _ccolorPopUps[0]->appendEntry("custom", 6);
+ COLOR_EDIT("GlkOptionsDialog.C", _manualCColorHexInput, _ccolorPopUps[0], _s("Caret:"), _s("Color of the cursor"), kCHexChangedCmd, kCColorChangedCmd);
+ _ccolorPopUps[0]->appendEntry("<default>", 7);
+ for (int c = 0; c <= 5; ++c)
+ _ccolorPopUps[0]->appendEntry(_(GLK_COLORS[c].name), c);
+ _ccolorPopUps[0]->appendEntry("custom", 6);
- COLOR_EDIT("GlkOptionsDialog.L", _manualLColorHexInput, _lcolorPopUps[0], _s("Link:"), _s("Color for URLs if they appear in-game"), kLHexChangedCmd, kLColorChangedCmd);
- _lcolorPopUps[0]->appendEntry("<default>", 7);
- for (int c = 0; c <= 5; ++c)
- _lcolorPopUps[0]->appendEntry(_(GLK_COLORS[c].name), c);
- _lcolorPopUps[0]->appendEntry("custom", 6);
+ COLOR_EDIT("GlkOptionsDialog.L", _manualLColorHexInput, _lcolorPopUps[0], _s("Link:"), _s("Color for URLs if they appear in-game"), kLHexChangedCmd, kLColorChangedCmd);
+ _lcolorPopUps[0]->appendEntry("<default>", 7);
+ for (int c = 0; c <= 5; ++c)
+ _lcolorPopUps[0]->appendEntry(_(GLK_COLORS[c].name), c);
+ _lcolorPopUps[0]->appendEntry("custom", 6);
- COLOR_EDIT("GlkOptionsDialog.M", _manualMColorHexInput, _mcolorPopUps[0], _s("More:"), _s("Color for the \"More...\" markers in the text"), kMHexChangedCmd, kMColorChangedCmd);
- _mcolorPopUps[0]->appendEntry("<default>", 7);
- for (int c = 0; c <= 5; ++c)
- _mcolorPopUps[0]->appendEntry(_(GLK_COLORS[c].name), c);
- _mcolorPopUps[0]->appendEntry("custom", 6);
+ COLOR_EDIT("GlkOptionsDialog.M", _manualMColorHexInput, _mcolorPopUps[0], _s("More:"), _s("Color for the \"More...\" markers in the text"), kMHexChangedCmd, kMColorChangedCmd);
+ _mcolorPopUps[0]->appendEntry("<default>", 7);
+ for (int c = 0; c <= 5; ++c)
+ _mcolorPopUps[0]->appendEntry(_(GLK_COLORS[c].name), c);
+ _mcolorPopUps[0]->appendEntry("custom", 6);
- _typographyHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.topographyheadinglbl", "Typography");
+ _typographyHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.topographyheadinglbl", "Typography");
- NEW_LABEL_POPUP("GlkOptionsDialog.linkstyle", _s("Link style:"), _linkStyle, "GlkOptionsDialog.linkStyle", _s("Style for URLs if they appear in-game"));
- _linkStyle->appendEntry(_("1"), 0);
- _linkStyle->appendEntry(_("2"), 1);
- _linkStyle->appendEntry(_("3"), 2);
+ NEW_LABEL_POPUP("GlkOptionsDialog.linkstyle", _s("Link style:"), _linkStyle, "GlkOptionsDialog.linkStyle", _s("Style for URLs if they appear in-game"));
+ _linkStyle->appendEntry(_("1"), 0);
+ _linkStyle->appendEntry(_("2"), 1);
+ _linkStyle->appendEntry(_("3"), 2);
- NEW_LABEL_POPUP("GlkOptionsDialog.caretshape", _s("Caret shape:"), _caretShape, "GlkOptionsDialog.caretShape", _s("Shape of the cursor"));
- _caretShape->appendEntry(_("0"), 0);
- _caretShape->appendEntry(_("1"), 1);
- _caretShape->appendEntry(_("2"), 2);
- _caretShape->appendEntry(_("3"), 3);
- _caretShape->appendEntry(_("4"), 4);
+ NEW_LABEL_POPUP("GlkOptionsDialog.caretshape", _s("Caret shape:"), _caretShape, "GlkOptionsDialog.caretShape", _s("Shape of the cursor"));
+ _caretShape->appendEntry(_("0"), 0);
+ _caretShape->appendEntry(_("1"), 1);
+ _caretShape->appendEntry(_("2"), 2);
+ _caretShape->appendEntry(_("3"), 3);
+ _caretShape->appendEntry(_("4"), 4);
- NEW_LABEL_EDIT("GlkOptionsDialog.moreprompt", _s("More prompt:"), _morePrompt, "GlkOptionsDialog.morePrompt", _s("Custom marker in place of the \"More...\" marker for eg. \"continue\". Leave it blank to use the game's default"));
+ NEW_LABEL_EDIT("GlkOptionsDialog.moreprompt", _s("More prompt:"), _morePrompt, "GlkOptionsDialog.morePrompt", _s("Custom marker in place of the \"More...\" marker for eg. \"continue\". Leave it blank to use the game's default"));
- NEW_LABEL_CHECKBOX("GlkOptionsDialog.stylehintlabel", _s("Style hints:"), _styleHint, "GlkOptionsDialog.stylehint", _s("Let the game suggest text styling options"));
- NEW_LABEL_CHECKBOX("GlkOptionsDialog.safeclickslabel", _s("Safe clicks:"), _safeClicks, "GlkOptionsDialog.safeclicks", _s("Safely apply clicks while input is pending"));
+ NEW_LABEL_CHECKBOX("GlkOptionsDialog.stylehintlabel", _s("Style hints:"), _styleHint, "GlkOptionsDialog.stylehint", _s("Let the game suggest text styling options"));
+ NEW_LABEL_CHECKBOX("GlkOptionsDialog.safeclickslabel", _s("Safe clicks:"), _safeClicks, "GlkOptionsDialog.safeclicks", _s("Safely apply clicks while input is pending"));
- NEW_LABEL_EDIT("GlkOptionsDialog.colslbl", _s("Column count:"), _cols, "GlkOptionsDialog.cols", _s("Number of columns"));
- NEW_LABEL_EDIT("GlkOptionsDialog.rowslbl", _s("Rows count:"), _rows, "GlkOptionsDialog.rows", _s("Number of rows"));
+ NEW_LABEL_EDIT("GlkOptionsDialog.colslbl", _s("Column count:"), _cols, "GlkOptionsDialog.cols", _s("Number of columns"));
+ NEW_LABEL_EDIT("GlkOptionsDialog.rowslbl", _s("Rows count:"), _rows, "GlkOptionsDialog.rows", _s("Number of rows"));
- NEW_LABEL_CHECKBOX("GlkOptionsDialog.lockcolslbl", _s("Lock columns:"), _lockcols, "GlkOptionsDialog.lockcols", _s("Check it to manually change the column count"));
- NEW_LABEL_CHECKBOX("GlkOptionsDialog.lockrowslbl", _s("Lock rows:"), _lockrows, "GlkOptionsDialog.lockrows", _s("Check it to manually change the row count"));
+ NEW_LABEL_CHECKBOX("GlkOptionsDialog.lockcolslbl", _s("Lock columns:"), _lockcols, "GlkOptionsDialog.lockcols", _s("Check it to manually change the column count"));
+ NEW_LABEL_CHECKBOX("GlkOptionsDialog.lockrowslbl", _s("Lock rows:"), _lockrows, "GlkOptionsDialog.lockrows", _s("Check it to manually change the row count"));
- NEW_LABEL_CHECKBOX("GlkOptionsDialog.justifylbl", _s("Justify:"), _justify, "GlkOptionsDialog.justify", _s("Enable text justification"));
+ NEW_LABEL_CHECKBOX("GlkOptionsDialog.justifylbl", _s("Justify:"), _justify, "GlkOptionsDialog.justify", _s("Enable text justification"));
- NEW_LABEL_POPUP("GlkOptionsDialog.quoteslbl", _s("Typographic quotes:"), _quotes, "GlkOptionsDialog.quotes", _s("Choose typographic quotes"));
- _quotes->appendEntry(_("Off"), 0);
- _quotes->appendEntry(_("Normal"), 1);
- _quotes->appendEntry(_("Rabid"), 2);
+ NEW_LABEL_POPUP("GlkOptionsDialog.quoteslbl", _s("Typographic quotes:"), _quotes, "GlkOptionsDialog.quotes", _s("Choose typographic quotes"));
+ _quotes->appendEntry(_("Off"), 0);
+ _quotes->appendEntry(_("Normal"), 1);
+ _quotes->appendEntry(_("Rabid"), 2);
- NEW_LABEL_CHECKBOX("GlkOptionsDialog.capslbl", _s("Caps:"), _caps, "GlkOptionsDialog.caps", _s("Force uppercase input"));
+ NEW_LABEL_CHECKBOX("GlkOptionsDialog.capslbl", _s("Caps:"), _caps, "GlkOptionsDialog.caps", _s("Force uppercase input"));
- NEW_LABEL_POPUP("GlkOptionsDialog.dasheslbl", _s("Dashes:"), _dashes, "GlkOptionsDialog.dashes", _s("Types of dashes"));
- _dashes->appendEntry(_("Off"), 0);
- _dashes->appendEntry(_("Em dashes"), 1);
- _dashes->appendEntry(_("En+Em dashes"), 2);
+ NEW_LABEL_POPUP("GlkOptionsDialog.dasheslbl", _s("Dashes:"), _dashes, "GlkOptionsDialog.dashes", _s("Types of dashes"));
+ _dashes->appendEntry(_("Off"), 0);
+ _dashes->appendEntry(_("Em dashes"), 1);
+ _dashes->appendEntry(_("En+Em dashes"), 2);
- _userExperiencelbl = createHeading(widgetsBoss(), "GlkOptionsDialog.userexplbl", "User experience");
+ _userExperiencelbl = createHeading(widgetsBoss(), "GlkOptionsDialog.userexplbl", "User experience");
- NEW_LABEL_POPUP("GlkOptionsDialog.spaceslbl", _s("Spaces:"), _spaces, "GlkOptionsDialog.spaces", _s("Types of spaces"));
- _spaces->appendEntry(_("Off"), 0);
- _spaces->appendEntry(_("Compress double spaces"), 1);
- _spaces->appendEntry(_("Expand single spaces"), 2);
+ NEW_LABEL_POPUP("GlkOptionsDialog.spaceslbl", _s("Spaces:"), _spaces, "GlkOptionsDialog.spaces", _s("Types of spaces"));
+ _spaces->appendEntry(_("Off"), 0);
+ _spaces->appendEntry(_("Compress double spaces"), 1);
+ _spaces->appendEntry(_("Expand single spaces"), 2);
- NEW_LABEL_CHECKBOX("GlkOptionsDialog.graphicslbl", _s("Graphics:"), _graphics, "GlkOptionsDialog.graphics", _s("Turn graphics on/off"));
+ NEW_LABEL_CHECKBOX("GlkOptionsDialog.graphicslbl", _s("Graphics:"), _graphics, "GlkOptionsDialog.graphics", _s("Turn graphics on/off"));
- _wmarginHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.WindowMarginHeading", "Window margin");
- NEW_LABEL_EDIT("GlkOptionsDialog.wmarginxlbl", _s("Horizontal:"), _wmarginx, "GlkOptionsDialog.wmarginx", _s("Horizontal margin for window"));
- NEW_LABEL_EDIT("GlkOptionsDialog.wmarginylbl", _s("Vertical:"), _wmarginy, "GlkOptionsDialog.wmarginy", _s("Vertical margin for window"));
+ _wmarginHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.WindowMarginHeading", "Window margin");
+ NEW_LABEL_EDIT("GlkOptionsDialog.wmarginxlbl", _s("Horizontal:"), _wmarginx, "GlkOptionsDialog.wmarginx", _s("Horizontal margin for window"));
+ NEW_LABEL_EDIT("GlkOptionsDialog.wmarginylbl", _s("Vertical:"), _wmarginy, "GlkOptionsDialog.wmarginy", _s("Vertical margin for window"));
- _wpaddingHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.wpaddinglbl", "Window padding");
- NEW_LABEL_EDIT("GlkOptionsDialog.wpaddingxlbl", _s("Horizontal:"), _wpaddingx, "GlkOptionsDialog.wpaddingx", _s("Horizontal padding for window"));
- NEW_LABEL_EDIT("GlkOptionsDialog.wpaddingylbl", _s("Vertical:"), _wpaddingy, "GlkOptionsDialog.wpaddingy", _s("Vertical padding for window"));
+ _wpaddingHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.wpaddinglbl", "Window padding");
+ NEW_LABEL_EDIT("GlkOptionsDialog.wpaddingxlbl", _s("Horizontal:"), _wpaddingx, "GlkOptionsDialog.wpaddingx", _s("Horizontal padding for window"));
+ NEW_LABEL_EDIT("GlkOptionsDialog.wpaddingylbl", _s("Vertical:"), _wpaddingy, "GlkOptionsDialog.wpaddingy", _s("Vertical padding for window"));
- _tmarginHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.tmarginlbl", "Text margin");
- NEW_LABEL_EDIT("GlkOptionsDialog.tmarginxlbl", _s("Horizontal:"), _tmarginx, "GlkOptionsDialog.tmarginx", _s("Horizontal margin for text"));
- NEW_LABEL_EDIT("GlkOptionsDialog.tmarginylbl", _s("Vertical:"), _tmarginy, "GlkOptionsDialog.tmarginy", _s("Vertical margin for text"));
+ _tmarginHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.tmarginlbl", "Text margin");
+ NEW_LABEL_EDIT("GlkOptionsDialog.tmarginxlbl", _s("Horizontal:"), _tmarginx, "GlkOptionsDialog.tmarginx", _s("Horizontal margin for text"));
+ NEW_LABEL_EDIT("GlkOptionsDialog.tmarginylbl", _s("Vertical:"), _tmarginy, "GlkOptionsDialog.tmarginy", _s("Vertical margin for text"));
- NEW_LABEL_EDIT("GlkOptionsDialog.leadinglbl", _s("Leading:"), _leading, "GlkOptionsDialog.leading", _s("Vertical distance between text rows. Valid inputs - 12, 16, 22 etc."));
- NEW_LABEL_EDIT("GlkOptionsDialog.baselinelbl", _s("Baseline:"), _baseline, "GlkOptionsDialog.baseline", _s("Invisible horizontal line on which text sits. Valid inputs - 8, 16 etc. as per your font size"));
+ NEW_LABEL_EDIT("GlkOptionsDialog.leadinglbl", _s("Leading:"), _leading, "GlkOptionsDialog.leading", _s("Vertical distance between text rows. Valid inputs - 12, 16, 22 etc."));
+ NEW_LABEL_EDIT("GlkOptionsDialog.baselinelbl", _s("Baseline:"), _baseline, "GlkOptionsDialog.baseline", _s("Invisible horizontal line on which text sits. Valid inputs - 8, 16 etc. as per your font size"));
- NEW_LABEL_SLIDER_CMD("GlkOptionsDialog.monosizelbl", _s("Monosize:"), _monosize, "GlkOptionsDialog.monosize", _monosizeVal, "GlkOptionsDialog.monosizeval", _s("Font size scaling for the monospace text font"), kMonoSizeCmd);
- NEW_LABEL_SLIDER_CMD("GlkOptionsDialog.propsizelbl", _s("Propsize:"), _propsize, "GlkOptionsDialog.propsize", _propsizeVal, "GlkOptionsDialog.propsizeval", _s("Font size scaling for the proportional text font"), kPropSizeCmd);
+ NEW_LABEL_SLIDER_CMD("GlkOptionsDialog.monosizelbl", _s("Monosize:"), _monosize, "GlkOptionsDialog.monosize", _monosizeVal, "GlkOptionsDialog.monosizeval", _s("Font size scaling for the monospace text font"), kMonoSizeCmd);
+ NEW_LABEL_SLIDER_CMD("GlkOptionsDialog.propsizelbl", _s("Propsize:"), _propsize, "GlkOptionsDialog.propsize", _propsizeVal, "GlkOptionsDialog.propsizeval", _s("Font size scaling for the proportional text font"), kPropSizeCmd);
- _moreHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.morelbl", "More");
- NEW_LABEL_POPUP("GlkOptionsDialog.morealignlbl", _s("Align:"), _morealign, "GlkOptionsDialog.morealign", _s("Alignment of the \"More...\" marker on the window"));
- _morealign->appendEntry(_("Left"), 0);
- _morealign->appendEntry(_("Centre"), 1);
- _morealign->appendEntry(_("Right"), 2);
+ _moreHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.morelbl", "More");
+ NEW_LABEL_POPUP("GlkOptionsDialog.morealignlbl", _s("Align:"), _morealign, "GlkOptionsDialog.morealign", _s("Alignment of the \"More...\" marker on the window"));
+ _morealign->appendEntry(_("Left"), 0);
+ _morealign->appendEntry(_("Centre"), 1);
+ _morealign->appendEntry(_("Right"), 2);
- NEW_LABEL_POPUP("GlkOptionsDialog.morefontlbl", _s("Font:"), _morefont, "GlkOptionsDialog.morefont", _s("Font for the \"More...\" marker"));
- for (int f = MONOR; f <= PROPZ; ++f)
- _morefont->appendEntry(fontLabels[f], f);
+ NEW_LABEL_POPUP("GlkOptionsDialog.morefontlbl", _s("Font:"), _morefont, "GlkOptionsDialog.morefont", _s("Font for the \"More...\" marker"));
+ for (int f = MONOR; f <= PROPZ; ++f)
+ _morefont->appendEntry(fontLabels[f], f);
}
GlkOptionsWidget::~GlkOptionsWidget() {}
void GlkOptionsWidget::reflowLayout() {
- GUI::OptionsContainerWidget::reflowLayout();
- layoutHeadings();
+ GUI::OptionsContainerWidget::reflowLayout();
+ layoutHeadings();
}
void GlkOptionsWidget::layoutHeadings() {
- int16 containerX = 0, containerY = 0, containerW = 0, containerH = 0;
- bool useRTL = false;
- if (!g_gui.xmlEval()->getWidgetData("GlkOptionsDialog", containerX, containerY, containerW, containerH, useRTL))
- return;
-
- if (containerW <= 0)
- return;
-
- struct HeadingX {
- GUI::StaticTextWidget *widget;
- int16 *xOut;
- int16 *wOut;
- };
-
- int16 fontX, colorX, borderX, wmarginX, tmarginX, wpaddingX, moreX, typographyX, userexpX;
- int16 fontW, colorW, borderW, wmarginW, tmarginW, wpaddingW, moreW, typographyW, userexpW;
-
- HeadingX headingXPos[] = {
- { _fontHeadinglbl, &fontX, &fontW },
- { _colorHeadinglbl, &colorX, &colorW },
- { _borderHeadinglbl, &borderX, &borderW },
- { _wmarginHeadinglbl, &wmarginX, &wmarginW },
- { _tmarginHeadinglbl, &tmarginX, &tmarginW },
- { _wpaddingHeadinglbl, &wpaddingX, &wpaddingW },
- { _moreHeadinglbl, &moreX, &moreW },
- { _typographyHeadinglbl, &typographyX, &typographyW },
- { _userExperiencelbl, &userexpX, &userexpW }
- };
-
- for (auto &h : headingXPos) {
- int w = MIN<int>(h.widget->getWidth(), containerW);
- int x = containerX + (containerW - w) / 2;
- *(h.wOut) = w;
- *(h.xOut) = x;
- }
-
- struct HeadingY {
- const char *rowWidgetName;
- GUI::StaticTextWidget *heading;
- int16 *yOut;
- int16 *rowYOut;
- int16 extraOffset;
- };
-
- int16 fontY, colorY, borderY, wmarginY, tmarginY, wpaddingY, moreY, typographyY, userexpY;
- int16 fontRowY, colorRowY, borderRowY, wmarginRowY, tmarginRowY, wpaddingRowY, moreRowY, typographyRowY, userexpRowY;
-
- int16 headingMinGap = g_gui.xmlEval()->getVar("GlkOptionsDialog.HeadingMinGap", 2);
-
- HeadingY headingYpos[] = {
- { "GlkOptionsDialog.TFont0", _fontHeadinglbl, &fontY, &fontRowY, 0 },
- { "GlkOptionsDialog.TColor0", _colorHeadinglbl, &colorY, &colorRowY, 0 },
- { "GlkOptionsDialog.linkStyle", _typographyHeadinglbl, &typographyY, &typographyRowY, 0 },
- { "GlkOptionsDialog.wborderx", _borderHeadinglbl, &borderY, &borderRowY, 0 },
- { "GlkOptionsDialog.wmarginy", _wmarginHeadinglbl, &wmarginY, &wmarginRowY, 0 },
- { "GlkOptionsDialog.tmarginx", _tmarginHeadinglbl, &tmarginY, &tmarginRowY, 0 },
- { "GlkOptionsDialog.wpaddingx", _wpaddingHeadinglbl, &wpaddingY, &wpaddingRowY, 0 },
- { "GlkOptionsDialog.morealign", _moreHeadinglbl, &moreY, &moreRowY, 0 },
- { "GlkOptionsDialog.stylehintlabel", _userExperiencelbl, &userexpY, &userexpRowY, 0 }
- };
-
- int spacing = g_gui.xmlEval()->getVar("Globals.Line.Height", 16) / 2;
-
- for (auto &h : headingYpos) {
- int16 tmpX = 0, tmpW = 0, tmpH = 0;
- if (g_gui.xmlEval()->getWidgetData(h.rowWidgetName, tmpX, *h.rowYOut, tmpW, tmpH, useRTL))
- *h.yOut = *h.rowYOut - h.heading->getHeight() - spacing + h.extraOffset;
- }
-
- if (fontY + _fontHeadinglbl->getHeight() + headingMinGap >= colorY)
- fontY = colorY - _fontHeadinglbl->getHeight() - headingMinGap;
-
- struct HeadingResize {
- GUI::StaticTextWidget *widget;
- int16 *x;
- int16 *y;
- int16 *w;
- };
-
- HeadingResize headingResize[] = {
- { _fontHeadinglbl, &fontX, &fontY, &fontW },
- { _colorHeadinglbl, &colorX, &colorY, &colorW },
- { _typographyHeadinglbl, &typographyX, &typographyY, &typographyW },
- { _borderHeadinglbl, &borderX, &borderY, &borderW },
- { _wmarginHeadinglbl, &wmarginX, &wmarginY, &wmarginW },
- { _tmarginHeadinglbl, &tmarginX, &tmarginY, &tmarginW },
- { _moreHeadinglbl, &moreX, &moreY, &moreW },
- { _wpaddingHeadinglbl, &wpaddingX, &wpaddingY, &wpaddingW },
- { _userExperiencelbl, &userexpX, &userexpY, &userexpW },
- };
-
- for (auto &h : headingResize)
- h.widget->resize(*h.x, *h.y, *h.w, h.widget->getHeight(), false);
+ int16 containerX = 0, containerY = 0, containerW = 0, containerH = 0;
+ bool useRTL = false;
+ if (!g_gui.xmlEval()->getWidgetData("GlkOptionsDialog", containerX, containerY, containerW, containerH, useRTL))
+ return;
+
+ if (containerW <= 0)
+ return;
+
+ struct HeadingX {
+ GUI::StaticTextWidget *widget;
+ int16 *xOut;
+ int16 *wOut;
+ };
+
+ int16 fontX, colorX, borderX, wmarginX, tmarginX, wpaddingX, moreX, typographyX, userexpX;
+ int16 fontW, colorW, borderW, wmarginW, tmarginW, wpaddingW, moreW, typographyW, userexpW;
+
+ HeadingX headingXPos[] = {
+ { _fontHeadinglbl, &fontX, &fontW },
+ { _colorHeadinglbl, &colorX, &colorW },
+ { _borderHeadinglbl, &borderX, &borderW },
+ { _wmarginHeadinglbl, &wmarginX, &wmarginW },
+ { _tmarginHeadinglbl, &tmarginX, &tmarginW },
+ { _wpaddingHeadinglbl, &wpaddingX, &wpaddingW },
+ { _moreHeadinglbl, &moreX, &moreW },
+ { _typographyHeadinglbl, &typographyX, &typographyW },
+ { _userExperiencelbl, &userexpX, &userexpW }
+ };
+
+ for (auto &h : headingXPos) {
+ int w = MIN<int>(h.widget->getWidth(), containerW);
+ int x = containerX + (containerW - w) / 2;
+ *(h.wOut) = w;
+ *(h.xOut) = x;
+ }
+
+ struct HeadingY {
+ const char *rowWidgetName;
+ GUI::StaticTextWidget *heading;
+ int16 *yOut;
+ int16 *rowYOut;
+ int16 extraOffset;
+ };
+
+ int16 fontY, colorY, borderY, wmarginY, tmarginY, wpaddingY, moreY, typographyY, userexpY;
+ int16 fontRowY, colorRowY, borderRowY, wmarginRowY, tmarginRowY, wpaddingRowY, moreRowY, typographyRowY, userexpRowY;
+
+ int16 headingMinGap = g_gui.xmlEval()->getVar("GlkOptionsDialog.HeadingMinGap", 2);
+
+ HeadingY headingYpos[] = {
+ { "GlkOptionsDialog.TFont0", _fontHeadinglbl, &fontY, &fontRowY, 0 },
+ { "GlkOptionsDialog.TColor0", _colorHeadinglbl, &colorY, &colorRowY, 0 },
+ { "GlkOptionsDialog.linkStyle", _typographyHeadinglbl, &typographyY, &typographyRowY, 0 },
+ { "GlkOptionsDialog.wborderx", _borderHeadinglbl, &borderY, &borderRowY, 0 },
+ { "GlkOptionsDialog.wmarginy", _wmarginHeadinglbl, &wmarginY, &wmarginRowY, 0 },
+ { "GlkOptionsDialog.tmarginx", _tmarginHeadinglbl, &tmarginY, &tmarginRowY, 0 },
+ { "GlkOptionsDialog.wpaddingx", _wpaddingHeadinglbl, &wpaddingY, &wpaddingRowY, 0 },
+ { "GlkOptionsDialog.morealign", _moreHeadinglbl, &moreY, &moreRowY, 0 },
+ { "GlkOptionsDialog.stylehintlabel", _userExperiencelbl, &userexpY, &userexpRowY, 0 }
+ };
+
+ int spacing = g_gui.xmlEval()->getVar("Globals.Line.Height", 16) / 2;
+
+ for (auto &h : headingYpos) {
+ int16 tmpX = 0, tmpW = 0, tmpH = 0;
+ if (g_gui.xmlEval()->getWidgetData(h.rowWidgetName, tmpX, *h.rowYOut, tmpW, tmpH, useRTL))
+ *h.yOut = *h.rowYOut - h.heading->getHeight() - spacing + h.extraOffset;
+ }
+
+ if (fontY + _fontHeadinglbl->getHeight() + headingMinGap >= colorY)
+ fontY = colorY - _fontHeadinglbl->getHeight() - headingMinGap;
+
+ struct HeadingResize {
+ GUI::StaticTextWidget *widget;
+ int16 *x;
+ int16 *y;
+ int16 *w;
+ };
+
+ HeadingResize headingResize[] = {
+ { _fontHeadinglbl, &fontX, &fontY, &fontW },
+ { _colorHeadinglbl, &colorX, &colorY, &colorW },
+ { _typographyHeadinglbl, &typographyX, &typographyY, &typographyW },
+ { _borderHeadinglbl, &borderX, &borderY, &borderW },
+ { _wmarginHeadinglbl, &wmarginX, &wmarginY, &wmarginW },
+ { _tmarginHeadinglbl, &tmarginX, &tmarginY, &tmarginW },
+ { _moreHeadinglbl, &moreX, &moreY, &moreW },
+ { _wpaddingHeadinglbl, &wpaddingX, &wpaddingY, &wpaddingW },
+ { _userExperiencelbl, &userexpX, &userexpY, &userexpW },
+ };
+
+ for (auto &h : headingResize)
+ h.widget->resize(*h.x, *h.y, *h.w, h.widget->getHeight(), false);
}
static void setFontPopUp(GUI::PopUpWidget *popup, bool hasConf, FACES font, const char *settingName, const Common::String &domain) {
- if (hasConf)
- popup->setSelectedTag(font);
- else
- popup->setSelectedTag(Screen::getFontId(ConfMan.get(settingName, domain)));
+ if (hasConf)
+ popup->setSelectedTag(font);
+ else
+ popup->setSelectedTag(Screen::getFontId(ConfMan.get(settingName, domain)));
}
static void setSimpleColorPopUp(GUI::PopUpWidget *popup, GUI::EditTextWidget *hexInput, bool hasConf, const char *confKey, const char *themeKey, const Common::String &domain, bool overrideEnabled, int defaultValue = 7) {
- Common::String targetKey = hasConf ? confKey : themeKey;
-
- if (hasConf && !overrideEnabled) {
- popup->setSelectedTag(defaultValue);
- hexInput->setEditString(Common::U32String());
- return;
- }
-
- // Grab the color from ConfMan (returns "RRGGBB" or "RRGGBB,RRGGBB")
- Common::String colorStr = ConfMan.get(targetKey, domain);
- Common::String hexPart = colorStr.substr(0, 6);
-
- if (hexInput) {
- hexInput->setEditString(Common::U32String(hexPart));
- }
-
- unsigned int rgb = 0;
- sscanf(hexPart.c_str(), "%x", &rgb);
- bool found = false;
-
- // See if it matches one of our predefined 6 colors
- for (int i = 0; i <= 5; ++i) {
- if (GLK_COLORS[i].rgb == rgb) {
- popup->setSelectedTag(i);
- found = true;
- break;
- }
- }
-
- // If it doesn't match standard colors, set to Custom (6)
- if (!found) {
- popup->setSelectedTag(6);
- }
+ Common::String targetKey = hasConf ? confKey : themeKey;
+
+ if (hasConf && !overrideEnabled) {
+ popup->setSelectedTag(defaultValue);
+ hexInput->setEditString(Common::U32String());
+ return;
+ }
+
+ // Grab the color from ConfMan (returns "RRGGBB" or "RRGGBB,RRGGBB")
+ Common::String colorStr = ConfMan.get(targetKey, domain);
+ Common::String hexPart = colorStr.substr(0, 6);
+
+ if (hexInput) {
+ hexInput->setEditString(Common::U32String(hexPart));
+ }
+
+ unsigned int rgb = 0;
+ sscanf(hexPart.c_str(), "%x", &rgb);
+ bool found = false;
+
+ // See if it matches one of our predefined 6 colors
+ for (int i = 0; i <= 5; ++i) {
+ if (GLK_COLORS[i].rgb == rgb) {
+ popup->setSelectedTag(i);
+ found = true;
+ break;
+ }
+ }
+
+ // If it doesn't match standard colors, set to Custom (6)
+ if (!found) {
+ popup->setSelectedTag(6);
+ }
}
void GlkOptionsWidget::load() {
- bool tempConfCreated = false;
- if (!g_conf) {
- tempConfCreated = true;
- // instantiate a global g_conf so the dialog can read values from it
- new Conf(INTERPRETER_GLULX);
- g_conf->load();
- }
-
- BoolOption boolOptions[] = {
- { _safeClicks, nullptr, &g_conf->_safeClicks, "safeclicks" },
- { _styleHint, &g_conf->_styleHint, nullptr, "stylehint" },
- { _lockcols, &g_conf->_lockCols, nullptr, "lockcols" },
- { _lockrows, &g_conf->_lockRows, nullptr, "lockrows" },
- { _justify, &g_conf->_propInfo._justify, nullptr, "justify" },
- { _caps, &g_conf->_propInfo._caps, nullptr, "caps" },
- { _graphics, nullptr, &g_conf->_graphics, "graphics" }
- };
-
- IntOption intOptions[] = {
- { _wmarginx, &g_conf->_wMarginX, "wmarginx", 0 },
- { _wmarginy, &g_conf->_wMarginY, "wmarginy", 0 },
- { _wpaddingx, &g_conf->_wPaddingX, "wpaddingx", 0 },
- { _wpaddingy, &g_conf->_wPaddingY, "wpaddingy", 0 },
- { _tmarginx, &g_conf->_tMarginX, "tmarginx", 0 },
- { _tmarginy, &g_conf->_tMarginY, "tmarginy", 0 },
- { _leading, &g_conf->_monoInfo._leading, "leading", 0 },
- { _baseline, &g_conf->_propInfo._baseLine, "baseline", 0 }
- };
-
- ColorOption colorOptions[] = {
- { _tcolorPopUps[0], _manualTColorHexInput, g_conf->_tStyles, nullptr, "tcolor_0", false },
- { _gcolorPopUps[0], _manualGColorHexInput, g_conf->_gStyles, nullptr, "gcolor_0", false },
- { _wcolorPopUps[0], _manualWColorHexInput, nullptr, nullptr, "windowcolor", false },
- { _bcolorPopUps[0], _manualBColorHexInput, nullptr, nullptr, "bordercolor", false },
- { _ccolorPopUps[0], _manualCColorHexInput, nullptr, &g_conf->_propInfo, "caretcolor", true },
- { _lcolorPopUps[0], _manualLColorHexInput, nullptr, &g_conf->_propInfo, "linkcolor", true },
- { _mcolorPopUps[0], _manualMColorHexInput, nullptr, &g_conf->_propInfo, "morecolor", true }
- };
-
- FontOption fontOptions[] = {
- { _tfontPopUps[0], g_conf->_tStyles, "tfont" },
- { _gfontPopUps[0], g_conf->_gStyles, "gfont" }
- };
-
- for (auto &opt : fontOptions) {
- if (g_conf)
- setFontPopUp(opt.popup, true, opt.styles[style_Normal].font, nullptr, _domain);
- else
- setFontPopUp(opt.popup, false, (FACES)0, opt.confKeyPrefix, _domain);
- }
-
- for (auto &opt : colorOptions) {
- if (g_conf) {
- bool overrideEnabled = true;
- if (!opt.isProp && strcmp(opt.confKey, "windowcolor") == 0)
- overrideEnabled = g_conf->_windowColorOverride;
- if (!opt.isProp && strcmp(opt.confKey, "bordercolor") == 0)
- overrideEnabled = g_conf->_borderColorOverride;
- setSimpleColorPopUp(opt.popup, opt.hexInput, true, opt.confKey, opt.confKey, _domain, overrideEnabled);
- } else {
- setSimpleColorPopUp(opt.popup, opt.hexInput, false, opt.confKey, opt.confKey, _domain, true);
- }
- }
-
- // number fields
- for (auto &opt : intOptions) {
- if (opt.widget && g_conf)
- opt.widget->setEditString(Common::U32String(Common::String::format("%d", *opt.target)));
- }
-
- for (auto &opt : boolOptions) {
- if (opt.widget && g_conf) {
- if (opt.targetBool)
- opt.widget->setState(*opt.targetBool);
- else
- opt.widget->setState(*opt.targetInt != 0);
- }
- }
-
- INIT_NUM(_wborderx ,_wBorderX);
- INIT_NUM(_wbordery ,_wBorderY);
- INIT_POPUP(_linkStyle, g_conf->_propInfo._linkStyle);
- INIT_POPUP(_caretShape, g_conf->_propInfo._caretShape);
- INIT_STRING(_morePrompt, g_conf->_propInfo._morePrompt);
- INIT_BOOL(_styleHint, g_conf->_styleHint);
- INIT_BOOL(_safeClicks, g_conf->_safeClicks);
- INIT_NUM(_cols, _cols);
- INIT_NUM(_rows, _rows);
- INIT_BOOL(_lockcols, g_conf->_lockCols);
- INIT_BOOL(_lockrows, g_conf->_lockRows);
- INIT_BOOL(_justify, g_conf->_propInfo._justify);
- INIT_BOOL(_caps, g_conf->_propInfo._caps);
- INIT_POPUP(_quotes, g_conf->_propInfo._quotes);
- INIT_POPUP(_dashes, g_conf->_propInfo._dashes);
- INIT_POPUP(_spaces, g_conf->_propInfo._spaces);
- INIT_BOOL(_graphics, g_conf->_graphics);
- INIT_NUM(_wmarginx, _wMarginX);
- INIT_NUM(_wmarginy, _wMarginY);
- INIT_NUM(_wpaddingx, _wPaddingX);
- INIT_NUM(_wpaddingy, _wPaddingY);
- INIT_NUM(_tmarginx, _tMarginX);
- INIT_NUM(_tmarginy, _tMarginY);
- INIT_INT(_leading, g_conf->_propInfo._leading);
- INIT_INT(_baseline, g_conf->_propInfo._baseLine);
- INIT_SLIDER_FLOAT(_monosize, g_conf->_monoInfo._size, 10, 25);
- INIT_SLIDER_FLOAT(_propsize, g_conf->_propInfo._size, 10, 25);
- _monosizeVal->setValue(_monosize->getValue());
- _propsizeVal->setValue(_propsize->getValue());
- INIT_POPUP(_morealign, g_conf->_propInfo._moreAlign);
- INIT_POPUP(_morefont, g_conf->_propInfo._moreFont);
-
- if (tempConfCreated)
- delete g_conf;
+ bool tempConfCreated = false;
+ if (!g_conf) {
+ tempConfCreated = true;
+ // instantiate a global g_conf so the dialog can read values from it
+ new Conf(INTERPRETER_GLULX);
+ g_conf->load();
+ }
+
+ BoolOption boolOptions[] = {
+ { _safeClicks, nullptr, &g_conf->_safeClicks, "safeclicks" },
+ { _styleHint, &g_conf->_styleHint, nullptr, "stylehint" },
+ { _lockcols, &g_conf->_lockCols, nullptr, "lockcols" },
+ { _lockrows, &g_conf->_lockRows, nullptr, "lockrows" },
+ { _justify, &g_conf->_propInfo._justify, nullptr, "justify" },
+ { _caps, &g_conf->_propInfo._caps, nullptr, "caps" },
+ { _graphics, nullptr, &g_conf->_graphics, "graphics" }
+ };
+
+ IntOption intOptions[] = {
+ { _wmarginx, &g_conf->_wMarginX, "wmarginx", 0 },
+ { _wmarginy, &g_conf->_wMarginY, "wmarginy", 0 },
+ { _wpaddingx, &g_conf->_wPaddingX, "wpaddingx", 0 },
+ { _wpaddingy, &g_conf->_wPaddingY, "wpaddingy", 0 },
+ { _tmarginx, &g_conf->_tMarginX, "tmarginx", 0 },
+ { _tmarginy, &g_conf->_tMarginY, "tmarginy", 0 },
+ { _leading, &g_conf->_monoInfo._leading, "leading", 0 },
+ { _baseline, &g_conf->_propInfo._baseLine, "baseline", 0 }
+ };
+
+ ColorOption colorOptions[] = {
+ { _tcolorPopUps[0], _manualTColorHexInput, g_conf->_tStyles, nullptr, "tcolor_0", false },
+ { _gcolorPopUps[0], _manualGColorHexInput, g_conf->_gStyles, nullptr, "gcolor_0", false },
+ { _wcolorPopUps[0], _manualWColorHexInput, nullptr, nullptr, "windowcolor", false },
+ { _bcolorPopUps[0], _manualBColorHexInput, nullptr, nullptr, "bordercolor", false },
+ { _ccolorPopUps[0], _manualCColorHexInput, nullptr, &g_conf->_propInfo, "caretcolor", true },
+ { _lcolorPopUps[0], _manualLColorHexInput, nullptr, &g_conf->_propInfo, "linkcolor", true },
+ { _mcolorPopUps[0], _manualMColorHexInput, nullptr, &g_conf->_propInfo, "morecolor", true }
+ };
+
+ FontOption fontOptions[] = {
+ { _tfontPopUps[0], g_conf->_tStyles, "tfont" },
+ { _gfontPopUps[0], g_conf->_gStyles, "gfont" }
+ };
+
+ for (auto &opt : fontOptions) {
+ if (g_conf)
+ setFontPopUp(opt.popup, true, opt.styles[style_Normal].font, nullptr, _domain);
+ else
+ setFontPopUp(opt.popup, false, (FACES)0, opt.confKeyPrefix, _domain);
+ }
+
+ for (auto &opt : colorOptions) {
+ if (g_conf) {
+ bool overrideEnabled = true;
+ if (!opt.isProp && strcmp(opt.confKey, "windowcolor") == 0)
+ overrideEnabled = g_conf->_windowColorOverride;
+ if (!opt.isProp && strcmp(opt.confKey, "bordercolor") == 0)
+ overrideEnabled = g_conf->_borderColorOverride;
+ setSimpleColorPopUp(opt.popup, opt.hexInput, true, opt.confKey, opt.confKey, _domain, overrideEnabled);
+ } else {
+ setSimpleColorPopUp(opt.popup, opt.hexInput, false, opt.confKey, opt.confKey, _domain, true);
+ }
+ }
+
+ // number fields
+ for (auto &opt : intOptions) {
+ if (opt.widget && g_conf)
+ opt.widget->setEditString(Common::U32String(Common::String::format("%d", *opt.target)));
+ }
+
+ for (auto &opt : boolOptions) {
+ if (opt.widget && g_conf) {
+ if (opt.targetBool)
+ opt.widget->setState(*opt.targetBool);
+ else
+ opt.widget->setState(*opt.targetInt != 0);
+ }
+ }
+
+ INIT_NUM(_wborderx ,_wBorderX);
+ INIT_NUM(_wbordery ,_wBorderY);
+ INIT_POPUP(_linkStyle, g_conf->_propInfo._linkStyle);
+ INIT_POPUP(_caretShape, g_conf->_propInfo._caretShape);
+ INIT_STRING(_morePrompt, g_conf->_propInfo._morePrompt);
+ INIT_BOOL(_styleHint, g_conf->_styleHint);
+ INIT_BOOL(_safeClicks, g_conf->_safeClicks);
+ INIT_NUM(_cols, _cols);
+ INIT_NUM(_rows, _rows);
+ INIT_BOOL(_lockcols, g_conf->_lockCols);
+ INIT_BOOL(_lockrows, g_conf->_lockRows);
+ INIT_BOOL(_justify, g_conf->_propInfo._justify);
+ INIT_BOOL(_caps, g_conf->_propInfo._caps);
+ INIT_POPUP(_quotes, g_conf->_propInfo._quotes);
+ INIT_POPUP(_dashes, g_conf->_propInfo._dashes);
+ INIT_POPUP(_spaces, g_conf->_propInfo._spaces);
+ INIT_BOOL(_graphics, g_conf->_graphics);
+ INIT_NUM(_wmarginx, _wMarginX);
+ INIT_NUM(_wmarginy, _wMarginY);
+ INIT_NUM(_wpaddingx, _wPaddingX);
+ INIT_NUM(_wpaddingy, _wPaddingY);
+ INIT_NUM(_tmarginx, _tMarginX);
+ INIT_NUM(_tmarginy, _tMarginY);
+ INIT_INT(_leading, g_conf->_propInfo._leading);
+ INIT_INT(_baseline, g_conf->_propInfo._baseLine);
+ INIT_SLIDER_FLOAT(_monosize, g_conf->_monoInfo._size, 10, 25);
+ INIT_SLIDER_FLOAT(_propsize, g_conf->_propInfo._size, 10, 25);
+ _monosizeVal->setValue(_monosize->getValue());
+ _propsizeVal->setValue(_propsize->getValue());
+ INIT_POPUP(_morealign, g_conf->_propInfo._moreAlign);
+ INIT_POPUP(_morefont, g_conf->_propInfo._moreFont);
+
+ if (tempConfCreated)
+ delete g_conf;
}
void GlkOptionsWidget::defineLayout(GUI::ThemeEval &layouts,
- const Common::String &layoutName,
- const Common::String &overlayedLayout) const {
- int16 baseScale = g_gui.xmlEval()->getVar("Globals.Line.Height", 16);
- int16 labelWidth = baseScale * 4;
- int16 popUpWidth = baseScale * 4.5;
- int16 prefixWidth = baseScale * 1.5;
- int16 hexWidth = baseScale * 3.5;
-
- layouts.addDialog(layoutName, overlayedLayout)
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addSpace()
- .addLayout(GUI::ThemeLayout::kLayoutVertical)
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(8, 8, 8, 8)
- .addWidget("FontHeading", "OptionsLabel")
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, prefixWidth + hexWidth, 0, 0)
- .addWidget("TFont", "OptionsLabel", labelWidth, baseScale)
- .addWidget("TFont0", "PopUp", baseScale * 10)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, prefixWidth + hexWidth, 0, 0)
- .addWidget("GFont", "OptionsLabel", labelWidth, baseScale)
- .addWidget("GFont0", "PopUp", baseScale * 10)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(8, 8, 8, 8)
- .addWidget("ColorHeading", "OptionsLabel")
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("TColor", "OptionsLabel", labelWidth)
- .addWidget("TColor0", "PopUp", popUpWidth)
- .addWidget("THexPrefix", "", prefixWidth)
- .addWidget("THex", "EditTextWidget", hexWidth)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("GColor", "OptionsLabel")
- .addWidget("GColor0", "PopUp", popUpWidth)
- .addWidget("GHexPrefix", "", prefixWidth)
- .addWidget("GHex", "EditTextWidget", hexWidth)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("WColor", "OptionsLabel")
- .addWidget("WColor0", "PopUp", popUpWidth)
- .addWidget("WHexPrefix", "", prefixWidth)
- .addWidget("WHex", "EditTextWidget", hexWidth)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("BColor", "OptionsLabel")
- .addWidget("BColor0", "PopUp", popUpWidth)
- .addWidget("BHexPrefix", "", prefixWidth)
- .addWidget("BHex", "EditTextWidget", hexWidth)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("CColor", "OptionsLabel")
- .addWidget("CColor0", "PopUp", popUpWidth)
- .addWidget("CHexPrefix", "", prefixWidth)
- .addWidget("CHex", "EditTextWidget", hexWidth)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("LColor", "OptionsLabel")
- .addWidget("LColor0", "PopUp", popUpWidth)
- .addWidget("LHexPrefix", "", prefixWidth)
- .addWidget("LHex", "EditTextWidget", hexWidth)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("MColor", "OptionsLabel")
- .addWidget("MColor0", "PopUp", popUpWidth)
- .addWidget("MHexPrefix", "", prefixWidth)
- .addWidget("MHex", "EditTextWidget", hexWidth)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(8, 8, 8, 8)
- .addWidget("wborderlbl", "OptionsLabel")
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("wborderx", "OptionsLabel")
- .addWidget("wborderhorizontal", "EditTextWidget", baseScale * 2)
- .addWidget("wbordery", "", baseScale * 3.75)
- .addWidget("wbordervertical", "EditTextWidget", baseScale * 2)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(8, 8, 8, 8)
- .addWidget("WindowMarginHeading", "OptionsLabel")
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("wmarginxlbl", "OptionsLabel")
- .addWidget("wmarginx", "EditTextWidget", baseScale * 2)
- .addWidget("wmarginylbl", "", baseScale * 3.75)
- .addWidget("wmarginy", "EditTextWidget", baseScale * 2)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(8, 8, 8, 8)
- .addWidget("tmarginlbl", "OptionsLabel")
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("tmarginxlbl", "OptionsLabel")
- .addWidget("tmarginx", "EditTextWidget", baseScale * 2)
- .addWidget("tmarginylbl", "", baseScale * 3.75)
- .addWidget("tmarginy", "EditTextWidget", baseScale * 2)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(8, 8, 8, 8)
- .addWidget("wpaddinglbl", "OptionsLabel")
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("wpaddingxlbl", "OptionsLabel")
- .addWidget("wpaddingx", "EditTextWidget", baseScale * 1.875)
- .addWidget("wpaddingylbl", "", baseScale * 3.75)
- .addWidget("wpaddingy", "EditTextWidget", baseScale * 1.875)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(8, 8, 8, 8)
- .addWidget("morelbl", "OptionsLabel")
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("morealignlbl", "OptionsLabel")
- .addWidget("morealign", "PopUp", baseScale * 10)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("morefontlbl", "OptionsLabel")
- .addWidget("morefont", "PopUp", baseScale * 10)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(8, 8, 8, 8)
- .addWidget("topographyheadinglbl", "OptionsLabel")
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("linkstyle", "OptionsLabel")
- .addWidget("linkStyle", "EditTextWidget", baseScale * 10)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("caretshape", "OptionsLabel")
- .addWidget("caretShape", "EditTextWidget", baseScale * 10)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("moreprompt", "OptionsLabel")
- .addWidget("morePrompt", "EditTextWidget", baseScale * 10)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("leadinglbl", "OptionsLabel")
- .addWidget("leading", "EditTextWidget", baseScale * 10)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("baselinelbl", "OptionsLabel")
- .addWidget("baseline", "EditTextWidget", baseScale * 10)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("monosizelbl", "OptionsLabel")
- .addWidget("monosize", "SliderWidget", baseScale * 10)
- .addWidget("monosizeval", "StaticTextWidget", baseScale * 2)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0 ,0)
- .addWidget("propsizelbl", "OptionsLabel")
- .addWidget("propsize", "SliderWidget", baseScale * 10)
- .addWidget("propsizeval", "StaticTextWidget", baseScale * 2)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("capslbl", "OptionsLabel")
- .addWidget("caps", "Checkbox", baseScale * 10)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("quoteslbl", "OptionsLabel")
- .addWidget("quotes", "PopUp", baseScale * 10)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("dasheslbl", "OptionsLabel")
- .addWidget("dashes", "PopUp", baseScale * 10)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("spaceslbl", "OptionsLabel")
- .addWidget("spaces", "PopUp", baseScale * 10)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(8, 8, 8, 8)
- .addWidget("userexplbl", "OptionsLabel")
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("stylehintlabel", "OptionsLabel")
- .addWidget("stylehint", "Checkbox", baseScale * 5)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("safeclickslabel", "OptionsLabel")
- .addWidget("safeclicks", "Checkbox", baseScale * 5)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("colslbl", "OptionsLabel")
- .addWidget("cols", "EditTextWidget", baseScale * 1.875)
- .addWidget("lockcolslbl", "OptionsLabel")
- .addWidget("lockcols", "Checkbox", baseScale * 2)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("rowslbl", "OptionsLabel")
- .addWidget("rows", "EditTextWidget", baseScale * 1.875)
- .addWidget("lockrowslbl", "OptionsLabel")
- .addWidget("lockrows", "Checkbox", baseScale * 2)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0, 0)
- .addWidget("justifylbl", "OptionsLabel")
- .addWidget("justify", "Checkbox", baseScale * 5)
- .closeLayout()
- .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
- .addPadding(0, 0, 0 ,0)
- .addWidget("graphicslbl", "OptionsLabel")
- .addWidget("graphics", "Checkbox", baseScale * 5)
- .closeLayout()
- .closeLayout()
- .addSpace()
- .closeLayout()
- .closeDialog();
+ const Common::String &layoutName,
+ const Common::String &overlayedLayout) const {
+ int16 baseScale = g_gui.xmlEval()->getVar("Globals.Line.Height", 16);
+ int16 labelWidth = baseScale * 4;
+ int16 popUpWidth = baseScale * 4.5;
+ int16 prefixWidth = baseScale * 1.5;
+ int16 hexWidth = baseScale * 3.5;
+
+ layouts.addDialog(layoutName, overlayedLayout)
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addSpace()
+ .addLayout(GUI::ThemeLayout::kLayoutVertical)
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(8, 8, 8, 8)
+ .addWidget("FontHeading", "OptionsLabel")
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, prefixWidth + hexWidth, 0, 0)
+ .addWidget("TFont", "OptionsLabel", labelWidth, baseScale)
+ .addWidget("TFont0", "PopUp", baseScale * 10)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, prefixWidth + hexWidth, 0, 0)
+ .addWidget("GFont", "OptionsLabel", labelWidth, baseScale)
+ .addWidget("GFont0", "PopUp", baseScale * 10)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(8, 8, 8, 8)
+ .addWidget("ColorHeading", "OptionsLabel")
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("TColor", "OptionsLabel", labelWidth)
+ .addWidget("TColor0", "PopUp", popUpWidth)
+ .addWidget("THexPrefix", "", prefixWidth)
+ .addWidget("THex", "EditTextWidget", hexWidth)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("GColor", "OptionsLabel")
+ .addWidget("GColor0", "PopUp", popUpWidth)
+ .addWidget("GHexPrefix", "", prefixWidth)
+ .addWidget("GHex", "EditTextWidget", hexWidth)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("WColor", "OptionsLabel")
+ .addWidget("WColor0", "PopUp", popUpWidth)
+ .addWidget("WHexPrefix", "", prefixWidth)
+ .addWidget("WHex", "EditTextWidget", hexWidth)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("BColor", "OptionsLabel")
+ .addWidget("BColor0", "PopUp", popUpWidth)
+ .addWidget("BHexPrefix", "", prefixWidth)
+ .addWidget("BHex", "EditTextWidget", hexWidth)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("CColor", "OptionsLabel")
+ .addWidget("CColor0", "PopUp", popUpWidth)
+ .addWidget("CHexPrefix", "", prefixWidth)
+ .addWidget("CHex", "EditTextWidget", hexWidth)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("LColor", "OptionsLabel")
+ .addWidget("LColor0", "PopUp", popUpWidth)
+ .addWidget("LHexPrefix", "", prefixWidth)
+ .addWidget("LHex", "EditTextWidget", hexWidth)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("MColor", "OptionsLabel")
+ .addWidget("MColor0", "PopUp", popUpWidth)
+ .addWidget("MHexPrefix", "", prefixWidth)
+ .addWidget("MHex", "EditTextWidget", hexWidth)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(8, 8, 8, 8)
+ .addWidget("wborderlbl", "OptionsLabel")
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("wborderx", "OptionsLabel")
+ .addWidget("wborderhorizontal", "EditTextWidget", baseScale * 2)
+ .addWidget("wbordery", "", baseScale * 3.75)
+ .addWidget("wbordervertical", "EditTextWidget", baseScale * 2)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(8, 8, 8, 8)
+ .addWidget("WindowMarginHeading", "OptionsLabel")
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("wmarginxlbl", "OptionsLabel")
+ .addWidget("wmarginx", "EditTextWidget", baseScale * 2)
+ .addWidget("wmarginylbl", "", baseScale * 3.75)
+ .addWidget("wmarginy", "EditTextWidget", baseScale * 2)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(8, 8, 8, 8)
+ .addWidget("tmarginlbl", "OptionsLabel")
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("tmarginxlbl", "OptionsLabel")
+ .addWidget("tmarginx", "EditTextWidget", baseScale * 2)
+ .addWidget("tmarginylbl", "", baseScale * 3.75)
+ .addWidget("tmarginy", "EditTextWidget", baseScale * 2)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(8, 8, 8, 8)
+ .addWidget("wpaddinglbl", "OptionsLabel")
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("wpaddingxlbl", "OptionsLabel")
+ .addWidget("wpaddingx", "EditTextWidget", baseScale * 1.875)
+ .addWidget("wpaddingylbl", "", baseScale * 3.75)
+ .addWidget("wpaddingy", "EditTextWidget", baseScale * 1.875)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(8, 8, 8, 8)
+ .addWidget("morelbl", "OptionsLabel")
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("morealignlbl", "OptionsLabel")
+ .addWidget("morealign", "PopUp", baseScale * 10)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("morefontlbl", "OptionsLabel")
+ .addWidget("morefont", "PopUp", baseScale * 10)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(8, 8, 8, 8)
+ .addWidget("topographyheadinglbl", "OptionsLabel")
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("linkstyle", "OptionsLabel")
+ .addWidget("linkStyle", "EditTextWidget", baseScale * 10)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("caretshape", "OptionsLabel")
+ .addWidget("caretShape", "EditTextWidget", baseScale * 10)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("moreprompt", "OptionsLabel")
+ .addWidget("morePrompt", "EditTextWidget", baseScale * 10)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("leadinglbl", "OptionsLabel")
+ .addWidget("leading", "EditTextWidget", baseScale * 10)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("baselinelbl", "OptionsLabel")
+ .addWidget("baseline", "EditTextWidget", baseScale * 10)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("monosizelbl", "OptionsLabel")
+ .addWidget("monosize", "SliderWidget", baseScale * 10)
+ .addWidget("monosizeval", "StaticTextWidget", baseScale * 2)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0 ,0)
+ .addWidget("propsizelbl", "OptionsLabel")
+ .addWidget("propsize", "SliderWidget", baseScale * 10)
+ .addWidget("propsizeval", "StaticTextWidget", baseScale * 2)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("capslbl", "OptionsLabel")
+ .addWidget("caps", "Checkbox", baseScale * 10)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("quoteslbl", "OptionsLabel")
+ .addWidget("quotes", "PopUp", baseScale * 10)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("dasheslbl", "OptionsLabel")
+ .addWidget("dashes", "PopUp", baseScale * 10)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("spaceslbl", "OptionsLabel")
+ .addWidget("spaces", "PopUp", baseScale * 10)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(8, 8, 8, 8)
+ .addWidget("userexplbl", "OptionsLabel")
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("stylehintlabel", "OptionsLabel")
+ .addWidget("stylehint", "Checkbox", baseScale * 5)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("safeclickslabel", "OptionsLabel")
+ .addWidget("safeclicks", "Checkbox", baseScale * 5)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("colslbl", "OptionsLabel")
+ .addWidget("cols", "EditTextWidget", baseScale * 1.875)
+ .addWidget("lockcolslbl", "OptionsLabel")
+ .addWidget("lockcols", "Checkbox", baseScale * 2)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("rowslbl", "OptionsLabel")
+ .addWidget("rows", "EditTextWidget", baseScale * 1.875)
+ .addWidget("lockrowslbl", "OptionsLabel")
+ .addWidget("lockrows", "Checkbox", baseScale * 2)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0, 0)
+ .addWidget("justifylbl", "OptionsLabel")
+ .addWidget("justify", "Checkbox", baseScale * 5)
+ .closeLayout()
+ .addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+ .addPadding(0, 0, 0 ,0)
+ .addWidget("graphicslbl", "OptionsLabel")
+ .addWidget("graphics", "Checkbox", baseScale * 5)
+ .closeLayout()
+ .closeLayout()
+ .addSpace()
+ .closeLayout()
+ .closeDialog();
}
static void saveFontPopUp(GUI::PopUpWidget *popup, WindowStyle *styles, const char *confKeyPrefix, const Common::String &domain) {
- FACES selectedFont = (FACES)popup->getSelectedTag();
- for (int i = 0; i < style_NUMSTYLES; ++i) {
- styles[i].font = selectedFont;
- Common::String key = Common::String::format("%s%d", confKeyPrefix, i);
- ConfMan.set(key, Screen::getFontName(selectedFont), domain);
- }
+ FACES selectedFont = (FACES)popup->getSelectedTag();
+ for (int i = 0; i < style_NUMSTYLES; ++i) {
+ styles[i].font = selectedFont;
+ Common::String key = Common::String::format("%s%d", confKeyPrefix, i);
+ ConfMan.set(key, Screen::getFontName(selectedFont), domain);
+ }
}
static void saveColorPopUp(GUI::PopUpWidget *popup, GUI::EditTextWidget *hexInput, WindowStyle *styles, const char *prefix, const Common::String &domain) {
- int idx = popup->getSelectedTag();
- unsigned int rgb = 0;
- bool valid = false;
-
- if (idx >= 0 && idx <= 5) {
- rgb = GLK_COLORS[idx].rgb;
- valid = true;
- } else if (idx == 6) { // custom
- Common::String hexStr = hexInput ? hexInput->getEditString().encode() : Common::String();
- if (hexStr.size() == 6) {
- unsigned int parsed;
- if (sscanf(hexStr.c_str(), "%x", &parsed) == 1) {
- rgb = parsed;
- valid = true;
- }
- }
- }
-
- if (!valid)
- return;
-
- byte r = (rgb >> 16) & 0xFF;
- byte g = (rgb >> 8) & 0xFF;
- byte b = rgb & 0xFF;
- Common::String rgbStr = Common::String::format("%02x%02x%02x", r, g, b);
-
- ConfMan.set(prefix, rgbStr, domain);
-
- Common::String stylePrefix(prefix);
- if (!stylePrefix.empty() && stylePrefix[stylePrefix.size()-1] == '0')
- stylePrefix = stylePrefix.substr(0, stylePrefix.size()-1);
-
- unsigned int engineColor = g_conf->parseColor(rgb);
-
- if (styles) {
- for (int i = 0; i < style_NUMSTYLES; ++i)
- styles[i].fg = engineColor;
- }
-
- for (int i = 0; i < style_NUMSTYLES; ++i) {
- Common::String key = Common::String::format("%s%d", stylePrefix.c_str(), i);
- Common::String line = Common::String::format("%s,%s", rgbStr.c_str(), rgbStr.c_str());
- ConfMan.set(key, line, domain);
- }
+ int idx = popup->getSelectedTag();
+ unsigned int rgb = 0;
+ bool valid = false;
+
+ if (idx >= 0 && idx <= 5) {
+ rgb = GLK_COLORS[idx].rgb;
+ valid = true;
+ } else if (idx == 6) { // custom
+ Common::String hexStr = hexInput ? hexInput->getEditString().encode() : Common::String();
+ if (hexStr.size() == 6) {
+ unsigned int parsed;
+ if (sscanf(hexStr.c_str(), "%x", &parsed) == 1) {
+ rgb = parsed;
+ valid = true;
+ }
+ }
+ }
+
+ if (!valid)
+ return;
+
+ byte r = (rgb >> 16) & 0xFF;
+ byte g = (rgb >> 8) & 0xFF;
+ byte b = rgb & 0xFF;
+ Common::String rgbStr = Common::String::format("%02x%02x%02x", r, g, b);
+
+ ConfMan.set(prefix, rgbStr, domain);
+
+ Common::String stylePrefix(prefix);
+ if (!stylePrefix.empty() && stylePrefix[stylePrefix.size()-1] == '0')
+ stylePrefix = stylePrefix.substr(0, stylePrefix.size()-1);
+
+ unsigned int engineColor = g_conf->parseColor(rgb);
+
+ if (styles) {
+ for (int i = 0; i < style_NUMSTYLES; ++i)
+ styles[i].fg = engineColor;
+ }
+
+ for (int i = 0; i < style_NUMSTYLES; ++i) {
+ Common::String key = Common::String::format("%s%d", stylePrefix.c_str(), i);
+ Common::String line = Common::String::format("%s,%s", rgbStr.c_str(), rgbStr.c_str());
+ ConfMan.set(key, line, domain);
+ }
}
static void savePropColorPopUp(GUI::PopUpWidget *popup, GUI::EditTextWidget *hexInput, PropFontInfo &propInfo, const char *confKey, const Common::String &domain) {
- int idx = popup->getSelectedTag();
- unsigned int rgb = 0;
- bool valid = false;
-
- if (idx >= 0 && idx <= 5) {
- rgb = GLK_COLORS[idx].rgb;
- valid = true;
- } else if (idx == 6) {
- Common::String hex = hexInput ? hexInput->getEditString().encode() : Common::String();
- hex.toLowercase();
- if (hex.size() == 6) {
- bool allHex = true;
- for (char c : hex) {
- if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f'))) {
- allHex = false;
- break;
- }
- }
- if (allHex) {
- sscanf(hex.c_str(), "%x", &rgb);
- valid = true;
- }
- }
- } else if (idx == 7) {
- ConfMan.set(confKey, Common::String(), domain);
- return;
- }
-
- if (!valid)
- return;
-
- unsigned int engineColor = g_conf->parseColor(rgb);
- if (strcmp(confKey, "caretcolor") == 0)
- propInfo._caretColor = engineColor;
- else if (strcmp(confKey, "linkcolor") == 0)
- propInfo._linkColor = engineColor;
- else if (strcmp(confKey, "morecolor") == 0)
- propInfo._moreColor = engineColor;
-
- byte r = (rgb >> 16) & 0xFF;
- byte g = (rgb >> 8) & 0xFF;
- byte b = rgb & 0xFF;
- Common::String rgbStr = Common::String::format("%02x%02x%02x", r, g, b);
- Common::String value = Common::String::format("%s,%s", rgbStr.c_str(), rgbStr.c_str());
- ConfMan.set(confKey, value, domain);
+ int idx = popup->getSelectedTag();
+ unsigned int rgb = 0;
+ bool valid = false;
+
+ if (idx >= 0 && idx <= 5) {
+ rgb = GLK_COLORS[idx].rgb;
+ valid = true;
+ } else if (idx == 6) {
+ Common::String hex = hexInput ? hexInput->getEditString().encode() : Common::String();
+ hex.toLowercase();
+ if (hex.size() == 6) {
+ bool allHex = true;
+ for (char c : hex) {
+ if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f'))) {
+ allHex = false;
+ break;
+ }
+ }
+ if (allHex) {
+ sscanf(hex.c_str(), "%x", &rgb);
+ valid = true;
+ }
+ }
+ } else if (idx == 7) {
+ ConfMan.set(confKey, Common::String(), domain);
+ return;
+ }
+
+ if (!valid)
+ return;
+
+ unsigned int engineColor = g_conf->parseColor(rgb);
+ if (strcmp(confKey, "caretcolor") == 0)
+ propInfo._caretColor = engineColor;
+ else if (strcmp(confKey, "linkcolor") == 0)
+ propInfo._linkColor = engineColor;
+ else if (strcmp(confKey, "morecolor") == 0)
+ propInfo._moreColor = engineColor;
+
+ byte r = (rgb >> 16) & 0xFF;
+ byte g = (rgb >> 8) & 0xFF;
+ byte b = rgb & 0xFF;
+ Common::String rgbStr = Common::String::format("%02x%02x%02x", r, g, b);
+ Common::String value = Common::String::format("%s,%s", rgbStr.c_str(), rgbStr.c_str());
+ ConfMan.set(confKey, value, domain);
}
static void saveIntField(GUI::EditTextWidget *widget, int &outValue, const char *confKey, int minValue, const Common::String &domain) {
- Common::String txt = widget->getEditString().encode();
- int value = txt.empty() ? 0 : atoi(txt.c_str());
- if (value < minValue) value = minValue;
- outValue = value;
- ConfMan.setInt(confKey, value, domain);
+ Common::String txt = widget->getEditString().encode();
+ int value = txt.empty() ? 0 : atoi(txt.c_str());
+ if (value < minValue) value = minValue;
+ outValue = value;
+ ConfMan.setInt(confKey, value, domain);
}
static void saveBoolField(GUI::CheckboxWidget *widget, bool &outValue, const char *confKey, const Common::String &domain) {
- bool value = widget->getState();
- outValue = value;
- ConfMan.setBool(confKey, value, domain);
+ bool value = widget->getState();
+ outValue = value;
+ ConfMan.setBool(confKey, value, domain);
}
static void saveBoolField(GUI::CheckboxWidget *widget, int &outValue, const char *confKey, const Common::String &domain) {
- bool value = widget->getState();
- outValue = value ? 1 : 0;
- ConfMan.setInt(confKey, outValue, domain);
+ bool value = widget->getState();
+ outValue = value ? 1 : 0;
+ ConfMan.setInt(confKey, outValue, domain);
}
static void savePopupField(GUI::PopUpWidget *popup, int &outValue, const char *confKey, const Common::String &domain) {
- int value = popup->getSelectedTag();
- outValue = value;
- ConfMan.setInt(confKey, value, domain);
+ int value = popup->getSelectedTag();
+ outValue = value;
+ ConfMan.setInt(confKey, value, domain);
}
static void saveSliderFloatField(GUI::SliderWidget *widget, double &outValue, const char *confKey, const Common::String &domain) {
- if (!widget) return;
+ if (!widget) return;
- double value = widget->getValue();
- outValue = value;
- ConfMan.setFloat(confKey, value, domain);
+ double value = widget->getValue();
+ outValue = value;
+ ConfMan.setFloat(confKey, value, domain);
}
bool GlkOptionsWidget::save() {
- bool tempConfCreated = false;
- if (!g_conf) {
- tempConfCreated = true;
- // instantiate a global g_conf so the dialog can save values into it
- new Conf(INTERPRETER_GLULX);
- g_conf->load();
- }
-
- BoolOption boolOptions[] = {
- { _safeClicks, nullptr, &g_conf->_safeClicks, "safeclicks" },
- { _styleHint, &g_conf->_styleHint, nullptr, "stylehint" },
- { _lockcols, &g_conf->_lockCols, nullptr, "lockcols" },
- { _lockrows, &g_conf->_lockRows, nullptr, "lockrows" },
- { _justify, &g_conf->_propInfo._justify, nullptr, "justify" },
- { _caps, &g_conf->_propInfo._caps, nullptr, "caps" },
- { _graphics, nullptr, &g_conf->_graphics, "graphics" }
- };
-
- IntOption intOptions[] = {
- { _wmarginx, &g_conf->_wMarginX, "wmarginx", 0 },
- { _wmarginy, &g_conf->_wMarginY, "wmarginy", 0 },
- { _wpaddingx, &g_conf->_wPaddingX, "wpaddingx", 0 },
- { _wpaddingy, &g_conf->_wPaddingY, "wpaddingy", 0 },
- { _tmarginx, &g_conf->_tMarginX, "tmarginx", 0 },
- { _tmarginy, &g_conf->_tMarginY, "tmarginy", 0 },
- { _leading, &g_conf->_monoInfo._leading, "leading", 0 },
- { _baseline, &g_conf->_propInfo._baseLine, "baseline", 0 }
- };
-
- ColorOption colorOptions[] = {
- { _tcolorPopUps[0], _manualTColorHexInput, g_conf->_tStyles, nullptr, "tcolor_0", false },
- { _gcolorPopUps[0], _manualGColorHexInput, g_conf->_gStyles, nullptr, "gcolor_0", false },
- { _wcolorPopUps[0], _manualWColorHexInput, nullptr, nullptr, "windowcolor", false },
- { _bcolorPopUps[0], _manualBColorHexInput, nullptr, nullptr, "bordercolor", false },
- { _ccolorPopUps[0], _manualCColorHexInput, nullptr, &g_conf->_propInfo, "caretcolor", true },
- { _lcolorPopUps[0], _manualLColorHexInput, nullptr, &g_conf->_propInfo, "linkcolor", true },
- { _mcolorPopUps[0], _manualMColorHexInput, nullptr, &g_conf->_propInfo, "morecolor", true }
- };
-
- FontOption fontOptions[] = {
- { _tfontPopUps[0], g_conf->_tStyles, "tfont" },
- { _gfontPopUps[0], g_conf->_gStyles, "gfont" }
- };
-
-
- for (auto &opt : fontOptions)
- saveFontPopUp(opt.popup, opt.styles, opt.confKeyPrefix, _domain);
-
- for (auto &opt : colorOptions) {
- if (opt.isProp)
- savePropColorPopUp(opt.popup, opt.hexInput, *opt.propInfo, opt.confKey, _domain);
- else
- saveColorPopUp(opt.popup, opt.hexInput, opt.styles, opt.confKey, _domain);
- }
-
- for (auto &opt : intOptions)
- if (opt.widget) saveIntField(opt.widget, *opt.target, opt.confKey, opt.minValue, _domain);
-
- saveSliderFloatField(_monosize, g_conf->_monoInfo._size, "monosize", _domain);
- saveSliderFloatField(_propsize, g_conf->_propInfo._size, "propsize", _domain);
-
- for (auto &opt : boolOptions) {
- if (opt.widget) {
- if (opt.targetBool)
- saveBoolField(opt.widget, *opt.targetBool, opt.confKey, _domain);
- else if (opt.targetInt)
- saveBoolField(opt.widget, *opt.targetInt, opt.confKey, _domain);
- }
- }
-
- g_conf->_propInfo._leading = g_conf->_monoInfo._leading;
- g_conf->_monoInfo._baseLine = g_conf->_propInfo._baseLine;
-
- Common::String WHexStr = _manualWColorHexInput->getEditString().encode();
- Common::String BHexStr = _manualBColorHexInput->getEditString().encode();
- Common::String bordStrx = _wborderx->getEditString().encode();
- Common::String bordStry = _wbordery->getEditString().encode();
- Common::String morepromptStr = _morePrompt->getEditString().encode();
- Common::String colsStr = _cols->getEditString().encode();
- Common::String rowsStr = _rows->getEditString().encode();
-
-
- int wIdx = _wcolorPopUps[0]->getSelectedTag();
-
- if (wIdx == 7) {
- // user chose to return control to the game
- g_conf->_windowColorOverride = false;
- ConfMan.setBool("windowcolor_override", false, _domain);
- // revert the stored colour to the original saved value. the game may immediately overwrite it
- // when it sends its next colour command.
- g_conf->_windowColor = g_conf->_windowSave;
- g_conf->_borderColor = g_conf->_borderSave;
- // clear global override so that next colour command from the game (or the existing _windowColor)
- // determines what is shown
- Windows::_overrideBgSet = false;
- } else {
- // any other selection does a manual override
- g_conf->_windowColorOverride = true;
- ConfMan.setBool("windowcolor_override", true, _domain);
- Windows::_overrideBgSet = true;
-
- if (wIdx == 6) {
- if (WHexStr.size() == 6) {
- unsigned int rgb;
- sscanf(WHexStr.c_str(), "%x", &rgb);
- unsigned int engineColor = g_conf->parseColor(rgb);
- byte r = (rgb >> 16) & 0xFF;
- byte g = (rgb >> 8) & 0xFF;
- byte b = rgb & 0xFF;
- Common::String rgbStr = Common::String::format("%02x%02x%02x", r, g, b);
-
- g_conf->_windowColor = engineColor;
- ConfMan.set("windowcolor", rgbStr, _domain);
- }
- } else if (_wcolorPopUps[0]) {
- int idx = _wcolorPopUps[0]->getSelectedTag();
- if (idx >= 0 && idx <= 5) {
- unsigned int engineColor = g_conf->parseColor(GLK_COLORS[idx].rgb);
- g_conf->_windowColor = engineColor;
- byte r = (GLK_COLORS[idx].rgb >> 16) & 0xFF;
- byte g = (GLK_COLORS[idx].rgb >> 8) & 0xFF;
- byte b = GLK_COLORS[idx].rgb & 0xFF;
- Common::String rgbStr = Common::String::format("%02x%02x%02x", r, g, b);
- ConfMan.set("windowcolor", rgbStr, _domain);
- }
- }
- }
-
- int bIdx = _bcolorPopUps[0]->getSelectedTag();
-
- if (bIdx == 7) {
- g_conf->_borderColorOverride = false;
- ConfMan.setBool("bordercolor_override", false, _domain);
-
- g_conf->_windowColor = g_conf->_windowSave;
- g_conf->_borderColor = g_conf->_borderSave;
-
- Windows::_overrideBgSet = false;
- } else {
- g_conf->_borderColorOverride = true;
- ConfMan.setBool("bordercolor_override", true, _domain);
- Windows::_overrideBgSet = true;
-
- if (bIdx == 6) {
- if (BHexStr.size() == 6) {
- unsigned int rgb;
- sscanf(BHexStr.c_str(), "%x", &rgb);
- unsigned int engineColor = g_conf->parseColor(rgb);
- byte r = (rgb >> 16) & 0xFF;
- byte g = (rgb >> 8) & 0xFF;
- byte b = rgb & 0xFF;
- Common::String rgbStr = Common::String::format("%02x%02x%02x", r, g, b);
-
- g_conf->_borderColor = engineColor;
- ConfMan.set("bordercolor", rgbStr, _domain);
- }
- } else if (_bcolorPopUps[0]) {
- int idx = _bcolorPopUps[0]->getSelectedTag();
- if (idx >= 0 && idx <= 5) {
- unsigned int engineColor = g_conf->parseColor(GLK_COLORS[idx].rgb);
- g_conf->_borderColor = engineColor;
- byte r = (GLK_COLORS[idx].rgb >> 16) & 0xFF;
- byte g = (GLK_COLORS[idx].rgb >> 8) & 0xFF;
- byte b = GLK_COLORS[idx].rgb & 0xFF;
- Common::String rgbStr = Common::String::format("%02x%02x%02x", r, g, b);
- ConfMan.set("bordercolor", rgbStr, _domain);
- }
- }
- }
-
- int bordx = bordStrx.empty() ? 0 : atoi(bordStrx.c_str());
- if (bordx < 0)
- bordx = 0;
-
- g_conf->_wBorderX = bordx;
- ConfMan.setInt("wborderx", bordx, _domain);
-
- int bordy = bordStry.empty() ? 0 : atoi(bordStry.c_str());
- if (bordy < 0)
- bordy = 0;
- g_conf->_wBorderY = bordy;
- ConfMan.setInt("wbordery", bordy, _domain);
-
-
- if (_linkStyle) {
- savePopupField(_linkStyle, g_conf->_propInfo._linkStyle, "linkstyle", _domain);
- g_conf->_monoInfo._linkStyle = g_conf->_propInfo._linkStyle;
- }
-
- if (_caretShape) {
- savePopupField(_caretShape, g_conf->_propInfo._caretShape, "caretShape", _domain);
- g_conf->_monoInfo._caretShape = g_conf->_propInfo._caretShape;
- }
-
- g_conf->_propInfo._morePrompt = morepromptStr;
- ConfMan.set("moreprompt", morepromptStr, _domain);
-
- if (_cols) {
- int cols = colsStr.empty() ? 0 : atoi(colsStr.c_str());
- g_conf->_cols = cols;
- ConfMan.setInt("cols", cols, _domain);
- }
-
- if (_rows) {
- int rows = rowsStr.empty() ? 0 : atoi(rowsStr.c_str());
- g_conf->_rows = rows;
- ConfMan.setInt("rows", rows, _domain);
- }
-
- if (_quotes)
- savePopupField(_quotes, g_conf->_propInfo._quotes, "quotes", _domain);
-
- if (_dashes)
- savePopupField(_dashes, g_conf->_propInfo._dashes, "dashes", _domain);
-
- if (_spaces)
- savePopupField(_spaces, g_conf->_propInfo._spaces, "spaces", _domain);
-
-
- if (_morealign) {
- int x = _morealign->getSelectedTag();
- g_conf->_propInfo._moreAlign = x;
- ConfMan.setInt("morealign", x, _domain);
- }
-
- if (_morefont) {
- FACES tf = (FACES)_morefont->getSelectedTag();
- g_conf->_propInfo._moreFont = tf;
- ConfMan.set("morefont", Screen::getFontName(tf), _domain);
- }
-
-
- if (g_vm) {
- if (g_vm->_screen)
- g_vm->_screen->initialize();
-
- if (g_vm->_windows) {
- g_vm->_windows->rearrange();
-
- for (Glk::Windows::iterator it = g_vm->_windows->begin(); it != g_vm->_windows->end(); ++it) {
- Glk::Window *w = *it;
- if (auto tb = dynamic_cast<Glk::TextBufferWindow *>(w))
- tb->refreshStyles();
- else if (auto tg = dynamic_cast<Glk::TextGridWindow *>(w))
- tg->refreshStyles();
- }
- g_vm->_windows->_forceRedraw = true;
- }
-
- if (g_vm->_events)
- g_vm->_events->redraw();
- }
-
- if (tempConfCreated)
- delete g_conf;
-
- return true;
+ bool tempConfCreated = false;
+ if (!g_conf) {
+ tempConfCreated = true;
+ // instantiate a global g_conf so the dialog can save values into it
+ new Conf(INTERPRETER_GLULX);
+ g_conf->load();
+ }
+
+ BoolOption boolOptions[] = {
+ { _safeClicks, nullptr, &g_conf->_safeClicks, "safeclicks" },
+ { _styleHint, &g_conf->_styleHint, nullptr, "stylehint" },
+ { _lockcols, &g_conf->_lockCols, nullptr, "lockcols" },
+ { _lockrows, &g_conf->_lockRows, nullptr, "lockrows" },
+ { _justify, &g_conf->_propInfo._justify, nullptr, "justify" },
+ { _caps, &g_conf->_propInfo._caps, nullptr, "caps" },
+ { _graphics, nullptr, &g_conf->_graphics, "graphics" }
+ };
+
+ IntOption intOptions[] = {
+ { _wmarginx, &g_conf->_wMarginX, "wmarginx", 0 },
+ { _wmarginy, &g_conf->_wMarginY, "wmarginy", 0 },
+ { _wpaddingx, &g_conf->_wPaddingX, "wpaddingx", 0 },
+ { _wpaddingy, &g_conf->_wPaddingY, "wpaddingy", 0 },
+ { _tmarginx, &g_conf->_tMarginX, "tmarginx", 0 },
+ { _tmarginy, &g_conf->_tMarginY, "tmarginy", 0 },
+ { _leading, &g_conf->_monoInfo._leading, "leading", 0 },
+ { _baseline, &g_conf->_propInfo._baseLine, "baseline", 0 }
+ };
+
+ ColorOption colorOptions[] = {
+ { _tcolorPopUps[0], _manualTColorHexInput, g_conf->_tStyles, nullptr, "tcolor_0", false },
+ { _gcolorPopUps[0], _manualGColorHexInput, g_conf->_gStyles, nullptr, "gcolor_0", false },
+ { _wcolorPopUps[0], _manualWColorHexInput, nullptr, nullptr, "windowcolor", false },
+ { _bcolorPopUps[0], _manualBColorHexInput, nullptr, nullptr, "bordercolor", false },
+ { _ccolorPopUps[0], _manualCColorHexInput, nullptr, &g_conf->_propInfo, "caretcolor", true },
+ { _lcolorPopUps[0], _manualLColorHexInput, nullptr, &g_conf->_propInfo, "linkcolor", true },
+ { _mcolorPopUps[0], _manualMColorHexInput, nullptr, &g_conf->_propInfo, "morecolor", true }
+ };
+
+ FontOption fontOptions[] = {
+ { _tfontPopUps[0], g_conf->_tStyles, "tfont" },
+ { _gfontPopUps[0], g_conf->_gStyles, "gfont" }
+ };
+
+
+ for (auto &opt : fontOptions)
+ saveFontPopUp(opt.popup, opt.styles, opt.confKeyPrefix, _domain);
+
+ for (auto &opt : colorOptions) {
+ if (opt.isProp)
+ savePropColorPopUp(opt.popup, opt.hexInput, *opt.propInfo, opt.confKey, _domain);
+ else
+ saveColorPopUp(opt.popup, opt.hexInput, opt.styles, opt.confKey, _domain);
+ }
+
+ for (auto &opt : intOptions)
+ if (opt.widget) saveIntField(opt.widget, *opt.target, opt.confKey, opt.minValue, _domain);
+
+ saveSliderFloatField(_monosize, g_conf->_monoInfo._size, "monosize", _domain);
+ saveSliderFloatField(_propsize, g_conf->_propInfo._size, "propsize", _domain);
+
+ for (auto &opt : boolOptions) {
+ if (opt.widget) {
+ if (opt.targetBool)
+ saveBoolField(opt.widget, *opt.targetBool, opt.confKey, _domain);
+ else if (opt.targetInt)
+ saveBoolField(opt.widget, *opt.targetInt, opt.confKey, _domain);
+ }
+ }
+
+ g_conf->_propInfo._leading = g_conf->_monoInfo._leading;
+ g_conf->_monoInfo._baseLine = g_conf->_propInfo._baseLine;
+
+ Common::String WHexStr = _manualWColorHexInput->getEditString().encode();
+ Common::String BHexStr = _manualBColorHexInput->getEditString().encode();
+ Common::String bordStrx = _wborderx->getEditString().encode();
+ Common::String bordStry = _wbordery->getEditString().encode();
+ Common::String morepromptStr = _morePrompt->getEditString().encode();
+ Common::String colsStr = _cols->getEditString().encode();
+ Common::String rowsStr = _rows->getEditString().encode();
+
+
+ int wIdx = _wcolorPopUps[0]->getSelectedTag();
+
+ if (wIdx == 7) {
+ // user chose to return control to the game
+ g_conf->_windowColorOverride = false;
+ ConfMan.setBool("windowcolor_override", false, _domain);
+ // revert the stored colour to the original saved value. the game may immediately overwrite it
+ // when it sends its next colour command.
+ g_conf->_windowColor = g_conf->_windowSave;
+ g_conf->_borderColor = g_conf->_borderSave;
+ // clear global override so that next colour command from the game (or the existing _windowColor)
+ // determines what is shown
+ Windows::_overrideBgSet = false;
+ } else {
+ // any other selection does a manual override
+ g_conf->_windowColorOverride = true;
+ ConfMan.setBool("windowcolor_override", true, _domain);
+ Windows::_overrideBgSet = true;
+
+ if (wIdx == 6) {
+ if (WHexStr.size() == 6) {
+ unsigned int rgb;
+ sscanf(WHexStr.c_str(), "%x", &rgb);
+ unsigned int engineColor = g_conf->parseColor(rgb);
+ byte r = (rgb >> 16) & 0xFF;
+ byte g = (rgb >> 8) & 0xFF;
+ byte b = rgb & 0xFF;
+ Common::String rgbStr = Common::String::format("%02x%02x%02x", r, g, b);
+
+ g_conf->_windowColor = engineColor;
+ ConfMan.set("windowcolor", rgbStr, _domain);
+ }
+ } else if (_wcolorPopUps[0]) {
+ int idx = _wcolorPopUps[0]->getSelectedTag();
+ if (idx >= 0 && idx <= 5) {
+ unsigned int engineColor = g_conf->parseColor(GLK_COLORS[idx].rgb);
+ g_conf->_windowColor = engineColor;
+ byte r = (GLK_COLORS[idx].rgb >> 16) & 0xFF;
+ byte g = (GLK_COLORS[idx].rgb >> 8) & 0xFF;
+ byte b = GLK_COLORS[idx].rgb & 0xFF;
+ Common::String rgbStr = Common::String::format("%02x%02x%02x", r, g, b);
+ ConfMan.set("windowcolor", rgbStr, _domain);
+ }
+ }
+ }
+
+ int bIdx = _bcolorPopUps[0]->getSelectedTag();
+
+ if (bIdx == 7) {
+ g_conf->_borderColorOverride = false;
+ ConfMan.setBool("bordercolor_override", false, _domain);
+
+ g_conf->_windowColor = g_conf->_windowSave;
+ g_conf->_borderColor = g_conf->_borderSave;
+
+ Windows::_overrideBgSet = false;
+ } else {
+ g_conf->_borderColorOverride = true;
+ ConfMan.setBool("bordercolor_override", true, _domain);
+ Windows::_overrideBgSet = true;
+
+ if (bIdx == 6) {
+ if (BHexStr.size() == 6) {
+ unsigned int rgb;
+ sscanf(BHexStr.c_str(), "%x", &rgb);
+ unsigned int engineColor = g_conf->parseColor(rgb);
+ byte r = (rgb >> 16) & 0xFF;
+ byte g = (rgb >> 8) & 0xFF;
+ byte b = rgb & 0xFF;
+ Common::String rgbStr = Common::String::format("%02x%02x%02x", r, g, b);
+
+ g_conf->_borderColor = engineColor;
+ ConfMan.set("bordercolor", rgbStr, _domain);
+ }
+ } else if (_bcolorPopUps[0]) {
+ int idx = _bcolorPopUps[0]->getSelectedTag();
+ if (idx >= 0 && idx <= 5) {
+ unsigned int engineColor = g_conf->parseColor(GLK_COLORS[idx].rgb);
+ g_conf->_borderColor = engineColor;
+ byte r = (GLK_COLORS[idx].rgb >> 16) & 0xFF;
+ byte g = (GLK_COLORS[idx].rgb >> 8) & 0xFF;
+ byte b = GLK_COLORS[idx].rgb & 0xFF;
+ Common::String rgbStr = Common::String::format("%02x%02x%02x", r, g, b);
+ ConfMan.set("bordercolor", rgbStr, _domain);
+ }
+ }
+ }
+
+ int bordx = bordStrx.empty() ? 0 : atoi(bordStrx.c_str());
+ if (bordx < 0)
+ bordx = 0;
+
+ g_conf->_wBorderX = bordx;
+ ConfMan.setInt("wborderx", bordx, _domain);
+
+ int bordy = bordStry.empty() ? 0 : atoi(bordStry.c_str());
+ if (bordy < 0)
+ bordy = 0;
+ g_conf->_wBorderY = bordy;
+ ConfMan.setInt("wbordery", bordy, _domain);
+
+
+ if (_linkStyle) {
+ savePopupField(_linkStyle, g_conf->_propInfo._linkStyle, "linkstyle", _domain);
+ g_conf->_monoInfo._linkStyle = g_conf->_propInfo._linkStyle;
+ }
+
+ if (_caretShape) {
+ savePopupField(_caretShape, g_conf->_propInfo._caretShape, "caretShape", _domain);
+ g_conf->_monoInfo._caretShape = g_conf->_propInfo._caretShape;
+ }
+
+ g_conf->_propInfo._morePrompt = morepromptStr;
+ ConfMan.set("moreprompt", morepromptStr, _domain);
+
+ if (_cols) {
+ int cols = colsStr.empty() ? 0 : atoi(colsStr.c_str());
+ g_conf->_cols = cols;
+ ConfMan.setInt("cols", cols, _domain);
+ }
+
+ if (_rows) {
+ int rows = rowsStr.empty() ? 0 : atoi(rowsStr.c_str());
+ g_conf->_rows = rows;
+ ConfMan.setInt("rows", rows, _domain);
+ }
+
+ if (_quotes)
+ savePopupField(_quotes, g_conf->_propInfo._quotes, "quotes", _domain);
+
+ if (_dashes)
+ savePopupField(_dashes, g_conf->_propInfo._dashes, "dashes", _domain);
+
+ if (_spaces)
+ savePopupField(_spaces, g_conf->_propInfo._spaces, "spaces", _domain);
+
+
+ if (_morealign) {
+ int x = _morealign->getSelectedTag();
+ g_conf->_propInfo._moreAlign = x;
+ ConfMan.setInt("morealign", x, _domain);
+ }
+
+ if (_morefont) {
+ FACES tf = (FACES)_morefont->getSelectedTag();
+ g_conf->_propInfo._moreFont = tf;
+ ConfMan.set("morefont", Screen::getFontName(tf), _domain);
+ }
+
+
+ if (g_vm) {
+ if (g_vm->_screen)
+ g_vm->_screen->initialize();
+
+ if (g_vm->_windows) {
+ g_vm->_windows->rearrange();
+
+ for (Glk::Windows::iterator it = g_vm->_windows->begin(); it != g_vm->_windows->end(); ++it) {
+ Glk::Window *w = *it;
+ if (auto tb = dynamic_cast<Glk::TextBufferWindow *>(w))
+ tb->refreshStyles();
+ else if (auto tg = dynamic_cast<Glk::TextGridWindow *>(w))
+ tg->refreshStyles();
+ }
+ g_vm->_windows->_forceRedraw = true;
+ }
+
+ if (g_vm->_events)
+ g_vm->_events->redraw();
+ }
+
+ if (tempConfCreated)
+ delete g_conf;
+
+ return true;
}
static void setManualColorHex(GUI::PopUpWidget *popup, GUI::EditTextWidget *hexInput) {
- int idx = popup->getSelectedTag();
+ int idx = popup->getSelectedTag();
- byte r = (GLK_COLORS[idx].rgb >> 16) & 0xFF;
- byte g = (GLK_COLORS[idx].rgb >> 8) & 0xFF;
- byte b = GLK_COLORS[idx].rgb & 0xFF;
- hexInput->setEditString(Common::U32String(Common::String::format("%02X%02X%02X", r, g, b)));
+ byte r = (GLK_COLORS[idx].rgb >> 16) & 0xFF;
+ byte g = (GLK_COLORS[idx].rgb >> 8) & 0xFF;
+ byte b = GLK_COLORS[idx].rgb & 0xFF;
+ hexInput->setEditString(Common::U32String(Common::String::format("%02X%02X%02X", r, g, b)));
}
static void setColorPopupFromHex(GUI::PopUpWidget *popup, GUI::EditTextWidget *hexInput) {
- Common::String hex = hexInput->getEditString().encode();
- if (hex.size() != 6)
- return;
-
- unsigned int rgb;
- if (sscanf(hex.c_str(), "%x", &rgb) != 1)
- return;
-
- bool found = false;
- for (int i = 0; i <= 5; ++i) {
- if (GLK_COLORS[i].rgb == rgb) {
- popup->setSelectedTag(i);
- found = true;
- break;
- }
- }
-
- if (!found)
- popup->setSelectedTag(6);
-
- popup->markAsDirty();
+ Common::String hex = hexInput->getEditString().encode();
+ if (hex.size() != 6)
+ return;
+
+ unsigned int rgb;
+ if (sscanf(hex.c_str(), "%x", &rgb) != 1)
+ return;
+
+ bool found = false;
+ for (int i = 0; i <= 5; ++i) {
+ if (GLK_COLORS[i].rgb == rgb) {
+ popup->setSelectedTag(i);
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ popup->setSelectedTag(6);
+
+ popup->markAsDirty();
}
void GlkOptionsWidget::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
- // Update the hex field to match the color chosen from the color popup
- if (cmd == kTColorChangedCmd) {
- setManualColorHex(_tcolorPopUps[0], _manualTColorHexInput);
- save();
- return;
- } else if (cmd == kGColorChangedCmd) {
- setManualColorHex(_gcolorPopUps[0], _manualGColorHexInput);
- save();
- return;
- } else if (cmd == kWColorChangedCmd) {
- setManualColorHex(_wcolorPopUps[0], _manualWColorHexInput);
- save();
- return;
- } else if (cmd == kBColorChangedCmd) {
- setManualColorHex(_bcolorPopUps[0], _manualBColorHexInput);
- save();
- return;
- } else if (cmd == kCColorChangedCmd) {
- setManualColorHex(_ccolorPopUps[0], _manualCColorHexInput);
- save();
- return;
- } else if (cmd == kLColorChangedCmd) {
- setManualColorHex(_lcolorPopUps[0], _manualLColorHexInput);
- save();
- return;
- } else if (cmd == kMColorChangedCmd) {
- setManualColorHex(_mcolorPopUps[0], _manualMColorHexInput);
- save();
- return;
- } else if (cmd == kTHexChangedCmd) { // hex input â popup sync
- setColorPopupFromHex(_tcolorPopUps[0], _manualTColorHexInput);
- save();
- return;
- } else if (cmd == kGHexChangedCmd) {
- setColorPopupFromHex(_gcolorPopUps[0], _manualGColorHexInput);
- save();
- return;
- } else if (cmd == kWHexChangedCmd) {
- setColorPopupFromHex(_wcolorPopUps[0], _manualWColorHexInput);
- save();
- return;
- } else if (cmd == kBHexChangedCmd) {
- setColorPopupFromHex(_bcolorPopUps[0], _manualBColorHexInput);
- save();
- return;
- } else if (cmd == kCHexChangedCmd) {
- setColorPopupFromHex(_ccolorPopUps[0], _manualCColorHexInput);
- save();
- return;
- } else if (cmd == kLHexChangedCmd) {
- setColorPopupFromHex(_lcolorPopUps[0], _manualLColorHexInput);
- save();
- return;
- } else if (cmd == kMHexChangedCmd) {
- setColorPopupFromHex(_mcolorPopUps[0], _manualMColorHexInput);
- save();
- return;
- } else if (cmd == kMonoSizeCmd) {
- _monosizeVal->setValue(_monosize->getValue());
- _monosizeVal->markAsDirty();
- return;
- } else if (cmd == kPropSizeCmd) {
- _propsizeVal->setValue(_propsize->getValue());
- _propsizeVal->markAsDirty();
- return;
- }
-
- OptionsContainerWidget::handleCommand(sender, cmd, data);
+ // Update the hex field to match the color chosen from the color popup
+ if (cmd == kTColorChangedCmd) {
+ setManualColorHex(_tcolorPopUps[0], _manualTColorHexInput);
+ save();
+ return;
+ } else if (cmd == kGColorChangedCmd) {
+ setManualColorHex(_gcolorPopUps[0], _manualGColorHexInput);
+ save();
+ return;
+ } else if (cmd == kWColorChangedCmd) {
+ setManualColorHex(_wcolorPopUps[0], _manualWColorHexInput);
+ save();
+ return;
+ } else if (cmd == kBColorChangedCmd) {
+ setManualColorHex(_bcolorPopUps[0], _manualBColorHexInput);
+ save();
+ return;
+ } else if (cmd == kCColorChangedCmd) {
+ setManualColorHex(_ccolorPopUps[0], _manualCColorHexInput);
+ save();
+ return;
+ } else if (cmd == kLColorChangedCmd) {
+ setManualColorHex(_lcolorPopUps[0], _manualLColorHexInput);
+ save();
+ return;
+ } else if (cmd == kMColorChangedCmd) {
+ setManualColorHex(_mcolorPopUps[0], _manualMColorHexInput);
+ save();
+ return;
+ } else if (cmd == kTHexChangedCmd) { // hex input â popup sync
+ setColorPopupFromHex(_tcolorPopUps[0], _manualTColorHexInput);
+ save();
+ return;
+ } else if (cmd == kGHexChangedCmd) {
+ setColorPopupFromHex(_gcolorPopUps[0], _manualGColorHexInput);
+ save();
+ return;
+ } else if (cmd == kWHexChangedCmd) {
+ setColorPopupFromHex(_wcolorPopUps[0], _manualWColorHexInput);
+ save();
+ return;
+ } else if (cmd == kBHexChangedCmd) {
+ setColorPopupFromHex(_bcolorPopUps[0], _manualBColorHexInput);
+ save();
+ return;
+ } else if (cmd == kCHexChangedCmd) {
+ setColorPopupFromHex(_ccolorPopUps[0], _manualCColorHexInput);
+ save();
+ return;
+ } else if (cmd == kLHexChangedCmd) {
+ setColorPopupFromHex(_lcolorPopUps[0], _manualLColorHexInput);
+ save();
+ return;
+ } else if (cmd == kMHexChangedCmd) {
+ setColorPopupFromHex(_mcolorPopUps[0], _manualMColorHexInput);
+ save();
+ return;
+ } else if (cmd == kMonoSizeCmd) {
+ _monosizeVal->setValue(_monosize->getValue());
+ _monosizeVal->markAsDirty();
+ return;
+ } else if (cmd == kPropSizeCmd) {
+ _propsizeVal->setValue(_propsize->getValue());
+ _propsizeVal->markAsDirty();
+ return;
+ }
+
+ OptionsContainerWidget::handleCommand(sender, cmd, data);
}
} // End of namespace Glk
Commit: e04e7faf28f956fd011e02f6f6127a824f4f2f29
https://github.com/scummvm/scummvm/commit/e04e7faf28f956fd011e02f6f6127a824f4f2f29
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-04-06T18:13:11+02:00
Commit Message:
GLK: Fix crash when custom color option is selected
Changed paths:
engines/glk/dialogs.cpp
diff --git a/engines/glk/dialogs.cpp b/engines/glk/dialogs.cpp
index 317e20a968f..cf21164e40e 100644
--- a/engines/glk/dialogs.cpp
+++ b/engines/glk/dialogs.cpp
@@ -1246,9 +1246,12 @@ bool GlkOptionsWidget::save() {
static void setManualColorHex(GUI::PopUpWidget *popup, GUI::EditTextWidget *hexInput) {
int idx = popup->getSelectedTag();
+ if (idx < 0 || idx > 5)
+ return;
+
byte r = (GLK_COLORS[idx].rgb >> 16) & 0xFF;
- byte g = (GLK_COLORS[idx].rgb >> 8) & 0xFF;
- byte b = GLK_COLORS[idx].rgb & 0xFF;
+ byte g = (GLK_COLORS[idx].rgb >> 8) & 0xFF;
+ byte b = (GLK_COLORS[idx].rgb & 0xFF);
hexInput->setEditString(Common::U32String(Common::String::format("%02X%02X%02X", r, g, b)));
}
Commit: 43db60276aba7452576097cc42dbac96e297096a
https://github.com/scummvm/scummvm/commit/43db60276aba7452576097cc42dbac96e297096a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-04-06T18:13:11+02:00
Commit Message:
GUI: Bump theme version
Changed paths:
gui/ThemeEngine.h
gui/themes/residualvm/THEMERC
gui/themes/scummclassic/THEMERC
gui/themes/scummmodern/THEMERC
gui/themes/scummremastered/THEMERC
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 338e0f491cc..eba9e29cf04 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -36,7 +36,7 @@
#include "graphics/pixelformat.h"
-#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.9.21"
+#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.9.22"
class OSystem;
diff --git a/gui/themes/residualvm/THEMERC b/gui/themes/residualvm/THEMERC
index 4441cf2078e..a89a97066f7 100644
--- a/gui/themes/residualvm/THEMERC
+++ b/gui/themes/residualvm/THEMERC
@@ -1,3 +1,3 @@
-[SCUMMVM_STX0.9.21:ResidualVM Modern Theme Remastered:No Author]
+[SCUMMVM_STX0.9.22:ResidualVM Modern Theme Remastered:No Author]
%using ../common
%using ../common-svg
diff --git a/gui/themes/scummclassic/THEMERC b/gui/themes/scummclassic/THEMERC
index 5fb66fa9a3b..433b25c75f0 100644
--- a/gui/themes/scummclassic/THEMERC
+++ b/gui/themes/scummclassic/THEMERC
@@ -1 +1 @@
-[SCUMMVM_STX0.9.21:ScummVM Classic Theme:No Author]
+[SCUMMVM_STX0.9.22:ScummVM Classic Theme:No Author]
diff --git a/gui/themes/scummmodern/THEMERC b/gui/themes/scummmodern/THEMERC
index c82ed30005a..a8ff598f81a 100644
--- a/gui/themes/scummmodern/THEMERC
+++ b/gui/themes/scummmodern/THEMERC
@@ -1,2 +1,2 @@
-[SCUMMVM_STX0.9.21:ScummVM Modern Theme:No Author]
+[SCUMMVM_STX0.9.22:ScummVM Modern Theme:No Author]
%using ../common
diff --git a/gui/themes/scummremastered/THEMERC b/gui/themes/scummremastered/THEMERC
index fee52be42ee..3c2b6baa640 100644
--- a/gui/themes/scummremastered/THEMERC
+++ b/gui/themes/scummremastered/THEMERC
@@ -1,3 +1,3 @@
-[SCUMMVM_STX0.9.21:ScummVM Modern Theme Remastered:No Author]
+[SCUMMVM_STX0.9.22:ScummVM Modern Theme Remastered:No Author]
%using ../common
%using ../common-svg
Commit: a6184d7877056cf126758ed2eb18f5c28ae31365
https://github.com/scummvm/scummvm/commit/a6184d7877056cf126758ed2eb18f5c28ae31365
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-04-06T18:13:11+02:00
Commit Message:
GUI: Regenerate themes
Changed paths:
gui/themes/default.inc
gui/themes/residualvm.zip
gui/themes/scummclassic.zip
gui/themes/scummmodern.zip
gui/themes/scummremastered.zip
diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index 3f632b8dd75..00deb393158 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -1448,6 +1448,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"<def var='TabWidget.TitleSpacing' value='10' scalable='yes'/>"
"<def var='RichTextWidget.InnerMargin' value='10' scalable='yes'/>"
"<def var='Layout.Spacing' value='8' scalable='yes'/>"
+"<def var='GlkOptionsDialog.HeadingMinGap' value='2'/>"
"<def var='ShowLauncherLogo' value='0'/>"
"<def var='ShowGlobalMenuLogo' value='0'/>"
"<def var='ShowSearchPic' value='0'/>"
@@ -3899,6 +3900,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"<def var='TabWidget.TitleSpacing' value='10' scalable='yes'/>"
"<def var='RichTextWidget.InnerMargin' value='10' scalable='yes'/>"
"<def var='Layout.Spacing' value='8' scalable='yes'/>"
+"<def var='GlkOptionsDialog.HeadingMinGap' value='2'/>"
"<def var='ShowLauncherLogo' value='0'/>"
"<def var='ShowGlobalMenuLogo' value='0'/>"
"<def var='ShowSearchPic' value='0'/>"
diff --git a/gui/themes/residualvm.zip b/gui/themes/residualvm.zip
index b7d36ba4f12..08d43e5f105 100644
Binary files a/gui/themes/residualvm.zip and b/gui/themes/residualvm.zip differ
diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index 266a3bc46ee..2f2df889c07 100644
Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index f0a0ac50dc1..b4a333f2f34 100644
Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ
diff --git a/gui/themes/scummremastered.zip b/gui/themes/scummremastered.zip
index 07674bc1af9..5391be7e260 100644
Binary files a/gui/themes/scummremastered.zip and b/gui/themes/scummremastered.zip differ
Commit: b9722eb04fb2675ce62a79e2e0dd75725348fdf0
https://github.com/scummvm/scummvm/commit/b9722eb04fb2675ce62a79e2e0dd75725348fdf0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-04-06T18:13:12+02:00
Commit Message:
GLK: Made font names translatable
Changed paths:
engines/glk/dialogs.cpp
diff --git a/engines/glk/dialogs.cpp b/engines/glk/dialogs.cpp
index cf21164e40e..d127471f3fc 100644
--- a/engines/glk/dialogs.cpp
+++ b/engines/glk/dialogs.cpp
@@ -191,7 +191,16 @@ static GUI::StaticTextWidget *createHeading(GUI::GuiObject *boss, const char *id
GlkOptionsWidget::GlkOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain)
: GUI::OptionsContainerWidget(boss, name, "GlkOptionsDialog", domain) {
- static const char *fontLabels[] = { "Monospace Regular", "Monospace Bold", "Monospace Italic", "Monospace Bold Italic", "Proportional Regular", "Proportional Bold", "Proportional Italic", "Proportional Bold Italic" };
+ static const char *fontLabels[] = {
+ _s("Monospace Regular"),
+ _s("Monospace Bold"),
+ _s("Monospace Italic"),
+ _s("Monospace Bold Italic"),
+ _s("Proportional Regular"),
+ _s("Proportional Bold"),
+ _s("Proportional Italic"),
+ _s("Proportional Bold Italic"),
+ };
for (int f = MONOR; f <= PROPZ; ++f) {
_tfontPopUps[f] = nullptr;
@@ -202,11 +211,11 @@ GlkOptionsWidget::GlkOptionsWidget(GuiObject *boss, const Common::String &name,
NEW_LABEL_POPUP("GlkOptionsDialog.TFont", _s("Text:"), _tfontPopUps[0], "GlkOptionsDialog.TFont0", _s("Font for the text"));
for (int f = MONOR; f <= PROPZ; ++f)
- _tfontPopUps[0]->appendEntry(fontLabels[f], f);
+ _tfontPopUps[0]->appendEntry(_(fontLabels[f]), f);
NEW_LABEL_POPUP("GlkOptionsDialog.GFont", _s("Grid:"), _gfontPopUps[0], "GlkOptionsDialog.GFont0", _s("Font for drawn graphics like maps, diagrams, puzzles, etc"));
for (int f = MONOR; f <= PROPZ; ++f)
- _gfontPopUps[0]->appendEntry(fontLabels[f], f);
+ _gfontPopUps[0]->appendEntry(_(fontLabels[f]), f);
_colorHeadinglbl = createHeading(widgetsBoss(), "GlkOptionsDialog.ColorHeading", "Color");
@@ -329,7 +338,7 @@ GlkOptionsWidget::GlkOptionsWidget(GuiObject *boss, const Common::String &name,
NEW_LABEL_POPUP("GlkOptionsDialog.morefontlbl", _s("Font:"), _morefont, "GlkOptionsDialog.morefont", _s("Font for the \"More...\" marker"));
for (int f = MONOR; f <= PROPZ; ++f)
- _morefont->appendEntry(fontLabels[f], f);
+ _morefont->appendEntry(_(fontLabels[f]), f);
}
@@ -1246,12 +1255,12 @@ bool GlkOptionsWidget::save() {
static void setManualColorHex(GUI::PopUpWidget *popup, GUI::EditTextWidget *hexInput) {
int idx = popup->getSelectedTag();
- if (idx < 0 || idx > 5)
- return;
+ if (idx < 0 || idx > 5)
+ return;
byte r = (GLK_COLORS[idx].rgb >> 16) & 0xFF;
byte g = (GLK_COLORS[idx].rgb >> 8) & 0xFF;
- byte b = (GLK_COLORS[idx].rgb & 0xFF);
+ byte b = (GLK_COLORS[idx].rgb & 0xFF);
hexInput->setEditString(Common::U32String(Common::String::format("%02X%02X%02X", r, g, b)));
}
More information about the Scummvm-git-logs
mailing list