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)
: Dialog(osystem, parent, font, "Cheat codes")
{
const int lineHeight = font.getLineHeight(),
fontHeight = font.getFontHeight(),
fontWidth = font.getMaxCharWidth(),
buttonWidth = font.getStringWidth("One shot ") + fontWidth * 2.5,
buttonHeight = font.getLineHeight() * 1.25;
const int VBORDER = fontHeight / 2;
const int HBORDER = fontWidth * 1.25;
const int VGAP = fontHeight / 4;
const int lineHeight = Dialog::lineHeight(),
fontHeight = Dialog::fontHeight(),
fontWidth = Dialog::fontWidth(),
buttonHeight = Dialog::buttonHeight(),
buttonWidth = Dialog::buttonWidth("One shot "),
VGAP = Dialog::vGap(),
VBORDER = Dialog::vBorder(),
HBORDER = Dialog::hBorder();
int xpos, ypos;
WidgetArray wid;
ButtonWidget* b;

View File

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

View File

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

View File

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

View File

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

View File

@ -449,7 +449,7 @@ void Dialog::drawDialog()
if(_th)
{
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);
}
}
@ -865,17 +865,14 @@ Widget* Dialog::findWidget(int x, int y) const
void Dialog::addOKBGroup(WidgetArray& wid, const GUI::Font& font,
const string& okText, int buttonWidth)
{
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
buttonHeight = font.getLineHeight() * 1.25;
const int VBORDER = fontHeight / 2;
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);
const int buttonHeight = Dialog::buttonHeight(),
BUTTON_GAP = Dialog::buttonGap(),
VBORDER = Dialog::vBorder(),
HBORDER = Dialog::hBorder();
buttonWidth = std::max(buttonWidth,
std::max(Dialog::buttonWidth(okText),
Dialog::buttonWidth("Cancel")));
_w = std::max(HBORDER * 2 + buttonWidth * 2 + BUTTON_GAP, _w);
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,
bool focusOKButton, int buttonWidth)
{
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
buttonHeight = font.getLineHeight() * 1.25;
const int VBORDER = fontHeight / 2;
const int HBORDER = fontWidth * 1.25;
const int BTN_BORDER = fontWidth * 2.5;
const int BUTTON_GAP = fontWidth;
const int buttonHeight = Dialog::buttonHeight(),
BUTTON_GAP = Dialog::buttonGap(),
VBORDER = Dialog::vBorder(),
HBORDER = Dialog::hBorder();
buttonWidth = std::max(buttonWidth,
std::max(font.getStringWidth("Defaults"),
std::max(font.getStringWidth(okText),
font.getStringWidth(cancelText))) + BTN_BORDER);
std::max(Dialog::buttonWidth("Defaults"),
std::max(Dialog::buttonWidth(okText),
Dialog::buttonWidth(cancelText))));
_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,
bool focusOKButton)
{
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
buttonHeight = font.getLineHeight() * 1.25;
const int VBORDER = fontHeight / 2;
const int HBORDER = fontWidth * 1.25;
const int BTN_BORDER = fontWidth * 2.5;
const int buttonWidth = font.getStringWidth(defaultsText) + BTN_BORDER;
const int buttonHeight = Dialog::buttonHeight(),
buttonWidth = Dialog::buttonWidth(defaultsText),
VBORDER = Dialog::vBorder(),
HBORDER = Dialog::hBorder();
addDefaultWidget(new ButtonWidget(this, font, HBORDER, _h - buttonHeight - VBORDER,
buttonWidth, buttonHeight, defaultsText, GuiObject::kDefaultsCmd));
@ -958,22 +950,20 @@ void Dialog::addDefaultsExtraOKCancelBGroup(
const string& okText, const string& cancelText, const string& defaultsText,
bool focusOKButton)
{
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
buttonHeight = font.getLineHeight() * 1.25;
const int VBORDER = fontHeight / 2;
const int HBORDER = fontWidth * 1.25;
const int BTN_BORDER = fontWidth * 2.5;
const int BUTTON_GAP = fontWidth;
const int buttonWidth = font.getStringWidth(defaultsText) + BTN_BORDER;
const int buttonHeight = Dialog::buttonHeight(),
buttonWidth = std::max(Dialog::buttonWidth(defaultsText),
Dialog::buttonWidth(extraText)),
BUTTON_GAP = Dialog::buttonGap(),
VBORDER = Dialog::vBorder(),
HBORDER = Dialog::hBorder();
addDefaultWidget(new ButtonWidget(this, font, HBORDER, _h - buttonHeight - VBORDER,
buttonWidth, buttonHeight, defaultsText, GuiObject::kDefaultsCmd));
wid.push_back(_defaultWidget);
addExtraWidget(new ButtonWidget(this, font, HBORDER + buttonWidth + BUTTON_GAP,
_h - buttonHeight - VBORDER, buttonWidth, buttonHeight,
extraText, extraCmd));
_h - buttonHeight - VBORDER,
buttonWidth, buttonHeight, extraText, extraCmd));
wid.push_back(_extraWidget);
addOKCancelBGroup(wid, font, okText, cancelText, focusOKButton, buttonWidth);

