From 79cce110f983f6a640a5502e524fa83909139195 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Sat, 27 Jan 2018 11:51:41 +0100 Subject: [PATCH] minimal refinements to JoystickDialog --- src/gui/InputDialog.cxx | 7 +++++-- src/gui/JoystickDialog.cxx | 10 ++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx index ec0d4d3c7..ec341ab3b 100644 --- a/src/gui/InputDialog.cxx +++ b/src/gui/InputDialog.cxx @@ -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 - (this, instance().frameBuffer().font(), _w-60, _h-60); + (this, font, font.getMaxCharWidth() * 56 + 20, font.getFontHeight() * 18 + 20); + } myJoyDialog->show(); break; diff --git a/src/gui/JoystickDialog.cxx b/src/gui/JoystickDialog.cxx index c503b7753..791f80597 100644 --- a/src/gui/JoystickDialog.cxx +++ b/src/gui/JoystickDialog.cxx @@ -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);