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

View File

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