uimenu: Add shortcut for changing OP (#84)

Allows to quickly change the current OP, when editing OP parameters.
pull/85/head^2
Rene Stange 3 years ago committed by GitHub
parent 0287f0dc76
commit 636a01f307
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 33
      src/uimenu.cpp
  2. 1
      src/uimenu.h

@ -94,6 +94,7 @@ const CUIMenu::TMenuItem CUIMenu::s_ReverbMenu[] =
#endif #endif
// inserting menu items before "OP1" affect OPShortcutHandler()
const CUIMenu::TMenuItem CUIMenu::s_EditVoiceMenu[] = const CUIMenu::TMenuItem CUIMenu::s_EditVoiceMenu[] =
{ {
{"OP1", MenuHandler, s_OperatorMenu, 0}, {"OP1", MenuHandler, s_OperatorMenu, 0},
@ -636,7 +637,7 @@ void CUIMenu::EditOPParameter (CUIMenu *pUIMenu, TMenuEvent Event)
case MenuEventPressAndStepDown: case MenuEventPressAndStepDown:
case MenuEventPressAndStepUp: case MenuEventPressAndStepUp:
pUIMenu->TGShortcutHandler (Event); pUIMenu->OPShortcutHandler (Event);
return; return;
default: default:
@ -892,6 +893,36 @@ void CUIMenu::TGShortcutHandler (TMenuEvent Event)
} }
} }
void CUIMenu::OPShortcutHandler (TMenuEvent Event)
{
assert (m_nCurrentMenuDepth >= 3);
assert (m_MenuStackMenu[m_nCurrentMenuDepth-2] = s_EditVoiceMenu);
unsigned nOP = m_nMenuStackSelection[m_nCurrentMenuDepth-2];
assert (nOP < 6);
assert (m_nMenuStackItem[m_nCurrentMenuDepth-1] == nOP);
assert (m_nMenuStackParameter[m_nCurrentMenuDepth-1] == nOP);
assert ( Event == MenuEventPressAndStepDown
|| Event == MenuEventPressAndStepUp);
if (Event == MenuEventPressAndStepDown)
{
nOP--;
}
else
{
nOP++;
}
if (nOP < 6)
{
m_nMenuStackSelection[m_nCurrentMenuDepth-2] = nOP;
m_nMenuStackItem[m_nCurrentMenuDepth-1] = nOP;
m_nMenuStackParameter[m_nCurrentMenuDepth-1] = nOP;
EventHandler (MenuEventUpdate);
}
}
void CUIMenu::TimerHandler (TKernelTimerHandle hTimer, void *pParam, void *pContext) void CUIMenu::TimerHandler (TKernelTimerHandle hTimer, void *pParam, void *pContext)
{ {
CUIMenu *pThis = static_cast<CUIMenu *> (pContext); CUIMenu *pThis = static_cast<CUIMenu *> (pContext);

@ -103,6 +103,7 @@ private:
static std::string ToOscillatorDetune (int nValue); static std::string ToOscillatorDetune (int nValue);
void TGShortcutHandler (TMenuEvent Event); void TGShortcutHandler (TMenuEvent Event);
void OPShortcutHandler (TMenuEvent Event);
static void TimerHandler (TKernelTimerHandle hTimer, void *pParam, void *pContext); static void TimerHandler (TKernelTimerHandle hTimer, void *pParam, void *pContext);

Loading…
Cancel
Save