allow tab keys to be remapped in menu mode too

This commit is contained in:
thrust26 2019-05-25 19:39:55 +02:00
parent b1b0f685d1
commit 5e36cb9fed
3 changed files with 8 additions and 33 deletions

View File

@ -66,7 +66,7 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
// Erase all mappings of given mode
myKeyMap.eraseMode(mode);
auto setDefaultKey = [&](Event::Type k_event, StellaKey key, StellaMod mod = StellaMod::KBDM_NONE)
auto setDefaultKey = [&](Event::Type k_event, StellaKey key, int mod = StellaMod::KBDM_NONE)
{
if (eraseAll || k_event == event)
{
@ -173,6 +173,11 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
setDefaultKey(Event::UISelect , KBDK_RETURN);
setDefaultKey(Event::UICancel , KBDK_ESCAPE);
setDefaultKey(Event::UINavPrev , KBDK_TAB, KBDM_SHIFT);
setDefaultKey(Event::UINavNext , KBDK_TAB);
setDefaultKey(Event::UITabPrev , KBDK_TAB, KBDM_SHIFT|KBDM_CTRL);
setDefaultKey(Event::UITabNext , KBDK_TAB, KBDM_CTRL);
setDefaultKey(Event::UIPrevDir , KBDK_BACKSPACE);
// FIXME - use the R77 define in the final release
@ -199,8 +204,6 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalKeyboardHandler::eraseMapping(Event::Type event, EventMode mode)
{
// This key cannot be remapped
if (event != Event::UINavNext || mode != EventMode::kMenuMode)
myKeyMap.eraseEvent(event, mode);
}
@ -222,7 +225,7 @@ bool PhysicalKeyboardHandler::addMapping(Event::Type event, EventMode mode,
StellaKey key, StellaMod mod)
{
// These keys cannot be remapped
if((key == KBDK_TAB && mode == EventMode::kMenuMode) || Event::isAnalog(event))
if(Event::isAnalog(event))
return false;
else
myKeyMap.add(event, mode, key, mod);

View File

@ -759,14 +759,6 @@ void EventHandler::setActionMappings(EventMode mode)
if(event == Event::Quit)
prepend = modifier + "+Q (*)";
else if(event == Event::UINavNext)
prepend = "Tab (*)";
else if(event == Event::UINavPrev)
prepend = "Shift+Tab (*)";
else if (event == Event::UITabNext)
prepend = modifier + "+Tab (*)";
else if (event == Event::UITabPrev)
prepend = modifier + "+Shift+Tab (*)";
// else if ...
if(key == "")

View File

@ -449,26 +449,6 @@ void Dialog::handleKeyDown(StellaKey key, StellaMod mod)
// Shift-Tab sets previous widget in current tab
Event::Type e = Event::NoType;
// Detect selection of previous and next tab headers and objects
if(key == KBDK_TAB)
{
if(StellaModTest::isControl(mod))
{
// tab header navigation
if(StellaModTest::isShift(mod))
e = Event::UITabPrev;
else
e = Event::UITabNext;
}
else
{
// object navigation
if(StellaModTest::isShift(mod))
e = Event::UINavPrev;
else
e = Event::UINavNext;
}
}
// FIXME - use the R77 define in the final release
// use the '1' define for testing
#if defined(RETRON77)