Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uimenu: Add shortcut for changing OP #84

Merged
merged 1 commit into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion src/uimenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const CUIMenu::TMenuItem CUIMenu::s_ReverbMenu[] =

#endif

// inserting menu items before "OP1" affect OPShortcutHandler()
const CUIMenu::TMenuItem CUIMenu::s_EditVoiceMenu[] =
{
{"OP1", MenuHandler, s_OperatorMenu, 0},
Expand Down Expand Up @@ -636,7 +637,7 @@ void CUIMenu::EditOPParameter (CUIMenu *pUIMenu, TMenuEvent Event)

case MenuEventPressAndStepDown:
case MenuEventPressAndStepUp:
pUIMenu->TGShortcutHandler (Event);
pUIMenu->OPShortcutHandler (Event);
return;

default:
Expand Down Expand Up @@ -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)
{
CUIMenu *pThis = static_cast<CUIMenu *> (pContext);
Expand Down
1 change: 1 addition & 0 deletions src/uimenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class CUIMenu
static std::string ToOscillatorDetune (int nValue);

void TGShortcutHandler (TMenuEvent Event);
void OPShortcutHandler (TMenuEvent Event);

static void TimerHandler (TKernelTimerHandle hTimer, void *pParam, void *pContext);

Expand Down