title bar added to all dialogs

This commit is contained in:
thrust26 2018-01-24 14:37:07 +01:00
parent 41827e03de
commit 5bd33885e3
30 changed files with 246 additions and 165 deletions

View File

@ -33,46 +33,48 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CheatCodeDialog::CheatCodeDialog(OSystem& osystem, DialogContainer& parent, CheatCodeDialog::CheatCodeDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font) const GUI::Font& font)
: Dialog(osystem, parent) : Dialog(osystem, parent, font, "Cheat codes")
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(), fontWidth = font.getMaxCharWidth(),
buttonWidth = font.getStringWidth("Defaults") + 20, buttonWidth = font.getStringWidth("Defaults") + 20,
buttonHeight = font.getLineHeight() + 4; buttonHeight = font.getLineHeight() + 4;
const int HBORDER = 10;
const int VBORDER = 10 + _th;
int xpos, ypos; int xpos, ypos;
WidgetArray wid; WidgetArray wid;
ButtonWidget* b; ButtonWidget* b;
// Set real dimensions // Set real dimensions
_w = 46 * fontWidth + 10; _w = 45 * fontWidth + HBORDER * 2;
_h = 11 * (lineHeight + 4) + 10; _h = 11 * (lineHeight + 4) + VBORDER;
// List of cheats, with checkboxes to enable/disable // List of cheats, with checkboxes to enable/disable
xpos = 10; ypos = 10; xpos = HBORDER; ypos = VBORDER;
myCheatList = myCheatList =
new CheckListWidget(this, font, xpos, ypos, _w - buttonWidth - 25, new CheckListWidget(this, font, xpos, ypos, _w - buttonWidth - HBORDER * 2 - 8,
_h - 2*buttonHeight - 10); _h - 2*buttonHeight - VBORDER);
myCheatList->setEditable(false); myCheatList->setEditable(false);
wid.push_back(myCheatList); wid.push_back(myCheatList);
xpos += myCheatList->getWidth() + 5; ypos = 15; xpos += myCheatList->getWidth() + 8; ypos = VBORDER;
b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"Add" + ELLIPSIS, kAddCheatCmd); "Add" + ELLIPSIS, kAddCheatCmd);
wid.push_back(b); wid.push_back(b);
ypos += lineHeight + 10; ypos += lineHeight + 8;
myEditButton = myEditButton =
new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"Edit" + ELLIPSIS, kEditCheatCmd); "Edit" + ELLIPSIS, kEditCheatCmd);
wid.push_back(myEditButton); wid.push_back(myEditButton);
ypos += lineHeight + 10; ypos += lineHeight + 8;
myRemoveButton = myRemoveButton =
new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"Remove", kRemCheatCmd); "Remove", kRemCheatCmd);
wid.push_back(myRemoveButton); wid.push_back(myRemoveButton);
ypos += lineHeight + 10; ypos += lineHeight + 8 * 3;
b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"One shot" + ELLIPSIS, kAddOneShotCmd); "One shot" + ELLIPSIS, kAddOneShotCmd);
@ -82,7 +84,7 @@ CheatCodeDialog::CheatCodeDialog(OSystem& osystem, DialogContainer& parent,
StringList labels; StringList labels;
labels.push_back("Name "); labels.push_back("Name ");
labels.push_back("Code (hex) "); labels.push_back("Code (hex) ");
myCheatInput = make_unique<InputTextDialog>(this, font, labels); myCheatInput = make_unique<InputTextDialog>(this, font, labels, "Cheat code");
myCheatInput->setTarget(this); myCheatInput->setTarget(this);
// Add filtering for each textfield // Add filtering for each textfield
@ -154,7 +156,7 @@ void CheatCodeDialog::addCheat()
myCheatInput->show(); // Center input dialog over entire screen myCheatInput->show(); // Center input dialog over entire screen
myCheatInput->setText("", 0); myCheatInput->setText("", 0);
myCheatInput->setText("", 1); myCheatInput->setText("", 1);
myCheatInput->setTitle(""); myCheatInput->setMessage("");
myCheatInput->setFocus(0); myCheatInput->setFocus(0);
myCheatInput->setEmitSignal(kCheatAdded); myCheatInput->setEmitSignal(kCheatAdded);
} }
@ -173,7 +175,7 @@ void CheatCodeDialog::editCheat()
myCheatInput->show(); // Center input dialog over entire screen myCheatInput->show(); // Center input dialog over entire screen
myCheatInput->setText(name, 0); myCheatInput->setText(name, 0);
myCheatInput->setText(code, 1); myCheatInput->setText(code, 1);
myCheatInput->setTitle(""); myCheatInput->setMessage("");
myCheatInput->setFocus(1); myCheatInput->setFocus(1);
myCheatInput->setEmitSignal(kCheatEdited); myCheatInput->setEmitSignal(kCheatEdited);
} }
@ -191,7 +193,7 @@ void CheatCodeDialog::addOneShotCheat()
myCheatInput->show(); // Center input dialog over entire screen myCheatInput->show(); // Center input dialog over entire screen
myCheatInput->setText("One-shot cheat", 0); myCheatInput->setText("One-shot cheat", 0);
myCheatInput->setText("", 1); myCheatInput->setText("", 1);
myCheatInput->setTitle(""); myCheatInput->setMessage("");
myCheatInput->setFocus(1); myCheatInput->setFocus(1);
myCheatInput->setEmitSignal(kOneShotCheatAdded); myCheatInput->setEmitSignal(kOneShotCheatAdded);
} }
@ -234,7 +236,7 @@ void CheatCodeDialog::handleCommand(CommandSender* sender, int cmd,
loadConfig(); // show changes onscreen loadConfig(); // show changes onscreen
} }
else else
myCheatInput->setTitle("Invalid code"); myCheatInput->setMessage("Invalid code");
break; break;
} }
@ -251,7 +253,7 @@ void CheatCodeDialog::handleCommand(CommandSender* sender, int cmd,
loadConfig(); // show changes onscreen loadConfig(); // show changes onscreen
} }
else else
myCheatInput->setTitle("Invalid code"); myCheatInput->setMessage("Invalid code");
break; break;
} }
@ -273,7 +275,7 @@ void CheatCodeDialog::handleCommand(CommandSender* sender, int cmd,
instance().cheat().addOneShot(name, code); instance().cheat().addOneShot(name, code);
} }
else else
myCheatInput->setTitle("Invalid code"); myCheatInput->setMessage("Invalid code");
break; break;
} }

View File

