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 // Erase all mappings of given mode
myKeyMap.eraseMode(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) if (eraseAll || k_event == event)
{ {
@ -173,6 +173,11 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
setDefaultKey(Event::UISelect , KBDK_RETURN); setDefaultKey(Event::UISelect , KBDK_RETURN);
setDefaultKey(Event::UICancel , KBDK_ESCAPE); 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); setDefaultKey(Event::UIPrevDir , KBDK_BACKSPACE);
// FIXME - use the R77 define in the final release // FIXME - use the R77 define in the final release
@ -199,9 +204,7 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalKeyboardHandler::eraseMapping(Event::Type event, EventMode mode) void PhysicalKeyboardHandler::eraseMapping(Event::Type event, EventMode mode)
{ {
// This key cannot be remapped myKeyMap.eraseEvent(event, mode);
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) StellaKey key, StellaMod mod)
{ {
// These keys cannot be remapped // These keys cannot be remapped
if((key == KBDK_TAB && mode == EventMode::kMenuMode) || Event::isAnalog(event)) if(Event::isAnalog(event))
return false; return false;
else else
myKeyMap.add(event, mode, key, mod); myKeyMap.add(event, mode, key, mod);

View File

@ -759,14 +759,6 @@ void EventHandler::setActionMappings(EventMode mode)
if(event == Event::Quit) if(event == Event::Quit)
prepend = modifier + "+Q (*)"; 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 ... // else if ...
if(key == "") if(key == "")

View File

@ -449,26 +449,6 @@ void Dialog::handleKeyDown(StellaKey key, StellaMod mod)
// Shift-Tab sets previous widget in current tab // Shift-Tab sets previous widget in current tab
Event::Type e = Event::NoType; 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 // FIXME - use the R77 define in the final release
// use the '1' define for testing // use the '1' define for testing
#if defined(RETRON77) #if defined(RETRON77)