diff --git a/src/gui/widgets/EffectChooser.cpp b/src/gui/widgets/EffectChooser.cpp index 5f4de79cd02..326a10f0cba 100644 --- a/src/gui/widgets/EffectChooser.cpp +++ b/src/gui/widgets/EffectChooser.cpp @@ -193,6 +193,11 @@ juce::Rectangle EffectChooser::getEffectRectangle(int i) void EffectChooser::mouseDown(const juce::MouseEvent &event) { + if (forwardedMainFrameMouseDowns(event)) + { + return; + } + hasDragged = false; currentClicked = -1; diff --git a/src/gui/widgets/LFOAndStepDisplay.cpp b/src/gui/widgets/LFOAndStepDisplay.cpp index f69375df134..f2db4a27eec 100644 --- a/src/gui/widgets/LFOAndStepDisplay.cpp +++ b/src/gui/widgets/LFOAndStepDisplay.cpp @@ -1223,6 +1223,11 @@ void LFOAndStepDisplay::onSkinChanged() void LFOAndStepDisplay::mouseDown(const juce::MouseEvent &event) { + if (forwardedMainFrameMouseDowns(event)) + { + return; + } + auto sge = firstListenerOfType(); for (int i = 0; i < n_lfo_types; ++i) diff --git a/src/gui/widgets/MenuForDiscreteParams.cpp b/src/gui/widgets/MenuForDiscreteParams.cpp index 052842baaa0..b1b9ea25ea4 100644 --- a/src/gui/widgets/MenuForDiscreteParams.cpp +++ b/src/gui/widgets/MenuForDiscreteParams.cpp @@ -144,6 +144,11 @@ void MenuForDiscreteParams::paint(juce::Graphics &g) void MenuForDiscreteParams::mouseDown(const juce::MouseEvent &event) { + if (forwardedMainFrameMouseDowns(event)) + { + return; + } + if (glyphMode && glyphPosition.contains(event.position)) { mouseDownOrigin = event.position.toInt(); diff --git a/src/gui/widgets/ModulatableSlider.cpp b/src/gui/widgets/ModulatableSlider.cpp index 56703ed7db3..a432882a541 100644 --- a/src/gui/widgets/ModulatableSlider.cpp +++ b/src/gui/widgets/ModulatableSlider.cpp @@ -367,6 +367,11 @@ void ModulatableSlider::mouseDrag(const juce::MouseEvent &event) void ModulatableSlider::mouseDown(const juce::MouseEvent &event) { + if (forwardedMainFrameMouseDowns(event)) + { + return; + } + if (event.mods.isPopupMenu()) { editTypeWas = NOEDIT; diff --git a/src/gui/widgets/MultiSwitch.cpp b/src/gui/widgets/MultiSwitch.cpp index 5e7192230db..72bc933a997 100644 --- a/src/gui/widgets/MultiSwitch.cpp +++ b/src/gui/widgets/MultiSwitch.cpp @@ -77,6 +77,11 @@ float MultiSwitch::coordinateToValue(int x, int y) void MultiSwitch::mouseDown(const juce::MouseEvent &event) { + if (forwardedMainFrameMouseDowns(event)) + { + return; + } + if (event.mods.isPopupMenu()) { notifyControlModifierClicked(event.mods); diff --git a/src/gui/widgets/NumberField.cpp b/src/gui/widgets/NumberField.cpp index 7799fb262b6..33fc1c693c0 100644 --- a/src/gui/widgets/NumberField.cpp +++ b/src/gui/widgets/NumberField.cpp @@ -110,18 +110,27 @@ void NumberField::setControlMode(Surge::Skin::Parameters::NumberfieldControlMode } void NumberField::mouseDown(const juce::MouseEvent &event) { + if (forwardedMainFrameMouseDowns(event)) + { + return; + } + mouseMode = NONE; + if (event.mods.isPopupMenu()) { notifyControlModifierClicked(event.mods); return; } + mouseMode = DRAG; + if (!Surge::GUI::showCursor(storage)) { juce::Desktop::getInstance().getMainMouseSource().enableUnboundedMouseMovement(true); mouseDownOrigin = event.position; } + lastDistanceChecked = 0; } diff --git a/src/gui/widgets/OscillatorWaveformDisplay.cpp b/src/gui/widgets/OscillatorWaveformDisplay.cpp index f335bd9d5a8..0e8b4e18063 100644 --- a/src/gui/widgets/OscillatorWaveformDisplay.cpp +++ b/src/gui/widgets/OscillatorWaveformDisplay.cpp @@ -467,6 +467,16 @@ void OscillatorWaveformDisplay::showWavetableMenu() menu.showMenuAsync(juce::PopupMenu::Options()); } } + +void OscillatorWaveformDisplay::mouseDown(const juce::MouseEvent &event) +{ + if (event.mods.isMiddleButtonDown() && sge) + { + sge->frame->mouseDown(event); + return; + } +} + void OscillatorWaveformDisplay::mouseUp(const juce::MouseEvent &event) { bool usesWT = uses_wavetabledata(oscdata->type.val.i); @@ -506,6 +516,7 @@ void OscillatorWaveformDisplay::mouseUp(const juce::MouseEvent &event) } } } + void OscillatorWaveformDisplay::mouseMove(const juce::MouseEvent &event) { if (supportsCustomEditor()) @@ -891,6 +902,7 @@ void OscillatorWaveformDisplay::drawEditorBox(juce::Graphics &g, const std::stri g.setFont(Surge::GUI::getFontManager()->getLatoAtSize(9)); g.drawText(s, customEditorBox, juce::Justification::centred); } + void OscillatorWaveformDisplay::mouseExit(const juce::MouseEvent &event) { isCustomEditorHovered = false; diff --git a/src/gui/widgets/OscillatorWaveformDisplay.h b/src/gui/widgets/OscillatorWaveformDisplay.h index a25de3f3c14..6cf4e566430 100644 --- a/src/gui/widgets/OscillatorWaveformDisplay.h +++ b/src/gui/widgets/OscillatorWaveformDisplay.h @@ -19,6 +19,7 @@ #include "SkinSupport.h" #include "Parameter.h" #include "SurgeStorage.h" +#include "WidgetBaseMixin.h" #include "juce_gui_basics/juce_gui_basics.h" #include "Oscillator.h" @@ -67,6 +68,7 @@ struct OscillatorWaveformDisplay : public juce::Component, public Surge::GUI::Sk pdata tp[n_scene_params]; juce::Rectangle leftJog, rightJog, waveTableName; + void mouseDown(const juce::MouseEvent &event) override; void mouseUp(const juce::MouseEvent &event) override; void mouseMove(const juce::MouseEvent &event) override; void mouseExit(const juce::MouseEvent &event) override; diff --git a/src/gui/widgets/Switch.cpp b/src/gui/widgets/Switch.cpp index f7683c22d5a..42ffacab088 100644 --- a/src/gui/widgets/Switch.cpp +++ b/src/gui/widgets/Switch.cpp @@ -13,6 +13,7 @@ ** open source in September 2018. */ +#include "SurgeGUIEditor.h" #include "Switch.h" #include "SurgeImage.h" @@ -53,6 +54,11 @@ void Switch::paint(juce::Graphics &g) void Switch::mouseDown(const juce::MouseEvent &event) { + if (forwardedMainFrameMouseDowns(event)) + { + return; + } + if (event.mods.isPopupMenu()) { notifyControlModifierClicked(event.mods); diff --git a/src/gui/widgets/VerticalLabel.cpp b/src/gui/widgets/VerticalLabel.cpp index 49443ea25d3..ab304eae403 100644 --- a/src/gui/widgets/VerticalLabel.cpp +++ b/src/gui/widgets/VerticalLabel.cpp @@ -26,6 +26,7 @@ VerticalLabel::VerticalLabel() #if SURGE_JUCE_ACCESSIBLE setAccessible(false); // it's just derocative #endif + setInterceptsMouseClicks(false, false); } VerticalLabel::~VerticalLabel() = default; diff --git a/src/gui/widgets/VuMeter.cpp b/src/gui/widgets/VuMeter.cpp index 68b04788af0..dd789e3278b 100644 --- a/src/gui/widgets/VuMeter.cpp +++ b/src/gui/widgets/VuMeter.cpp @@ -27,6 +27,7 @@ VuMeter::VuMeter() #if SURGE_JUCE_ACCESSIBLE setAccessible(false); #endif + setInterceptsMouseClicks(false, false); } VuMeter::~VuMeter() = default; diff --git a/src/gui/widgets/WaveShaperSelector.cpp b/src/gui/widgets/WaveShaperSelector.cpp index a8c49a79fcc..705afdeb377 100644 --- a/src/gui/widgets/WaveShaperSelector.cpp +++ b/src/gui/widgets/WaveShaperSelector.cpp @@ -425,6 +425,11 @@ void WaveShaperSelector::setValue(float f) void WaveShaperSelector::mouseDown(const juce::MouseEvent &event) { + if (forwardedMainFrameMouseDowns(event)) + { + return; + } + lastDragDistance = 0; everDragged = false; diff --git a/src/gui/widgets/WidgetBaseMixin.h b/src/gui/widgets/WidgetBaseMixin.h index 923e9153ac1..bfc748e251c 100644 --- a/src/gui/widgets/WidgetBaseMixin.h +++ b/src/gui/widgets/WidgetBaseMixin.h @@ -22,6 +22,7 @@ #include "juce_gui_basics/juce_gui_basics.h" #include +#include "MainFrame.h" class SurgeGUIEditor; @@ -124,6 +125,18 @@ struct WidgetBaseMixin : public Surge::GUI::SkinConsumingComponent, } return nullptr; } + + bool forwardedMainFrameMouseDowns(const juce::MouseEvent &e) + { + if (e.mods.isMiddleButtonDown()) + { + auto sge = firstListenerOfType(); + if (sge && sge->frame) + sge->frame->mouseDown(e); + return true; + } + return false; + } }; } // namespace Widgets } // namespace Surge