From 7ba3dae4e23d97cd82c79c389ecccf8203a2082b Mon Sep 17 00:00:00 2001 From: thrust26 Date: Wed, 19 Feb 2020 07:34:11 +0100 Subject: [PATCH] minor tweaks --- src/gui/Dialog.cxx | 10 ++++++++-- src/gui/Dialog.hxx | 1 + src/gui/HighScoresDialog.cxx | 8 ++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index a9c60f3d1..a14cb5614 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -779,7 +779,7 @@ void Dialog::addOKCancelBGroup(WidgetArray& wid, const GUI::Font& font, std::max(font.getStringWidth("Defaults"), std::max(font.getStringWidth(okText), font.getStringWidth(cancelText))) + BTN_BORDER); - int buttonHeight = font.getLineHeight() + 4; + int buttonHeight = Dialog::buttonHeight(font); _w = std::max(HBORDER * 2 + buttonWidth * 2 + BUTTON_GAP, _w); @@ -821,7 +821,7 @@ void Dialog::addDefaultsOKCancelBGroup(WidgetArray& wid, const GUI::Font& font, const int VBORDER = 10; const int BTN_BORDER = 20; int buttonWidth = font.getStringWidth(defaultsText) + BTN_BORDER; - int buttonHeight = font.getLineHeight() + 4; + int buttonHeight = Dialog::buttonHeight(font); addDefaultWidget(new ButtonWidget(this, font, HBORDER, _h - buttonHeight - VBORDER, buttonWidth, buttonHeight, defaultsText, GuiObject::kDefaultsCmd)); @@ -830,6 +830,12 @@ void Dialog::addDefaultsOKCancelBGroup(WidgetArray& wid, const GUI::Font& font, addOKCancelBGroup(wid, font, okText, cancelText, focusOKButton, buttonWidth); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int Dialog::buttonHeight(const GUI::Font& font) const +{ + return font.getLineHeight() + 4; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Dialog::TabFocus::appendFocusList(WidgetArray& list) { diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx index 5b95fe5e0..2aa9d9727 100644 --- a/src/gui/Dialog.hxx +++ b/src/gui/Dialog.hxx @@ -157,6 +157,7 @@ class Dialog : public GuiObject const string& cancelText = "Cancel", const string& defaultsText = "Defaults", bool focusOKButton = true); + int buttonHeight(const GUI::Font& font) const; void processCancelWithoutWidget(bool state) { _processCancel = state; } virtual void processCancel() { close(); } diff --git a/src/gui/HighScoresDialog.cxx b/src/gui/HighScoresDialog.cxx index 86b194ce2..8cef7305c 100644 --- a/src/gui/HighScoresDialog.cxx +++ b/src/gui/HighScoresDialog.cxx @@ -43,7 +43,7 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& ifont = instance().frameBuffer().infoFont(); const int lineHeight = _font.getLineHeight(), fontWidth = _font.getMaxCharWidth(); - const int VBORDER = 8; + const int VBORDER = 10; const int HBORDER = 10; const int VGAP = 4; @@ -90,7 +90,7 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent, wid.push_back(myEditNamesWidget[p]); myDatesWidget[p] = new StaticTextWidget(this, _font, xposDate, ypos + 1, "12-02-20 17:15"); myDeleteButtons[p] = new ButtonWidget(this, _font, xposDelete, ypos + 1, 18, 18, "X", - kDeleteSingle); + kDeleteSingle); myDeleteButtons[p]->setID(p); wid.push_back(myDeleteButtons[p]); @@ -100,7 +100,7 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent, myMD5Widget = new StaticTextWidget(this, ifont, xpos, ypos + 1, "MD5: 12345678901234567890123456789012"); - _h = myMD5Widget->getBottom() + VBORDER + (lineHeight + 4) + VBORDER; + _h = myMD5Widget->getBottom() + VBORDER + buttonHeight(_font) + VBORDER; _w = myDeleteButtons[0]->getRight() + HBORDER; addDefaultsOKCancelBGroup(wid, _font, "Save", "Cancel", " Reset "); @@ -192,7 +192,7 @@ void HighScoresDialog::handleCommand(CommandSender* sender, int cmd, int data, i updateWidgets(); break; - case GuiObject::kDefaultsCmd: + case GuiObject::kDefaultsCmd: // "Reset" button for (int p = NUM_POSITIONS - 1; p >= 0; --p) deletePos(p); updateWidgets();