View File

@ -127,6 +127,19 @@ class Dialog : public GuiObject
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:
void draw() override { }
void releaseFocus() override;
@ -164,7 +177,6 @@ class Dialog : public GuiObject
const string& cancelText = "Cancel",
const string& defaultsText = "Defaults",
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
// point, since the parameter list is kind of getting ridiculous

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -61,20 +61,20 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
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");
const GUI::Font& font = instance().frameBuffer().launcherFont();
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(),
HBORDER = fontWidth * 1.25,
VBORDER = fontHeight / 2,
BUTTON_GAP = fontWidth,
LBL_GAP = fontWidth,
VGAP = fontHeight / 4,
buttonHeight = myUseMinimalUI ? lineHeight - VGAP * 2: lineHeight * 1.25,
const int lineHeight = Dialog::lineHeight(),
fontHeight = Dialog::fontHeight(),
fontWidth = Dialog::fontWidth(),
BUTTON_GAP = Dialog::buttonGap(),
VBORDER = Dialog::vBorder(),
HBORDER = Dialog::hBorder(),
VGAP = Dialog::vGap(),
INDENT = Dialog::indent();
const int LBL_GAP = fontWidth,
buttonHeight = myUseMinimalUI ? lineHeight - VGAP * 2: Dialog::buttonHeight(),
buttonWidth = (_w - 2 * HBORDER - BUTTON_GAP * (4 - 1));
int xpos = HBORDER, ypos = VBORDER;
@ -85,22 +85,22 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
string lblSubDirs = "Incl. subdirectories";
string lblFound = "12345 items found";
tooltip().setFont(font);
tooltip().setFont(_font);
int lwSelect = font.getStringWidth(lblSelect);
int cwAllFiles = font.getStringWidth(lblAllFiles) + CheckboxWidget::prefixSize(font);
int cwSubDirs = font.getStringWidth(lblSubDirs) + CheckboxWidget::prefixSize(font);
int lwFilter = font.getStringWidth(lblFilter);
int lwFound = font.getStringWidth(lblFound);
int lwSelect = _font.getStringWidth(lblSelect);
int cwAllFiles = _font.getStringWidth(lblAllFiles) + CheckboxWidget::prefixSize(_font);
int cwSubDirs = _font.getStringWidth(lblSubDirs) + CheckboxWidget::prefixSize(_font);
int lwFilter = _font.getStringWidth(lblFilter);
int lwFound = _font.getStringWidth(lblFound);
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;
if(w < wTotal)
{
// make sure there is space for at least 6 characters in the filter field
lblSelect = "Select a ROM" + ELLIPSIS;
int lwSelectShort = font.getStringWidth(lblSelect);
int lwSelectShort = _font.getStringWidth(lblSelect);
wTotal -= 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
lblSubDirs = "Subdir.";
int cwSubDirsShort = font.getStringWidth(lblSubDirs) + CheckboxWidget::prefixSize(font);
int cwSubDirsShort = _font.getStringWidth(lblSubDirs) + CheckboxWidget::prefixSize(_font);
wTotal -= 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
lblAllFiles = "All files";
int cwAllFilesShort = font.getStringWidth(lblAllFiles) + CheckboxWidget::prefixSize(font);
int cwAllFilesShort = _font.getStringWidth(lblAllFiles) + CheckboxWidget::prefixSize(_font);
wTotal -= 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
lblFound = "12345 found";
int lwFoundShort = font.getStringWidth(lblFound);
int lwFoundShort = _font.getStringWidth(lblFound);
wTotal -= 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
lblSelect = "";
int lwSelectShort = font.getStringWidth(lblSelect);
int lwSelectShort = _font.getStringWidth(lblSelect);
// wTotal -= lwSelect - lwSelectShort; // dead code
lwSelect = lwSelectShort;
@ -152,16 +152,16 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
#if defined(RETRON77)
ver << " for RetroN 77";
#endif
new StaticTextWidget(this, font, 0, ypos, _w, fontHeight,
new StaticTextWidget(this, _font, 0, ypos, _w, fontHeight,
ver.str(), TextAlign::Center);
ypos += lineHeight;
}
// Show the header
new StaticTextWidget(this, font, xpos, ypos, lblSelect);
new StaticTextWidget(this, _font, xpos, ypos, lblSelect);
// Shop the files counter
xpos = _w - HBORDER - lwFound;
myRomCount = new StaticTextWidget(this, font, xpos, ypos,
myRomCount = new StaticTextWidget(this, _font, xpos, ypos,
lwFound, fontHeight,
"", TextAlign::Right);
@ -169,23 +169,23 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
// It has to fit between both labels
if(!myUseMinimalUI && w >= 640)
{
int fwFilter = std::min(EditTextWidget::calcWidth(font, "123456789012345"),
int fwFilter = std::min(EditTextWidget::calcWidth(_font, "123456789012345"),
xpos - cwSubDirs - lwFilter - cwAllFiles
- lwSelect - HBORDER - LBL_GAP * (noSelect ? 5 : 7));
// Show the filter input field
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"
"Use '*' and '?' as wildcards.");
// Show the "Filter" label
xpos -= lwFilter + LBL_GAP;
new StaticTextWidget(this, font, xpos, ypos, lblFilter);
new StaticTextWidget(this, _font, xpos, ypos, lblFilter);
// Show the subdirectories checkbox
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;
tip << "Search files in subdirectories too.";
mySubDirs->setToolTip(tip.str());
@ -195,7 +195,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
xpos = HBORDER;
else
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.");
wid.push_back(myAllFiles);
@ -211,7 +211,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
if(romWidth > 0) romWidth += HBORDER;
int listWidth = _w - (romWidth > 0 ? romWidth + fontWidth : 0) - HBORDER * 2;
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->setListMode(FilesystemNode::ListMode::All);
wid.push_back(myList);
@ -236,11 +236,11 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
// Add textfield to show current directory
xpos = HBORDER;
ypos += myList->getHeight() + VGAP;
lwSelect = font.getStringWidth("Path") + LBL_GAP;
myDirLabel = new StaticTextWidget(this, font, xpos, ypos+2, lwSelect, fontHeight,
lwSelect = _font.getStringWidth("Path") + LBL_GAP;
myDirLabel = new StaticTextWidget(this, _font, xpos, ypos+2, lwSelect, fontHeight,
"Path", TextAlign::Left);
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->clearFlags(Widget::FLAG_RETAIN_FOCUS);
@ -249,41 +249,41 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
// Add four buttons at the bottom
xpos = HBORDER; ypos = _h - VBORDER - buttonHeight;
#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);
wid.push_back(myStartButton);
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);
wid.push_back(myPrevDirButton);
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);
wid.push_back(myOptionsButton);
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);
wid.push_back(myQuitButton);
#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);
wid.push_back(myQuitButton);
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);
wid.push_back(myOptionsButton);
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);
wid.push_back(myPrevDirButton);
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);
wid.push_back(myStartButton);
#endif
@ -297,12 +297,12 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
addToFocusList(wid);
// 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
// ROM properties
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
myList->progress().setRange(0, 50000, 5);
@ -536,16 +536,15 @@ float LauncherDialog::getRomInfoZoom(int listHeight) const
if(zoom > 0.F)
{
const GUI::Font& font = instance().frameBuffer().launcherFont();
const GUI::Font& smallFont = instance().frameBuffer().smallFont();
const int fontWidth = font.getMaxCharWidth(),
HBORDER = fontWidth * 1.25;
const int fontWidth = Dialog::fontWidth(),
HBORDER = Dialog::hBorder();
// upper zoom limit - at least 24 launchers chars/line and 7 + 4 ROM info lines
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;
}
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)
{
// 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
+ MIN_ROMINFO_LINES * FONTS[i].height)
@ -916,7 +915,7 @@ void LauncherDialog::openHighScores()
void LauncherDialog::openWhatsNew()
{
if(myWhatsNewDialog == nullptr)
myWhatsNewDialog = make_unique<WhatsNewDialog>(instance(), parent(), _font, _w, _h);
myWhatsNewDialog = make_unique<WhatsNewDialog>(instance(), parent(), _w, _h);
myWhatsNewDialog->open();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,16 +34,15 @@ StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& pa
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Basic settings"),
myMode{mode}
{
const int buttonHeight = _font.getLineHeight() + _font.getLineHeight() / 5,
lineHeight = _font.getLineHeight(),
fontWidth = _font.getMaxCharWidth(),
buttonWidth = _font.getStringWidth(" Help " + ELLIPSIS),
iLineHeight = instance().frameBuffer().infoFont().getLineHeight();
const int VBORDER = _font.getFontHeight() / 2;
const int HBORDER = fontWidth;
const int INDENT = fontWidth * 2;
const int VGAP = _font.getFontHeight() / 4;
const int iLineHeight = instance().frameBuffer().infoFont().getLineHeight();
const int lineHeight = Dialog::lineHeight(),
fontWidth = Dialog::fontWidth(),
buttonHeight = Dialog::buttonHeight(),
buttonWidth = Dialog::buttonWidth(" Help " + ELLIPSIS),
VBORDER = Dialog::vBorder(),
HBORDER = Dialog::hBorder(),
VGAP = Dialog::vGap(),
INDENT = Dialog::indent();
int xpos, ypos;
ButtonWidget* bw = nullptr;
@ -97,8 +96,8 @@ StellaSettingsDialog::~StellaSettingsDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaSettingsDialog::addUIOptions(WidgetArray& wid, int& xpos, int& ypos)
{
const int VGAP = _font.getFontHeight() / 4;
const int lineHeight = _font.getLineHeight();
const int lineHeight = Dialog::lineHeight(),
VGAP = Dialog::vGap();
VariantList items;
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)
{
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 int lineHeight = _font.getLineHeight(),
fontWidth = _font.getMaxCharWidth();
VariantList items;
// 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)
{
const int VGAP = _font.getFontHeight() / 4;
const int lineHeight = _font.getLineHeight();
const int lineHeight = Dialog::lineHeight(),
VGAP = Dialog::vGap();
const GUI::Font& ifont = instance().frameBuffer().infoFont();
VariantList ctrls;

View File

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

View File

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

View File

@ -15,6 +15,8 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include "OSystem.hxx"
#include "FrameBuffer.hxx"
#include "Version.hxx"
#include "WhatsNewDialog.hxx"
@ -22,20 +24,21 @@
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)
#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
: 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
{
const int fontHeight = _font.getFontHeight(),
fontWidth = _font.getMaxCharWidth(),
buttonHeight = _font.getLineHeight() * 1.25;
const int VGAP = fontHeight / 4;
const int VBORDER = fontHeight / 2;
const int HBORDER = fontWidth * 1.25;
const int fontWidth = Dialog::fontWidth(),
buttonHeight = Dialog::buttonHeight(),
VBORDER = Dialog::vBorder(),
HBORDER = Dialog::hBorder(),
VGAP = Dialog::vGap();
int ypos = _th + VBORDER;
// Set preliminary dimensions
@ -75,10 +78,9 @@ WhatsNewDialog::WhatsNewDialog(OSystem& osystem, DialogContainer& parent, const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void WhatsNewDialog::add(int& ypos, const string& text)
{
const int lineHeight = _font.getLineHeight(),
fontHeight = _font.getFontHeight(),
fontWidth = _font.getMaxCharWidth(),
HBORDER = fontWidth * 1.25;
const int lineHeight = Dialog::lineHeight(),
fontHeight = Dialog::fontHeight(),
HBORDER = Dialog::hBorder();
const string DOT = "\x1f";
string txt = DOT + " " + text;

View File

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