centralized some dialog constants

This commit is contained in:
thrust26 2020-12-27 19:00:28 +01:00
parent 3edc5aafe8
commit 7d0b15e01c
32 changed files with 435 additions and 499 deletions

View File

@ -35,15 +35,14 @@ CheatCodeDialog::CheatCodeDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font) const GUI::Font& font)
: Dialog(osystem, parent, font, "Cheat codes") : Dialog(osystem, parent, font, "Cheat codes")
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = font.getFontHeight(), fontHeight = Dialog::fontHeight(),
fontWidth = font.getMaxCharWidth(), fontWidth = Dialog::fontWidth(),
buttonWidth = font.getStringWidth("One shot ") + fontWidth * 2.5, buttonHeight = Dialog::buttonHeight(),
buttonHeight = font.getLineHeight() * 1.25; buttonWidth = Dialog::buttonWidth("One shot "),
const int VBORDER = fontHeight / 2; VGAP = Dialog::vGap(),
const int HBORDER = fontWidth * 1.25; VBORDER = Dialog::vBorder(),
const int VGAP = fontHeight / 4; HBORDER = Dialog::hBorder();
int xpos, ypos; int xpos, ypos;
WidgetArray wid; WidgetArray wid;
ButtonWidget* b; ButtonWidget* b;

View File

@ -29,15 +29,14 @@ AboutDialog::AboutDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font) const GUI::Font& font)
: Dialog(osystem, parent, font, "About Stella") : Dialog(osystem, parent, font, "About Stella")
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontWidth = font.getMaxCharWidth(), fontHeight = Dialog::fontHeight(),
fontHeight = font.getFontHeight(), fontWidth = Dialog::fontWidth(),
buttonWidth = font.getStringWidth("Previous") + fontWidth * 2.5, buttonHeight = Dialog::buttonHeight(),
buttonHeight = font.getLineHeight() * 1.25; buttonWidth = Dialog::buttonWidth("Previous"),
const int VBORDER = fontHeight / 2; VBORDER = Dialog::vBorder(),
const int HBORDER = fontWidth * 1.25; HBORDER = Dialog::hBorder(),
const int VGAP = fontHeight / 4; VGAP = Dialog::vGap();
int xpos, ypos; int xpos, ypos;
WidgetArray wid; WidgetArray wid;
@ -274,7 +273,7 @@ void AboutDialog::handleCommand(CommandSender* sender, int cmd, int data, int id
case kWhatsNew: case kWhatsNew:
if(myWhatsNewDialog == nullptr) if(myWhatsNewDialog == nullptr)
myWhatsNewDialog = make_unique<WhatsNewDialog>(instance(), parent(), _font, myWhatsNewDialog = make_unique<WhatsNewDialog>(instance(), parent(),
640 * 0.95, 480 * 0.95); 640 * 0.95, 480 * 0.95);
myWhatsNewDialog->open(); myWhatsNewDialog->open();
break; break;

View File

@ -34,16 +34,15 @@ BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font,
// Set real dimensions // Set real dimensions
_w = max_w; _w = max_w;
_h = max_h; _h = max_h;
const int lineHeight = Dialog::lineHeight(),
const int lineHeight = font.getLineHeight(), fontHeight = Dialog::fontHeight(),
fontWidth = font.getMaxCharWidth(), fontWidth = Dialog::fontWidth(),
fontHeight = font.getFontHeight(), buttonHeight = Dialog::buttonHeight(),
buttonHeight = font.getLineHeight() * 1.25, buttonWidth = Dialog::buttonWidth("Base Dir"),
buttonWidth = font.getStringWidth("Base Dir") + fontWidth * 2.5; BUTTON_GAP = Dialog::buttonGap(),
const int VBORDER = fontHeight / 2; VBORDER = Dialog::vBorder(),
const int HBORDER = fontWidth * 1.25; HBORDER = Dialog::hBorder(),
const int VGAP = fontHeight / 4; VGAP = Dialog::vGap();
const int BUTTON_GAP = fontWidth;
const int selectHeight = lineHeight + VGAP * 3; const int selectHeight = lineHeight + VGAP * 3;
int xpos, ypos; int xpos, ypos;
ButtonWidget* b; ButtonWidget* b;
@ -138,10 +137,8 @@ void BrowserDialog::show(const string& startpath,
const Command& command, const Command& command,
const FilesystemNode::NameFilter& namefilter) const FilesystemNode::NameFilter& namefilter)
{ {
const int fontWidth = _font.getMaxCharWidth(), const int fontWidth = Dialog::fontWidth(),
fontHeight = _font.getFontHeight(), VGAP = Dialog::vGap();
VGAP = fontHeight / 4;
_mode = mode; _mode = mode;
_command = command; _command = command;
string directory; string directory;

View File

@ -31,14 +31,12 @@ ComboDialog::ComboDialog(GuiObject* boss, const GUI::Font& font,
const VariantList& combolist) const VariantList& combolist)
: Dialog(boss->instance(), boss->parent(), font, "Add...") : Dialog(boss->instance(), boss->parent(), font, "Add...")
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontWidth = font.getMaxCharWidth(), fontWidth = Dialog::fontWidth(),
fontHeight = font.getFontHeight(), buttonHeight = Dialog::buttonHeight(),
buttonHeight = font.getLineHeight() * 1.25; VBORDER = Dialog::vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = Dialog::hBorder(),
const int HBORDER = fontWidth * 1.25; VGAP = Dialog::vGap();
const int VGAP = fontHeight / 4;
int xpos, ypos; int xpos, ypos;
WidgetArray wid; WidgetArray wid;

View File

@ -34,16 +34,14 @@
CommandDialog::CommandDialog(OSystem& osystem, DialogContainer& parent) CommandDialog::CommandDialog(OSystem& osystem, DialogContainer& parent)
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Commands") : Dialog(osystem, parent, osystem.frameBuffer().font(), "Commands")
{ {
const int fontHeight = _font.getFontHeight(), const int buttonHeight = Dialog::buttonHeight(),
fontWidth = _font.getMaxCharWidth(), buttonWidth = _font.getStringWidth("Time Machine On") + Dialog::fontWidth() * 2,
buttonHeight = _font.getLineHeight() * 1.25, VBORDER = Dialog::vBorder(),
buttonWidth = _font.getStringWidth("Time Machine On") + fontWidth * 2; HBORDER = Dialog::hBorder(),
const int VBORDER = fontHeight / 2; VGAP = Dialog::vGap(),
const int HBORDER = fontWidth * 1.25; INDENT = Dialog::indent();
const int VGAP = fontHeight / 4; const int HGAP = Dialog::buttonGap(),
const int HGAP = fontWidth; rowHeight = buttonHeight + VGAP;
const int rowHeight = buttonHeight + VGAP;
// Set real dimensions // Set real dimensions
_w = 3 * (buttonWidth + HGAP) - HGAP + HBORDER * 2; _w = 3 * (buttonWidth + HGAP) - HGAP + HBORDER * 2;
_h = 6 * rowHeight - VGAP + VBORDER * 2 + _th; _h = 6 * rowHeight - VGAP + VBORDER * 2 + _th;

View File

@ -48,14 +48,12 @@ DeveloperDialog::DeveloperDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h) const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, font, "Developer settings") : Dialog(osystem, parent, font, "Developer settings")
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = font.getFontHeight(), fontWidth = Dialog::fontWidth(),
fontWidth = font.getMaxCharWidth(), buttonHeight = Dialog::buttonHeight(),
buttonHeight = font.getLineHeight() * 1.25; VBORDER = Dialog::vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = Dialog::hBorder(),
const int HBORDER = fontWidth * 1.25; VGAP = Dialog::vGap();
const int VGAP = fontHeight / 4;
int xpos, ypos; int xpos, ypos;
// Set real dimensions // Set real dimensions
@ -87,14 +85,12 @@ DeveloperDialog::DeveloperDialog(OSystem& osystem, DialogContainer& parent,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::addEmulationTab(const GUI::Font& font) void DeveloperDialog::addEmulationTab(const GUI::Font& font)
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = font.getFontHeight(), fontWidth = Dialog::fontWidth(),
fontWidth = font.getMaxCharWidth(); VBORDER = Dialog::vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = Dialog::hBorder(),
const int HBORDER = fontWidth * 1.25; VGAP = Dialog::vGap(),
const int INDENT = fontWidth * 2; INDENT = Dialog::indent();
const int VGAP = fontHeight / 4;
int ypos = VBORDER; int ypos = VBORDER;
WidgetArray wid; WidgetArray wid;
VariantList items; VariantList items;
@ -216,14 +212,11 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::addTiaTab(const GUI::Font& font) void DeveloperDialog::addTiaTab(const GUI::Font& font)
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = font.getFontHeight(), VBORDER = Dialog::vBorder(),
fontWidth = font.getMaxCharWidth(); HBORDER = Dialog::hBorder(),
const int VBORDER = fontHeight / 2; VGAP = Dialog::vGap(),
const int HBORDER = fontWidth * 1.25; INDENT = Dialog::indent();
const int INDENT = fontWidth * 2;
const int VGAP = fontHeight / 4;
int ypos = VBORDER; int ypos = VBORDER;
int pwidth = font.getStringWidth("Faulty Cosmic Ark stars"); int pwidth = font.getStringWidth("Faulty Cosmic Ark stars");
WidgetArray wid; WidgetArray wid;
@ -323,17 +316,16 @@ void DeveloperDialog::addTiaTab(const GUI::Font& font)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::addVideoTab(const GUI::Font& font) void DeveloperDialog::addVideoTab(const GUI::Font& font)
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = font.getFontHeight(), fontHeight = Dialog::fontHeight(),
fontWidth = font.getMaxCharWidth(); fontWidth = Dialog::fontWidth(),
const int VBORDER = fontHeight / 2; VBORDER = Dialog::vBorder(),
const int HBORDER = fontWidth * 1.25; HBORDER = Dialog::hBorder(),
const int INDENT = fontWidth * 2; VGAP = Dialog::vGap(),
const int VGAP = fontHeight / 4; INDENT = Dialog::indent();
int ypos = VBORDER; int ypos = VBORDER;
int lwidth = font.getStringWidth("Intensity "); int lwidth = font.getStringWidth("Intensity ");
int pwidth = font.getMaxCharWidth() * 6; int pwidth = fontWidth * 6;
WidgetArray wid; WidgetArray wid;
VariantList items; VariantList items;
int tabID = myTab->addTab(" Video ", TabWidget::AUTO_WIDTH); int tabID = myTab->addTab(" Video ", TabWidget::AUTO_WIDTH);
@ -366,7 +358,7 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font)
myTVJitterRecLabelWidget = new StaticTextWidget(myTab, font, myTVJitterRecLabelWidget = new StaticTextWidget(myTab, font,
myTVJitterRecWidget->getRight() + 4, myTVJitterRecWidget->getRight() + 4,
myTVJitterRecWidget->getTop() + 2, myTVJitterRecWidget->getTop() + 2,
5 * fontWidth, fontHeight, ""); 5 * fontWidth, fontHeight);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
myColorLossWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1, myColorLossWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
@ -467,14 +459,13 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
"30m", "30m",
"60m" "60m"
}; };
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = font.getFontHeight(), fontHeight = Dialog::fontHeight(),
fontWidth = font.getMaxCharWidth(); fontWidth = Dialog::fontWidth(),
const int VBORDER = fontHeight / 2; VBORDER = Dialog::vBorder(),
const int HBORDER = fontWidth * 1.25; HBORDER = Dialog::hBorder(),
const int INDENT = fontWidth * 2; VGAP = Dialog::vGap(),
const int VGAP = fontHeight / 4; INDENT = Dialog::indent();
int xpos = HBORDER, int xpos = HBORDER,
ypos = VBORDER, ypos = VBORDER,
lwidth = fontWidth * 11; lwidth = fontWidth * 11;
@ -568,13 +559,12 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
WidgetArray wid; WidgetArray wid;
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = font.getFontHeight(), fontHeight = Dialog::fontHeight(),
fontWidth = font.getMaxCharWidth(); fontWidth = Dialog::fontWidth(),
const int VBORDER = fontHeight / 2; VBORDER = Dialog::vBorder(),
const int HBORDER = fontWidth * 1.25; HBORDER = Dialog::hBorder(),
const int VGAP = fontHeight / 4; VGAP = Dialog::vGap();
VariantList items; VariantList items;
int xpos, ypos, pwidth; int xpos, ypos, pwidth;
const Common::Size& ds = instance().frameBuffer().desktopSize(); const Common::Size& ds = instance().frameBuffer().desktopSize();