@ -146,8 +146,8 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
myLabel->setEditable(false, true); myLabel->setEditable(false, true);
// Inputbox which will pop up when searching RAM // Inputbox which will pop up when searching RAM
StringList labels = { "Search " }; StringList labels = { "Value" };
myInputBox = make_unique<InputTextDialog>(boss, lfont, nfont, labels); myInputBox = make_unique<InputTextDialog>(boss, lfont, nfont, labels, " ");
myInputBox->setTarget(this); myInputBox->setTarget(this);
// Start with these buttons disabled // Start with these buttons disabled
@ -247,7 +247,7 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
{ {
const string& result = doSearch(myInputBox->getResult()); const string& result = doSearch(myInputBox->getResult());
if(result != "") if(result != "")
myInputBox->setTitle(result); myInputBox->setMessage(result);
else else
myInputBox->close(); myInputBox->close();
break; break;
@ -257,7 +257,7 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
{ {
const string& result = doCompare(myInputBox->getResult()); const string& result = doCompare(myInputBox->getResult());
if(result != "") if(result != "")
myInputBox->setTitle(result); myInputBox->setMessage(result);
else else
myInputBox->close(); myInputBox->close();
break; break;
@ -322,11 +322,13 @@ void RamWidget::showInputBox(int cmd)
// Add inputbox in the middle of the RAM widget // Add inputbox in the middle of the RAM widget
uInt32 x = getAbsX() + ((getWidth() - myInputBox->getWidth()) >> 1); uInt32 x = getAbsX() + ((getWidth() - myInputBox->getWidth()) >> 1);
uInt32 y = getAbsY() + ((getHeight() - myInputBox->getHeight()) >> 1); uInt32 y = getAbsY() + ((getHeight() - myInputBox->getHeight()) >> 1);
myInputBox->show(x, y); myInputBox->show(x, y);
myInputBox->setText(""); myInputBox->setText("");
myInputBox->setTitle(""); myInputBox->setMessage("");
myInputBox->setFocus(0); myInputBox->setFocus(0);
myInputBox->setEmitSignal(cmd); myInputBox->setEmitSignal(cmd);
myInputBox->setTitle(cmd == kSValEntered ? "Search" : "Compare");
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -1012,31 +1012,33 @@ void FrameBuffer::VideoModeList::setZoom(uInt32 zoom)
kDbgChangedTextColor Text color for changed cells kDbgChangedTextColor Text color for changed cells
kDbgColorHi Highlighted color in debugger data cells kDbgColorHi Highlighted color in debugger data cells
kDbgColorRed Red color in debugger kDbgColorRed Red color in debugger
*** Info color *** *** Other colors ***
kColorinfo kColorInfo TIA output position color
kTitleBarColor Title bar color
kTitleTextColor Title text color
*/ */
uInt32 FrameBuffer::ourGUIColors[3][kNumColors-256] = { uInt32 FrameBuffer::ourGUIColors[3][kNumColors-256] = {
// Standard // Standard
{ 0x686868, 0x000000, 0xa38c61, 0xdccfa5, 0x404040, { 0x686868, 0x000000, 0xa38c61, 0xdccfa5, 0x404040, // base
0x000000, 0x62a108, 0x9f0000, 0x000000, 0x000000, 0x62a108, 0x9f0000, 0x000000, // text
0xc9af7c, 0xf0f0cf, 0xc80000, 0xc9af7c, 0xf0f0cf, 0xc80000, // elements
0xac3410, 0xd55941, 0xffffff, 0xffd652, 0xac3410, 0xd55941, 0xffffff, 0xffd652, // buttons
0xac3410, 0xac3410, // checkbox
0xac3410, 0xd55941, 0xac3410, 0xd55941, // scrollbar
0xac3410, 0xd55941, 0xac3410, 0xd55941, // slider
0xc80000, 0x00ff00, 0xc8c8ff, 0xc80000, 0xc80000, 0x00ff00, 0xc8c8ff, 0xc80000, // debugger
0xffffff 0xffffff, 0xac3410, 0xffffff // other
}, },
// Classic // Classic
{ 0x686868, 0x000000, 0x404040, 0x404040, 0x404040, { 0x686868, 0x000000, 0x404040, 0x404040, 0x404040, // base
0x20a020, 0x00ff00, 0xc80000, 0x20a020, 0x20a020, 0x00ff00, 0xc80000, 0x20a020, // text
0x000000, 0x000000, 0xc80000, 0x000000, 0x000000, 0xc80000, // elements
0x000000, 0x000000, 0x20a020, 0x00ff00, 0x000000, 0x000000, 0x20a020, 0x00ff00, // buttons
0x20a020, 0x20a020, // checkbox
0x20a020, 0x00ff00, 0x20a020, 0x00ff00, // scrollbar
0x20a020, 0x00ff00, 0x20a020, 0x00ff00, // slider
0xc80000, 0x00ff00, 0xc8c8ff, 0xc80000, 0xc80000, 0x00ff00, 0xc8c8ff, 0xc80000, // debugger
0x20a020 0x20a020, 0x20a020, 0x000000 // other
}, },
// Light // Light
{ {
@ -1048,6 +1050,6 @@ uInt32 FrameBuffer::ourGUIColors[3][kNumColors-256] = {
0x808080, 0x0078d7, // scrollbar 0x808080, 0x0078d7, // scrollbar
0x333333, 0x0078d7, // slider 0x333333, 0x0078d7, // slider
0xffc0c0, 0x000000, 0xe00000, 0xc00000, // debugger 0xffc0c0, 0x000000, 0xe00000, 0xc00000, // debugger
0xffffff // info 0xffffff, 0x808080, 0xffffff // other
} }
}; };

View File

@ -68,6 +68,8 @@ enum {
kDbgColorHi, kDbgColorHi,
kDbgColorRed, kDbgColorRed,
kColorInfo, kColorInfo,
kColorTitleBar,
kColorTitleText,
kNumColors kNumColors
}; };

View File

@ -25,7 +25,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AboutDialog::AboutDialog(OSystem& osystem, DialogContainer& parent, AboutDialog::AboutDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font) const GUI::Font& font)
: Dialog(osystem, parent), : Dialog(osystem, parent, font, "About Stella"),
myPage(1), myPage(1),
myNumPages(4), myNumPages(4),
myLinesPerPage(13) myLinesPerPage(13)
@ -40,7 +40,7 @@ AboutDialog::AboutDialog(OSystem& osystem, DialogContainer& parent,
// Set real dimensions // Set real dimensions
_w = 55 * fontWidth + 8; _w = 55 * fontWidth + 8;
_h = 15 * lineHeight + 20; _h = 15 * lineHeight + 20 + _th;
// Add Previous, Next and Close buttons // Add Previous, Next and Close buttons
xpos = 10; ypos = _h - buttonHeight - 10; xpos = 10; ypos = _h - buttonHeight - 10;
@ -63,15 +63,15 @@ AboutDialog::AboutDialog(OSystem& osystem, DialogContainer& parent,
wid.push_back(b); wid.push_back(b);
addOKWidget(b); addCancelWidget(b); addOKWidget(b); addCancelWidget(b);
xpos = 5; ypos = 5; xpos = 5; ypos = 5 + _th;
myTitle = new StaticTextWidget(this, font, xpos, ypos, _w - 10, fontHeight, myTitle = new StaticTextWidget(this, font, xpos, ypos, _w - xpos * 2, fontHeight,
"", TextAlign::Center); "", TextAlign::Center);
myTitle->setTextColor(kTextColorEm); myTitle->setTextColor(kTextColorEm);
xpos = 10; ypos += lineHeight + 4; xpos = 16; ypos += lineHeight + 4;
for(int i = 0; i < myLinesPerPage; i++) for(int i = 0; i < myLinesPerPage; i++)
{ {
myDesc.push_back(new StaticTextWidget(this, font, xpos, ypos, _w - 20, myDesc.push_back(new StaticTextWidget(this, font, xpos, ypos, _w - xpos * 2,
fontHeight, "", TextAlign::Left)); fontHeight, "", TextAlign::Left));
myDescStr.push_back(""); myDescStr.push_back("");
ypos += fontHeight; ypos += fontHeight;
@ -116,30 +116,30 @@ void AboutDialog::updateStrings(int page, int lines, string& title)
case 2: case 2:
title = "The Stella Team"; title = "The Stella Team";
ADD_ATEXT("\\L\\c0"" Stephen Anthony"); ADD_ATEXT("\\L\\c0""Stephen Anthony");
ADD_ATEXT("\\L\\c2"" Lead developer, current maintainer for the"); ADD_ATEXT("\\L\\c2"" Lead developer, current maintainer for the");
ADD_ATEXT("\\L\\c2"" Linux/OSX and Windows ports "); ADD_ATEXT("\\L\\c2"" Linux/OSX and Windows ports ");
ADD_ATEXT("\\L\\c0"" Christian Speckner"); ADD_ATEXT("\\L\\c0""Christian Speckner");
ADD_ATEXT("\\L\\c2"" Emulation core development, TIA core"); ADD_ATEXT("\\L\\c2"" Emulation core development, TIA core");
ADD_ATEXT("\\L\\c0"" Eckhard Stolberg"); ADD_ATEXT("\\L\\c0""Eckhard Stolberg");
ADD_ATEXT("\\L\\c2"" Emulation core development"); ADD_ATEXT("\\L\\c2"" Emulation core development");
ADD_ATEXT("\\L\\c0"" Thomas Jentzsch"); ADD_ATEXT("\\L\\c0""Thomas Jentzsch");
ADD_ATEXT("\\L\\c2"" Emulation core development, jack-of-all-trades"); ADD_ATEXT("\\L\\c2"" Emulation core development, jack-of-all-trades");
ADD_ATEXT("\\L\\c0"" Brian Watson"); ADD_ATEXT("\\L\\c0""Brian Watson");
ADD_ATEXT("\\L\\c2"" Emulation core enhancement, debugger support"); ADD_ATEXT("\\L\\c2"" Emulation core enhancement, debugger support");
ADD_ATEXT("\\L\\c0"" Bradford W. Mott"); ADD_ATEXT("\\L\\c0""Bradford W. Mott");
ADD_ATEXT("\\L\\c2"" Original author of Stella"); ADD_ATEXT("\\L\\c2"" Original author of Stella");
break; break;
case 3: case 3:
title = "Contributors"; title = "Contributors";
ADD_ATEXT("\\L\\c0"" See https://stella-emu.github.io/credits.html for"); ADD_ATEXT("\\L\\c0""See https://stella-emu.github.io/credits.html for");
ADD_ATEXT("\\L\\c0"" people that have contributed to Stella."); ADD_ATEXT("\\L\\c0""people that have contributed to Stella.");
ADD_ALINE(); ADD_ALINE();
ADD_ATEXT("\\L\\c0"" Thanks to the ScummVM project for the GUI code."); ADD_ATEXT("\\L\\c0""Thanks to the ScummVM project for the GUI code.");
ADD_ALINE(); ADD_ALINE();
ADD_ATEXT("\\L\\c0"" Thanks to Ian Bogost and the Georgia Tech"); ADD_ATEXT("\\L\\c0""Thanks to Ian Bogost and the Georgia Tech Atari Team");
ADD_ATEXT("\\L\\c0"" Atari Team for the CRT Simulation effects."); ADD_ATEXT("\\L\\c0""for the CRT Simulation effects.");
break; break;
case 4: case 4:

View File

@ -35,7 +35,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent, AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font) const GUI::Font& font)
: Dialog(osystem, parent) : Dialog(osystem, parent, font, "Audio settings")
{ {
const int VBORDER = 10; const int VBORDER = 10;
const int HBORDER = 10; const int HBORDER = 10;
@ -53,9 +53,9 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
// Set real dimensions // Set real dimensions
_w = 35 * fontWidth + HBORDER * 2; _w = 35 * fontWidth + HBORDER * 2;
_h = 7 * (lineHeight + 4) + VBORDER; _h = 7 * (lineHeight + 4) + VBORDER + _th;
xpos = HBORDER; ypos = VBORDER; xpos = HBORDER; ypos = VBORDER + _th;
// Enable sound // Enable sound
xpos = HBORDER; xpos = HBORDER;

View File

@ -29,7 +29,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ComboDialog::ComboDialog(GuiObject* boss, const GUI::Font& font, ComboDialog::ComboDialog(GuiObject* boss, const GUI::Font& font,
const VariantList& combolist) const VariantList& combolist)
: Dialog(boss->instance(), boss->parent()), : Dialog(boss->instance(), boss->parent(), font, ""),
myComboEvent(Event::NoType) myComboEvent(Event::NoType)
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = font.getLineHeight(),
@ -42,19 +42,15 @@ ComboDialog::ComboDialog(GuiObject* boss, const GUI::Font& font,
// Set real dimensions // Set real dimensions
_w = 35 * fontWidth + 10; _w = 35 * fontWidth + 10;
_h = 11 * (lineHeight + 4) + 10; _h = 10 * (lineHeight + 4) + 10 + _th;
xpos = ypos = 5; xpos = 10;
ypos = 10 + _th;
// Get maximum width of popupwidget // Get maximum width of popupwidget
int pwidth = 0; int pwidth = 0;
for(const auto& s: combolist) for(const auto& s: combolist)
pwidth = std::max(font.getStringWidth(s.first), pwidth); pwidth = std::max(font.getStringWidth(s.first), pwidth);
// Label for dialog, indicating which combo is being changed
myComboName = new StaticTextWidget(this, font, xpos, ypos, _w - xpos - 10,
fontHeight, "", TextAlign::Center);
ypos += (lineHeight + 4) + 5;
// Add event popup for 8 events // Add event popup for 8 events
auto ADD_EVENT_POPUP = [&](int idx, const string& label) auto ADD_EVENT_POPUP = [&](int idx, const string& label)
{ {
@ -87,7 +83,7 @@ void ComboDialog::show(Event::Type event, const string& name)
if(event >= Event::Combo1 && event <= Event::Combo16) if(event >= Event::Combo1 && event <= Event::Combo16)
{ {
myComboEvent = event; myComboEvent = event;
myComboName->setLabel("Add events for " + name); setTitle("Add events for " + name);
open(); open();
} }
else else

View File

@ -45,7 +45,6 @@ class ComboDialog : public Dialog
private: private:
Event::Type myComboEvent; Event::Type myComboEvent;
StaticTextWidget* myComboName;
PopUpWidget* myEvents[8]; PopUpWidget* myEvents[8];
private: private:

View File

@ -30,23 +30,25 @@ CommandDialog::CommandDialog(OSystem& osystem, DialogContainer& parent)
: Dialog(osystem, parent) : Dialog(osystem, parent)
{ {
const GUI::Font& font = instance().frameBuffer().font(); const GUI::Font& font = instance().frameBuffer().font();
initTitle(font, "Commands");
const int buttonWidth = font.getStringWidth("Right Diff B") + 20, const int buttonWidth = font.getStringWidth("Right Diff B") + 20,
buttonHeight = font.getLineHeight() + 6, buttonHeight = font.getLineHeight() + 6,
rowHeight = font.getLineHeight() + 10; rowHeight = buttonHeight + 8;
// Set real dimensions // Set real dimensions
_w = 3 * (buttonWidth + 5) + 20; _w = 3 * (buttonWidth + 5) + 20;
_h = 6 * rowHeight + 15; _h = 6 * rowHeight + 8 + _th;
WidgetArray wid; WidgetArray wid;
ButtonWidget* b[16]; ButtonWidget* b[16];
int xoffset = 10, yoffset = 10; int xoffset = 10, yoffset = 8 + _th;
auto ADD_CD_BUTTON = [&](const string& label, int cmd) auto ADD_CD_BUTTON = [&](const string& label, int cmd)
{ {
ButtonWidget* bw = new ButtonWidget(this, font, xoffset, yoffset, ButtonWidget* bw = new ButtonWidget(this, font, xoffset, yoffset,
buttonWidth, buttonHeight, label, cmd); buttonWidth, buttonHeight, label, cmd);
xoffset += buttonWidth + 6; xoffset += buttonWidth + 8;
return bw; return bw;
}; };
@ -56,31 +58,31 @@ CommandDialog::CommandDialog(OSystem& osystem, DialogContainer& parent)
b[8] = ADD_CD_BUTTON("Save State", kSaveStateCmd); b[8] = ADD_CD_BUTTON("Save State", kSaveStateCmd);
// Row 2 // Row 2
xoffset = 10; yoffset += buttonHeight + 3; xoffset = 10; yoffset += buttonHeight + 8;
b[1] = ADD_CD_BUTTON("Reset", kResetCmd); b[1] = ADD_CD_BUTTON("Reset", kResetCmd);
b[5] = ADD_CD_BUTTON("Left Diff B", kLeftDiffBCmd); b[5] = ADD_CD_BUTTON("Left Diff B", kLeftDiffBCmd);
b[9] = ADD_CD_BUTTON("State Slot", kStateSlotCmd); b[9] = ADD_CD_BUTTON("State Slot", kStateSlotCmd);
// Row 3 // Row 3
xoffset = 10; yoffset += buttonHeight + 3; xoffset = 10; yoffset += buttonHeight + 8;
b[2] = ADD_CD_BUTTON("Color TV", kColorCmd); b[2] = ADD_CD_BUTTON("Color TV", kColorCmd);
b[6] = ADD_CD_BUTTON("Right Diff A", kRightDiffACmd); b[6] = ADD_CD_BUTTON("Right Diff A", kRightDiffACmd);
b[10] = ADD_CD_BUTTON("Load State", kLoadStateCmd); b[10] = ADD_CD_BUTTON("Load State", kLoadStateCmd);
// Row 4 // Row 4
xoffset = 10; yoffset += buttonHeight + 3; xoffset = 10; yoffset += buttonHeight + 8;
b[3] = ADD_CD_BUTTON("B/W TV", kBWCmd); b[3] = ADD_CD_BUTTON("B/W TV", kBWCmd);
b[7] = ADD_CD_BUTTON("Right Diff B", kRightDiffBCmd); b[7] = ADD_CD_BUTTON("Right Diff B", kRightDiffBCmd);
b[11] = ADD_CD_BUTTON("Snapshot", kSnapshotCmd); b[11] = ADD_CD_BUTTON("Snapshot", kSnapshotCmd);
// Row 5 // Row 5
xoffset = 10; yoffset += buttonHeight + 3; xoffset = 10; yoffset += buttonHeight + 8;
b[12] = ADD_CD_BUTTON("NTSC/PAL", kFormatCmd); b[12] = ADD_CD_BUTTON("NTSC/PAL", kFormatCmd);
b[13] = ADD_CD_BUTTON("Palette", kPaletteCmd); b[13] = ADD_CD_BUTTON("Palette", kPaletteCmd);
b[14] = ADD_CD_BUTTON("Reload ROM", kReloadRomCmd); b[14] = ADD_CD_BUTTON("Reload ROM", kReloadRomCmd);
// Row 6 // Row 6
xoffset = 10 + buttonWidth + 6; yoffset += buttonHeight + 3; xoffset = 10 + buttonWidth + 8; yoffset += buttonHeight + 8;
b[15] = ADD_CD_BUTTON("Exit Game", kExitCmd); b[15] = ADD_CD_BUTTON("Exit Game", kExitCmd);
for(int i = 0; i < 16; ++i) for(int i = 0; i < 16; ++i)

View File

@ -29,13 +29,13 @@
ConfigPathDialog::ConfigPathDialog( ConfigPathDialog::ConfigPathDialog(
OSystem& osystem, DialogContainer& parent, OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, GuiObject* boss) const GUI::Font& font, GuiObject* boss)
: Dialog(osystem, parent), : Dialog(osystem, parent, font, "Configure paths"),
CommandSender(boss), CommandSender(boss),
myFont(font), myFont(font),
myBrowser(nullptr), myBrowser(nullptr),
myIsGlobal(boss != nullptr) myIsGlobal(boss != nullptr)
{ {
const int VBORDER = 10; const int VBORDER = 10 + _th;
const int HBORDER = 10; const int HBORDER = 10;
const int V_GAP = 4; const int V_GAP = 4;
const int H_GAP = 8; const int H_GAP = 8;
@ -49,7 +49,7 @@ ConfigPathDialog::ConfigPathDialog(
// Set real dimensions // Set real dimensions
_w = 64 * fontWidth + HBORDER*2; _w = 64 * fontWidth + HBORDER*2;
_h = 9 * (lineHeight + V_GAP) + 10; _h = 9 * (lineHeight + V_GAP) + VBORDER;
xpos = HBORDER; ypos = VBORDER; xpos = HBORDER; ypos = VBORDER;

View File

@ -44,7 +44,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DeveloperDialog::DeveloperDialog(OSystem& osystem, DialogContainer& parent, 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) : Dialog(osystem, parent, font, "Developer settings")
{ {
const int VGAP = 4; const int VGAP = 4;
const int lineHeight = font.getLineHeight(), const int lineHeight = font.getLineHeight(),
@ -54,11 +54,11 @@ DeveloperDialog::DeveloperDialog(OSystem& osystem, DialogContainer& parent,
// Set real dimensions // Set real dimensions
_w = std::min(53 * fontWidth + 10, max_w); _w = std::min(53 * fontWidth + 10, max_w);
_h = std::min(15 * (lineHeight + VGAP) + 14, max_h); _h = std::min(15 * (lineHeight + VGAP) + 14 + _th, max_h);
// The tab widget // The tab widget
xpos = 2; ypos = 4; xpos = 2; ypos = 4;
myTab = new TabWidget(this, font, xpos, ypos, _w - 2 * xpos, _h - buttonHeight - 16 - ypos); myTab = new TabWidget(this, font, xpos, ypos + _th, _w - 2 * xpos, _h - _th - buttonHeight - 16 - ypos);
addTabWidget(myTab); addTabWidget(myTab);
addEmulationTab(font); addEmulationTab(font);

View File

@ -38,9 +38,34 @@
* ... * ...
*/ */
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Dialog::Dialog(OSystem& instance, DialogContainer& parent, const GUI::Font& font, const string& title,
int x, int y, int w, int h)
: GuiObject(instance, parent, *this, x, y, w, h),
_font(&font),
_title(title),
_th(0),
_mouseWidget(nullptr),
_focusedWidget(nullptr),
_dragWidget(nullptr),
_okWidget(nullptr),
_cancelWidget(nullptr),
_visible(false),
_processCancel(false),
_surface(nullptr),
_tabID(0),
_flags(WIDGET_ENABLED | WIDGET_BORDER | WIDGET_CLEARBG)
{
initTitle(font, title);
}
Dialog::Dialog(OSystem& instance, DialogContainer& parent, Dialog::Dialog(OSystem& instance, DialogContainer& parent,
int x, int y, int w, int h) int x, int y, int w, int h)
: GuiObject(instance, parent, *this, x, y, w, h), : GuiObject(instance, parent, *this, x, y, w, h),
_font(nullptr),
_title(""),
_th(0),
_fh(0),
_mouseWidget(nullptr), _mouseWidget(nullptr),
_focusedWidget(nullptr), _focusedWidget(nullptr),
_dragWidget(nullptr), _dragWidget(nullptr),
@ -102,6 +127,29 @@ void Dialog::close(bool refresh)
parent().removeDialog(); parent().removeDialog();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::initTitle(const GUI::Font& font, const string& title)
{
_font = &font;
_fh = font.getLineHeight();
setTitle(title);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::setTitle(const string& title)
{
if(_font != nullptr)
{
_title = title;
_h -= _th;
if(title.empty())
_th = 0;
else
_th = _fh + 4;
_h += _th;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::center() void Dialog::center()
{ {
@ -271,8 +319,19 @@ void Dialog::drawDialog()
if(_dirty) if(_dirty)
{ {
if(_flags & WIDGET_CLEARBG) if(_flags & WIDGET_CLEARBG)
{
// cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl; // cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl;
s.fillRect(_x, _y, _w, _h, kDlgColor); s.fillRect(_x, _y + _th, _w, _h - _th, kDlgColor);
if(_th)
{
s.fillRect(_x, _y, _w, _th, kColorTitleBar);
s.drawString(*_font, _title, _x + 10, _y + 2 + 1, _font->getStringWidth(_title), kColorTitleText);
/*int lSize = _th * 1 / 2;
int lBorder = (_th - lSize) / 2;
s.line(_w - lSize - lBorder, _y + lBorder, _w - lBorder, _y + lBorder + lSize, kColorTitleText);
s.line(_w - lSize - lBorder + 1, _y + lBorder, _w - lBorder + 1, _y + lBorder + lSize, kColorTitleText);*/
}
}
else else
s.invalidate(); s.invalidate();
if(_flags & WIDGET_BORDER) if(_flags & WIDGET_BORDER)

View File

@ -46,6 +46,8 @@ class Dialog : public GuiObject
public: public:
Dialog(OSystem& instance, DialogContainer& parent, Dialog(OSystem& instance, DialogContainer& parent,
int x = 0, int y = 0, int w = 0, int h = 0); int x = 0, int y = 0, int w = 0, int h = 0);
Dialog(OSystem& instance, DialogContainer& parent, const GUI::Font& font, const string& title,
int x = 0, int y = 0, int w = 0, int h = 0);
virtual ~Dialog(); virtual ~Dialog();
@ -84,6 +86,8 @@ class Dialog : public GuiObject
void clearFlags(int flags) { _flags &= ~flags; setDirty(); } void clearFlags(int flags) { _flags &= ~flags; setDirty(); }
int getFlags() const { return _flags; } int getFlags() const { return _flags; }
void setTitle(const string& title);
protected: protected:
virtual void draw() override { } virtual void draw() override { }
void releaseFocus() override; void releaseFocus() override;
@ -123,6 +127,8 @@ class Dialog : public GuiObject
*/ */
bool getResizableBounds(uInt32& w, uInt32& h) const; bool getResizableBounds(uInt32& w, uInt32& h) const;
void initTitle(const GUI::Font& font, const string& title);
private: private:
void buildCurrentFocusList(int tabID = -1); void buildCurrentFocusList(int tabID = -1);
bool handleNavEvent(Event::Type e); bool handleNavEvent(Event::Type e);
@ -138,6 +144,10 @@ class Dialog : public GuiObject
Widget* _cancelWidget; Widget* _cancelWidget;
bool _visible; bool _visible;
bool _processCancel; bool _processCancel;
string _title;
int _th;
const GUI::Font* _font;
int _fh;
Common::FixedStack<shared_ptr<FBSurface>> mySurfaceStack; Common::FixedStack<shared_ptr<FBSurface>> mySurfaceStack;

View File

@ -37,7 +37,7 @@
GameInfoDialog::GameInfoDialog( GameInfoDialog::GameInfoDialog(
OSystem& osystem, DialogContainer& parent, const GUI::Font& font, OSystem& osystem, DialogContainer& parent, const GUI::Font& font,
GuiObject* boss) GuiObject* boss)
: Dialog(osystem, parent), : Dialog(osystem, parent, font, "Game properties"),
CommandSender(boss), CommandSender(boss),
myPropertiesLoaded(false), myPropertiesLoaded(false),
myDefaultsSelected(false) myDefaultsSelected(false)
@ -61,12 +61,12 @@ GameInfoDialog::GameInfoDialog(
// Set real dimensions // Set real dimensions
_w = 52 * fontWidth + 8; _w = 52 * fontWidth + 8;
_h = 9 * (lineHeight + vGap) + vBorder * 2 + buttonHeight + fontHeight + ifont.getLineHeight() + 20; _h = 9 * (lineHeight + vGap) + vBorder * 2 + _th + buttonHeight + fontHeight + ifont.getLineHeight() + 20;
// The tab widget // The tab widget
xpos = hBorder; ypos = vBorder; xpos = hBorder; ypos = vBorder;
myTab = new TabWidget(this, font, 2, 4, _w - 2 * 2, myTab = new TabWidget(this, font, 2, 4 + _th, _w - 2 * 2,
_h - (buttonHeight + fontHeight + ifont.getLineHeight() + 20)); _h - (_th + buttonHeight + fontHeight + ifont.getLineHeight() + 20));
addTabWidget(myTab); addTabWidget(myTab);
// 1) Cartridge properties // 1) Cartridge properties

View File

@ -30,7 +30,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GlobalPropsDialog::GlobalPropsDialog(GuiObject* boss, const GUI::Font& font) GlobalPropsDialog::GlobalPropsDialog(GuiObject* boss, const GUI::Font& font)
: Dialog(boss->instance(), boss->parent()), : Dialog(boss->instance(), boss->parent(), font, "Power-on options"),
CommandSender(boss) CommandSender(boss)
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = font.getLineHeight(),
@ -47,9 +47,9 @@ GlobalPropsDialog::GlobalPropsDialog(GuiObject* boss, const GUI::Font& font)
// Set real dimensions // Set real dimensions
_w = lwidth + pwidth + fontWidth*3 + 15; _w = lwidth + pwidth + fontWidth*3 + 15;
_h = 17 * (lineHeight + 4) + buttonHeight + 20; _h = 17 * (lineHeight + 4) + buttonHeight + 20 + _th;
xpos = 10; ypos = 10; xpos = 10; ypos = 10 + _th;
// Bankswitch type // Bankswitch type
new StaticTextWidget(this, font, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(this, font, xpos, ypos+1, lwidth, fontHeight,

View File

@ -24,7 +24,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent, HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font) const GUI::Font& font)
: Dialog(osystem, parent), : Dialog(osystem, parent, font, "Help"),
myPage(1), myPage(1),
myNumPages(5) myNumPages(5)
{ {
@ -39,7 +39,7 @@ HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent,
// Set real dimensions // Set real dimensions
_w = 46 * fontWidth + 10; _w = 46 * fontWidth + 10;
_h = 12 * lineHeight + 20; _h = 12 * lineHeight + 20 + _th;
// Add Previous, Next and Close buttons // Add Previous, Next and Close buttons
xpos = 10; ypos = _h - buttonHeight - 10; xpos = 10; ypos = _h - buttonHeight - 10;
@ -61,7 +61,7 @@ HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent,
"Close", GuiObject::kCloseCmd); "Close", GuiObject::kCloseCmd);
wid.push_back(b); wid.push_back(b);
xpos = 5; ypos = 5; xpos = 5; ypos = 5 + _th;
myTitle = new StaticTextWidget(this, font, xpos, ypos, _w - 10, fontHeight, myTitle = new StaticTextWidget(this, font, xpos, ypos, _w - 10, fontHeight,
"", TextAlign::Center); "", TextAlign::Center);

View File

@ -38,11 +38,10 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent, InputDialog::InputDialog(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), : Dialog(osystem, parent, font, "Input settings"),
myConfirmMsg(nullptr), myConfirmMsg(nullptr),
myMaxWidth(max_w), myMaxWidth(max_w),
myMaxHeight(max_h) myMaxHeight(max_h)
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(), fontWidth = font.getMaxCharWidth(),
@ -54,11 +53,11 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
// Set real dimensions // Set real dimensions
_w = std::min(50 * fontWidth + 10, max_w); _w = std::min(50 * fontWidth + 10, max_w);
_h = std::min(16 * (lineHeight + 4) + 16, max_h); _h = std::min(16 * (lineHeight + 4) + 16 + _th, max_h);
// The tab widget // The tab widget
xpos = 2; ypos = vBorder; xpos = 2; ypos = vBorder + _th;
myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - buttonHeight - 20); myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h -_th - buttonHeight - 20);
addTabWidget(myTab); addTabWidget(myTab);
// 1) Event mapper for emulation actions // 1) Event mapper for emulation actions
@ -536,7 +535,7 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
myConfirmMsg = make_unique<GUI::MessageBox> myConfirmMsg = make_unique<GUI::MessageBox>
(this, instance().frameBuffer().font(), msg, (this, instance().frameBuffer().font(), msg,
myMaxWidth, myMaxHeight, kConfirmEEEraseCmd, myMaxWidth, myMaxHeight, kConfirmEEEraseCmd,
"OK", "Cancel", false); "OK", "Cancel", "Erase EEPROM", false);
} }
myConfirmMsg->show(); myConfirmMsg->show();
break; break;

View File

@ -29,8 +29,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font, InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
const StringList& labels) const StringList& labels, const string& title)
: Dialog(boss->instance(), boss->parent()), : Dialog(boss->instance(), boss->parent(), font, title),
CommandSender(boss), CommandSender(boss),
myEnableCenter(false), myEnableCenter(false),
myErrorFlag(false), myErrorFlag(false),
@ -43,8 +43,8 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& lfont, InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont, const GUI::Font& nfont,
const StringList& labels) const StringList& labels, const string& title)
: Dialog(boss->instance(), boss->parent()), : Dialog(boss->instance(), boss->parent(), lfont, title),
CommandSender(boss), CommandSender(boss),
myEnableCenter(false), myEnableCenter(false),
myErrorFlag(false), myErrorFlag(false),
@ -66,7 +66,7 @@ void InputTextDialog::initialize(const GUI::Font& lfont, const GUI::Font& nfont,
// Calculate real dimensions // Calculate real dimensions
_w = fontWidth * 41; _w = fontWidth * 41;
_h = lineHeight * 4 + int(labels.size()) * (lineHeight + 5); _h = lineHeight * 4 + int(labels.size()) * (lineHeight + 5) + _th;
// Determine longest label // Determine longest label
for(i = 0; i < labels.size(); ++i) for(i = 0; i < labels.size(); ++i)
@ -80,7 +80,7 @@ void InputTextDialog::initialize(const GUI::Font& lfont, const GUI::Font& nfont,
lwidth = lfont.getStringWidth(labels[maxIdx]); lwidth = lfont.getStringWidth(labels[maxIdx]);
// Create editboxes for all labels // Create editboxes for all labels
ypos = lineHeight; ypos = lineHeight + _th;
for(i = 0; i < labels.size(); ++i) for(i = 0; i < labels.size(); ++i)
{ {
xpos = 10; xpos = 10;
@ -98,9 +98,9 @@ void InputTextDialog::initialize(const GUI::Font& lfont, const GUI::Font& nfont,
} }
xpos = 10; xpos = 10;
myTitle = new StaticTextWidget(this, lfont, xpos, ypos, _w - 2*xpos, fontHeight, myMessage = new StaticTextWidget(this, lfont, xpos, ypos, _w - 2*xpos, fontHeight,
"", TextAlign::Left); "", TextAlign::Left);
myTitle->setTextColor(kTextColorEm); myMessage->setTextColor(kTextColorEm);
addToFocusList(wid); addToFocusList(wid);
@ -148,9 +148,9 @@ void InputTextDialog::center()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InputTextDialog::setTitle(const string& title) void InputTextDialog::setMessage(const string& title)
{ {
myTitle->setLabel(title); myMessage->setLabel(title);
myErrorFlag = true; myErrorFlag = true;
} }
@ -207,7 +207,7 @@ void InputTextDialog::handleCommand(CommandSender* sender, int cmd,
// Erase the invalid message once editing is restarted // Erase the invalid message once editing is restarted
if(myErrorFlag) if(myErrorFlag)
{ {
myTitle->setLabel(""); myMessage->setLabel("");
myErrorFlag = false; myErrorFlag = false;
} }
break; break;

View File

@ -30,9 +30,9 @@ class InputTextDialog : public Dialog, public CommandSender
{ {
public: public:
InputTextDialog(GuiObject* boss, const GUI::Font& font, InputTextDialog(GuiObject* boss, const GUI::Font& font,
const StringList& labels); const StringList& labels, const string& title = "");
InputTextDialog(GuiObject* boss, const GUI::Font& lfont, InputTextDialog(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont, const StringList& labels); const GUI::Font& nfont, const StringList& labels, const string& title = "");
virtual ~InputTextDialog() = default; virtual ~InputTextDialog() = default;
/** Place the input dialog onscreen and center it */ /** Place the input dialog onscreen and center it */
@ -47,7 +47,7 @@ class InputTextDialog : public Dialog, public CommandSender
void setTextFilter(const EditableWidget::TextFilter& f, int idx = 0); void setTextFilter(const EditableWidget::TextFilter& f, int idx = 0);
void setEmitSignal(int cmd) { myCmd = cmd; } void setEmitSignal(int cmd) { myCmd = cmd; }
void setTitle(const string& title); void setMessage(const string& title);
void setFocus(int idx = 0); void setFocus(int idx = 0);
@ -61,7 +61,7 @@ class InputTextDialog : public Dialog, public CommandSender
private: private:
vector<EditTextWidget*> myInput; vector<EditTextWidget*> myInput;
StaticTextWidget* myTitle; StaticTextWidget* myMessage;
bool myEnableCenter; bool myEnableCenter;
bool myErrorFlag; bool myErrorFlag;

View File

@ -27,7 +27,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
JoystickDialog::JoystickDialog(GuiObject* boss, const GUI::Font& font, JoystickDialog::JoystickDialog(GuiObject* boss, const GUI::Font& font,
int max_w, int max_h) int max_w, int max_h)
: Dialog(boss->instance(), boss->parent(), 0, 0, max_w, max_h) : Dialog(boss->instance(), boss->parent(), font, "Joystick database", 0, 0, max_w, max_h)
{ {
int xpos, ypos; int xpos, ypos;
WidgetArray wid; WidgetArray wid;
@ -36,7 +36,7 @@ JoystickDialog::JoystickDialog(GuiObject* boss, const GUI::Font& font,
buttonHeight = font.getLineHeight() + 4; buttonHeight = font.getLineHeight() + 4;
// Joystick list // Joystick list
xpos = 10; ypos = 10; xpos = 10; ypos = 10 + _th;
int w = _w - 2 * xpos; int w = _w - 2 * xpos;
int h = _h - buttonHeight - ypos - 20; int h = _h - buttonHeight - ypos - 20;
myJoyList = new StringListWidget(this, font, xpos, ypos, w, h); myJoyList = new StringListWidget(this, font, xpos, ypos, w, h);

View File

@ -215,8 +215,8 @@ void LauncherDialog::loadConfig()
instance().settings().getString("romdir"); instance().settings().getString("romdir");
// When romdir hasn't been set, it probably indicates that this is the first // When romdir hasn't been set, it probably indicates that this is the first
// time running Stella; in this case, we should prompt the user // time running Stella; in this case, we should prompt the user
if(romdir == "") if(true || romdir == "")
{ {
if(!myFirstRunMsg) if(!myFirstRunMsg)
{ {
@ -225,11 +225,12 @@ void LauncherDialog::loadConfig()
msg.push_back("Before you can start a game, you need to"); msg.push_back("Before you can start a game, you need to");
msg.push_back("specify where your ROMs are located."); msg.push_back("specify where your ROMs are located.");
msg.push_back(""); msg.push_back("");
msg.push_back("Click 'OK' to select a default ROM directory,"); msg.push_back("Click 'Default' to select a default ROM directory,");
msg.push_back("or 'Cancel' to browse the filesystem manually."); msg.push_back("or 'Browse' to browse the filesystem manually.");
myFirstRunMsg = make_unique<GUI::MessageBox> myFirstRunMsg = make_unique<GUI::MessageBox>
(this, instance().frameBuffer().font(), (this, instance().frameBuffer().font(),
msg, _w, _h, kFirstRunMsgChosenCmd); msg, _w, _h, kFirstRunMsgChosenCmd,
"Default", "Browse", "ROM directory");
} }
myFirstRunMsg->show(); myFirstRunMsg->show();
} }

View File

@ -28,7 +28,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LauncherFilterDialog::LauncherFilterDialog(GuiObject* boss, const GUI::Font& font) LauncherFilterDialog::LauncherFilterDialog(GuiObject* boss, const GUI::Font& font)
: Dialog(boss->instance(), boss->parent()), : Dialog(boss->instance(), boss->parent(), font, "Filter file list"),
CommandSender(boss) CommandSender(boss)
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = font.getLineHeight(),
@ -41,9 +41,9 @@ LauncherFilterDialog::LauncherFilterDialog(GuiObject* boss, const GUI::Font& fon
VariantList items; VariantList items;
// Set real dimensions // Set real dimensions
_w = 3 * buttonWidth;//lwidth + pwidth + fontWidth*5 + 10; _w = 3 * buttonWidth + 20 + 4 * 8;
xpos = 10; ypos = 10; xpos = 10; ypos = 10 + _th;
// Types of files to show // Types of files to show
VarList::push_back(items, "All files", "allfiles"); VarList::push_back(items, "All files", "allfiles");
@ -56,13 +56,13 @@ LauncherFilterDialog::LauncherFilterDialog(GuiObject* boss, const GUI::Font& fon
ypos += lineHeight + 10; ypos += lineHeight + 10;
// Different types of ROM extensions // Different types of ROM extensions
xpos = 40; xpos += font.getStringWidth("Show ");
myRomType[0] = new CheckboxWidget(this, font, xpos, ypos, ourRomTypes[0][0]); myRomType[0] = new CheckboxWidget(this, font, xpos, ypos, ourRomTypes[0][0]);
int rightcol = xpos + myRomType[0]->getWidth() + 10; int rightcol = xpos + myRomType[0]->getWidth() + 8 * 3;
myRomType[3] = new CheckboxWidget(this, font, xpos+rightcol, ypos, ourRomTypes[0][3]); myRomType[3] = new CheckboxWidget(this, font, rightcol, ypos, ourRomTypes[0][3]);
ypos += lineHeight + 4; ypos += lineHeight + 4;
myRomType[1] = new CheckboxWidget(this, font, xpos, ypos, ourRomTypes[0][1]); myRomType[1] = new CheckboxWidget(this, font, xpos, ypos, ourRomTypes[0][1]);
myRomType[4] = new CheckboxWidget(this, font, xpos+rightcol, ypos, ourRomTypes[0][4]); myRomType[4] = new CheckboxWidget(this, font, rightcol, ypos, ourRomTypes[0][4]);
ypos += lineHeight + 4; ypos += lineHeight + 4;
myRomType[2] = new CheckboxWidget(this, font, xpos, ypos, ourRomTypes[0][2]); myRomType[2] = new CheckboxWidget(this, font, xpos, ypos, ourRomTypes[0][2]);
ypos += lineHeight + 10; ypos += lineHeight + 10;
@ -177,7 +177,7 @@ void LauncherFilterDialog::saveConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherFilterDialog::setDefaults() void LauncherFilterDialog::setDefaults()
{ {
handleFileTypeChange("allfiles"); handleFileTypeChange("allroms");
_dirty = true; _dirty = true;
} }

View File

@ -33,7 +33,7 @@
LoggerDialog::LoggerDialog(OSystem& osystem, DialogContainer& parent, LoggerDialog::LoggerDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h, const GUI::Font& font, int max_w, int max_h,
bool uselargefont) bool uselargefont)
: Dialog(osystem, parent), : Dialog(osystem, parent, font, "System logs"),
myLogInfo(nullptr) myLogInfo(nullptr)
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = font.getLineHeight(),
@ -48,7 +48,7 @@ LoggerDialog::LoggerDialog(OSystem& osystem, DialogContainer& parent,
_h = max_h; _h = max_h;
// Test listing of the log output // Test listing of the log output
xpos = 10; ypos = 10; xpos = 10; ypos = 10 + _th;
myLogInfo = new StringListWidget(this, uselargefont ? font : myLogInfo = new StringListWidget(this, uselargefont ? font :
instance().frameBuffer().infoFont(), xpos, ypos, _w - 2 * xpos, instance().frameBuffer().infoFont(), xpos, ypos, _w - 2 * xpos,
_h - buttonHeight - ypos - 20 - 2 * lineHeight, false); _h - buttonHeight - ypos - 20 - 2 * lineHeight, false);

View File

@ -29,8 +29,9 @@ namespace GUI {
MessageBox::MessageBox(GuiObject* boss, const GUI::Font& font, MessageBox::MessageBox(GuiObject* boss, const GUI::Font& font,
const StringList& text, int max_w, int max_h, int cmd, const StringList& text, int max_w, int max_h, int cmd,
const string& okText, const string& cancelText, const string& okText, const string& cancelText,
const string& title,
bool focusOKButton) bool focusOKButton)
: Dialog(boss->instance(), boss->parent(), 0, 0, max_w, max_h), : Dialog(boss->instance(), boss->parent(), font, title, 0, 0, max_w, max_h),
CommandSender(boss), CommandSender(boss),
myCmd(cmd) myCmd(cmd)
{ {
@ -45,9 +46,10 @@ MessageBox::MessageBox(GuiObject* boss, const GUI::Font& font,
MessageBox::MessageBox(GuiObject* boss, const GUI::Font& font, MessageBox::MessageBox(GuiObject* boss, const GUI::Font& font,
const string& text, int max_w, int max_h, int cmd, const string& text, int max_w, int max_h, int cmd,
const string& okText, const string& cancelText, const string& okText, const string& cancelText,
const string& title,
bool focusOKButton) bool focusOKButton)
: MessageBox(boss, font, StringParser(text).stringList(), max_w, max_h, : MessageBox(boss, font, StringParser(text).stringList(), max_w, max_h,
cmd, okText, cancelText, focusOKButton) cmd, okText, cancelText, title, focusOKButton)
{ {
} }
@ -64,9 +66,9 @@ void MessageBox::addText(const GUI::Font& font, const StringList& text)
for(const auto& s: text) for(const auto& s: text)
str_w = std::max(int(s.length()), str_w); str_w = std::max(int(s.length()), str_w);
_w = std::min(str_w * fontWidth + 20, _w); _w = std::min(str_w * fontWidth + 20, _w);
_h = std::min(uInt32((text.size() + 2) * lineHeight + 20), uInt32(_h)); _h = std::min(uInt32((text.size() + 2) * lineHeight + 20 + _th), uInt32(_h));
xpos = 10; ypos = 10; xpos = 10; ypos = 10 + _th;
for(const auto& s: text) for(const auto& s: text)
{ {
new StaticTextWidget(this, font, xpos, ypos, _w - 20, new StaticTextWidget(this, font, xpos, ypos, _w - 20,

View File

@ -37,10 +37,12 @@ class MessageBox : public Dialog, public CommandSender
MessageBox(GuiObject* boss, const GUI::Font& font, const StringList& text, MessageBox(GuiObject* boss, const GUI::Font& font, const StringList& text,
int max_w, int max_h, int cmd = 0, int max_w, int max_h, int cmd = 0,
const string& okText = "OK", const string& cancelText = "Cancel", const string& okText = "OK", const string& cancelText = "Cancel",
const string& title = "",
bool focusOKButton = true); bool focusOKButton = true);
MessageBox(GuiObject* boss, const GUI::Font& font, const string& text, MessageBox(GuiObject* boss, const GUI::Font& font, const string& text,
int max_w, int max_h, int cmd = 0, int max_w, int max_h, int cmd = 0,
const string& okText = "OK", const string& cancelText = "Cancel", const string& okText = "OK", const string& cancelText = "Cancel",
const string& title = "",
bool focusOKButton = true); bool focusOKButton = true);
virtual ~MessageBox() = default; virtual ~MessageBox() = default;

View File

@ -51,14 +51,17 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
myMode(mode) myMode(mode)
{ {
const GUI::Font& font = instance().frameBuffer().font(); const GUI::Font& font = instance().frameBuffer().font();
initTitle(font, "Options");
const int buttonWidth = font.getStringWidth("Developer Settings" + ELLIPSIS) + 20, const int buttonWidth = font.getStringWidth("Developer Settings" + ELLIPSIS) + 20,
buttonHeight = font.getLineHeight() + 6, buttonHeight = font.getLineHeight() + 6,
rowHeight = font.getLineHeight() + 10; rowHeight = font.getLineHeight() + 10;
const int VBORDER = 10 + _th;
_w = 2 * buttonWidth + 30; _w = 2 * buttonWidth + 30;
_h = 7 * rowHeight + 15; _h = 7 * rowHeight + 15 + _th;
int xoffset = 10, yoffset = 10; int xoffset = 10, yoffset = VBORDER;
WidgetArray wid; WidgetArray wid;
ButtonWidget* b = nullptr; ButtonWidget* b = nullptr;
@ -95,12 +98,12 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
wid.push_back(myRomAuditButton); wid.push_back(myRomAuditButton);
// Move to second column // Move to second column
xoffset += buttonWidth + 10; yoffset = 10; xoffset += buttonWidth + 10; yoffset = VBORDER;
myGameInfoButton = ADD_OD_BUTTON("Game Properties" + ELLIPSIS, kInfoCmd); myGameInfoButton = ADD_OD_BUTTON("Game Properties" + ELLIPSIS, kInfoCmd);
wid.push_back(myGameInfoButton); wid.push_back(myGameInfoButton);
myCheatCodeButton = ADD_OD_BUTTON("Cheat Code" + ELLIPSIS, kCheatCmd); myCheatCodeButton = ADD_OD_BUTTON("Cheat Codes" + ELLIPSIS, kCheatCmd);
#ifndef CHEATCODE_SUPPORT #ifndef CHEATCODE_SUPPORT
myCheatCodeButton->clearFlags(WIDGET_ENABLED); myCheatCodeButton->clearFlags(WIDGET_ENABLED);
#endif #endif

View File

@ -35,12 +35,12 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent, RomAuditDialog::RomAuditDialog(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), : Dialog(osystem, parent, font, "Audit ROMs"),
myConfirmMsg(nullptr), myConfirmMsg(nullptr),
myMaxWidth(max_w), myMaxWidth(max_w),
myMaxHeight(max_h) myMaxHeight(max_h)
{ {
const int VBORDER = 10; const int VBORDER = 10 + _th;
const int HBORDER = 10; const int HBORDER = 10;
const int lineHeight = font.getLineHeight(), const int lineHeight = font.getLineHeight(),
@ -54,7 +54,7 @@ RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent,
// Set real dimensions // Set real dimensions
_w = 64 * fontWidth + HBORDER * 2; _w = 64 * fontWidth + HBORDER * 2;
_h = 7 * (lineHeight + 4) + 10; _h = 7 * (lineHeight + 4) + VBORDER;
// Audit path // Audit path
ButtonWidget* romButton = ButtonWidget* romButton =
@ -189,7 +189,7 @@ void RomAuditDialog::handleCommand(CommandSender* sender, int cmd,
myConfirmMsg = make_unique<GUI::MessageBox> myConfirmMsg = make_unique<GUI::MessageBox>
(this, instance().frameBuffer().font(), msg, (this, instance().frameBuffer().font(), msg,
myMaxWidth, myMaxHeight, kConfirmAuditCmd, myMaxWidth, myMaxHeight, kConfirmAuditCmd,
"OK", "Cancel", false); "OK", "Cancel", "ROM Audit", false);
} }
myConfirmMsg->show(); myConfirmMsg->show();
break; break;

View File

@ -28,7 +28,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent, SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font) const GUI::Font& font)
: Dialog(osystem, parent), : Dialog(osystem, parent, font, "Snapshot settings"),
myFont(font) myFont(font)
{ {
const int VBORDER = 10; const int VBORDER = 10;
@ -45,9 +45,9 @@ SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
// Set real dimensions // Set real dimensions
_w = 64 * fontWidth + HBORDER * 2; _w = 64 * fontWidth + HBORDER * 2;
_h = 10 * (lineHeight + 4) + 10; _h = 10 * (lineHeight + 4) + VBORDER + _th;
xpos = HBORDER; ypos = VBORDER; xpos = HBORDER; ypos = VBORDER + _th;
// Snapshot path (save files) // Snapshot path (save files)
b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,

View File

@ -35,7 +35,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent, UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font) const GUI::Font& font)
: Dialog(osystem, parent) : Dialog(osystem, parent, font, "UI settings")
{ {
const GUI::Font& ifont = instance().frameBuffer().infoFont(); const GUI::Font& ifont = instance().frameBuffer().infoFont();
const int lineHeight = font.getLineHeight(), const int lineHeight = font.getLineHeight(),
@ -54,11 +54,11 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
// Set real dimensions // Set real dimensions
_w = 37 * fontWidth + 10; _w = 37 * fontWidth + 10;
_h = 10 * (lineHeight + 4) + 10; _h = 10 * (lineHeight + 4) + VBORDER + _th;
// The tab widget // The tab widget
xpos = HBORDER; ypos = VBORDER; xpos = HBORDER; ypos = VBORDER;
myTab = new TabWidget(this, font, 2, 4, _w - 2*2, _h - buttonHeight - 20); myTab = new TabWidget(this, font, 2, 4 + _th, _w - 2*2, _h - _th - buttonHeight - 20);
addTabWidget(myTab); addTabWidget(myTab);
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////

View File

@ -35,7 +35,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent, VideoDialog::VideoDialog(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) : Dialog(osystem, parent, font, "Video settings")
{ {
const int VGAP = 4; const int VGAP = 4;
const int VBORDER = 8; const int VBORDER = 8;
@ -56,11 +56,11 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
// Set real dimensions // Set real dimensions
_w = std::min((52+4*0) * fontWidth + HBORDER * 2, max_w); _w = std::min((52+4*0) * fontWidth + HBORDER * 2, max_w);
_h = std::min((16-2) * (lineHeight + VGAP) + 14, max_h); _h = std::min((16-2) * (lineHeight + VGAP) + 14 + _th, max_h);
// The tab widget // The tab widget
xpos = 2; ypos = 4; xpos = 2; ypos = 4;
myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - buttonHeight - 20); myTab = new TabWidget(this, font, xpos, ypos + _th, _w - 2*xpos, _h - _th - buttonHeight - 20);
addTabWidget(myTab); addTabWidget(myTab);
xpos = HBORDER; ypos = VBORDER; xpos = HBORDER; ypos = VBORDER;