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,
UISelect, UINavPrev, UINavNext, UIOK, UICancel, UIPrevDir,
UITabPrev, UITabNext,
LastType
};

View File

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

View File

@ -364,7 +364,7 @@ class EventHandler
COMBO_SIZE = 16,
EVENTS_PER_COMBO = 8,
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))
{
// tab header navigation
if(StellaModTest::isShift(mod) && cycleTab(-1))
return;
else if(!StellaModTest::isShift(mod) && cycleTab(+1))
return;
if(StellaModTest::isShift(mod))
e = Event::UITabPrev;
else
e = Event::UITabNext;
}
else
{
@ -456,16 +456,15 @@ void Dialog::handleKeyDown(StellaKey key, StellaMod mod)
e = Event::UINavNext;
}
}
// FIXME - use the R77 define in the final release
// use the '1' define for testing
#if defined(RETRON77)
// #if 1
// #if defined(RETRON77)
#if 1
// special keys used for R77
if (key == KBDK_F13 && cycleTab(-1))
return;
if (key == KBDK_BACKSPACE && cycleTab(1))
return;
else if (key == KBDK_F13)
e = Event::UITabPrev;
else if (key == KBDK_BACKSPACE)
e = Event::UITabNext;
#endif
// 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)
{
case Event::UITabPrev:
if (cycleTab(-1))
return true;
break;
case Event::UITabNext:
if (cycleTab(1))
return true;
break;
case Event::UINavPrev:
if(_focusedWidget && !_focusedWidget->wantsTab())
{