View File

@ -449,7 +449,7 @@ void Dialog::drawDialog()
if(_th) if(_th)
{ {
s.fillRect(_x, _y, _w, _th, kColorTitleBar); s.fillRect(_x, _y, _w, _th, kColorTitleBar);
s.drawString(_font, _title, _x + _font.getMaxCharWidth() * 1.25, _y + _font.getFontHeight() / 6, s.drawString(_font, _title, _x + hBorder(), _y + _font.getFontHeight() / 6,
_font.getStringWidth(_title), kColorTitleText); _font.getStringWidth(_title), kColorTitleText);
} }
} }
@ -865,17 +865,14 @@ Widget* Dialog::findWidget(int x, int y) const
void Dialog::addOKBGroup(WidgetArray& wid, const GUI::Font& font, void Dialog::addOKBGroup(WidgetArray& wid, const GUI::Font& font,
const string& okText, int buttonWidth) const string& okText, int buttonWidth)
{ {
const int fontWidth = font.getMaxCharWidth(), const int buttonHeight = Dialog::buttonHeight(),
fontHeight = font.getFontHeight(), BUTTON_GAP = Dialog::buttonGap(),
buttonHeight = font.getLineHeight() * 1.25; VBORDER = Dialog::vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = Dialog::hBorder();
const int HBORDER = fontWidth * 1.25;
const int BTN_BORDER = fontWidth * 2.5;
const int BUTTON_GAP = fontWidth;
buttonWidth = fontWidth * 6 + BTN_BORDER;
buttonWidth = std::max(buttonWidth, font.getStringWidth(okText) + BTN_BORDER);
buttonWidth = std::max(buttonWidth,
std::max(Dialog::buttonWidth(okText),
Dialog::buttonWidth("Cancel")));
_w = std::max(HBORDER * 2 + buttonWidth * 2 + BUTTON_GAP, _w); _w = std::max(HBORDER * 2 + buttonWidth * 2 + BUTTON_GAP, _w);
addOKWidget(new ButtonWidget(this, font, (_w - buttonWidth) / 2, addOKWidget(new ButtonWidget(this, font, (_w - buttonWidth) / 2,
@ -888,17 +885,15 @@ void Dialog::addOKCancelBGroup(WidgetArray& wid, const GUI::Font& font,
const string& okText, const string& cancelText, const string& okText, const string& cancelText,
bool focusOKButton, int buttonWidth) bool focusOKButton, int buttonWidth)
{ {
const int fontWidth = font.getMaxCharWidth(), const int buttonHeight = Dialog::buttonHeight(),
fontHeight = font.getFontHeight(), BUTTON_GAP = Dialog::buttonGap(),
buttonHeight = font.getLineHeight() * 1.25; VBORDER = Dialog::vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = Dialog::hBorder();
const int HBORDER = fontWidth * 1.25;
const int BTN_BORDER = fontWidth * 2.5;
const int BUTTON_GAP = fontWidth;
buttonWidth = std::max(buttonWidth, buttonWidth = std::max(buttonWidth,
std::max(font.getStringWidth("Defaults"), std::max(Dialog::buttonWidth("Defaults"),
std::max(font.getStringWidth(okText), std::max(Dialog::buttonWidth(okText),
font.getStringWidth(cancelText))) + BTN_BORDER); Dialog::buttonWidth(cancelText))));
_w = std::max(HBORDER * 2 + buttonWidth * 2 + BUTTON_GAP, _w); _w = std::max(HBORDER * 2 + buttonWidth * 2 + BUTTON_GAP, _w);
@ -936,13 +931,10 @@ void Dialog::addDefaultsOKCancelBGroup(WidgetArray& wid, const GUI::Font& font,
const string& defaultsText, const string& defaultsText,
bool focusOKButton) bool focusOKButton)
{ {
const int fontWidth = font.getMaxCharWidth(), const int buttonHeight = Dialog::buttonHeight(),
fontHeight = font.getFontHeight(), buttonWidth = Dialog::buttonWidth(defaultsText),
buttonHeight = font.getLineHeight() * 1.25; VBORDER = Dialog::vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = Dialog::hBorder();
const int HBORDER = fontWidth * 1.25;
const int BTN_BORDER = fontWidth * 2.5;
const int buttonWidth = font.getStringWidth(defaultsText) + BTN_BORDER;
addDefaultWidget(new ButtonWidget(this, font, HBORDER, _h - buttonHeight - VBORDER, addDefaultWidget(new ButtonWidget(this, font, HBORDER, _h - buttonHeight - VBORDER,
buttonWidth, buttonHeight, defaultsText, GuiObject::kDefaultsCmd)); buttonWidth, buttonHeight, defaultsText, GuiObject::kDefaultsCmd));
@ -958,22 +950,20 @@ void Dialog::addDefaultsExtraOKCancelBGroup(
const string& okText, const string& cancelText, const string& defaultsText, const string& okText, const string& cancelText, const string& defaultsText,
bool focusOKButton) bool focusOKButton)
{ {
const int fontWidth = font.getMaxCharWidth(), const int buttonHeight = Dialog::buttonHeight(),
fontHeight = font.getFontHeight(), buttonWidth = std::max(Dialog::buttonWidth(defaultsText),
buttonHeight = font.getLineHeight() * 1.25; Dialog::buttonWidth(extraText)),
const int VBORDER = fontHeight / 2; BUTTON_GAP = Dialog::buttonGap(),
const int HBORDER = fontWidth * 1.25; VBORDER = Dialog::vBorder(),
const int BTN_BORDER = fontWidth * 2.5; HBORDER = Dialog::hBorder();
const int BUTTON_GAP = fontWidth;
const int buttonWidth = font.getStringWidth(defaultsText) + BTN_BORDER;
addDefaultWidget(new ButtonWidget(this, font, HBORDER, _h - buttonHeight - VBORDER, addDefaultWidget(new ButtonWidget(this, font, HBORDER, _h - buttonHeight - VBORDER,
buttonWidth, buttonHeight, defaultsText, GuiObject::kDefaultsCmd)); buttonWidth, buttonHeight, defaultsText, GuiObject::kDefaultsCmd));
wid.push_back(_defaultWidget); wid.push_back(_defaultWidget);
addExtraWidget(new ButtonWidget(this, font, HBORDER + buttonWidth + BUTTON_GAP, addExtraWidget(new ButtonWidget(this, font, HBORDER + buttonWidth + BUTTON_GAP,
_h - buttonHeight - VBORDER, buttonWidth, buttonHeight, _h - buttonHeight - VBORDER,
extraText, extraCmd)); buttonWidth, buttonHeight, extraText, extraCmd));
wid.push_back(_extraWidget); wid.push_back(_extraWidget);
addOKCancelBGroup(wid, font, okText, cancelText, focusOKButton, buttonWidth); addOKCancelBGroup(wid, font, okText, cancelText, focusOKButton, buttonWidth);

View File

@ -127,6 +127,19 @@ class Dialog : public GuiObject
ToolTip& tooltip() { return *_toolTip; } ToolTip& tooltip() { return *_toolTip; }
int lineHeight() const { return _font.getLineHeight(); }
int fontHeight() const { return _font.getFontHeight(); }
int fontWidth() const { return _font.getMaxCharWidth(); }
int buttonHeight() const { return lineHeight() * 1.25; }
int buttonWidth(const string& label) const {
return _font.getStringWidth(label) + fontWidth() * 2.5;
}
int buttonGap() const { return fontWidth(); }
int hBorder() const { return fontWidth() * 1.25; };
int vBorder() const { return fontHeight() / 2; };
int vGap() const { return fontHeight() / 4; };
int indent() const { return fontWidth() * 2; };
protected: protected:
void draw() override { } void draw() override { }
void releaseFocus() override; void releaseFocus() override;
@ -164,7 +177,6 @@ class Dialog : public GuiObject
const string& cancelText = "Cancel", const string& cancelText = "Cancel",
const string& defaultsText = "Defaults", const string& defaultsText = "Defaults",
bool focusOKButton = true); bool focusOKButton = true);
int buttonHeight(const GUI::Font& font) const;
// NOTE: This method, and the three above it, are due to be refactored at some // NOTE: This method, and the three above it, are due to be refactored at some
// point, since the parameter list is kind of getting ridiculous // point, since the parameter list is kind of getting ridiculous

View File

@ -477,13 +477,13 @@ void EditableWidget::drawCaretSelection()
int y = editRect.y(); int y = editRect.y();
int w = editRect.w(); int w = editRect.w();
int h = editRect.h(); int h = editRect.h();
int wt = int(text.length()) * _font.getMaxCharWidth() + 1; int wt = int(text.length()) * _boss->dialog().fontWidth() + 1;
int dx = selectStartPos() * _font.getMaxCharWidth() - _editScrollOffset; int dx = selectStartPos() * _boss->dialog().fontWidth() - _editScrollOffset;
if(dx < 0) if(dx < 0)
{ {
// selected text starts left of displayed rect // selected text starts left of displayed rect
text = text.substr(-(dx - 1) / _font.getMaxCharWidth()); text = text.substr(-(dx - 1) / _boss->dialog().fontWidth());
wt += dx; wt += dx;
dx = 0; dx = 0;
} }

View File

@ -66,15 +66,13 @@ EmulationDialog::EmulationDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h) const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, font, "Emulation settings") : Dialog(osystem, parent, font, "Emulation settings")
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = font.getFontHeight(), fontWidth = Dialog::fontWidth(),
fontWidth = font.getMaxCharWidth(), buttonHeight = Dialog::buttonHeight(),
buttonHeight = font.getLineHeight() * 1.25; VBORDER = Dialog::vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = Dialog::hBorder(),
const int HBORDER = fontWidth * 1.25; VGAP = Dialog::vGap(),
const int INDENT = fontWidth * 2; INDENT = Dialog::indent();
const int VGAP = fontHeight / 4;
int xpos, ypos; int xpos, ypos;
int lwidth = font.getStringWidth("Emulation speed "); int lwidth = font.getStringWidth("Emulation speed ");
WidgetArray wid; WidgetArray wid;

View File

@ -42,14 +42,13 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
CommandSender(boss), CommandSender(boss),
myEventMode{mode} myEventMode{mode}
{ {
const int fontHeight = font.getFontHeight(), const int lineHeight = boss->dialog().lineHeight(),
lineHeight = font.getLineHeight(), fontWidth = boss->dialog().fontWidth(),
fontWidth = font.getMaxCharWidth(), buttonHeight = boss->dialog().buttonHeight(),
buttonWidth = font.getStringWidth("Defaults") + fontWidth * 1.25, buttonWidth = boss->dialog().buttonWidth("Defaults"),
buttonHeight = font.getLineHeight() * 1.25; VBORDER = boss->dialog().vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = boss->dialog().hBorder(),
const int HBORDER = fontWidth * 1.25; VGAP = boss->dialog().vGap();
const int VGAP = fontHeight / 4;
const int ACTION_LINES = 2; const int ACTION_LINES = 2;
int xpos = HBORDER, ypos = VBORDER; int xpos = HBORDER, ypos = VBORDER;
const int listWidth = _w - buttonWidth - HBORDER * 2 - fontWidth; const int listWidth = _w - buttonWidth - HBORDER * 2 - fontWidth;
@ -136,8 +135,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
xpos = HBORDER; xpos = HBORDER;
ypos = myActionsList->getBottom() + VGAP * 2; ypos = myActionsList->getBottom() + VGAP * 2;
StaticTextWidget* t; StaticTextWidget* t;
t = new StaticTextWidget(boss, font, xpos, ypos+2, font.getStringWidth("Action"), t = new StaticTextWidget(boss, font, xpos, ypos+2, "Action");
fontHeight, "Action", TextAlign::Left);
myKeyMapping = new EditTextWidget(boss, font, xpos + t->getWidth() + fontWidth, ypos, myKeyMapping = new EditTextWidget(boss, font, xpos + t->getWidth() + fontWidth, ypos,
_w - xpos - t->getWidth() - fontWidth - HBORDER + 2, _w - xpos - t->getWidth() - fontWidth - HBORDER + 2,

View File

@ -56,16 +56,13 @@ GameInfoDialog::GameInfoDialog(
CommandSender(boss) CommandSender(boss)
{ {
const GUI::Font& ifont = instance().frameBuffer().infoFont(); const GUI::Font& ifont = instance().frameBuffer().infoFont();
const int infoLineHeight = ifont.getLineHeight();
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = font.getFontHeight(), fontWidth = Dialog::fontWidth(),
fontWidth = font.getMaxCharWidth(), buttonHeight = Dialog::buttonHeight(),
buttonHeight = font.getLineHeight() * 1.25, VBORDER = Dialog::vBorder(),
infoLineHeight = ifont.getLineHeight(); HBORDER = Dialog::hBorder(),
const int VBORDER = fontHeight / 2; VGAP = Dialog::vGap();
const int HBORDER = fontWidth * 1.25;
const int VGAP = fontHeight / 4;
WidgetArray wid; WidgetArray wid;
// Set real dimensions // Set real dimensions
@ -103,13 +100,12 @@ GameInfoDialog::GameInfoDialog(
void GameInfoDialog::addEmulationTab() void GameInfoDialog::addEmulationTab()
{ {
const GUI::Font& ifont = instance().frameBuffer().infoFont(); const GUI::Font& ifont = instance().frameBuffer().infoFont();
const int lineHeight = _font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = _font.getFontHeight(), fontHeight = Dialog::fontHeight(),
fontWidth = _font.getMaxCharWidth(); fontWidth = Dialog::fontWidth(),
const int VBORDER = fontHeight / 2; VBORDER = Dialog::vBorder(),
const int HBORDER = fontWidth * 1.25; HBORDER = Dialog::hBorder(),
const int VGAP = fontHeight / 4; VGAP = Dialog::vGap();
int ypos, pwidth, tabID; int ypos, pwidth, tabID;
WidgetArray wid; WidgetArray wid;
VariantList items; VariantList items;
@ -200,13 +196,10 @@ void GameInfoDialog::addEmulationTab()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameInfoDialog::addConsoleTab() void GameInfoDialog::addConsoleTab()
{ {
const int lineHeight = _font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = _font.getFontHeight(), VBORDER = Dialog::vBorder(),
fontWidth = _font.getMaxCharWidth(); HBORDER = Dialog::hBorder(),
const int VBORDER = fontHeight / 2; VGAP = Dialog::vGap();
const int HBORDER = fontWidth * 1.25;
const int VGAP = fontHeight / 4;
int xpos, ypos, lwidth, tabID; int xpos, ypos, lwidth, tabID;
WidgetArray wid; WidgetArray wid;
@ -256,15 +249,13 @@ void GameInfoDialog::addConsoleTab()
void GameInfoDialog::addControllersTab() void GameInfoDialog::addControllersTab()
{ {
const GUI::Font& ifont = instance().frameBuffer().infoFont(); const GUI::Font& ifont = instance().frameBuffer().infoFont();
const int lineHeight = _font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = _font.getFontHeight(), fontWidth = Dialog::fontWidth(),
fontWidth = _font.getMaxCharWidth(), buttonHeight = Dialog::buttonHeight(),
buttonHeight = _font.getLineHeight() * 1.25; VBORDER = Dialog::vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = Dialog::hBorder(),
const int HBORDER = fontWidth * 1.25; VGAP = Dialog::vGap(),
const int INDENT = fontWidth * 2; INDENT = Dialog::indent();
const int VGAP = fontHeight / 4;
int xpos, ypos, pwidth, tabID; int xpos, ypos, pwidth, tabID;
VariantList items, ctrls; VariantList items, ctrls;
WidgetArray wid; WidgetArray wid;
@ -408,13 +399,11 @@ void GameInfoDialog::addControllersTab()
void GameInfoDialog::addCartridgeTab() void GameInfoDialog::addCartridgeTab()
{ {
// 4) Cartridge properties // 4) Cartridge properties
const int lineHeight = _font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = _font.getFontHeight(), fontHeight = Dialog::fontHeight(),
fontWidth = _font.getMaxCharWidth(); VBORDER = Dialog::vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = Dialog::hBorder(),
const int HBORDER = fontWidth * 1.25; VGAP = Dialog::vGap();
const int VGAP = fontHeight / 4;
int xpos, ypos, lwidth, fwidth, tabID; int xpos, ypos, lwidth, fwidth, tabID;
WidgetArray wid; WidgetArray wid;
VariantList items; VariantList items;
@ -469,14 +458,13 @@ void GameInfoDialog::addCartridgeTab()
void GameInfoDialog::addHighScoresTab() void GameInfoDialog::addHighScoresTab()
{ {
// 4) High Scores properties // 4) High Scores properties
const int lineHeight = _font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = _font.getFontHeight(), fontHeight = Dialog::fontHeight(),
fontWidth = _font.getMaxCharWidth(); fontWidth = Dialog::fontWidth(),
const int VBORDER = fontHeight / 2; VBORDER = Dialog::vBorder(),
const int HBORDER = fontWidth * 1.25; HBORDER = Dialog::hBorder(),
const int INDENT = fontWidth * 2; VGAP = Dialog::vGap(),
const int VGAP = fontHeight / 4; INDENT = Dialog::indent();
int xpos, ypos, lwidth, pwidth, tabID; int xpos, ypos, lwidth, pwidth, tabID;
WidgetArray wid; WidgetArray wid;
VariantList items; VariantList items;

View File

@ -33,14 +33,12 @@ GlobalPropsDialog::GlobalPropsDialog(GuiObject* boss, const GUI::Font& font)
: Dialog(boss->instance(), boss->parent(), font, "Power-on options"), : Dialog(boss->instance(), boss->parent(), font, "Power-on options"),
CommandSender(boss) CommandSender(boss)
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontWidth = font.getMaxCharWidth(), fontWidth = Dialog::fontWidth(),
fontHeight = font.getFontHeight(), buttonHeight = Dialog::buttonHeight(),
buttonHeight = lineHeight * 1.25; VBORDER = Dialog::vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = Dialog::hBorder(),
const int HBORDER = fontWidth * 1.25; VGAP = Dialog::vGap();
const int VGAP = fontHeight / 4;
int xpos, ypos; int xpos, ypos;
int lwidth = font.getStringWidth("Right difficulty "), int lwidth = font.getStringWidth("Right difficulty "),
pwidth = font.getStringWidth("CM (SpectraVideo CompuMate)"); pwidth = font.getStringWidth("CM (SpectraVideo CompuMate)");
@ -138,10 +136,9 @@ GlobalPropsDialog::GlobalPropsDialog(GuiObject* boss, const GUI::Font& font)
int GlobalPropsDialog::addHoldWidgets(const GUI::Font& font, int x, int y, int GlobalPropsDialog::addHoldWidgets(const GUI::Font& font, int x, int y,
WidgetArray& wid) WidgetArray& wid)
{ {
const int fontWidth = font.getMaxCharWidth(), const int fontHeight = Dialog::fontHeight(),
fontHeight = font.getFontHeight(); fontWidth = Dialog::fontWidth(),
const int VGAP = fontHeight / 4; VGAP = Dialog::vGap();
int xpos = x, ypos = y, xdiff = CheckboxWidget::boxSize(font) - 9; int xpos = x, ypos = y, xdiff = CheckboxWidget::boxSize(font) - 9;
// Left joystick // Left joystick

View File

@ -28,15 +28,14 @@ HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font) const GUI::Font& font)
: Dialog(osystem, parent, font, "Help") : Dialog(osystem, parent, font, "Help")
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontWidth = font.getMaxCharWidth(), fontHeight = Dialog::fontHeight(),
fontHeight = font.getFontHeight(), fontWidth = Dialog::fontWidth(),
buttonWidth = font.getStringWidth("Previous") + fontWidth * 2.5, buttonHeight = Dialog::buttonHeight(),
buttonHeight = font.getLineHeight() * 1.25; buttonWidth = Dialog::buttonWidth("Previous"),
const int VBORDER = fontHeight / 2; VBORDER = Dialog::vBorder(),
const int HBORDER = fontWidth * 1.25; HBORDER = Dialog::hBorder(),
const int VGAP = fontHeight / 4; VGAP = Dialog::vGap();
int xpos, ypos; int xpos, ypos;
WidgetArray wid; WidgetArray wid;
@ -76,10 +75,10 @@ HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent,
{ {
myKey[i] = myKey[i] =
new StaticTextWidget(this, font, xpos, ypos, lwidth, new StaticTextWidget(this, font, xpos, ypos, lwidth,
fontHeight, "", TextAlign::Left); fontHeight);
myDesc[i] = myDesc[i] =
new StaticTextWidget(this, font, xpos+lwidth, ypos, _w - xpos - lwidth - HBORDER, new StaticTextWidget(this, font, xpos+lwidth, ypos, _w - xpos - lwidth - HBORDER,
fontHeight, "", TextAlign::Left); fontHeight);
ypos += fontHeight; ypos += fontHeight;
} }

View File

@ -107,23 +107,22 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent,
myScores.variation = HSM::DEFAULT_VARIATION; myScores.variation = HSM::DEFAULT_VARIATION;
const GUI::Font& ifont = instance().frameBuffer().infoFont(); const GUI::Font& ifont = instance().frameBuffer().infoFont();
const int lineHeight = _font.getLineHeight(), const int infoLineHeight = ifont.getLineHeight();
fontHeight = _font.getFontHeight(), const int lineHeight = Dialog::lineHeight(),
fontWidth = _font.getMaxCharWidth(), fontHeight = Dialog::fontHeight(),
infoLineHeight = ifont.getLineHeight(), fontWidth = Dialog::fontWidth(),
buttonHeight = _font.getLineHeight() * 1.25; buttonHeight = Dialog::buttonHeight(),
const int VBORDER = fontHeight / 2; BUTTON_GAP = Dialog::buttonGap(),
const int HBORDER = fontWidth * 1.25; VBORDER = Dialog::vBorder(),
const int VGAP = fontHeight / 4; HBORDER = Dialog::hBorder(),
const int BUTTON_GAP = fontWidth; VGAP = Dialog::vGap();
int xposRank = HBORDER; int xposRank = HBORDER;
int xposScore = xposRank + _font.getStringWidth("Rank"); int xposScore = xposRank + _font.getStringWidth("Rank");
int xposSpecial = xposScore + _font.getStringWidth(" Score "); int xposSpecial = xposScore + _font.getStringWidth(" Score ");
int xposName = xposSpecial + _font.getStringWidth("Round "); int xposName = xposSpecial + _font.getStringWidth("Round ");
int xposDate = xposName + _font.getStringWidth("Name "); int xposDate = xposName + _font.getStringWidth("Name ");
int xposDelete = xposDate + _font.getStringWidth("YY-MM-DD HH:MM "); int xposDelete = xposDate + _font.getStringWidth("YY-MM-DD HH:MM ");
int nWidth = _font.getStringWidth("ABC") + _font.getMaxCharWidth() * 0.75; int nWidth = _font.getStringWidth("ABC") + fontWidth * 0.75;
bool smallFont = _font.getFontHeight() < 24; bool smallFont = _font.getFontHeight() < 24;
int buttonSize = smallFont ? BUTTON_GFX_H : BUTTON_GFX_H_LARGE; int buttonSize = smallFont ? BUTTON_GFX_H : BUTTON_GFX_H_LARGE;
int xpos, ypos; int xpos, ypos;

View File

@ -44,13 +44,12 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
myMaxWidth{max_w}, myMaxWidth{max_w},
myMaxHeight{max_h} myMaxHeight{max_h}
{ {
const int lineHeight = _font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontWidth = _font.getMaxCharWidth(), fontWidth = Dialog::fontWidth(),
fontHeight = _font.getFontHeight(), buttonHeight = Dialog::buttonHeight(),
buttonHeight = _font.getLineHeight() * 1.25; VBORDER = Dialog::vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = Dialog::hBorder(),
const int VGAP = fontHeight / 4; VGAP = Dialog::vGap();
const int HBORDER = fontWidth * 1.25;
int xpos, ypos, tabID; int xpos, ypos, tabID;
// Set real dimensions // Set real dimensions
@ -107,13 +106,12 @@ InputDialog::~InputDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InputDialog::addDevicePortTab() void InputDialog::addDevicePortTab()
{ {
const int lineHeight = _font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontWidth = _font.getMaxCharWidth(), fontWidth = Dialog::fontWidth(),
fontHeight = _font.getFontHeight(), buttonHeight = Dialog::buttonHeight(),
buttonHeight = _font.getLineHeight() * 1.25; VBORDER = Dialog::vBorder(),
const int VGAP = fontHeight / 4; HBORDER = Dialog::hBorder(),
const int VBORDER = fontHeight / 2; VGAP = Dialog::vGap();
const int HBORDER = fontWidth * 1.25;
int xpos, ypos, lwidth, tabID; int xpos, ypos, lwidth, tabID;
WidgetArray wid; WidgetArray wid;
@ -213,7 +211,7 @@ void InputDialog::addDevicePortTab()
// Show joystick database // Show joystick database
ypos += lineHeight; ypos += lineHeight;
lwidth = _font.getStringWidth("Joystick Database" + ELLIPSIS) + fontWidth * 2.5; lwidth = Dialog::buttonWidth("Joystick Database" + ELLIPSIS);
myJoyDlgButton = new ButtonWidget(myTab, _font, HBORDER, ypos, lwidth, buttonHeight, myJoyDlgButton = new ButtonWidget(myTab, _font, HBORDER, ypos, lwidth, buttonHeight,
"Joystick Database" + ELLIPSIS, kDBButtonPressed); "Joystick Database" + ELLIPSIS, kDBButtonPressed);
wid.push_back(myJoyDlgButton); wid.push_back(myJoyDlgButton);
@ -240,13 +238,12 @@ void InputDialog::addDevicePortTab()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InputDialog::addMouseTab() void InputDialog::addMouseTab()
{ {
const int lineHeight = _font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontWidth = _font.getMaxCharWidth(), fontWidth = Dialog::fontWidth(),
fontHeight = _font.getFontHeight(); VBORDER = Dialog::vBorder(),
const int VGAP = fontHeight / 4; HBORDER = Dialog::hBorder(),
const int VBORDER = fontHeight / 2; VGAP = Dialog::vGap(),
const int HBORDER = fontWidth * 1.25; INDENT = Dialog::indent();
const int INDENT = fontWidth * 2;
int xpos = HBORDER, ypos, lwidth, pwidth, tabID; int xpos = HBORDER, ypos, lwidth, pwidth, tabID;
WidgetArray wid; WidgetArray wid;
VariantList items; VariantList items;
@ -713,7 +710,7 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
{ {
const GUI::Font& font = instance().frameBuffer().font(); const GUI::Font& font = instance().frameBuffer().font();
myJoyDialog = make_unique<JoystickDialog> myJoyDialog = make_unique<JoystickDialog>
(this, font, font.getMaxCharWidth() * 56 + 20, font.getFontHeight() * 18 + 20); (this, font, fontWidth() * 56 + 20, fontHeight() * 18 + 20);
} }
myJoyDialog->show(); myJoyDialog->show();
break; break;

View File

@ -50,14 +50,13 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& lfont,
void InputTextDialog::initialize(const GUI::Font& lfont, const GUI::Font& nfont, void InputTextDialog::initialize(const GUI::Font& lfont, const GUI::Font& nfont,
const StringList& labels) const StringList& labels)
{ {
const int lineHeight = lfont.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontWidth = lfont.getMaxCharWidth(), fontHeight = Dialog::fontHeight(),
fontHeight = lfont.getFontHeight(), fontWidth = Dialog::fontWidth(),
buttonHeight = lfont.getLineHeight() * 1.25; buttonHeight = Dialog::buttonHeight(),
const int VBORDER = fontHeight / 2; VBORDER = Dialog::vBorder(),
const int HBORDER = fontWidth * 1.25; HBORDER = Dialog::hBorder(),
const int VGAP = fontHeight / 4; VGAP = Dialog::vGap();
uInt32 xpos, ypos, i, lwidth = 0, maxIdx = 0; uInt32 xpos, ypos, i, lwidth = 0, maxIdx = 0;
WidgetArray wid; WidgetArray wid;

View File

@ -31,15 +31,13 @@ JoystickDialog::JoystickDialog(GuiObject* boss, const GUI::Font& font,
{ {
int xpos, ypos; int xpos, ypos;
WidgetArray wid; WidgetArray wid;
const int lineHeight = Dialog::lineHeight(),
const int lineHeight = font.getLineHeight(), fontHeight = Dialog::fontHeight(),
fontWidth = font.getMaxCharWidth(), fontWidth = Dialog::fontWidth(),
fontHeight = font.getFontHeight(), buttonHeight = Dialog::buttonHeight(),
buttonWidth = font.getStringWidth("Remove") + fontWidth * 2.5, buttonWidth = Dialog::buttonWidth("Remove"),
buttonHeight = font.getLineHeight() * 1.25; VBORDER = Dialog::vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = Dialog::hBorder();
const int HBORDER = fontWidth * 1.25;
// Joystick list // Joystick list
xpos = HBORDER; ypos = VBORDER + _th; xpos = HBORDER; ypos = VBORDER + _th;
int w = _w - 2 * xpos; int w = _w - 2 * xpos;

View File

@ -61,20 +61,20 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent, LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
int x, int y, int w, int h) int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h) : Dialog(osystem, parent, osystem.frameBuffer().launcherFont(), "",
x, y, w, h)
{ {
myUseMinimalUI = instance().settings().getBool("minimal_ui"); myUseMinimalUI = instance().settings().getBool("minimal_ui");
const int lineHeight = Dialog::lineHeight(),
const GUI::Font& font = instance().frameBuffer().launcherFont(); fontHeight = Dialog::fontHeight(),
const int fontWidth = font.getMaxCharWidth(), fontWidth = Dialog::fontWidth(),
fontHeight = font.getFontHeight(), BUTTON_GAP = Dialog::buttonGap(),
lineHeight = font.getLineHeight(), VBORDER = Dialog::vBorder(),
HBORDER = fontWidth * 1.25, HBORDER = Dialog::hBorder(),
VBORDER = fontHeight / 2, VGAP = Dialog::vGap(),
BUTTON_GAP = fontWidth, INDENT = Dialog::indent();
LBL_GAP = fontWidth, const int LBL_GAP = fontWidth,
VGAP = fontHeight / 4, buttonHeight = myUseMinimalUI ? lineHeight - VGAP * 2: Dialog::buttonHeight(),
buttonHeight = myUseMinimalUI ? lineHeight - VGAP * 2: lineHeight * 1.25,
buttonWidth = (_w - 2 * HBORDER - BUTTON_GAP * (4 - 1)); buttonWidth = (_w - 2 * HBORDER - BUTTON_GAP * (4 - 1));
int xpos = HBORDER, ypos = VBORDER; int xpos = HBORDER, ypos = VBORDER;
@ -85,22 +85,22 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
string lblSubDirs = "Incl. subdirectories"; string lblSubDirs = "Incl. subdirectories";
string lblFound = "12345 items found"; string lblFound = "12345 items found";
tooltip().setFont(font); tooltip().setFont(_font);
int lwSelect = font.getStringWidth(lblSelect); int lwSelect = _font.getStringWidth(lblSelect);
int cwAllFiles = font.getStringWidth(lblAllFiles) + CheckboxWidget::prefixSize(font); int cwAllFiles = _font.getStringWidth(lblAllFiles) + CheckboxWidget::prefixSize(_font);
int cwSubDirs = font.getStringWidth(lblSubDirs) + CheckboxWidget::prefixSize(font); int cwSubDirs = _font.getStringWidth(lblSubDirs) + CheckboxWidget::prefixSize(_font);
int lwFilter = font.getStringWidth(lblFilter); int lwFilter = _font.getStringWidth(lblFilter);
int lwFound = font.getStringWidth(lblFound); int lwFound = _font.getStringWidth(lblFound);
int wTotal = HBORDER * 2 + lwSelect + cwAllFiles + cwSubDirs + lwFilter + lwFound int wTotal = HBORDER * 2 + lwSelect + cwAllFiles + cwSubDirs + lwFilter + lwFound
+ EditTextWidget::calcWidth(font, "123456") + LBL_GAP * 7; + EditTextWidget::calcWidth(_font, "123456") + LBL_GAP * 7;
bool noSelect = false; bool noSelect = false;
if(w < wTotal) if(w < wTotal)
{ {
// make sure there is space for at least 6 characters in the filter field // make sure there is space for at least 6 characters in the filter field
lblSelect = "Select a ROM" + ELLIPSIS; lblSelect = "Select a ROM" + ELLIPSIS;
int lwSelectShort = font.getStringWidth(lblSelect); int lwSelectShort = _font.getStringWidth(lblSelect);
wTotal -= lwSelect - lwSelectShort; wTotal -= lwSelect - lwSelectShort;
lwSelect = lwSelectShort; lwSelect = lwSelectShort;
@ -109,7 +109,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
{ {
// make sure there is space for at least 6 characters in the filter field // make sure there is space for at least 6 characters in the filter field
lblSubDirs = "Subdir."; lblSubDirs = "Subdir.";
int cwSubDirsShort = font.getStringWidth(lblSubDirs) + CheckboxWidget::prefixSize(font); int cwSubDirsShort = _font.getStringWidth(lblSubDirs) + CheckboxWidget::prefixSize(_font);
wTotal -= cwSubDirs - cwSubDirsShort; wTotal -= cwSubDirs - cwSubDirsShort;
cwSubDirs = cwSubDirsShort; cwSubDirs = cwSubDirsShort;
@ -118,7 +118,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
{ {
// make sure there is space for at least 6 characters in the filter field // make sure there is space for at least 6 characters in the filter field
lblAllFiles = "All files"; lblAllFiles = "All files";
int cwAllFilesShort = font.getStringWidth(lblAllFiles) + CheckboxWidget::prefixSize(font); int cwAllFilesShort = _font.getStringWidth(lblAllFiles) + CheckboxWidget::prefixSize(_font);
wTotal -= cwAllFiles - cwAllFilesShort; wTotal -= cwAllFiles - cwAllFilesShort;
cwAllFiles = cwAllFilesShort; cwAllFiles = cwAllFilesShort;
@ -127,7 +127,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
{ {
// make sure there is space for at least 6 characters in the filter field // make sure there is space for at least 6 characters in the filter field
lblFound = "12345 found"; lblFound = "12345 found";
int lwFoundShort = font.getStringWidth(lblFound); int lwFoundShort = _font.getStringWidth(lblFound);
wTotal -= lwFound - lwFoundShort; wTotal -= lwFound - lwFoundShort;
lwFound = lwFoundShort; lwFound = lwFoundShort;
@ -137,7 +137,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
{ {
// make sure there is space for at least 6 characters in the filter field // make sure there is space for at least 6 characters in the filter field
lblSelect = ""; lblSelect = "";
int lwSelectShort = font.getStringWidth(lblSelect); int lwSelectShort = _font.getStringWidth(lblSelect);
// wTotal -= lwSelect - lwSelectShort; // dead code // wTotal -= lwSelect - lwSelectShort; // dead code
lwSelect = lwSelectShort; lwSelect = lwSelectShort;
@ -152,16 +152,16 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
#if defined(RETRON77) #if defined(RETRON77)
ver << " for RetroN 77"; ver << " for RetroN 77";
#endif #endif
new StaticTextWidget(this, font, 0, ypos, _w, fontHeight, new StaticTextWidget(this, _font, 0, ypos, _w, fontHeight,
ver.str(), TextAlign::Center); ver.str(), TextAlign::Center);
ypos += lineHeight; ypos += lineHeight;
} }
// Show the header // Show the header
new StaticTextWidget(this, font, xpos, ypos, lblSelect); new StaticTextWidget(this, _font, xpos, ypos, lblSelect);
// Shop the files counter // Shop the files counter
xpos = _w - HBORDER - lwFound; xpos = _w - HBORDER - lwFound;
myRomCount = new StaticTextWidget(this, font, xpos, ypos, myRomCount = new StaticTextWidget(this, _font, xpos, ypos,
lwFound, fontHeight, lwFound, fontHeight,
"", TextAlign::Right); "", TextAlign::Right);
@ -169,23 +169,23 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
// It has to fit between both labels // It has to fit between both labels
if(!myUseMinimalUI && w >= 640) if(!myUseMinimalUI && w >= 640)
{ {
int fwFilter = std::min(EditTextWidget::calcWidth(font, "123456789012345"), int fwFilter = std::min(EditTextWidget::calcWidth(_font, "123456789012345"),
xpos - cwSubDirs - lwFilter - cwAllFiles xpos - cwSubDirs - lwFilter - cwAllFiles
- lwSelect - HBORDER - LBL_GAP * (noSelect ? 5 : 7)); - lwSelect - HBORDER - LBL_GAP * (noSelect ? 5 : 7));
// Show the filter input field // Show the filter input field
xpos -= fwFilter + LBL_GAP; xpos -= fwFilter + LBL_GAP;
myPattern = new EditTextWidget(this, font, xpos, ypos - 2, fwFilter, lineHeight, ""); myPattern = new EditTextWidget(this, _font, xpos, ypos - 2, fwFilter, lineHeight, "");
myPattern->setToolTip("Enter filter text to reduce file list.\n" myPattern->setToolTip("Enter filter text to reduce file list.\n"
"Use '*' and '?' as wildcards."); "Use '*' and '?' as wildcards.");
// Show the "Filter" label // Show the "Filter" label
xpos -= lwFilter + LBL_GAP; xpos -= lwFilter + LBL_GAP;
new StaticTextWidget(this, font, xpos, ypos, lblFilter); new StaticTextWidget(this, _font, xpos, ypos, lblFilter);
// Show the subdirectories checkbox // Show the subdirectories checkbox
xpos -= cwSubDirs + LBL_GAP * 2; xpos -= cwSubDirs + LBL_GAP * 2;
mySubDirs = new CheckboxWidget(this, font, xpos, ypos, lblSubDirs, kSubDirsCmd); mySubDirs = new CheckboxWidget(this, _font, xpos, ypos, lblSubDirs, kSubDirsCmd);
ostringstream tip; ostringstream tip;
tip << "Search files in subdirectories too."; tip << "Search files in subdirectories too.";
mySubDirs->setToolTip(tip.str()); mySubDirs->setToolTip(tip.str());
@ -195,7 +195,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
xpos = HBORDER; xpos = HBORDER;
else else
xpos -= cwAllFiles + LBL_GAP; xpos -= cwAllFiles + LBL_GAP;
myAllFiles = new CheckboxWidget(this, font, xpos, ypos, lblAllFiles, kAllfilesCmd); myAllFiles = new CheckboxWidget(this, _font, xpos, ypos, lblAllFiles, kAllfilesCmd);
myAllFiles->setToolTip("Uncheck to show ROM files only."); myAllFiles->setToolTip("Uncheck to show ROM files only.");
wid.push_back(myAllFiles); wid.push_back(myAllFiles);
@ -211,7 +211,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
if(romWidth > 0) romWidth += HBORDER; if(romWidth > 0) romWidth += HBORDER;
int listWidth = _w - (romWidth > 0 ? romWidth + fontWidth : 0) - HBORDER * 2; int listWidth = _w - (romWidth > 0 ? romWidth + fontWidth : 0) - HBORDER * 2;
xpos = HBORDER; ypos += lineHeight + VGAP; xpos = HBORDER; ypos += lineHeight + VGAP;
myList = new FileListWidget(this, font, xpos, ypos, listWidth, listHeight); myList = new FileListWidget(this, _font, xpos, ypos, listWidth, listHeight);
myList->setEditable(false); myList->setEditable(false);
myList->setListMode(FilesystemNode::ListMode::All); myList->setListMode(FilesystemNode::ListMode::All);
wid.push_back(myList); wid.push_back(myList);
@ -236,11 +236,11 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
// Add textfield to show current directory // Add textfield to show current directory
xpos = HBORDER; xpos = HBORDER;
ypos += myList->getHeight() + VGAP; ypos += myList->getHeight() + VGAP;
lwSelect = font.getStringWidth("Path") + LBL_GAP; lwSelect = _font.getStringWidth("Path") + LBL_GAP;
myDirLabel = new StaticTextWidget(this, font, xpos, ypos+2, lwSelect, fontHeight, myDirLabel = new StaticTextWidget(this, _font, xpos, ypos+2, lwSelect, fontHeight,
"Path", TextAlign::Left); "Path", TextAlign::Left);
xpos += lwSelect; xpos += lwSelect;
myDir = new EditTextWidget(this, font, xpos, ypos, _w - xpos - HBORDER, lineHeight, ""); myDir = new EditTextWidget(this, _font, xpos, ypos, _w - xpos - HBORDER, lineHeight, "");
myDir->setEditable(false, true); myDir->setEditable(false, true);
myDir->clearFlags(Widget::FLAG_RETAIN_FOCUS); myDir->clearFlags(Widget::FLAG_RETAIN_FOCUS);
@ -249,41 +249,41 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
// Add four buttons at the bottom // Add four buttons at the bottom
xpos = HBORDER; ypos = _h - VBORDER - buttonHeight; xpos = HBORDER; ypos = _h - VBORDER - buttonHeight;
#ifndef BSPF_MACOS #ifndef BSPF_MACOS
myStartButton = new ButtonWidget(this, font, xpos, ypos, (buttonWidth + 0) / 4, buttonHeight, myStartButton = new ButtonWidget(this, _font, xpos, ypos, (buttonWidth + 0) / 4, buttonHeight,
"Select", kLoadROMCmd); "Select", kLoadROMCmd);
wid.push_back(myStartButton); wid.push_back(myStartButton);
xpos += (buttonWidth + 0) / 4 + BUTTON_GAP; xpos += (buttonWidth + 0) / 4 + BUTTON_GAP;
myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, (buttonWidth + 1) / 4, buttonHeight, myPrevDirButton = new ButtonWidget(this, _font, xpos, ypos, (buttonWidth + 1) / 4, buttonHeight,
"Go Up", kPrevDirCmd); "Go Up", kPrevDirCmd);
wid.push_back(myPrevDirButton); wid.push_back(myPrevDirButton);
xpos += (buttonWidth + 1) / 4 + BUTTON_GAP; xpos += (buttonWidth + 1) / 4 + BUTTON_GAP;
myOptionsButton = new ButtonWidget(this, font, xpos, ypos, (buttonWidth + 3) / 4, buttonHeight, myOptionsButton = new ButtonWidget(this, _font, xpos, ypos, (buttonWidth + 3) / 4, buttonHeight,
"Options" + ELLIPSIS, kOptionsCmd); "Options" + ELLIPSIS, kOptionsCmd);
wid.push_back(myOptionsButton); wid.push_back(myOptionsButton);
xpos += (buttonWidth + 2) / 4 + BUTTON_GAP; xpos += (buttonWidth + 2) / 4 + BUTTON_GAP;
myQuitButton = new ButtonWidget(this, font, xpos, ypos, (buttonWidth + 4) / 4, buttonHeight, myQuitButton = new ButtonWidget(this, _font, xpos, ypos, (buttonWidth + 4) / 4, buttonHeight,
"Quit", kQuitCmd); "Quit", kQuitCmd);
wid.push_back(myQuitButton); wid.push_back(myQuitButton);
#else #else
myQuitButton = new ButtonWidget(this, font, xpos, ypos, (buttonWidth + 0) / 4, buttonHeight, myQuitButton = new ButtonWidget(this, _font, xpos, ypos, (buttonWidth + 0) / 4, buttonHeight,
"Quit", kQuitCmd); "Quit", kQuitCmd);
wid.push_back(myQuitButton); wid.push_back(myQuitButton);
xpos += (buttonWidth + 0) / 4 + BUTTON_GAP; xpos += (buttonWidth + 0) / 4 + BUTTON_GAP;
myOptionsButton = new ButtonWidget(this, font, xpos, ypos, (buttonWidth + 1) / 4, buttonHeight, myOptionsButton = new ButtonWidget(this, _font, xpos, ypos, (buttonWidth + 1) / 4, buttonHeight,
"Options" + ELLIPSIS, kOptionsCmd); "Options" + ELLIPSIS, kOptionsCmd);
wid.push_back(myOptionsButton); wid.push_back(myOptionsButton);
xpos += (buttonWidth + 1) / 4 + BUTTON_GAP; xpos += (buttonWidth + 1) / 4 + BUTTON_GAP;
myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, (buttonWidth + 2) / 4, buttonHeight, myPrevDirButton = new ButtonWidget(this, _font, xpos, ypos, (buttonWidth + 2) / 4, buttonHeight,
"Go Up", kPrevDirCmd); "Go Up", kPrevDirCmd);
wid.push_back(myPrevDirButton); wid.push_back(myPrevDirButton);
xpos += (buttonWidth + 2) / 4 + BUTTON_GAP; xpos += (buttonWidth + 2) / 4 + BUTTON_GAP;
myStartButton = new ButtonWidget(this, font, xpos, ypos, (buttonWidth + 3) / 4, buttonHeight, myStartButton = new ButtonWidget(this, _font, xpos, ypos, (buttonWidth + 3) / 4, buttonHeight,
"Select", kLoadROMCmd); "Select", kLoadROMCmd);
wid.push_back(myStartButton); wid.push_back(myStartButton);
#endif #endif
@ -297,12 +297,12 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
addToFocusList(wid); addToFocusList(wid);
// Create (empty) context menu for ROM list options // Create (empty) context menu for ROM list options
myMenu = make_unique<ContextMenu>(this, osystem.frameBuffer().launcherFont(), EmptyVarList); myMenu = make_unique<ContextMenu>(this, _font, EmptyVarList);
// Create global props dialog, which is used to temporarily override // Create global props dialog, which is used to temporarily override
// ROM properties // ROM properties
myGlobalProps = make_unique<GlobalPropsDialog>(this, myGlobalProps = make_unique<GlobalPropsDialog>(this,
myUseMinimalUI ? osystem.frameBuffer().launcherFont() : osystem.frameBuffer().font()); myUseMinimalUI ? _font : osystem.frameBuffer().font());
// since we cannot know how many files there are, use are really high value here // since we cannot know how many files there are, use are really high value here
myList->progress().setRange(0, 50000, 5); myList->progress().setRange(0, 50000, 5);
@ -536,16 +536,15 @@ float LauncherDialog::getRomInfoZoom(int listHeight) const
if(zoom > 0.F) if(zoom > 0.F)
{ {
const GUI::Font& font = instance().frameBuffer().launcherFont();
const GUI::Font& smallFont = instance().frameBuffer().smallFont(); const GUI::Font& smallFont = instance().frameBuffer().smallFont();
const int fontWidth = font.getMaxCharWidth(), const int fontWidth = Dialog::fontWidth(),
HBORDER = fontWidth * 1.25; HBORDER = Dialog::hBorder();
// upper zoom limit - at least 24 launchers chars/line and 7 + 4 ROM info lines // upper zoom limit - at least 24 launchers chars/line and 7 + 4 ROM info lines
if((_w - (HBORDER * 2 + fontWidth + 30) - zoom * TIAConstants::viewableWidth) if((_w - (HBORDER * 2 + fontWidth + 30) - zoom * TIAConstants::viewableWidth)
/ font.getMaxCharWidth() < MIN_LAUNCHER_CHARS) / fontWidth < MIN_LAUNCHER_CHARS)
{ {
zoom = float(_w - (HBORDER * 2 + fontWidth + 30) - MIN_LAUNCHER_CHARS * font.getMaxCharWidth()) zoom = float(_w - (HBORDER * 2 + fontWidth + 30) - MIN_LAUNCHER_CHARS * fontWidth)
/ TIAConstants::viewableWidth; / TIAConstants::viewableWidth;
} }
if((listHeight - 12 - zoom * TIAConstants::viewableHeight) < if((listHeight - 12 - zoom * TIAConstants::viewableHeight) <
@ -584,7 +583,7 @@ void LauncherDialog::setRomInfoFont(const Common::Size& area)
for(size_t i = 0; i < sizeof(FONTS) / sizeof(FontDesc); ++i) for(size_t i = 0; i < sizeof(FONTS) / sizeof(FontDesc); ++i)
{ {
// only use fonts <= launcher fonts // only use fonts <= launcher fonts
if(instance().frameBuffer().launcherFont().getFontHeight() >= FONTS[i].height) if(Dialog::fontHeight() >= FONTS[i].height)
{ {
if(area.h >= uInt32(MIN_ROMINFO_ROWS * FONTS[i].height + 2 if(area.h >= uInt32(MIN_ROMINFO_ROWS * FONTS[i].height + 2
+ MIN_ROMINFO_LINES * FONTS[i].height) + MIN_ROMINFO_LINES * FONTS[i].height)
@ -916,7 +915,7 @@ void LauncherDialog::openHighScores()
void LauncherDialog::openWhatsNew() void LauncherDialog::openWhatsNew()
{ {
if(myWhatsNewDialog == nullptr) if(myWhatsNewDialog == nullptr)
myWhatsNewDialog = make_unique<WhatsNewDialog>(instance(), parent(), _font, _w, _h); myWhatsNewDialog = make_unique<WhatsNewDialog>(instance(), parent(), _w, _h);
myWhatsNewDialog->open(); myWhatsNewDialog->open();
} }

View File

@ -37,15 +37,13 @@ LoggerDialog::LoggerDialog(OSystem& osystem, DialogContainer& parent,
bool uselargefont) bool uselargefont)
: Dialog(osystem, parent, font, "System logs") : Dialog(osystem, parent, font, "System logs")
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontWidth = font.getMaxCharWidth(), fontWidth = Dialog::fontWidth(),
fontHeight = font.getFontHeight(), buttonHeight = Dialog::buttonHeight(),
buttonWidth = font.getStringWidth("Save log to disk" + ELLIPSIS) + fontWidth * 2.5, buttonWidth = Dialog::buttonWidth("Save log to disk" + ELLIPSIS),
buttonHeight = font.getLineHeight() * 1.25; VBORDER = Dialog::vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = Dialog::hBorder(),
const int HBORDER = fontWidth * 1.25; VGAP = Dialog::vGap();
const int VGAP = fontHeight / 4;
int xpos, ypos; int xpos, ypos;
WidgetArray wid; WidgetArray wid;

View File

@ -79,11 +79,10 @@ MessageBox::MessageBox(GuiObject* boss, const GUI::Font& font,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MessageBox::addText(const GUI::Font& font, const StringList& text) void MessageBox::addText(const GUI::Font& font, const StringList& text)
{ {
const int fontWidth = font.getMaxCharWidth(), const int fontWidth = Dialog::fontWidth(),
fontHeight = font.getFontHeight(); fontHeight = Dialog::fontHeight(),
const int VBORDER = fontHeight / 2; VBORDER = Dialog::vBorder(),
const int HBORDER = fontWidth * 1.25; HBORDER = Dialog::hBorder();
int xpos, ypos; int xpos, ypos;
// Set real dimensions // Set real dimensions
int str_w = 0; int str_w = 0;

View File

@ -54,17 +54,15 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
{ {
// do not show basic settings options in debugger // do not show basic settings options in debugger
bool minSettings = osystem.settings().getBool("minimal_ui") && mode != Menu::AppMode::debugger; bool minSettings = osystem.settings().getBool("minimal_ui") && mode != Menu::AppMode::debugger;
const int const int lineHeight = Dialog::lineHeight(),
fontWidth = _font.getMaxCharWidth(), buttonHeight = Dialog::buttonHeight(),
fontHeight = _font.getFontHeight(), VBORDER = Dialog::vBorder(),
buttonHeight = _font.getLineHeight() * 1.25, HBORDER = Dialog::hBorder(),
VGAP = fontHeight / 4, VGAP = Dialog::vGap(),
HGAP = fontWidth, INDENT = Dialog::indent();
rowHeight = buttonHeight + VGAP; const int HGAP = Dialog::buttonGap(),
const int VBORDER = fontHeight / 2; rowHeight = buttonHeight + VGAP;
const int HBORDER = fontWidth * 1.25; int buttonWidth = Dialog::buttonWidth("Game Properties" + ELLIPSIS);
int buttonWidth = _font.getStringWidth("Game Properties" + ELLIPSIS) + fontWidth * 2.5;
_w = 2 * buttonWidth + HBORDER * 2 + HGAP; _w = 2 * buttonWidth + HBORDER * 2 + HGAP;
_h = 7 * rowHeight + VBORDER * 2 - VGAP + _th; _h = 7 * rowHeight + VBORDER * 2 - VGAP + _th;
@ -133,7 +131,7 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
b = ADD_OD_BUTTON("About" + ELLIPSIS, kAboutCmd); b = ADD_OD_BUTTON("About" + ELLIPSIS, kAboutCmd);
wid.push_back(b); wid.push_back(b);
buttonWidth = _font.getStringWidth(" Close ") + fontWidth * 2.5; buttonWidth = Dialog::buttonWidth(" Close ");
xoffset -= (buttonWidth + HGAP) / 2; xoffset -= (buttonWidth + HGAP) / 2;
b = ADD_OD_BUTTON("Close", kExitCmd); b = ADD_OD_BUTTON("Close", kExitCmd);
wid.push_back(b); wid.push_back(b);

View File

@ -32,17 +32,14 @@ ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font,
: Dialog(boss->instance(), boss->parent()), : Dialog(boss->instance(), boss->parent()),
myFont{font} myFont{font}
{ {
const int fontWidth = font.getMaxCharWidth(), const int lineHeight = Dialog::lineHeight(),
fontHeight = font.getFontHeight(), fontHeight = Dialog::fontHeight(),
lineHeight = font.getLineHeight(), buttonHeight = Dialog::buttonHeight(),
VBORDER = fontHeight / 2, buttonWidth = Dialog::buttonWidth("Cancel"),
HBORDER = fontWidth * 1.25, VBORDER = Dialog::vBorder(),
VGAP = fontHeight / 4, HBORDER = Dialog::hBorder(),
buttonHeight = font.getLineHeight() * 1.25, VGAP = Dialog::vGap();
BTN_BORDER = fontWidth * 2.5, const int lwidth = font.getStringWidth(message);
buttonWidth = font.getStringWidth("Cancel") + BTN_BORDER,
lwidth = font.getStringWidth(message);
int xpos, ypos; int xpos, ypos;
WidgetArray wid; WidgetArray wid;
@ -73,12 +70,9 @@ ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ProgressDialog::setMessage(const string& message) void ProgressDialog::setMessage(const string& message)
{ {
const int fontWidth = myFont.getMaxCharWidth(), const int buttonWidth = Dialog::buttonWidth("Cancel"),
HBORDER = fontWidth * 1.25, HBORDER = Dialog::hBorder();
lwidth = myFont.getStringWidth(message), const int lwidth = myFont.getStringWidth(message);
BTN_BORDER = fontWidth * 2.5,
buttonWidth = myFont.getStringWidth("Cancel") + BTN_BORDER;
// Recalculate real dimensions // Recalculate real dimensions
_w = HBORDER * 2 + std::max(lwidth, buttonWidth); _w = HBORDER * 2 + std::max(lwidth, buttonWidth);

View File

@ -31,13 +31,10 @@ QuadTariDialog::QuadTariDialog(GuiObject* boss, const GUI::Font& font, int max_w
: Dialog(boss->instance(), boss->parent(), font, "QuadTari controllers", 0, 0, max_w, max_h), : Dialog(boss->instance(), boss->parent(), font, "QuadTari controllers", 0, 0, max_w, max_h),
myGameProperties{properties} myGameProperties{properties}
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = font.getFontHeight(), VBORDER = Dialog::vBorder(),
fontWidth = font.getMaxCharWidth(); HBORDER = Dialog::hBorder(),
const int VBORDER = fontHeight / 2; VGAP = Dialog::vGap();
const int HBORDER = fontWidth * 1.25;
const int VGAP = fontHeight / 4;
int xpos, ypos; int xpos, ypos;
WidgetArray wid; WidgetArray wid;
VariantList ctrls; VariantList ctrls;

View File

@ -27,28 +27,30 @@ R77HelpDialog::R77HelpDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font) const GUI::Font& font)
: Dialog(osystem, parent, font, "RetroN 77 help") : Dialog(osystem, parent, font, "RetroN 77 help")
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontWidth = font.getMaxCharWidth(), fontHeight = Dialog::fontHeight(),
fontHeight = font.getFontHeight(), fontWidth = Dialog::fontWidth(),
buttonWidth = font.getStringWidth("Previous") + 20, buttonHeight = Dialog::buttonHeight(),
buttonHeight = font.getLineHeight() + 4; buttonWidth = Dialog::buttonWidth("Previous"),
const int HBORDER = 10; BUTTON_GAP = Dialog::buttonGap(),
VBORDER = Dialog::vBorder(),
HBORDER = Dialog::hBorder();
int xpos, ypos; int xpos, ypos;
WidgetArray wid; WidgetArray wid;
// Set real dimensions // Set real dimensions
_w = 47 * fontWidth + HBORDER * 2; _w = 47 * fontWidth + HBORDER * 2;
_h = (LINES_PER_PAGE + 2) * lineHeight + 12 + _th; _h = (LINES_PER_PAGE + 2) * lineHeight + VBORDER * 2 + _th;
// Add Previous, Next and Close buttons // Add Previous, Next and Close buttons
xpos = HBORDER; ypos = _h - buttonHeight - 10; xpos = HBORDER; ypos = _h - buttonHeight - VBORDER;
myPrevButton = myPrevButton =
new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"Previous", GuiObject::kPrevCmd); "Previous", GuiObject::kPrevCmd);
myPrevButton->clearFlags(Widget::FLAG_ENABLED); myPrevButton->clearFlags(Widget::FLAG_ENABLED);
wid.push_back(myPrevButton); wid.push_back(myPrevButton);
xpos += buttonWidth + 8; xpos += buttonWidth + BUTTON_GAP;
myNextButton = myNextButton =
new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"Next", GuiObject::kNextCmd); "Next", GuiObject::kNextCmd);
@ -61,7 +63,7 @@ R77HelpDialog::R77HelpDialog(OSystem& osystem, DialogContainer& parent,
wid.push_back(b); wid.push_back(b);
addCancelWidget(b); addCancelWidget(b);
xpos = HBORDER; ypos = 5 + _th; xpos = HBORDER; ypos = VBORDER + _th;
myTitle = new StaticTextWidget(this, font, xpos, ypos, _w - HBORDER * 2, fontHeight, myTitle = new StaticTextWidget(this, font, xpos, ypos, _w - HBORDER * 2, fontHeight,
"", TextAlign::Center); "", TextAlign::Center);

View File

@ -40,45 +40,44 @@ RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent,
myMaxWidth{max_w}, myMaxWidth{max_w},
myMaxHeight{max_h} myMaxHeight{max_h}
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontWidth = font.getMaxCharWidth(), fontWidth = Dialog::fontWidth(),
fontHeight = font.getFontHeight(), buttonHeight = Dialog::buttonHeight(),
buttonWidth = font.getStringWidth("Audit path" + ELLIPSIS) + fontWidth * 2.5, buttonWidth = Dialog::buttonWidth("Audit path" + ELLIPSIS),
buttonHeight = font.getLineHeight() * 1.25, VBORDER = Dialog::vBorder(),
lwidth = font.getStringWidth("ROMs without properties (skipped) "); HBORDER = Dialog::hBorder(),
const int VBORDER = _th + fontHeight / 2; VGAP = Dialog::vGap();
const int HBORDER = fontWidth * 1.25; const int lwidth = font.getStringWidth("ROMs without properties (skipped) ");
int xpos, ypos = _th + VBORDER;
int xpos, ypos = VBORDER;
WidgetArray wid; WidgetArray wid;
// Set real dimensions // Set real dimensions
_w = 64 * fontWidth + HBORDER * 2; _w = 64 * fontWidth + HBORDER * 2;
_h = 7 * (lineHeight + 4) + VBORDER; _h = _th + VBORDER * 2 + buttonHeight * 2 + lineHeight * 3 + VGAP * 10;
// Audit path // Audit path
ButtonWidget* romButton = ButtonWidget* romButton =
new ButtonWidget(this, font, HBORDER, ypos, buttonWidth, buttonHeight, new ButtonWidget(this, font, HBORDER, ypos, buttonWidth, buttonHeight,
"Audit path" + ELLIPSIS, kChooseAuditDirCmd); "Audit path" + ELLIPSIS, kChooseAuditDirCmd);
wid.push_back(romButton); wid.push_back(romButton);
xpos = HBORDER + buttonWidth + 8; xpos = HBORDER + buttonWidth + fontWidth;
myRomPath = new EditTextWidget(this, font, xpos, ypos + (buttonHeight - lineHeight) / 2 - 1, myRomPath = new EditTextWidget(this, font, xpos, ypos + (buttonHeight - lineHeight) / 2 - 1,
_w - xpos - HBORDER, lineHeight, ""); _w - xpos - HBORDER, lineHeight);
wid.push_back(myRomPath); wid.push_back(myRomPath);
// Show results of ROM audit // Show results of ROM audit
ypos += buttonHeight + 16; ypos += buttonHeight + VGAP * 4;
new StaticTextWidget(this, font, HBORDER, ypos, "ROMs with properties (renamed) "); new StaticTextWidget(this, font, HBORDER, ypos, "ROMs with properties (renamed) ");
myResults1 = new EditTextWidget(this, font, HBORDER + lwidth, ypos - 2, myResults1 = new EditTextWidget(this, font, HBORDER + lwidth, ypos - 2,
fontWidth * 6, lineHeight, ""); fontWidth * 6, lineHeight);
myResults1->setEditable(false, true); myResults1->setEditable(false, true);
ypos += buttonHeight; ypos += buttonHeight;
new StaticTextWidget(this, font, HBORDER, ypos, "ROMs without properties (skipped) "); new StaticTextWidget(this, font, HBORDER, ypos, "ROMs without properties (skipped) ");
myResults2 = new EditTextWidget(this, font, HBORDER + lwidth, ypos - 2, myResults2 = new EditTextWidget(this, font, HBORDER + lwidth, ypos - 2,
fontWidth * 6, lineHeight, ""); fontWidth * 6, lineHeight);
myResults2->setEditable(false, true); myResults2->setEditable(false, true);
ypos += buttonHeight + 8; ypos += buttonHeight + VGAP * 2;
new StaticTextWidget(this, font, HBORDER, ypos, "(*) WARNING: Operation cannot be undone!"); new StaticTextWidget(this, font, HBORDER, ypos, "(*) WARNING: Operation cannot be undone!");
// Add OK and Cancel buttons // Add OK and Cancel buttons

View File

@ -30,16 +30,14 @@ SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h) const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, font, "Snapshot settings") : Dialog(osystem, parent, font, "Snapshot settings")
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = _font.getFontHeight(), fontWidth = Dialog::fontWidth(),
fontWidth = font.getMaxCharWidth(), buttonHeight = Dialog::buttonHeight(),
buttonWidth = font.getStringWidth("Save path" + ELLIPSIS) + fontWidth * 2.5, buttonWidth = Dialog::buttonWidth("Save path" + ELLIPSIS),
buttonHeight = font.getLineHeight() * 1.25; VBORDER = Dialog::vBorder(),
const int HBORDER = fontWidth * 1.25; HBORDER = Dialog::hBorder(),
const int VBORDER = fontHeight / 4; VGAP = Dialog::vGap(),
const int INDENT = fontWidth * 2; INDENT = Dialog::indent();
const int VGAP = fontHeight / 4;
int xpos, ypos, fwidth; int xpos, ypos, fwidth;
WidgetArray wid; WidgetArray wid;
ButtonWidget* b; ButtonWidget* b;

View File

@ -34,16 +34,15 @@ StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& pa
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Basic settings"), : Dialog(osystem, parent, osystem.frameBuffer().font(), "Basic settings"),
myMode{mode} myMode{mode}
{ {
const int buttonHeight = _font.getLineHeight() + _font.getLineHeight() / 5, const int iLineHeight = instance().frameBuffer().infoFont().getLineHeight();
lineHeight = _font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontWidth = _font.getMaxCharWidth(), fontWidth = Dialog::fontWidth(),
buttonWidth = _font.getStringWidth(" Help " + ELLIPSIS), buttonHeight = Dialog::buttonHeight(),
iLineHeight = instance().frameBuffer().infoFont().getLineHeight(); buttonWidth = Dialog::buttonWidth(" Help " + ELLIPSIS),
VBORDER = Dialog::vBorder(),
const int VBORDER = _font.getFontHeight() / 2; HBORDER = Dialog::hBorder(),
const int HBORDER = fontWidth; VGAP = Dialog::vGap(),
const int INDENT = fontWidth * 2; INDENT = Dialog::indent();
const int VGAP = _font.getFontHeight() / 4;
int xpos, ypos; int xpos, ypos;
ButtonWidget* bw = nullptr; ButtonWidget* bw = nullptr;
@ -97,8 +96,8 @@ StellaSettingsDialog::~StellaSettingsDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaSettingsDialog::addUIOptions(WidgetArray& wid, int& xpos, int& ypos) void StellaSettingsDialog::addUIOptions(WidgetArray& wid, int& xpos, int& ypos)
{ {
const int VGAP = _font.getFontHeight() / 4; const int lineHeight = Dialog::lineHeight(),
const int lineHeight = _font.getLineHeight(); VGAP = Dialog::vGap();
VariantList items; VariantList items;
int pwidth = _font.getStringWidth("Right bottom"); // align width with other popup int pwidth = _font.getStringWidth("Right bottom"); // align width with other popup
@ -126,10 +125,10 @@ void StellaSettingsDialog::addUIOptions(WidgetArray& wid, int& xpos, int& ypos)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaSettingsDialog::addVideoOptions(WidgetArray& wid, int& xpos, int& ypos) void StellaSettingsDialog::addVideoOptions(WidgetArray& wid, int& xpos, int& ypos)
{ {
const int VGAP = _font.getFontHeight() / 4; const int lineHeight = Dialog::lineHeight(),
fontWidth = Dialog::fontWidth(),
VGAP = Dialog::vGap();
const GUI::Font& ifont = instance().frameBuffer().infoFont(); const GUI::Font& ifont = instance().frameBuffer().infoFont();
const int lineHeight = _font.getLineHeight(),
fontWidth = _font.getMaxCharWidth();
VariantList items; VariantList items;
// TV effects options // TV effects options
@ -180,8 +179,8 @@ void StellaSettingsDialog::addVideoOptions(WidgetArray& wid, int& xpos, int& ypo
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaSettingsDialog::addGameOptions(WidgetArray& wid, int& xpos, int& ypos) void StellaSettingsDialog::addGameOptions(WidgetArray& wid, int& xpos, int& ypos)
{ {
const int VGAP = _font.getFontHeight() / 4; const int lineHeight = Dialog::lineHeight(),
const int lineHeight = _font.getLineHeight(); VGAP = Dialog::vGap();
const GUI::Font& ifont = instance().frameBuffer().infoFont(); const GUI::Font& ifont = instance().frameBuffer().infoFont();
VariantList ctrls; VariantList ctrls;

View File

@ -45,14 +45,14 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
myIsGlobal{boss != nullptr} myIsGlobal{boss != nullptr}
{ {
const GUI::Font& ifont = instance().frameBuffer().infoFont(); const GUI::Font& ifont = instance().frameBuffer().infoFont();
const int lineHeight = font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontWidth = font.getMaxCharWidth(), fontHeight = Dialog::fontHeight(),
fontHeight = font.getFontHeight(), fontWidth = Dialog::fontWidth(),
buttonHeight = font.getLineHeight() * 1.25; buttonHeight = Dialog::buttonHeight(),
const int VBORDER = fontHeight / 2; VBORDER = Dialog::vBorder(),
const int HBORDER = fontWidth * 1.25; HBORDER = Dialog::hBorder(),
const int INDENT = fontWidth * 2; VGAP = Dialog::vGap(),
const int VGAP = fontHeight / 4; INDENT = Dialog::indent();
int xpos, ypos, tabID; int xpos, ypos, tabID;
int lwidth, pwidth, bwidth; int lwidth, pwidth, bwidth;
WidgetArray wid; WidgetArray wid;

View File

@ -57,13 +57,12 @@ VideoAudioDialog::VideoAudioDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h) const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, font, "Video & Audio settings") : Dialog(osystem, parent, font, "Video & Audio settings")
{ {
const int lineHeight = _font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = _font.getFontHeight(), fontWidth = Dialog::fontWidth(),
fontWidth = _font.getMaxCharWidth(), buttonHeight = Dialog::buttonHeight(),
buttonHeight = _font.getLineHeight() * 1.25; VBORDER = Dialog::vBorder(),
const int VGAP = fontHeight / 4; HBORDER = Dialog::hBorder(),
const int VBORDER = fontHeight / 2; VGAP = Dialog::vGap();
const int HBORDER = fontWidth * 1.25;
int xpos, ypos; int xpos, ypos;
// Set real dimensions // Set real dimensions
@ -103,12 +102,12 @@ VideoAudioDialog::VideoAudioDialog(OSystem& osystem, DialogContainer& parent,
void VideoAudioDialog::addDisplayTab() void VideoAudioDialog::addDisplayTab()
{ {
const GUI::Font& ifont = instance().frameBuffer().infoFont(); const GUI::Font& ifont = instance().frameBuffer().infoFont();
const int lineHeight = _font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = _font.getFontHeight(), fontHeight = Dialog::fontHeight(),
fontWidth = _font.getMaxCharWidth(); fontWidth = Dialog::fontWidth(),
const int VGAP = fontHeight / 4; VBORDER = Dialog::vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = Dialog::hBorder(),
const int HBORDER = fontWidth * 1.25; VGAP = Dialog::vGap();
const int INDENT = CheckboxWidget::prefixSize(_font); const int INDENT = CheckboxWidget::prefixSize(_font);
const int lwidth = _font.getStringWidth("V-Size adjust "), const int lwidth = _font.getStringWidth("V-Size adjust "),
pwidth = _font.getStringWidth("OpenGLES2"); pwidth = _font.getStringWidth("OpenGLES2");
@ -199,13 +198,12 @@ void VideoAudioDialog::addDisplayTab()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoAudioDialog::addPaletteTab() void VideoAudioDialog::addPaletteTab()
{ {
const int lineHeight = _font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = _font.getFontHeight(), fontWidth = Dialog::fontWidth(),
fontWidth = _font.getMaxCharWidth(); VBORDER = Dialog::vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = Dialog::hBorder(),
const int HBORDER = fontWidth * 1.25; VGAP = Dialog::vGap(),
const int INDENT = fontWidth * 2; INDENT = Dialog::indent();
const int VGAP = fontHeight / 4;
const int lwidth = _font.getStringWidth(" NTSC phase "); const int lwidth = _font.getStringWidth(" NTSC phase ");
const int pwidth = _font.getStringWidth("Standard"); const int pwidth = _font.getStringWidth("Standard");
int xpos = HBORDER, int xpos = HBORDER,
@ -331,14 +329,14 @@ void VideoAudioDialog::addPaletteTab()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoAudioDialog::addTVEffectsTab() void VideoAudioDialog::addTVEffectsTab()
{ {
const int lineHeight = _font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = _font.getFontHeight(), fontWidth = Dialog::fontWidth(),
fontWidth = _font.getMaxCharWidth(), buttonHeight = Dialog::buttonHeight(),
buttonHeight = _font.getLineHeight() * 1.25; buttonWidth = Dialog::buttonWidth("Clone Bad Adjust"),
const int VBORDER = fontHeight / 2; VBORDER = Dialog::vBorder(),
const int HBORDER = fontWidth * 1.25; HBORDER = Dialog::hBorder(),
VGAP = Dialog::vGap();
const int INDENT = CheckboxWidget::prefixSize(_font);// fontWidth * 2; const int INDENT = CheckboxWidget::prefixSize(_font);// fontWidth * 2;
const int VGAP = fontHeight / 4;
int xpos = HBORDER, int xpos = HBORDER,
ypos = VBORDER; ypos = VBORDER;
const int lwidth = _font.getStringWidth("Saturation "); const int lwidth = _font.getStringWidth("Saturation ");
@ -392,14 +390,13 @@ void VideoAudioDialog::addTVEffectsTab()
CREATE_CUSTOM_SLIDERS(ScanIntense, "Intensity", kScanlinesChanged) CREATE_CUSTOM_SLIDERS(ScanIntense, "Intensity", kScanlinesChanged)
// Create buttons in 2nd column // Create buttons in 2nd column
int cloneWidth = _font.getStringWidth("Clone Bad Adjust") + fontWidth * 2.5; xpos = _w - HBORDER - 2 * 2 - buttonWidth;
xpos = _w - HBORDER - 2 * 2 - cloneWidth;
ypos = VBORDER - VGAP / 2; ypos = VBORDER - VGAP / 2;
// Adjustable presets // Adjustable presets
#define CREATE_CLONE_BUTTON(obj, desc) \ #define CREATE_CLONE_BUTTON(obj, desc) \
myClone ## obj = \ myClone ## obj = \
new ButtonWidget(myTab, _font, xpos, ypos, cloneWidth, buttonHeight,\ new ButtonWidget(myTab, _font, xpos, ypos, buttonWidth, buttonHeight,\
desc, kClone ## obj ##Cmd); \ desc, kClone ## obj ##Cmd); \
wid.push_back(myClone ## obj); \ wid.push_back(myClone ## obj); \
ypos += buttonHeight + VGAP; ypos += buttonHeight + VGAP;
@ -418,14 +415,12 @@ void VideoAudioDialog::addTVEffectsTab()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoAudioDialog::addAudioTab() void VideoAudioDialog::addAudioTab()
{ {
const int lineHeight = _font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = _font.getFontHeight(), fontWidth = Dialog::fontWidth(),
fontWidth = _font.getMaxCharWidth(); VBORDER = Dialog::vBorder(),
const int VBORDER = fontHeight / 2; HBORDER = Dialog::hBorder(),
const int HBORDER = fontWidth * 1.25; VGAP = Dialog::vGap();
const int INDENT = CheckboxWidget::prefixSize(_font); const int INDENT = CheckboxWidget::prefixSize(_font);
const int VGAP = fontHeight / 4;
int xpos, ypos; int xpos, ypos;
int lwidth = _font.getStringWidth("Volume "), int lwidth = _font.getStringWidth("Volume "),
pwidth; pwidth;

View File

@ -15,6 +15,8 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================ //============================================================================
#include "OSystem.hxx"
#include "FrameBuffer.hxx"
#include "Version.hxx" #include "Version.hxx"
#include "WhatsNewDialog.hxx" #include "WhatsNewDialog.hxx"
@ -22,20 +24,21 @@
constexpr int MAX_CHARS = 64; // maximum number of chars per line constexpr int MAX_CHARS = 64; // maximum number of chars per line
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
WhatsNewDialog::WhatsNewDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font, WhatsNewDialog::WhatsNewDialog(OSystem& osystem, DialogContainer& parent,
int max_w, int max_h) int max_w, int max_h)
#if defined(RETRON77) #if defined(RETRON77)
: Dialog(osystem, parent, font, "What's New in Stella " + string(STELLA_VERSION) + " for RetroN 77?") : Dialog(osystem, parent, osystem.frameBuffer().font(),
"What's New in Stella " + string(STELLA_VERSION) + " for RetroN 77?")
#else #else
: Dialog(osystem, parent, font, "What's New in Stella " + string(STELLA_VERSION) + "?") : Dialog(osystem, parent, osystem.frameBuffer().font(),
"What's New in Stella " + string(STELLA_VERSION) + "?")
#endif #endif
{ {
const int fontHeight = _font.getFontHeight(), const int fontWidth = Dialog::fontWidth(),
fontWidth = _font.getMaxCharWidth(), buttonHeight = Dialog::buttonHeight(),
buttonHeight = _font.getLineHeight() * 1.25; VBORDER = Dialog::vBorder(),
const int VGAP = fontHeight / 4; HBORDER = Dialog::hBorder(),
const int VBORDER = fontHeight / 2; VGAP = Dialog::vGap();
const int HBORDER = fontWidth * 1.25;
int ypos = _th + VBORDER; int ypos = _th + VBORDER;
// Set preliminary dimensions // Set preliminary dimensions
@ -75,10 +78,9 @@ WhatsNewDialog::WhatsNewDialog(OSystem& osystem, DialogContainer& parent, const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void WhatsNewDialog::add(int& ypos, const string& text) void WhatsNewDialog::add(int& ypos, const string& text)
{ {
const int lineHeight = _font.getLineHeight(), const int lineHeight = Dialog::lineHeight(),
fontHeight = _font.getFontHeight(), fontHeight = Dialog::fontHeight(),
fontWidth = _font.getMaxCharWidth(), HBORDER = Dialog::hBorder();
HBORDER = fontWidth * 1.25;
const string DOT = "\x1f"; const string DOT = "\x1f";
string txt = DOT + " " + text; string txt = DOT + " " + text;

View File

@ -23,7 +23,7 @@
class WhatsNewDialog : public Dialog class WhatsNewDialog : public Dialog
{ {
public: public:
WhatsNewDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font, WhatsNewDialog(OSystem& osystem, DialogContainer& parent,
int max_w, int max_h); int max_w, int max_h);
~WhatsNewDialog() override = default; ~WhatsNewDialog() override = default;