refined some more dialogs

This commit is contained in:
thrust26 2018-01-23 11:52:53 +01:00
parent d7dd6db9b8
commit 795c84de9d
4 changed files with 68 additions and 63 deletions

View File

@ -35,80 +35,82 @@ ConfigPathDialog::ConfigPathDialog(
myBrowser(nullptr),
myIsGlobal(boss != nullptr)
{
const int VBORDER = 10;
const int HBORDER = 10;
const int V_GAP = 4;
const int H_GAP = 8;
const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(),
buttonWidth = font.getStringWidth("Properties file") + 20,
buttonHeight = font.getLineHeight() + 4;
const int vBorder = 8;
const int hBorder = 10;
int xpos, ypos;
WidgetArray wid;
ButtonWidget* b;
// Set real dimensions
_w = 56 * fontWidth + 8;
_h = 9 * (lineHeight + 4) + 10;
_w = 64 * fontWidth + HBORDER*2;
_h = 9 * (lineHeight + V_GAP) + 10;
xpos = hBorder; ypos = vBorder;
xpos = HBORDER; ypos = VBORDER;
// ROM path
ButtonWidget* romButton =
new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"ROM path" + ELLIPSIS, kChooseRomDirCmd);
wid.push_back(romButton);
xpos += buttonWidth + 10;
myRomPath = new EditTextWidget(this, font, xpos, ypos + 2,
_w - xpos - 10, lineHeight, "");
xpos += buttonWidth + H_GAP;
myRomPath = new EditTextWidget(this, font, xpos, ypos + 1,
_w - xpos - HBORDER, lineHeight, "");
wid.push_back(myRomPath);
// Cheat file
xpos = hBorder; ypos += romButton->getHeight() + 3;
xpos = HBORDER; ypos += buttonHeight + V_GAP;
b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"Cheat file" + ELLIPSIS, kChooseCheatFileCmd);
wid.push_back(b);
xpos += buttonWidth + 10;
myCheatFile = new EditTextWidget(this, font, xpos, ypos + 2,
_w - xpos - 10, lineHeight, "");
xpos += buttonWidth + H_GAP;
myCheatFile = new EditTextWidget(this, font, xpos, ypos + 1,
_w - xpos - HBORDER, lineHeight, "");
wid.push_back(myCheatFile);
// Palette file
xpos = hBorder; ypos += b->getHeight() + 3;
xpos = HBORDER; ypos += buttonHeight + V_GAP;
b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"Palette file" + ELLIPSIS, kChoosePaletteFileCmd);
wid.push_back(b);
xpos += buttonWidth + 10;
myPaletteFile = new EditTextWidget(this, font, xpos, ypos + 2,
_w - xpos - 10, lineHeight, "");
xpos += buttonWidth + H_GAP;
myPaletteFile = new EditTextWidget(this, font, xpos, ypos + 1,
_w - xpos - HBORDER, lineHeight, "");
wid.push_back(myPaletteFile);
// Properties file
xpos = hBorder; ypos += b->getHeight() + 3;
xpos = HBORDER; ypos += buttonHeight + V_GAP;
b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"Properties file" + ELLIPSIS, kChoosePropsFileCmd);
wid.push_back(b);
xpos += buttonWidth + 10;
myPropsFile = new EditTextWidget(this, font, xpos, ypos + 2,
_w - xpos - 10, lineHeight, "");
xpos += buttonWidth + H_GAP;
myPropsFile = new EditTextWidget(this, font, xpos, ypos + 1,
_w - xpos - HBORDER, lineHeight, "");
wid.push_back(myPropsFile);
// State directory
xpos = hBorder; ypos += b->getHeight() + 3;
xpos = HBORDER; ypos += buttonHeight + V_GAP;
b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"State path" + ELLIPSIS, kChooseStateDirCmd);
wid.push_back(b);
xpos += buttonWidth + 10;
myStatePath = new EditTextWidget(this, font, xpos, ypos + 2,
_w - xpos - 10, lineHeight, "");
xpos += buttonWidth + H_GAP;
myStatePath = new EditTextWidget(this, font, xpos, ypos + 1,
_w - xpos - HBORDER, lineHeight, "");
wid.push_back(myStatePath);
// NVRAM directory
xpos = hBorder; ypos += b->getHeight() + 3;
xpos = HBORDER; ypos += buttonHeight + V_GAP;
b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"NVRAM path" + ELLIPSIS, kChooseNVRamDirCmd);
wid.push_back(b);
xpos += buttonWidth + 10;
myNVRamPath = new EditTextWidget(this, font, xpos, ypos + 2,
_w - xpos - 10, lineHeight, "");
xpos += buttonWidth + H_GAP;
myNVRamPath = new EditTextWidget(this, font, xpos, ypos + 1,
_w - xpos - HBORDER, lineHeight, "");
wid.push_back(myNVRamPath);
// Add Defaults, OK and Cancel buttons

