define tab cycling events and make tab cycling configurable

This commit is contained in:
thrust26 2019-05-04 11:37:43 +02:00
parent e015025d90
commit a38f56fe91
4 changed files with 28 additions and 12 deletions

View File

@ -78,6 +78,7 @@ class Event
UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown, UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown,
UISelect, UINavPrev, UINavNext, UIOK, UICancel, UIPrevDir, UISelect, UINavPrev, UINavNext, UIOK, UICancel, UIPrevDir,
UITabPrev, UITabNext,
LastType LastType
}; };

View File

@ -762,6 +762,10 @@ void EventHandler::setActionMappings(EventMode mode)
prepend = "Tab (*)"; prepend = "Tab (*)";
else if(event == Event::UINavPrev) else if(event == Event::UINavPrev)
prepend = "Shift + Tab (*)"; prepend = "Shift + Tab (*)";
else if (event == Event::UITabNext)
prepend = modifier + " + Tab (*)";
else if (event == Event::UITabPrev)
prepend = modifier + " + Shift + Tab (*)";
else if(event == Event::UIPrevDir) else if(event == Event::UIPrevDir)
prepend = "Backspace (*)"; prepend = "Backspace (*)";
// else if ... // else if ...
@ -1425,6 +1429,8 @@ EventHandler::ActionList EventHandler::ourMenuActionList[MENU_ACTIONLIST_SIZE] =
{ Event::UINavPrev, "Previous object", "", false }, { Event::UINavPrev, "Previous object", "", false },
{ Event::UINavNext, "Next object", "", false }, { Event::UINavNext, "Next object", "", false },
{ Event::UITabPrev, "Previous tab", "", false },
{ Event::UITabNext, "Next tab", "", false },
{ Event::UIPrevDir, "Parent directory", "", false } { Event::UIPrevDir, "Parent directory", "", false }
}; };

View File

@ -364,7 +364,7 @@ class EventHandler
COMBO_SIZE = 16, COMBO_SIZE = 16,
EVENTS_PER_COMBO = 8, EVENTS_PER_COMBO = 8,
EMUL_ACTIONLIST_SIZE = 83 + COMBO_SIZE, EMUL_ACTIONLIST_SIZE = 83 + COMBO_SIZE,
MENU_ACTIONLIST_SIZE = 14 MENU_ACTIONLIST_SIZE = 16
; ;
/** /**

View File

@ -442,10 +442,10 @@ void Dialog::handleKeyDown(StellaKey key, StellaMod mod)
if(StellaModTest::isControl(mod)) if(StellaModTest::isControl(mod))
{ {
// tab header navigation // tab header navigation
if(StellaModTest::isShift(mod) && cycleTab(-1)) if(StellaModTest::isShift(mod))
return; e = Event::UITabPrev;
else if(!StellaModTest::isShift(mod) && cycleTab(+1)) else
return; e = Event::UITabNext;
} }
else else
{ {
@ -456,16 +456,15 @@ void Dialog::handleKeyDown(StellaKey key, StellaMod mod)
e = Event::UINavNext; 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)
// #if 1 #if 1
// special keys used for R77 // special keys used for R77
if (key == KBDK_F13 && cycleTab(-1)) else if (key == KBDK_F13)
return; e = Event::UITabPrev;
if (key == KBDK_BACKSPACE && cycleTab(1)) else if (key == KBDK_BACKSPACE)
return; e = Event::UITabNext;
#endif #endif
// Check the keytable now, since we might get one of the above events, // Check the keytable now, since we might get one of the above events,
@ -669,6 +668,16 @@ bool Dialog::handleNavEvent(Event::Type e)
{ {
switch(e) switch(e)
{ {
case Event::UITabPrev:
if (cycleTab(-1))
return true;
break;
case Event::UITabNext:
if (cycleTab(1))
return true;
break;
case Event::UINavPrev: case Event::UINavPrev:
if(_focusedWidget && !_focusedWidget->wantsTab()) if(_focusedWidget && !_focusedWidget->wantsTab())
{ {