Skip to content

Commit

Permalink
Merge pull request surge-synthesizer#501 from baconpaul/keyboard-496
Browse files Browse the repository at this point in the history
Keycodes restored

Former-commit-id: a70aaff320b216b0e803cdbb9fdb92a2b3a5bec1 [formerly 589bd29]
Former-commit-id: 407bdef1514027ccc68621c78ec9bfa21364ad9b
Former-commit-id: a64169503b925322ed3b208a839c969728148d1a
  • Loading branch information
baconpaul authored Feb 4, 2019
2 parents 3bea96c + 3710db4 commit 41a7ad5
Showing 1 changed file with 38 additions and 36 deletions.
74 changes: 38 additions & 36 deletions src/common/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,44 +419,44 @@ void SurgeGUIEditor::refresh_mod()

int32_t SurgeGUIEditor::onKeyDown(const VstKeyCode& code, CFrame* frame)
{
switch (code.character)
{
case VKEY_ALT:
// modsource = modsource_editor;
// queue_refresh = true;
mod_editor = true;
refresh_mod();
return 1;
case VKEY_TAB:
toggle_mod_editing();
return 1;
case VKEY_LEFT:
synth->incrementCategory(false);
return 1;
case VKEY_RIGHT:
synth->incrementCategory(true);
return 1;
case VKEY_UP:
synth->incrementPatch(false);
return 1;
case VKEY_DOWN:
synth->incrementPatch(true);
return 1;
}
return -1;
if(code.virt != 0 )
{
switch (code.virt)
{
case VKEY_TAB:
toggle_mod_editing();
return 1;
case VKEY_LEFT:
synth->incrementCategory(false);
return 1;
case VKEY_RIGHT:
synth->incrementCategory(true);
return 1;
case VKEY_UP:
synth->incrementPatch(false);
return 1;
case VKEY_DOWN:
synth->incrementPatch(true);
return 1;
}
}
else
{
switch(code.character)
{
case '+':
setZoomFactor(getZoomFactor()+10);
return 1;
case '-':
setZoomFactor(getZoomFactor()-10);
return 1;
}
}
return -1;
}

int32_t SurgeGUIEditor::onKeyUp(const VstKeyCode& keyCode, CFrame* frame)
{
switch (keyCode.character)
{
case VKEY_ALT:
// modsource = 0;
// queue_refresh = true;
mod_editor = false;
refresh_mod();
return 1;
}
return -1;
}

Expand Down Expand Up @@ -499,8 +499,6 @@ void SurgeGUIEditor::openOrRecreateEditor()
return;
assert(frame);

getFrame()->registerKeyboardHook(this);

if (editor_open)
close_editor();

Expand Down Expand Up @@ -1255,6 +1253,10 @@ bool PLUGIN_API SurgeGUIEditor::open(void* parent, const PlatformType& platformT
synth = (sub3_synth*)plug->plugin_instance;
#endif*/

/*
** Register only once (when we open)
*/
frame->registerKeyboardHook(this);
openOrRecreateEditor();

return true;
Expand Down

0 comments on commit 41a7ad5

Please sign in to comment.