diff --git a/Source/CommonPluginEditor.cpp b/Source/CommonPluginEditor.cpp index c2ccfb0..e85e431 100644 --- a/Source/CommonPluginEditor.cpp +++ b/Source/CommonPluginEditor.cpp @@ -113,7 +113,7 @@ CommonPluginEditor::~CommonPluginEditor() { bool CommonPluginEditor::keyPressed(const juce::KeyPress& key) { // If we're not accepting special keys, end early - if (audioProcessor.getGlobalBoolValue("acceptsAllKeys", juce::JUCEApplicationBase::isStandaloneApp()) == false) return false; + if (!audioProcessor.getAcceptsKeys()) return false; if (key.getModifiers().isCommandDown() && key.getModifiers().isShiftDown() && key.getKeyCode() == 'S') { saveProjectAs(); diff --git a/Source/CommonPluginProcessor.h b/Source/CommonPluginProcessor.h index 4cb9884..ee7c24e 100644 --- a/Source/CommonPluginProcessor.h +++ b/Source/CommonPluginProcessor.h @@ -153,9 +153,12 @@ public: #else "ffmpeg"; #endif - void setAcceptKeys(bool shouldAcceptKeys) { + void setAcceptsKeys(bool shouldAcceptKeys) { setGlobalValue("acceptsAllKeys", shouldAcceptKeys); } + bool getAcceptsKeys() { + return getGlobalBoolValue("acceptsAllKeys", juce::JUCEApplicationBase::isStandaloneApp()); + } protected: diff --git a/Source/components/OsciMainMenuBarModel.cpp b/Source/components/OsciMainMenuBarModel.cpp index d832de8..c81bf7f 100644 --- a/Source/components/OsciMainMenuBarModel.cpp +++ b/Source/components/OsciMainMenuBarModel.cpp @@ -61,8 +61,8 @@ void OsciMainMenuBarModel::resetMenuItems() { addMenuItem(1, "Randomize Blender Port", [this] { audioProcessor.setObjectServerPort(juce::Random::getSystemRandom().nextInt(juce::Range(51600, 51700))); }); - addMenuItem(1, audioProcessor.getGlobalBoolValue("acceptsAllKeys", juce::JUCEApplicationBase::isStandaloneApp()) ? "Disable Special Keys" : "Enable Special Keys", [this] { - audioProcessor.setAcceptKeys(!audioProcessor.getGlobalBoolValue("acceptsAllKeys", juce::JUCEApplicationBase::isStandaloneApp())); + addMenuItem(1, audioProcessor.getAcceptsKeys() ? "Disable Special Keys" : "Enable Special Keys", [this] { + audioProcessor.setAcceptsKeys(!audioProcessor.getAcceptsKeys()); resetMenuItems(); }); diff --git a/Source/visualiser/VisualiserComponent.cpp b/Source/visualiser/VisualiserComponent.cpp index 5f8c050..f84ceee 100644 --- a/Source/visualiser/VisualiserComponent.cpp +++ b/Source/visualiser/VisualiserComponent.cpp @@ -255,7 +255,7 @@ void VisualiserComponent::mouseDown(const juce::MouseEvent &event) { bool VisualiserComponent::keyPressed(const juce::KeyPress &key) { // If we're not accepting special keys, end early - if (audioProcessor.getGlobalBoolValue("acceptsAllKeys", juce::JUCEApplicationBase::isStandaloneApp()) == false) return false; + if (!audioProcessor.getAcceptsKeys()) return false; if (key.isKeyCode(juce::KeyPress::escapeKey)) { if (fullScreenCallback) {