some small dialog refinements

This commit is contained in:
thrust26 2018-01-23 19:50:37 +01:00
parent 5757eccfcf
commit 74e5003c8f
4 changed files with 58 additions and 55 deletions

View File

@ -50,17 +50,19 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
lineHeight = font.getLineHeight(),
buttonWidth = font.getStringWidth("Defaults") + 10,
buttonHeight = font.getLineHeight() + 4;
int xpos = 5, ypos = 5;
const int HBORDER = 8;
const int VBORDER = 8;
int xpos = HBORDER, ypos = VBORDER;
myActionsList = new StringListWidget(boss, font, xpos, ypos,
_w - buttonWidth - 20, _h - 3*lineHeight);
_w - buttonWidth - HBORDER * 2 - 8, _h - 3*lineHeight - VBORDER);
myActionsList->setTarget(this);
myActionsList->setEditable(false);
myActionsList->setList(actions);
addFocusWidget(myActionsList);
// Add remap, erase, cancel and default buttons
xpos += myActionsList->getWidth() + 5; ypos += 5;
xpos = _w - HBORDER - buttonWidth;
myMapButton = new ButtonWidget(boss, font, xpos, ypos,
buttonWidth, buttonHeight,
"Map" + ELLIPSIS, kStartMapCmd);
@ -105,13 +107,13 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
myComboButton = nullptr;
// Show message for currently selected event
xpos = 10; ypos = 5 + myActionsList->getHeight() + 5;
xpos = HBORDER; ypos = VBORDER + myActionsList->getHeight() + 8;
StaticTextWidget* t;
t = new StaticTextWidget(boss, font, xpos, ypos+2, font.getStringWidth("Action"),
fontHeight, "Action", TextAlign::Left);
myKeyMapping = new EditTextWidget(boss, font, xpos + t->getWidth() + 8, ypos,
_w - xpos - t->getWidth() - 15, lineHeight, "");
_w - xpos - t->getWidth() - 8 - HBORDER, lineHeight, "");
myKeyMapping->setEditable(false, true);
myKeyMapping->clearFlags(WIDGET_RETAIN_FOCUS);
}

View File

