minimal refinements to JoystickDialog

This commit is contained in:
thrust26 2018-01-27 11:51:41 +01:00
parent 9c9abc125d
commit 79cce110f9
2 changed files with 9 additions and 8 deletions

View File

@ -224,7 +224,7 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
// Show joystick database
ypos += lineHeight;
myJoyDlgButton = new ButtonWidget(myTab, font, HBORDER, ypos, 20,
"Joystick database" + ELLIPSIS, kDBButtonPressed);
"Joystick Database" + ELLIPSIS, kDBButtonPressed);
wid.push_back(myJoyDlgButton);
// Add EEPROM erase (part 1/2)
@ -513,8 +513,11 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
case kDBButtonPressed:
if(!myJoyDialog)
{
const GUI::Font& font = instance().frameBuffer().font();
myJoyDialog = make_unique<JoystickDialog>
(this, instance().frameBuffer().font(), _w-60, _h-60);
(this, font, font.getMaxCharWidth() * 56 + 20, font.getFontHeight() * 18 + 20);
}
myJoyDialog->show();
break;

View File

@ -32,7 +32,7 @@ JoystickDialog::JoystickDialog(GuiObject* boss, const GUI::Font& font,
int xpos, ypos;
WidgetArray wid;
int buttonWidth = font.getStringWidth("Close") + 20,
int buttonWidth = font.getStringWidth("Remove ") + 20,
buttonHeight = font.getLineHeight() + 4;
// Joystick list
@ -45,11 +45,9 @@ JoystickDialog::JoystickDialog(GuiObject* boss, const GUI::Font& font,
// Joystick ID
ypos = _h - buttonHeight - 10;
StaticTextWidget* t = new StaticTextWidget(this, font, xpos, ypos,
font.getStringWidth("Joystick ID "), font.getFontHeight(),
"Joystick ID ", TextAlign::Left);
StaticTextWidget* t = new StaticTextWidget(this, font, xpos, ypos+2, "Joystick ID ");
xpos += t->getWidth() + 4;
myJoyText = new EditTextWidget(this, font, xpos, ypos-2,
myJoyText = new EditTextWidget(this, font, xpos, ypos,
font.getStringWidth("Unplugged")+8, font.getLineHeight(), "");
myJoyText->setEditable(false);
@ -60,7 +58,7 @@ JoystickDialog::JoystickDialog(GuiObject* boss, const GUI::Font& font,
addOKWidget(myCloseBtn); addCancelWidget(myCloseBtn);
buttonWidth = font.getStringWidth("Remove") + 20;
xpos -= buttonWidth + 5;
xpos -= buttonWidth + 8;
myRemoveBtn = new ButtonWidget(this, font, xpos, ypos,
buttonWidth, buttonHeight, "Remove", kRemoveCmd);
myRemoveBtn->clearFlags(WIDGET_ENABLED);