improvement for hardcoded keys in Inputdialog

This commit is contained in:
thrust26 2019-02-18 20:20:14 +01:00
parent 8f800d97b9
commit 2d0221ae1f
2 changed files with 29 additions and 6 deletions

View File

@ -712,16 +712,31 @@ void EventHandler::setActionMappings(EventMode mode)
// There are some keys which are hardcoded. These should be represented too.
string prepend = "";
if(event == Event::Quit)
string modifier;
#ifndef BSPF_MACOS
prepend = "Ctrl Q";
modifier = "Ctrl";
#else
prepend = "Cmd Q";
modfier = "Cmd";
#endif
if(event == Event::Quit)
prepend = modifier + " + Q (*)";
else if(event == Event::VolumeDecrease)
prepend = "Alt + '[' (*)";
else if(event == Event::VolumeIncrease)
prepend = "Alt + ']' (*)";
else if(event == Event::SoundToggle)
prepend = modifier + " + ']' (*)";
else if(event == Event::Fry)
prepend = "Backspace (*)";
else if(event == Event::OptionsMenuMode)
prepend = "Tab (*)";
else if(event == Event::UINavNext)
prepend = "TAB";
prepend = "Tab (*)";
else if(event == Event::UINavPrev)
prepend = "Shift-TAB";
prepend = "Shift + Tab (*)";
else if(event == Event::UIPrevDir)
prepend = "Backspace (*)";
// else if ...
if(key == "")

View File

@ -19,6 +19,9 @@
#include "bspf.hxx"
#include "OSystem.hxx"
#include "GuiObject.hxx"
#include "FrameBuffer.hxx"
#include "EventHandler.hxx"
#include "Event.hxx"
#include "OSystem.hxx"
@ -46,6 +49,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
myLastValue(0),
myFirstTime(true)
{
const GUI::Font& ifont = boss->instance().frameBuffer().infoFont();
const int fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(),
buttonWidth = font.getStringWidth("Defaults") + 10,
@ -55,7 +59,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
int xpos = HBORDER, ypos = VBORDER;
myActionsList = new StringListWidget(boss, font, xpos, ypos,
_w - buttonWidth - HBORDER * 2 - 8, _h - 3*lineHeight - VBORDER);
_w - buttonWidth - HBORDER * 2 - 8, _h - 4*lineHeight - VBORDER);
myActionsList->setTarget(this);
myActionsList->setEditable(false);
myActionsList->setList(actions);
@ -116,6 +120,10 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
_w - xpos - t->getWidth() - 8 - HBORDER, lineHeight, "");
myKeyMapping->setEditable(false, true);
myKeyMapping->clearFlags(WIDGET_RETAIN_FOCUS);
// Add information for hardcoded keys
ypos += lineHeight + 8;
new StaticTextWidget(boss, ifont, xpos, ypos, "(*) Hardcoded action, cannot be erased");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -