From 0514ed432a1f611d4aa9db26af19b928aa3bf518 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Mon, 18 Apr 2016 20:28:33 -0400 Subject: [PATCH] Bug1052: Appearance should change immediately after ctrl-(double-)click... ... for scrubbing. Now the green play indicator appears, though the play button on the control toolbar does not go down until the mouse moves. --- src/TrackPanel.cpp | 2 +- src/tracks/ui/PlayIndicatorOverlay.cpp | 10 ++++++++-- src/tracks/ui/Scrubbing.cpp | 5 ++++- src/tracks/ui/Scrubbing.h | 11 +++++++++-- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index a572d7b70..df59c19d6 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -1151,7 +1151,7 @@ void TrackPanel::HandleEscapeKey(bool down) return; auto &scrubber = GetProject()->GetScrubber(); - if(scrubber.IsScrubbing()) + if(scrubber.HasStartedScrubbing()) scrubber.StopScrubbing(); else switch (mMouseCapture) { diff --git a/src/tracks/ui/PlayIndicatorOverlay.cpp b/src/tracks/ui/PlayIndicatorOverlay.cpp index 6b7e48b9a..dbc6d698e 100644 --- a/src/tracks/ui/PlayIndicatorOverlay.cpp +++ b/src/tracks/ui/PlayIndicatorOverlay.cpp @@ -17,6 +17,7 @@ Paul Licameli split from TrackPanel.cpp #include "../../TrackPanelCell.h" #include "../../TrackPanelCellIterator.h" #include "../../widgets/Ruler.h" +#include "Scrubbing.h" #include @@ -113,8 +114,13 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event) // Let other listeners get the notification event.Skip(); - if (!mProject->IsAudioActive()) - mNewIndicatorX = -1; + if (!mProject->IsAudioActive()) { + const auto &scrubber = mProject->GetScrubber(); + if (scrubber.HasStartedScrubbing()) + mNewIndicatorX = scrubber.GetScrubStartPosition(); + else + mNewIndicatorX = -1; + } else { ViewInfo &viewInfo = mProject->GetViewInfo(); diff --git a/src/tracks/ui/Scrubbing.cpp b/src/tracks/ui/Scrubbing.cpp index 8ca099c89..d661fe989 100644 --- a/src/tracks/ui/Scrubbing.cpp +++ b/src/tracks/ui/Scrubbing.cpp @@ -302,8 +302,11 @@ void Scrubber::ContinueScrubbing() #endif } -bool Scrubber::StopScrubbing() +void Scrubber::StopScrubbing() { + mScrubStartPosition = -1; + mSmoothScrollingScrub = false; + if (IsScrubbing()) { if (gAudioIO->IsBusy()) { diff --git a/src/tracks/ui/Scrubbing.h b/src/tracks/ui/Scrubbing.h index 3d5d016dc..52d6a6444 100644 --- a/src/tracks/ui/Scrubbing.h +++ b/src/tracks/ui/Scrubbing.h @@ -35,10 +35,17 @@ public: // Returns true iff the event should be considered consumed by this: bool MaybeStartScrubbing(const wxMouseEvent &event); void ContinueScrubbing(); - bool StopScrubbing(); + void StopScrubbing(); + wxCoord GetScrubStartPosition() const + { return mScrubStartPosition; } + + // True iff the user has clicked to start scrub and not yet stopped, + // but IsScrubbing() may yet be false + bool HasStartedScrubbing() const + { return GetScrubStartPosition() >= 0; } bool IsScrubbing() const; - bool IsScrollScrubbing() const // If true, implies IsScrubbing() + bool IsScrollScrubbing() const // If true, implies HasStartedScrubbing() { return mSmoothScrollingScrub; } bool ShouldDrawScrubSpeed();