mirror of https://github.com/stella-emu/stella.git
some code improvements and fixes for #326
This commit is contained in:
parent
b5f5ddefad
commit
7dd4242e63
|
@ -31,22 +31,25 @@ CommandDialog::CommandDialog(OSystem& osystem, DialogContainer& parent)
|
||||||
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Commands")
|
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Commands")
|
||||||
{
|
{
|
||||||
const int HBORDER = 10;
|
const int HBORDER = 10;
|
||||||
const int buttonWidth = _font.getStringWidth("Stella Palette") + 20,
|
const int VBORDER = 10;
|
||||||
|
const int HGAP = 8;
|
||||||
|
const int VGAP = 4;
|
||||||
|
const int buttonWidth = _font.getStringWidth("Stella Palette") + 16,
|
||||||
buttonHeight = _font.getLineHeight() + 6,
|
buttonHeight = _font.getLineHeight() + 6,
|
||||||
rowHeight = buttonHeight + 8;
|
rowHeight = buttonHeight + VGAP;
|
||||||
|
|
||||||
// Set real dimensions
|
// Set real dimensions
|
||||||
_w = 3 * (buttonWidth + 5) + HBORDER * 2;
|
_w = 3 * (buttonWidth + 5) + HBORDER * 2;
|
||||||
_h = 6 * rowHeight + 8 + _th;
|
_h = 6 * rowHeight - VGAP + VBORDER * 2 + _th;
|
||||||
ButtonWidget* bw;
|
ButtonWidget* bw;
|
||||||
WidgetArray wid;
|
WidgetArray wid;
|
||||||
int xoffset = HBORDER, yoffset = 8 + _th;
|
int xoffset = HBORDER, yoffset = VBORDER + _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);
|
||||||
yoffset += buttonHeight + 8;
|
yoffset += buttonHeight + VGAP;
|
||||||
return bw;
|
return bw;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -55,22 +58,22 @@ CommandDialog::CommandDialog(OSystem& osystem, DialogContainer& parent)
|
||||||
wid.push_back(bw);
|
wid.push_back(bw);
|
||||||
bw = ADD_CD_BUTTON("Reset", kResetCmd);
|
bw = ADD_CD_BUTTON("Reset", kResetCmd);
|
||||||
wid.push_back(bw);
|
wid.push_back(bw);
|
||||||
myColorButton = ADD_CD_BUTTON("Color TV", kColorCmd);
|
myColorButton = ADD_CD_BUTTON("", kColorCmd);
|
||||||
wid.push_back(myColorButton);
|
wid.push_back(myColorButton);
|
||||||
myLeftDiffButton = ADD_CD_BUTTON("Left Diff X", kLeftDiffCmd);
|
myLeftDiffButton = ADD_CD_BUTTON("", kLeftDiffCmd);
|
||||||
wid.push_back(myLeftDiffButton);
|
wid.push_back(myLeftDiffButton);
|
||||||
myRightDiffButton = ADD_CD_BUTTON("Left Diff X", kLeftDiffCmd);
|
myRightDiffButton = ADD_CD_BUTTON("", kLeftDiffCmd);
|
||||||
wid.push_back(myRightDiffButton);
|
wid.push_back(myRightDiffButton);
|
||||||
|
|
||||||
// Column 2
|
// Column 2
|
||||||
xoffset += buttonWidth + 8;
|
xoffset += buttonWidth + HGAP;
|
||||||
yoffset = 8 + _th;
|
yoffset = VBORDER + _th;
|
||||||
|
|
||||||
mySaveStateButton = ADD_CD_BUTTON("Save State", kSaveStateCmd);
|
mySaveStateButton = ADD_CD_BUTTON("", kSaveStateCmd);
|
||||||
wid.push_back(mySaveStateButton);
|
wid.push_back(mySaveStateButton);
|
||||||
myStateSlotButton = ADD_CD_BUTTON("State Slot", kStateSlotCmd);
|
myStateSlotButton = ADD_CD_BUTTON("", kStateSlotCmd);
|
||||||
wid.push_back(myStateSlotButton);
|
wid.push_back(myStateSlotButton);
|
||||||
myLoadStateButton = ADD_CD_BUTTON("Load State", kLoadStateCmd);
|
myLoadStateButton = ADD_CD_BUTTON("", kLoadStateCmd);
|
||||||
wid.push_back(myLoadStateButton);
|
wid.push_back(myLoadStateButton);
|
||||||
bw = ADD_CD_BUTTON("Snapshot", kSnapshotCmd);
|
bw = ADD_CD_BUTTON("Snapshot", kSnapshotCmd);
|
||||||
wid.push_back(bw);
|
wid.push_back(bw);
|
||||||
|
@ -80,12 +83,12 @@ CommandDialog::CommandDialog(OSystem& osystem, DialogContainer& parent)
|
||||||
wid.push_back(bw);
|
wid.push_back(bw);
|
||||||
|
|
||||||
// Column 3
|
// Column 3
|
||||||
xoffset += buttonWidth + 8;
|
xoffset += buttonWidth + HGAP;
|
||||||
yoffset = 8 + _th;
|
yoffset = VBORDER + _th;
|
||||||
|
|
||||||
myTVFormatButton = ADD_CD_BUTTON("SECAM-60", kFormatCmd);
|
myTVFormatButton = ADD_CD_BUTTON("", kFormatCmd);
|
||||||
wid.push_back(myTVFormatButton);
|
wid.push_back(myTVFormatButton);
|
||||||
myPaletteButton = ADD_CD_BUTTON("Stella Palette", kPaletteCmd);
|
myPaletteButton = ADD_CD_BUTTON("", kPaletteCmd);
|
||||||
wid.push_back(myPaletteButton);
|
wid.push_back(myPaletteButton);
|
||||||
bw = ADD_CD_BUTTON("TODO", 0);
|
bw = ADD_CD_BUTTON("TODO", 0);
|
||||||
wid.push_back(bw);
|
wid.push_back(bw);
|
||||||
|
@ -109,9 +112,9 @@ void CommandDialog::loadConfig()
|
||||||
myTVFormatButton->setLabel(instance().console().getFormatString() + " Mode");
|
myTVFormatButton->setLabel(instance().console().getFormatString() + " Mode");
|
||||||
string palette, label;
|
string palette, label;
|
||||||
palette = instance().settings().getString("palette");
|
palette = instance().settings().getString("palette");
|
||||||
if(palette == "standard")
|
if(BSPF::equalsIgnoreCase(palette, "standard"))
|
||||||
label = "Stella Palette";
|
label = "Stella Palette";
|
||||||
else if(palette == "z26")
|
else if(BSPF::equalsIgnoreCase(palette, "z26"))
|
||||||
label = "Z26 Palette";
|
label = "Z26 Palette";
|
||||||
else
|
else
|
||||||
label = "User Palette";
|
label = "User Palette";
|
||||||
|
|
|
@ -64,11 +64,6 @@ class CommandDialog : public Dialog
|
||||||
kExitCmd = 'Clex'
|
kExitCmd = 'Clex'
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
|
||||||
kNumRows = 4,
|
|
||||||
kNumCols = 4
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
CommandDialog() = delete;
|
CommandDialog() = delete;
|
||||||
|
|
|
@ -72,7 +72,6 @@ GameInfoDialog::GameInfoDialog(
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// 1) Emulation properties
|
// 1) Emulation properties
|
||||||
wid.clear();
|
|
||||||
tabID = myTab->addTab("Emulation");
|
tabID = myTab->addTab("Emulation");
|
||||||
|
|
||||||
ypos = VBORDER;
|
ypos = VBORDER;
|
||||||
|
@ -132,8 +131,7 @@ GameInfoDialog::GameInfoDialog(
|
||||||
"(*) Changes require a ROM reload");
|
"(*) Changes require a ROM reload");
|
||||||
|
|
||||||
// Add items for tab 0
|
// Add items for tab 0
|
||||||
addToFocusList(wid, myTab, tabID);
|
addToFocusList(wid, myTab, tabID);
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// 2) Console properties
|
// 2) Console properties
|
||||||
|
@ -277,6 +275,7 @@ GameInfoDialog::GameInfoDialog(
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// 4) Cartridge properties
|
// 4) Cartridge properties
|
||||||
|
wid.clear();
|
||||||
tabID = myTab->addTab("Cartridge");
|
tabID = myTab->addTab("Cartridge");
|
||||||
|
|
||||||
xpos = HBORDER; ypos = VBORDER;
|
xpos = HBORDER; ypos = VBORDER;
|
||||||
|
|
Loading…
Reference in New Issue