@ -48,8 +48,8 @@ GameInfoDialog::GameInfoDialog(
fontHeight = font.getFontHeight(),
buttonWidth = font.getStringWidth("Defaults") + 20,
buttonHeight = font.getLineHeight() + 4;
const int vBorder = 4;
const int hBorder = 2;
const int vBorder = 8;
const int hBorder = 8;
const int hSpace = 10;
const int vGap = 4;
@ -65,7 +65,7 @@ GameInfoDialog::GameInfoDialog(
// The tab widget
xpos = hBorder; ypos = vBorder;
myTab = new TabWidget(this, font, xpos, ypos, _w - 2 * hBorder,
myTab = new TabWidget(this, font, 2, 4, _w - 2 * 2,
_h - (buttonHeight + fontHeight + ifont.getLineHeight() + 20));
addTabWidget(myTab);

View File

@ -54,7 +54,7 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
// Set real dimensions
_w = std::min(50 * fontWidth + 10, max_w);
_h = std::min(16 * (lineHeight + 4) + 14, max_h);
_h = std::min(16 * (lineHeight + 4) + 16, max_h);
// The tab widget
xpos = 2; ypos = vBorder;
@ -66,7 +66,7 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
actions = instance().eventHandler().getActionList(kEmulationMode);
myEmulEventMapper = new EventMappingWidget(myTab, font, 2, 2,
myTab->getWidth(),
myTab->getHeight() - ypos,
myTab->getHeight() - 4,
actions, kEmulationMode);
myTab->setParentWidget(tabID, myEmulEventMapper);
addToFocusList(myEmulEventMapper->getFocusList(), myTab, tabID);
@ -76,7 +76,7 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
actions = instance().eventHandler().getActionList(kMenuMode);
myMenuEventMapper = new EventMappingWidget(myTab, font, 2, 2,
myTab->getWidth(),
myTab->getHeight() - ypos,
myTab->getHeight() - 4,
actions, kMenuMode);
myTab->setParentWidget(tabID, myMenuEventMapper);
addToFocusList(myMenuEventMapper->getFocusList(), myTab, tabID);
@ -108,42 +108,43 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
int xpos, ypos, lwidth, pwidth, tabID;
WidgetArray wid;
VariantList items;
const int vGap = 4;
const int hSpace = 8;
const int VGAP = 4;
const int VBORDER = 8;
const int HBORDER = 8;
// Devices/ports
tabID = myTab->addTab("Devices & Ports");
// Stelladaptor mappings
ypos = vGap+2;
ypos = VBORDER;
lwidth = font.getStringWidth("Digital paddle sensitivity "); // was: "Use mouse as a controller "
pwidth = font.getStringWidth("-UI, -Emulation");
VarList::push_back(items, "Left / Right", "lr");
VarList::push_back(items, "Right / Left", "rl");
mySAPort = new PopUpWidget(myTab, font, hSpace, ypos, pwidth, lineHeight, items,
mySAPort = new PopUpWidget(myTab, font, HBORDER, ypos, pwidth, lineHeight, items,
"Stelladaptor port order ", lwidth);
wid.push_back(mySAPort);
// Use mouse as controller
ypos += lineHeight + vGap;
ypos += lineHeight + VGAP;
items.clear();
VarList::push_back(items, "Always", "always");
VarList::push_back(items, "Analog devices", "analog");
VarList::push_back(items, "Never", "never");
myMouseControl = new PopUpWidget(myTab, font, hSpace, ypos, pwidth, lineHeight, items,
"Use mouse as a controller ", lwidth);
myMouseControl = new PopUpWidget(myTab, font, HBORDER, ypos, pwidth, lineHeight, items,
"Use mouse as a controller ", lwidth);
wid.push_back(myMouseControl);
// Mouse cursor state
ypos += lineHeight + vGap;
ypos += lineHeight + VGAP;
items.clear();
VarList::push_back(items, "-UI, -Emulation", "0");
VarList::push_back(items, "-UI, +Emulation", "1");
VarList::push_back(items, "+UI, -Emulation", "2");
VarList::push_back(items, "+UI, +Emulation", "3");
myCursorState = new PopUpWidget(myTab, font, hSpace, ypos, pwidth, lineHeight, items,
"Mouse cursor visibility ", lwidth);
myCursorState = new PopUpWidget(myTab, font, HBORDER, ypos, pwidth, lineHeight, items,
"Mouse cursor visibility ", lwidth);
wid.push_back(myCursorState);
#ifndef WINDOWED_SUPPORT
myCursorState->clearFlags(WIDGET_ENABLED);
@ -153,57 +154,57 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
pwidth = font.getMaxCharWidth() * 8;
// Add joystick deadzone setting
ypos += lineHeight + vGap*3;
myDeadzone = new SliderWidget(myTab, font, hSpace, ypos, pwidth, lineHeight,
ypos += lineHeight + VGAP*3;
myDeadzone = new SliderWidget(myTab, font, HBORDER, ypos, pwidth, lineHeight,
"Joystick deadzone size ", lwidth, kDeadzoneChanged);
myDeadzone->setMinValue(0); myDeadzone->setMaxValue(29);
xpos = hSpace + myDeadzone->getWidth() + 5;
xpos = HBORDER + myDeadzone->getWidth() + 5;
myDeadzoneLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 5*fontWidth,
lineHeight, "", TextAlign::Left);
wid.push_back(myDeadzone);
// Add paddle speed (digital emulation)
ypos += lineHeight + vGap;
myDPaddleSpeed = new SliderWidget(myTab, font, hSpace, ypos, pwidth, lineHeight,
ypos += lineHeight + VGAP;
myDPaddleSpeed = new SliderWidget(myTab, font, HBORDER, ypos, pwidth, lineHeight,
"Digital paddle sensitivity ",
lwidth, kDPSpeedChanged);
myDPaddleSpeed->setMinValue(1); myDPaddleSpeed->setMaxValue(20);
xpos = hSpace + myDPaddleSpeed->getWidth() + 5;
xpos = HBORDER + myDPaddleSpeed->getWidth() + 5;
myDPaddleLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight,
"", TextAlign::Left);
wid.push_back(myDPaddleSpeed);
// Add paddle speed (mouse emulation)
ypos += lineHeight + vGap;
myMPaddleSpeed = new SliderWidget(myTab, font, hSpace, ypos, pwidth, lineHeight,
ypos += lineHeight + VGAP;
myMPaddleSpeed = new SliderWidget(myTab, font, HBORDER, ypos, pwidth, lineHeight,
"Mouse paddle sensitivity ",
lwidth, kMPSpeedChanged);
myMPaddleSpeed->setMinValue(1); myMPaddleSpeed->setMaxValue(20);
xpos = hSpace + myMPaddleSpeed->getWidth() + 5;
xpos = HBORDER + myMPaddleSpeed->getWidth() + 5;
myMPaddleLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight,
"", TextAlign::Left);
wid.push_back(myMPaddleSpeed);
// Add trackball speed
ypos += lineHeight + vGap;
myTrackBallSpeed = new SliderWidget(myTab, font, hSpace, ypos, pwidth, lineHeight,
ypos += lineHeight + VGAP;
myTrackBallSpeed = new SliderWidget(myTab, font, HBORDER, ypos, pwidth, lineHeight,
"Trackball sensitivity ",
lwidth, kTBSpeedChanged);
myTrackBallSpeed->setMinValue(1); myTrackBallSpeed->setMaxValue(20);
xpos = hSpace + myTrackBallSpeed->getWidth() + 5;
xpos = HBORDER + myTrackBallSpeed->getWidth() + 5;
myTrackBallLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight,
"", TextAlign::Left);
wid.push_back(myTrackBallSpeed);
// Add 'allow all 4 directions' for joystick
ypos += lineHeight + vGap*3;
myAllowAll4 = new CheckboxWidget(myTab, font, hSpace, ypos,
ypos += lineHeight + VGAP*3;
myAllowAll4 = new CheckboxWidget(myTab, font, HBORDER, ypos,
"Allow all 4 directions on joystick");
wid.push_back(myAllowAll4);
// Grab mouse (in windowed mode)
ypos += lineHeight + vGap;
myGrabMouse = new CheckboxWidget(myTab, font, hSpace, ypos,
ypos += lineHeight + VGAP;
myGrabMouse = new CheckboxWidget(myTab, font, HBORDER, ypos,
"Grab mouse in emulation mode");
wid.push_back(myGrabMouse);
#ifndef WINDOWED_SUPPORT
@ -211,38 +212,38 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
#endif
// Enable/disable control key-combos
ypos += lineHeight + vGap;
myCtrlCombo = new CheckboxWidget(myTab, font, hSpace, ypos,
ypos += lineHeight + VGAP;
myCtrlCombo = new CheckboxWidget(myTab, font, HBORDER, ypos,
"Use Control key combos");
wid.push_back(myCtrlCombo);
int fwidth;
// Add EEPROM erase (part 1/2)
ypos += vGap*4;
ypos += VGAP*4;
fwidth = font.getStringWidth("AtariVox/SaveKey");
lwidth = font.getStringWidth("AtariVox/SaveKey");
new StaticTextWidget(myTab, font, _w - 14 - (fwidth + lwidth) / 2, ypos,
new StaticTextWidget(myTab, font, _w - HBORDER - 4 - (fwidth + lwidth) / 2, ypos,
"AtariVox/SaveKey");
// Show joystick database
ypos += lineHeight;
myJoyDlgButton = new ButtonWidget(myTab, font, hSpace, ypos, 20,
myJoyDlgButton = new ButtonWidget(myTab, font, HBORDER, ypos, 20,
"Joystick database" + ELLIPSIS, kDBButtonPressed);
wid.push_back(myJoyDlgButton);
// Add EEPROM erase (part 1/2)
myEraseEEPROMButton = new ButtonWidget(myTab, font, _w - 14 - fwidth, ypos,
myEraseEEPROMButton = new ButtonWidget(myTab, font, _w - HBORDER - 4 - fwidth, ypos,
fwidth, lineHeight+4,
"Erase EEPROM", kEEButtonPressed);
// Add AtariVox serial port
ypos += lineHeight + vGap*2;
ypos += lineHeight + VGAP*2;
lwidth = font.getStringWidth("AVox serial port ");
fwidth = _w - 14 - hSpace - lwidth;
new StaticTextWidget(myTab, font, hSpace, ypos, "AVox serial port ");
myAVoxPort = new EditTextWidget(myTab, font, hSpace + lwidth, ypos,
fwidth, fontHeight, "");
fwidth = _w - HBORDER * 2 - 4 - lwidth;
new StaticTextWidget(myTab, font, HBORDER, ypos + 2, "AVox serial port ");
myAVoxPort = new EditTextWidget(myTab, font, HBORDER + lwidth, ypos,
fwidth, fontHeight);
wid.push_back(myAVoxPort);

View File

@ -43,7 +43,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
fontHeight = font.getFontHeight(),
buttonWidth = font.getStringWidth("Defaults") + 20,
buttonHeight = font.getLineHeight() + 4;
const int VBORDER = 5;
const int VBORDER = 8;
const int HBORDER = 10;
int xpos, ypos, tabID;
int lwidth, pwidth = font.getStringWidth("Standard");
@ -54,11 +54,11 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
// Set real dimensions
_w = 37 * fontWidth + 10;
_h = 11 * (lineHeight + 4) + 10;
_h = 10 * (lineHeight + 4) + 10;
// The tab widget
xpos = ypos = VBORDER;
myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - buttonHeight - 20);
xpos = HBORDER; ypos = VBORDER;
myTab = new TabWidget(this, font, 2, 4, _w - 2*2, _h - buttonHeight - 20);
addTabWidget(myTab);
//////////////////////////////////////////////////////////
@ -128,7 +128,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
ypos += lineHeight + 4;
// Add message concerning usage
xpos = VBORDER; ypos += 1*(lineHeight + 4);
xpos = HBORDER; ypos += 1*(lineHeight + 4);
lwidth = ifont.getStringWidth("(*) Changes require application restart");
new StaticTextWidget(myTab, ifont, xpos, ypos, std::min(lwidth, _w-20), fontHeight,
"(*) Changes require application restart",
@ -143,7 +143,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
tabID = myTab->addTab(" Misc. ");
lwidth = font.getStringWidth("Interface Palette (*) ");
pwidth = font.getStringWidth("Standard");
xpos = ypos = VBORDER;
xpos = HBORDER; ypos = VBORDER;
// UI Palette
ypos += 1;
@ -190,7 +190,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
ypos += lineHeight + 4;
// Add message concerning usage
xpos = VBORDER; ypos += 1*(lineHeight + 4);
xpos = HBORDER; ypos += 1*(lineHeight + 4);
lwidth = ifont.getStringWidth("(*) Requires application restart");
new StaticTextWidget(myTab, ifont, xpos, ypos, std::min(lwidth, _w-20), fontHeight,
"(*) Requires application restart",