gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit a828af73b4592cafc974a3f3dc52f3848ff43d11
parent 2b753d0f9f6182a4d81fef10bad957cd3ffdd016
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Thu, 30 May 2024 13:20:28 +0200

preparations to open context menu for a specific parameter

Diffstat:
Msource/jucePluginEditorLib/pluginEditor.cpp | 13+++++++++++--
Msource/jucePluginEditorLib/pluginEditor.h | 6++++--
Msource/jucePluginEditorLib/pluginEditorState.cpp | 12+++++++++---
Msource/jucePluginEditorLib/pluginEditorState.h | 2+-
Msource/jucePluginEditorLib/pluginEditorWindow.cpp | 2+-
Msource/virusJucePlugin/VirusEditor.cpp | 2+-
6 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/source/jucePluginEditorLib/pluginEditor.cpp b/source/jucePluginEditorLib/pluginEditor.cpp @@ -257,9 +257,18 @@ namespace jucePluginEditorLib return m_patchManager->activatePatchFromClipboard(); } - void Editor::openMenu() + void Editor::openMenu(juce::MouseEvent* _event) { - onOpenMenu(this); + onOpenMenu(this, _event); + } + + bool Editor::openContextMenuForParameter(const juce::MouseEvent* _event) + { + if(!_event || !_event->originalComponent) + return false; + + // TODO + return false; } bool Editor::keyPressed(const juce::KeyPress& _key) diff --git a/source/jucePluginEditorLib/pluginEditor.h b/source/jucePluginEditorLib/pluginEditor.h @@ -25,7 +25,7 @@ namespace jucePluginEditorLib class Editor : public genericUI::Editor, genericUI::EditorInterface { public: - pluginLib::Event<Editor*> onOpenMenu; + pluginLib::Event<Editor*, juce::MouseEvent*> onOpenMenu; Editor(Processor& _processor, pluginLib::ParameterBinding& _binding, std::string _skinFolder); ~Editor() override; @@ -69,7 +69,9 @@ namespace jucePluginEditorLib void copyCurrentPatchToClipboard() const; bool replaceCurrentPatchFromClipboard() const; - virtual void openMenu(); + virtual void openMenu(juce::MouseEvent* _event); + virtual bool openContextMenuForParameter(const juce::MouseEvent* _event); + private: bool keyPressed(const juce::KeyPress& _key) override; diff --git a/source/jucePluginEditorLib/pluginEditorState.cpp b/source/jucePluginEditorLib/pluginEditorState.cpp @@ -106,9 +106,9 @@ void PluginEditorState::loadSkin(const Skin& _skin) auto* editor = createEditor(_skin); m_editor.reset(editor); - getEditor()->onOpenMenu.addListener([this](Editor*) + getEditor()->onOpenMenu.addListener([this](Editor*, const juce::MouseEvent* _e) { - openMenu(); + openMenu(_e); }); m_rootScale = editor->getScale(); @@ -145,8 +145,14 @@ Editor* PluginEditorState::getEditor() const return dynamic_cast<Editor*>(m_editor.get()); } -void PluginEditorState::openMenu() +void PluginEditorState::openMenu(const juce::MouseEvent* _event) { + if(_event && _event->mods.isPopupMenu() && getEditor()) + { + if(getEditor()->openContextMenuForParameter(_event)) + return; + } + const auto& config = m_processor.getConfig(); const auto scale = juce::roundToInt(config.getDoubleValue("scale", 100)); diff --git a/source/jucePluginEditorLib/pluginEditorState.h b/source/jucePluginEditorLib/pluginEditorState.h @@ -55,7 +55,7 @@ namespace jucePluginEditorLib const Skin& getCurrentSkin() { return m_currentSkin; } const std::vector<Skin>& getIncludedSkins(); - void openMenu(); + void openMenu(const juce::MouseEvent* _event); std::function<void(int)> evSetGuiScale; std::function<void(juce::Component*)> evSkinLoaded; diff --git a/source/jucePluginEditorLib/pluginEditorWindow.cpp b/source/jucePluginEditorLib/pluginEditorWindow.cpp @@ -138,7 +138,7 @@ void EditorWindow::mouseDown(const juce::MouseEvent& event) if(dynamic_cast<juce::Button*>(event.eventComponent)) return; - m_state.openMenu(); + m_state.openMenu(&event); } } \ No newline at end of file diff --git a/source/virusJucePlugin/VirusEditor.cpp b/source/virusJucePlugin/VirusEditor.cpp @@ -152,7 +152,7 @@ namespace genericVirusUI { menuButton->onClick = [this]() { - openMenu(); + openMenu(nullptr); }; }