From 8d94c2e273ae9f2b0a831b24c9f38c01249476fc Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Tue, 23 Nov 2021 20:12:54 -0500 Subject: [PATCH] A collection of beta fixes 1. Tune button blinks because it uses legacy state from toggle. Closes #5459 2. Allow drag outside of SS to reset values. Closes #5455 3. Use JUCE documetn buttons on overlay popout/close. Closes #5453 --- src/surge-xt/gui/overlays/OverlayWrapper.cpp | 10 +++++----- src/surge-xt/gui/overlays/OverlayWrapper.h | 2 +- src/surge-xt/gui/widgets/LFOAndStepDisplay.cpp | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/surge-xt/gui/overlays/OverlayWrapper.cpp b/src/surge-xt/gui/overlays/OverlayWrapper.cpp index ac60cfc4f00..d73ac78e9be 100644 --- a/src/surge-xt/gui/overlays/OverlayWrapper.cpp +++ b/src/surge-xt/gui/overlays/OverlayWrapper.cpp @@ -27,14 +27,14 @@ namespace Overlays { OverlayWrapper::OverlayWrapper() { - closeButton = std::make_unique("closeButton"); + closeButton.reset( + getLookAndFeel().createDocumentWindowButton(juce::DocumentWindow::closeButton)); closeButton->addListener(this); - closeButton->setButtonText("X"); addChildComponent(*closeButton); - tearOutButton = std::make_unique("tearOut"); + tearOutButton.reset( + getLookAndFeel().createDocumentWindowButton(juce::DocumentWindow::maximiseButton)); tearOutButton->addListener(this); - tearOutButton->setButtonText("^"); addChildComponent(*tearOutButton); } @@ -86,7 +86,7 @@ void OverlayWrapper::addAndTakeOwnership(std::unique_ptr c) primaryChild = std::move(c); primaryChild->setBounds(q); - auto buttonSize = titlebarSize - 2; + auto buttonSize = titlebarSize; auto closeButtonBounds = getLocalBounds().withHeight(buttonSize).withLeft(getWidth() - buttonSize).translated(-2, 2); auto tearOutButtonBounds = closeButtonBounds.translated(-buttonSize - 2, 0); diff --git a/src/surge-xt/gui/overlays/OverlayWrapper.h b/src/surge-xt/gui/overlays/OverlayWrapper.h index 546ce24733b..f794e16bd8f 100644 --- a/src/surge-xt/gui/overlays/OverlayWrapper.h +++ b/src/surge-xt/gui/overlays/OverlayWrapper.h @@ -53,7 +53,7 @@ struct OverlayWrapper : public juce::Component, std::unique_ptr primaryChild; void addAndTakeOwnership(std::unique_ptr c); - std::unique_ptr closeButton, tearOutButton; + std::unique_ptr closeButton, tearOutButton; void buttonClicked(juce::Button *button) override; juce::Point mouseDownWithinTarget; diff --git a/src/surge-xt/gui/widgets/LFOAndStepDisplay.cpp b/src/surge-xt/gui/widgets/LFOAndStepDisplay.cpp index 4e4de6072de..f3e95309d78 100644 --- a/src/surge-xt/gui/widgets/LFOAndStepDisplay.cpp +++ b/src/surge-xt/gui/widgets/LFOAndStepDisplay.cpp @@ -1206,7 +1206,9 @@ void LFOAndStepDisplay::setStepValue(const juce::MouseEvent &event) { auto r = steprect[i]; - if (r.contains(event.position)) + float rx0 = r.getX(); + float rx1 = r.getX() + r.getWidth(); + if (event.position.x >= rx0 && event.position.x < rx1) { draggedStep = i;