Skip to content

Commit

Permalink
Tab Key Changes
Browse files Browse the repository at this point in the history
1. Tab key modulation arming is off by default with a workflow menu
2. Even when its on it doesn't screw up the patch store any more

Closes surge-synthesizer#4911
  • Loading branch information
baconpaul committed Aug 28, 2021
1 parent b3e867d commit ef7a716
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/common/UserDefaults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ void initMaps()
case LastWavetablePath:
r = "lastWavetablePath";
break;
case TabKeyArmsModulators:
r = "tabKeyArmsModulators";
break;
case nKeys:
break;
}
Expand Down
2 changes: 2 additions & 0 deletions src/common/UserDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ enum DefaultKey // streamed as strings so feel free to change the order to whate
LastWavetablePath,
LastPatchPath,

TabKeyArmsModulators,

nKeys
};
/**
Expand Down
21 changes: 17 additions & 4 deletions src/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1506,8 +1506,9 @@ bool SurgeGUIEditor::open(void *parent)
frame->setBounds(0, 0, currentSkin->getWindowSizeX(), currentSkin->getWindowSizeY());
frame->setSurgeGUIEditor(this);
frame->setWantsKeyboardFocus(true);
frame->addKeyListener(this);
juceEditor->addAndMakeVisible(*frame);
juceEditor->addKeyListener(this);

/*
* SET UP JUCE EDITOR BETTER
*/
Expand Down Expand Up @@ -2804,6 +2805,14 @@ juce::PopupMenu SurgeGUIEditor::makeWorkflowMenu(const juce::Point<int> &where)
wfMenu.addItem(Surge::GUI::toOSCaseForMenu("Show Virtual Keyboard"), true, showVirtualKeyboard,
[this]() { toggleVirtualKeyboard(); });

bool tabArm = Surge::Storage::getUserDefaultValue(&(this->synth->storage),
Surge::Storage::TabKeyArmsModulators, false);
wfMenu.addItem(Surge::GUI::toOSCaseForMenu("Tab Key Arms Modulators"), true, tabArm,
[this, tabArm]() {
Surge::Storage::updateUserDefaultValue(
&(this->synth->storage), Surge::Storage::TabKeyArmsModulators, !tabArm);
});

return wfMenu;
}

Expand Down Expand Up @@ -5032,14 +5041,18 @@ bool SurgeGUIEditor::keyPressed(const juce::KeyPress &key, juce::Component *orig
{
if (key.getTextCharacter() == juce::KeyPress::tabKey)
{
// store patch dialog gets access to the Tab key to switch between fields if it's open
if (topmostEditorTag() == STORE_PATCH)
auto tk = Surge::Storage::getUserDefaultValue(
&(this->synth->storage), Surge::Storage::DefaultKey::TabKeyArmsModulators, 0);
if (!tk)
{
return false;
}
if (isAnyOverlayOpenAtAll())
{
return false;
}

toggle_mod_editing();

return true;
}

Expand Down
1 change: 1 addition & 0 deletions src/gui/SurgeGUIEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ class SurgeGUIEditor : public Surge::GUI::IComponentTagValue::Listener,

return false;
}
bool isAnyOverlayOpenAtAll() { return !juceOverlays.empty(); }

std::string getDisplayForTag(long tag, bool external = false, float value = 0);
float getF01FromString(long tag, const std::string &s);
Expand Down

0 comments on commit ef7a716

Please sign in to comment.