View File

@ -115,11 +115,11 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
// Add textfield to show current directory
xpos = 10;
xpos += 5; ypos += myList->getHeight() + 4;
lwidth = font.getStringWidth("Dir ");
ypos += myList->getHeight() + 4;
lwidth = font.getStringWidth("Path ");
myDirLabel = new StaticTextWidget(this, font, xpos, ypos+2, lwidth, fontHeight,
"Dir", TextAlign::Left);
xpos += lwidth + 5;
"Path", TextAlign::Left);
xpos += lwidth;
myDir = new EditTextWidget(this, font, xpos, ypos, _w - xpos - 10, lineHeight, "");
myDir->setEditable(false, true);
myDir->clearFlags(WIDGET_RETAIN_FOCUS);

View File

@ -40,8 +40,8 @@ RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent,
myMaxWidth(max_w),
myMaxHeight(max_h)
{
const int vBorder = 10;
const int hBorder = 10;
const int VBORDER = 10;
const int HBORDER = 10;
const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(),
@ -49,44 +49,44 @@ RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent,
buttonWidth = font.getStringWidth("Audit path" + ELLIPSIS) + 20,
buttonHeight = font.getLineHeight() + 4,
lwidth = font.getStringWidth("ROMs without properties (skipped) ");
int xpos, ypos = vBorder;
int xpos, ypos = VBORDER;
WidgetArray wid;
// Set real dimensions
_w = 54 * fontWidth + 10;
_w = 64 * fontWidth + HBORDER * 2;
_h = 7 * (lineHeight + 4) + 10;
// Audit path
ButtonWidget* romButton =
new ButtonWidget(this, font, hBorder, ypos, buttonWidth, buttonHeight,
new ButtonWidget(this, font, HBORDER, ypos, buttonWidth, buttonHeight,
"Audit path" + ELLIPSIS, kChooseAuditDirCmd);
wid.push_back(romButton);
xpos = hBorder + buttonWidth + 10;
myRomPath = new EditTextWidget(this, font, xpos, ypos + 2,
_w - xpos - hBorder, lineHeight, "");
xpos = HBORDER + buttonWidth + 8;
myRomPath = new EditTextWidget(this, font, xpos, ypos + 1,
_w - xpos - HBORDER, lineHeight, "");
wid.push_back(myRomPath);
// Show results of ROM audit
ypos += buttonHeight + 16;
new StaticTextWidget(this, font, hBorder, ypos, lwidth, fontHeight,
new StaticTextWidget(this, font, HBORDER, ypos, lwidth, fontHeight,
"ROMs with properties (renamed) ", TextAlign::Left);
myResults1 = new EditTextWidget(this, font, hBorder + lwidth, ypos - 2,
_w - hBorder*2 - lwidth, lineHeight, "");
myResults1 = new EditTextWidget(this, font, HBORDER + lwidth, ypos - 2,
fontWidth * 6, lineHeight, "");
myResults1->setEditable(false, true);
ypos += buttonHeight;
new StaticTextWidget(this, font, hBorder, ypos, lwidth, fontHeight,
new StaticTextWidget(this, font, HBORDER, ypos, lwidth, fontHeight,
"ROMs without properties (skipped) ", TextAlign::Left);
myResults2 = new EditTextWidget(this, font, hBorder + lwidth, ypos - 2,
_w - hBorder*2 - lwidth, lineHeight, "");
myResults2 = new EditTextWidget(this, font, HBORDER + lwidth, ypos - 2,
fontWidth * 6, lineHeight, "");
myResults2->setEditable(false, true);
ypos += buttonHeight + 8;
new StaticTextWidget(this, font, hBorder, ypos, _w - 20, fontHeight,
"(*) WARNING: operation cannot be undone!",
new StaticTextWidget(this, font, HBORDER, ypos, _w - 20, fontHeight,
"(*) WARNING: Operation cannot be undone!",
TextAlign::Left);
// Add OK and Cancel buttons
addOKCancelBGroup(wid, font, "Audit", "Done");
addOKCancelBGroup(wid, font, "Audit", "Close");
addBGroupToFocusList(wid);
// Create file browser dialog

View File

@ -31,38 +31,41 @@ SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
: Dialog(osystem, parent),
myFont(font)
{
const int VBORDER = 10;
const int HBORDER = 10;
const int INDENT = 20;
const int V_GAP = 4;
const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(),
buttonWidth = font.getStringWidth("Save path" + ELLIPSIS) + 20,
buttonHeight = font.getLineHeight() + 4;
const int vBorder = 10;
int xpos, ypos, lwidth, fwidth;
WidgetArray wid;
ButtonWidget* b;
// Set real dimensions
_w = 53 * fontWidth + 8;
_w = 64 * fontWidth + HBORDER * 2;
_h = 10 * (lineHeight + 4) + 10;
xpos = vBorder; ypos = vBorder;
xpos = HBORDER; ypos = VBORDER;
// Snapshot path (save files)
b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"Save path" + ELLIPSIS, kChooseSnapSaveDirCmd);
wid.push_back(b);
xpos += buttonWidth + 10;
mySnapSavePath = new EditTextWidget(this, font, xpos, ypos + 2,
_w - xpos - 10, lineHeight, "");
xpos += buttonWidth + 8;
mySnapSavePath = new EditTextWidget(this, font, xpos, ypos + 1,
_w - xpos - HBORDER, lineHeight, "");
wid.push_back(mySnapSavePath);
// Snapshot path (load files)
xpos = vBorder; ypos += buttonHeight + 3;
xpos = HBORDER; ypos += buttonHeight + V_GAP;
b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
"Load path" + ELLIPSIS, kChooseSnapLoadDirCmd);
wid.push_back(b);
xpos += buttonWidth + 10;
mySnapLoadPath = new EditTextWidget(this, font, xpos, ypos + 2,
_w - xpos - 10, lineHeight, "");
xpos += buttonWidth + 8;
mySnapLoadPath = new EditTextWidget(this, font, xpos, ypos + 1,
_w - xpos - HBORDER, lineHeight, "");
wid.push_back(mySnapLoadPath);
// Snapshot naming
@ -71,7 +74,7 @@ SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
VariantList items;
VarList::push_back(items, "actual ROM name", "rom");
VarList::push_back(items, "internal database", "int");
xpos = vBorder+10; ypos += buttonHeight + 8;
xpos = HBORDER; ypos += buttonHeight + V_GAP * 4;
mySnapName =
new PopUpWidget(this, font, xpos, ypos, fwidth, lineHeight, items,
"Save snapshots according to ", lwidth);
@ -97,18 +100,18 @@ SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
// Booleans for saving snapshots
fwidth = font.getStringWidth("When saving snapshots:");
xpos = vBorder; ypos += buttonHeight + 5;
xpos = HBORDER; ypos += lineHeight + V_GAP * 3;
new StaticTextWidget(this, font, xpos, ypos, fwidth, lineHeight,
"When saving snapshots:", TextAlign::Left);
// Snapshot single or multiple saves
xpos += 30; ypos += lineHeight + 3;
xpos += INDENT; ypos += lineHeight + V_GAP;
mySnapSingle = new CheckboxWidget(this, font, xpos, ypos,
"Overwrite existing files");
wid.push_back(mySnapSingle);
// Snapshot in 1x mode (ignore scaling)
ypos += mySnapSingle->getHeight() + 4;
ypos += lineHeight + V_GAP;
mySnap1x = new CheckboxWidget(this, font, xpos, ypos,
"Ignore scaling (1x mode)");
wid.push_back(mySnap1x);