mirror of https://github.com/stella-emu/stella.git
StellaSettingsDialog font parameter cleanup
This commit is contained in:
parent
13bea87331
commit
96f2d55133
|
@ -645,7 +645,7 @@ void LauncherDialog::openSettings()
|
||||||
{
|
{
|
||||||
if (myStellaSettingsDialog == nullptr)
|
if (myStellaSettingsDialog == nullptr)
|
||||||
myStellaSettingsDialog = make_unique<StellaSettingsDialog>(instance(), parent(),
|
myStellaSettingsDialog = make_unique<StellaSettingsDialog>(instance(), parent(),
|
||||||
instance().frameBuffer().launcherFont(), _w, _h, Menu::AppMode::launcher);
|
_w, _h, Menu::AppMode::launcher);
|
||||||
myStellaSettingsDialog->open();
|
myStellaSettingsDialog->open();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -42,8 +42,8 @@ Dialog* Menu::baseDialog()
|
||||||
if (myOSystem.settings().getBool("basic_settings"))
|
if (myOSystem.settings().getBool("basic_settings"))
|
||||||
{
|
{
|
||||||
if (stellaSettingDialog == nullptr)
|
if (stellaSettingDialog == nullptr)
|
||||||
stellaSettingDialog = new StellaSettingsDialog(myOSystem, *this, myOSystem.frameBuffer().font(),
|
stellaSettingDialog = new StellaSettingsDialog(myOSystem, *this,
|
||||||
1280, 720, AppMode::emulator);
|
1280, 720, AppMode::emulator);
|
||||||
return stellaSettingDialog;
|
return stellaSettingDialog;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -307,7 +307,7 @@ void MinUICommandDialog::openSettings()
|
||||||
{
|
{
|
||||||
if (myStellaSettingsDialog == nullptr)
|
if (myStellaSettingsDialog == nullptr)
|
||||||
myStellaSettingsDialog = make_unique<StellaSettingsDialog>(instance(), parent(),
|
myStellaSettingsDialog = make_unique<StellaSettingsDialog>(instance(), parent(),
|
||||||
instance().frameBuffer().launcherFont(), FBMinimum::Width, FBMinimum::Height, Menu::AppMode::launcher);
|
1280, 720, Menu::AppMode::launcher);
|
||||||
myStellaSettingsDialog->open();
|
myStellaSettingsDialog->open();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -29,16 +29,16 @@
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& parent,
|
StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
const GUI::Font& font, int max_w, int max_h, Menu::AppMode mode)
|
int max_w, int max_h, Menu::AppMode mode)
|
||||||
: Dialog(osystem, parent, font, "Basic settings"),
|
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Basic settings"),
|
||||||
myMode(mode)
|
myMode(mode)
|
||||||
{
|
{
|
||||||
const int VBORDER = 8;
|
const int VBORDER = 8;
|
||||||
const int HBORDER = 10;
|
const int HBORDER = 10;
|
||||||
const int INDENT = 20;
|
const int INDENT = 20;
|
||||||
const int buttonHeight = font.getLineHeight() + 6,
|
const int buttonHeight = _font.getLineHeight() + 6,
|
||||||
lineHeight = font.getLineHeight(),
|
lineHeight = _font.getLineHeight(),
|
||||||
fontWidth = font.getMaxCharWidth(),
|
fontWidth = _font.getMaxCharWidth(),
|
||||||
buttonWidth = _font.getStringWidth("Help" + ELLIPSIS) + 32;
|
buttonWidth = _font.getStringWidth("Help" + ELLIPSIS) + 32;
|
||||||
const int VGAP = 5;
|
const int VGAP = 5;
|
||||||
int xpos, ypos;
|
int xpos, ypos;
|
||||||
|
@ -53,50 +53,50 @@ StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& pa
|
||||||
xpos = HBORDER;
|
xpos = HBORDER;
|
||||||
ypos = VBORDER + _th;
|
ypos = VBORDER + _th;
|
||||||
|
|
||||||
bw = new ButtonWidget(this, font, xpos, ypos, _w - HBORDER * 2 - buttonWidth - 8, buttonHeight,
|
bw = new ButtonWidget(this, _font, xpos, ypos, _w - HBORDER * 2 - buttonWidth - 8, buttonHeight,
|
||||||
"Use Advanced Settings" + ELLIPSIS, kAdvancedSettings);
|
"Use Advanced Settings" + ELLIPSIS, kAdvancedSettings);
|
||||||
wid.push_back(bw);
|
wid.push_back(bw);
|
||||||
bw = new ButtonWidget(this, font, bw->getRight() + 8, ypos, buttonWidth, buttonHeight,
|
bw = new ButtonWidget(this, _font, bw->getRight() + 8, ypos, buttonWidth, buttonHeight,
|
||||||
"Help" + ELLIPSIS, kHelp);
|
"Help" + ELLIPSIS, kHelp);
|
||||||
wid.push_back(bw);
|
wid.push_back(bw);
|
||||||
|
|
||||||
ypos += lineHeight + VGAP*4;
|
ypos += lineHeight + VGAP*4;
|
||||||
|
|
||||||
new StaticTextWidget(this, font, xpos, ypos + 1, "Global settings:");
|
new StaticTextWidget(this, _font, xpos, ypos + 1, "Global settings:");
|
||||||
xpos += INDENT;
|
xpos += INDENT;
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
addUIOptions(wid, xpos, ypos, font);
|
addUIOptions(wid, xpos, ypos);
|
||||||
ypos += VGAP * 4;
|
ypos += VGAP * 4;
|
||||||
addVideoOptions(wid, xpos, ypos, font);
|
addVideoOptions(wid, xpos, ypos);
|
||||||
ypos += VGAP * 4;
|
ypos += VGAP * 4;
|
||||||
|
|
||||||
xpos -= INDENT;
|
xpos -= INDENT;
|
||||||
myGameSettings = new StaticTextWidget(this, font, xpos, ypos + 1, "Game settings:");
|
myGameSettings = new StaticTextWidget(this, _font, xpos, ypos + 1, "Game settings:");
|
||||||
xpos += INDENT;
|
xpos += INDENT;
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
addGameOptions(wid, xpos, ypos, font);
|
addGameOptions(wid, xpos, ypos);
|
||||||
|
|
||||||
// Add Defaults, OK and Cancel buttons
|
// Add Defaults, OK and Cancel buttons
|
||||||
addDefaultsOKCancelBGroup(wid, font);
|
addDefaultsOKCancelBGroup(wid, _font);
|
||||||
|
|
||||||
addToFocusList(wid);
|
addToFocusList(wid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void StellaSettingsDialog::addUIOptions(WidgetArray& wid, int& xpos, int& ypos, const GUI::Font& font)
|
void StellaSettingsDialog::addUIOptions(WidgetArray& wid, int& xpos, int& ypos)
|
||||||
{
|
{
|
||||||
const int VGAP = 4;
|
const int VGAP = 4;
|
||||||
const int lineHeight = font.getLineHeight();
|
const int lineHeight = _font.getLineHeight();
|
||||||
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
|
||||||
|
|
||||||
ypos += 1;
|
ypos += 1;
|
||||||
VarList::push_back(items, "Standard", "standard");
|
VarList::push_back(items, "Standard", "standard");
|
||||||
VarList::push_back(items, "Classic", "classic");
|
VarList::push_back(items, "Classic", "classic");
|
||||||
VarList::push_back(items, "Light", "light");
|
VarList::push_back(items, "Light", "light");
|
||||||
myThemePopup = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight, items, "UI theme ");
|
myThemePopup = new PopUpWidget(this, _font, xpos, ypos, pwidth, lineHeight, items, "UI theme ");
|
||||||
wid.push_back(myThemePopup);
|
wid.push_back(myThemePopup);
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
|
@ -107,24 +107,23 @@ void StellaSettingsDialog::addUIOptions(WidgetArray& wid, int& xpos, int& ypos,
|
||||||
VarList::push_back(items, "Right top", 2);
|
VarList::push_back(items, "Right top", 2);
|
||||||
VarList::push_back(items, "Right bottom", 3);
|
VarList::push_back(items, "Right bottom", 3);
|
||||||
VarList::push_back(items, "Left bottom", 4);
|
VarList::push_back(items, "Left bottom", 4);
|
||||||
myPositionPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight,
|
myPositionPopup = new PopUpWidget(this, _font, xpos, ypos, pwidth, lineHeight,
|
||||||
items, "Dialogs position ");
|
items, "Dialogs position ");
|
||||||
wid.push_back(myPositionPopup);
|
wid.push_back(myPositionPopup);
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void StellaSettingsDialog::addVideoOptions(WidgetArray& wid, int& xpos, int& ypos,
|
void StellaSettingsDialog::addVideoOptions(WidgetArray& wid, int& xpos, int& ypos)
|
||||||
const GUI::Font& font)
|
|
||||||
{
|
{
|
||||||
const int VGAP = 4;
|
const int VGAP = 4;
|
||||||
const GUI::Font& ifont = instance().frameBuffer().infoFont();
|
const GUI::Font& ifont = instance().frameBuffer().infoFont();
|
||||||
const int lineHeight = font.getLineHeight(),
|
const int lineHeight = _font.getLineHeight(),
|
||||||
fontWidth = font.getMaxCharWidth();
|
fontWidth = _font.getMaxCharWidth();
|
||||||
VariantList items;
|
VariantList items;
|
||||||
|
|
||||||
// TV effects options
|
// TV effects options
|
||||||
int swidth = font.getMaxCharWidth() * 11;
|
int swidth = _font.getMaxCharWidth() * 11;
|
||||||
|
|
||||||
// TV Mode
|
// TV Mode
|
||||||
VarList::push_back(items, "Disabled", static_cast<uInt32>(NTSCFilter::Preset::OFF));
|
VarList::push_back(items, "Disabled", static_cast<uInt32>(NTSCFilter::Preset::OFF));
|
||||||
|
@ -132,16 +131,16 @@ void StellaSettingsDialog::addVideoOptions(WidgetArray& wid, int& xpos, int& ypo
|
||||||
VarList::push_back(items, "S-Video", static_cast<uInt32>(NTSCFilter::Preset::SVIDEO));
|
VarList::push_back(items, "S-Video", static_cast<uInt32>(NTSCFilter::Preset::SVIDEO));
|
||||||
VarList::push_back(items, "Composite", static_cast<uInt32>(NTSCFilter::Preset::COMPOSITE));
|
VarList::push_back(items, "Composite", static_cast<uInt32>(NTSCFilter::Preset::COMPOSITE));
|
||||||
VarList::push_back(items, "Bad adjust", static_cast<uInt32>(NTSCFilter::Preset::BAD));
|
VarList::push_back(items, "Bad adjust", static_cast<uInt32>(NTSCFilter::Preset::BAD));
|
||||||
int pwidth = font.getStringWidth("Right bottom");
|
int pwidth = _font.getStringWidth("Right bottom");
|
||||||
int lwidth = font.getStringWidth("Scanline intensity ");
|
int lwidth = _font.getStringWidth("Scanline intensity ");
|
||||||
|
|
||||||
myTVMode = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight,
|
myTVMode = new PopUpWidget(this, _font, xpos, ypos, pwidth, lineHeight,
|
||||||
items, "TV mode ");
|
items, "TV mode ");
|
||||||
wid.push_back(myTVMode);
|
wid.push_back(myTVMode);
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
// Scanline intensity
|
// Scanline intensity
|
||||||
myTVScanIntense = new SliderWidget(this, font, xpos, ypos-1, swidth, lineHeight,
|
myTVScanIntense = new SliderWidget(this, _font, xpos, ypos-1, swidth, lineHeight,
|
||||||
"Scanline intensity", lwidth, kScanlinesChanged, fontWidth * 3);
|
"Scanline intensity", lwidth, kScanlinesChanged, fontWidth * 3);
|
||||||
myTVScanIntense->setMinValue(0); myTVScanIntense->setMaxValue(10);
|
myTVScanIntense->setMinValue(0); myTVScanIntense->setMaxValue(10);
|
||||||
myTVScanIntense->setTickmarkIntervals(2);
|
myTVScanIntense->setTickmarkIntervals(2);
|
||||||
|
@ -149,7 +148,7 @@ void StellaSettingsDialog::addVideoOptions(WidgetArray& wid, int& xpos, int& ypo
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
// TV Phosphor blend level
|
// TV Phosphor blend level
|
||||||
myTVPhosLevel = new SliderWidget(this, font, xpos, ypos-1, swidth, lineHeight,
|
myTVPhosLevel = new SliderWidget(this, _font, xpos, ypos-1, swidth, lineHeight,
|
||||||
"Phosphor blend ", lwidth, kPhosphorChanged, fontWidth * 3);
|
"Phosphor blend ", lwidth, kPhosphorChanged, fontWidth * 3);
|
||||||
myTVPhosLevel->setMinValue(0); myTVPhosLevel->setMaxValue(10);
|
myTVPhosLevel->setMinValue(0); myTVPhosLevel->setMaxValue(10);
|
||||||
myTVPhosLevel->setTickmarkIntervals(2);
|
myTVPhosLevel->setTickmarkIntervals(2);
|
||||||
|
@ -157,7 +156,7 @@ void StellaSettingsDialog::addVideoOptions(WidgetArray& wid, int& xpos, int& ypo
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
// FS overscan
|
// FS overscan
|
||||||
myTVOverscan = new SliderWidget(this, font, xpos, ypos - 1, swidth, lineHeight,
|
myTVOverscan = new SliderWidget(this, _font, xpos, ypos - 1, swidth, lineHeight,
|
||||||
"Overscan (*) ", lwidth, kOverscanChanged, fontWidth * 3);
|
"Overscan (*) ", lwidth, kOverscanChanged, fontWidth * 3);
|
||||||
myTVOverscan->setMinValue(0); myTVOverscan->setMaxValue(10);
|
myTVOverscan->setMinValue(0); myTVOverscan->setMaxValue(10);
|
||||||
myTVOverscan->setTickmarkIntervals(2);
|
myTVOverscan->setTickmarkIntervals(2);
|
||||||
|
@ -169,10 +168,10 @@ void StellaSettingsDialog::addVideoOptions(WidgetArray& wid, int& xpos, int& ypo
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void StellaSettingsDialog::addGameOptions(WidgetArray& wid, int& xpos, int& ypos, const GUI::Font& font)
|
void StellaSettingsDialog::addGameOptions(WidgetArray& wid, int& xpos, int& ypos)
|
||||||
{
|
{
|
||||||
const int VGAP = 4;
|
const int VGAP = 4;
|
||||||
const int lineHeight = font.getLineHeight();
|
const int lineHeight = _font.getLineHeight();
|
||||||
const GUI::Font& ifont = instance().frameBuffer().infoFont();
|
const GUI::Font& ifont = instance().frameBuffer().infoFont();
|
||||||
VariantList ctrls;
|
VariantList ctrls;
|
||||||
|
|
||||||
|
@ -187,9 +186,9 @@ void StellaSettingsDialog::addGameOptions(WidgetArray& wid, int& xpos, int& ypos
|
||||||
VarList::push_back(ctrls, "Trakball", "TRAKBALL");
|
VarList::push_back(ctrls, "Trakball", "TRAKBALL");
|
||||||
VarList::push_back(ctrls, "Sega Genesis", "GENESIS");
|
VarList::push_back(ctrls, "Sega Genesis", "GENESIS");
|
||||||
|
|
||||||
int pwidth = font.getStringWidth("Sega Genesis");
|
int pwidth = _font.getStringWidth("Sega Genesis");
|
||||||
myLeftPortLabel = new StaticTextWidget(this, font, xpos, ypos + 1, "Left port ");
|
myLeftPortLabel = new StaticTextWidget(this, _font, xpos, ypos + 1, "Left port ");
|
||||||
myLeftPort = new PopUpWidget(this, font, myLeftPortLabel->getRight(),
|
myLeftPort = new PopUpWidget(this, _font, myLeftPortLabel->getRight(),
|
||||||
myLeftPortLabel->getTop() - 1, pwidth, lineHeight, ctrls, "", 0, kLeftCChanged);
|
myLeftPortLabel->getTop() - 1, pwidth, lineHeight, ctrls, "", 0, kLeftCChanged);
|
||||||
wid.push_back(myLeftPort);
|
wid.push_back(myLeftPort);
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
@ -198,8 +197,8 @@ void StellaSettingsDialog::addGameOptions(WidgetArray& wid, int& xpos, int& ypos
|
||||||
"Sega Genesis detected");
|
"Sega Genesis detected");
|
||||||
ypos += ifont.getLineHeight() + VGAP;
|
ypos += ifont.getLineHeight() + VGAP;
|
||||||
|
|
||||||
myRightPortLabel = new StaticTextWidget(this, font, xpos, ypos + 1, "Right port ");
|
myRightPortLabel = new StaticTextWidget(this, _font, xpos, ypos + 1, "Right port ");
|
||||||
myRightPort = new PopUpWidget(this, font, myRightPortLabel->getRight(),
|
myRightPort = new PopUpWidget(this, _font, myRightPortLabel->getRight(),
|
||||||
myRightPortLabel->getTop() - 1, pwidth, lineHeight, ctrls, "", 0, kRightCChanged);
|
myRightPortLabel->getTop() - 1, pwidth, lineHeight, ctrls, "", 0, kRightCChanged);
|
||||||
wid.push_back(myRightPort);
|
wid.push_back(myRightPort);
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
@ -415,7 +414,7 @@ void StellaSettingsDialog::switchSettingsMode()
|
||||||
msg.push_back("proceed with the switch, click");
|
msg.push_back("proceed with the switch, click");
|
||||||
msg.push_back("'OK', otherwise click 'Cancel'.");
|
msg.push_back("'OK', otherwise click 'Cancel'.");
|
||||||
|
|
||||||
myConfirmMsg = make_unique<GUI::MessageBox>(this, instance().frameBuffer().font(), msg,
|
myConfirmMsg = make_unique<GUI::MessageBox>(this, _font, msg,
|
||||||
_w-16, _h, kConfirmSwitchCmd, "OK", "Cancel", "Switch settings mode", false);
|
_w-16, _h, kConfirmSwitchCmd, "OK", "Cancel", "Switch settings mode", false);
|
||||||
myConfirmMsg->show();
|
myConfirmMsg->show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ class StellaSettingsDialog : public Dialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StellaSettingsDialog(OSystem& osystem, DialogContainer& parent,
|
StellaSettingsDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
const GUI::Font& font, int max_w, int max_h, Menu::AppMode mode);
|
int max_w, int max_h, Menu::AppMode mode);
|
||||||
virtual ~StellaSettingsDialog() = default;
|
virtual ~StellaSettingsDialog() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -47,9 +47,9 @@ class StellaSettingsDialog : public Dialog
|
||||||
void saveConfig() override;
|
void saveConfig() override;
|
||||||
void setDefaults() override;
|
void setDefaults() override;
|
||||||
|
|
||||||
void addVideoOptions(WidgetArray& wid, int& xpos, int& ypos, const GUI::Font& font);
|
void addVideoOptions(WidgetArray& wid, int& xpos, int& ypos);
|
||||||
void addUIOptions(WidgetArray& wid, int& xpos, int& ypos, const GUI::Font& font);
|
void addUIOptions(WidgetArray& wid, int& xpos, int& ypos);
|
||||||
void addGameOptions(WidgetArray& wid, int& xpos, int& ypos, const GUI::Font& font);
|
void addGameOptions(WidgetArray& wid, int& xpos, int& ypos);
|
||||||
|
|
||||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||||
void handleOverscanChange();
|
void handleOverscanChange();
|
||||||
|
|
Loading…
Reference in New Issue