1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-26 00:58:37 +02:00

Bug1052: Appearance should change immediately after ctrl-(double-)click...

This commit is contained in:
Paul Licameli 2016-04-18 20:30:24 -04:00
commit 724a5d0a3a
4 changed files with 22 additions and 6 deletions

View File

@ -1151,7 +1151,7 @@ void TrackPanel::HandleEscapeKey(bool down)
return; return;
auto &scrubber = GetProject()->GetScrubber(); auto &scrubber = GetProject()->GetScrubber();
if(scrubber.IsScrubbing()) if(scrubber.HasStartedScrubbing())
scrubber.StopScrubbing(); scrubber.StopScrubbing();
else switch (mMouseCapture) else switch (mMouseCapture)
{ {

View File

@ -17,6 +17,7 @@ Paul Licameli split from TrackPanel.cpp
#include "../../TrackPanelCell.h" #include "../../TrackPanelCell.h"
#include "../../TrackPanelCellIterator.h" #include "../../TrackPanelCellIterator.h"
#include "../../widgets/Ruler.h" #include "../../widgets/Ruler.h"
#include "Scrubbing.h"
#include <wx/dc.h> #include <wx/dc.h>
@ -113,8 +114,13 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
// Let other listeners get the notification // Let other listeners get the notification
event.Skip(); event.Skip();
if (!mProject->IsAudioActive()) if (!mProject->IsAudioActive()) {
const auto &scrubber = mProject->GetScrubber();
if (scrubber.HasStartedScrubbing())
mNewIndicatorX = scrubber.GetScrubStartPosition();
else
mNewIndicatorX = -1; mNewIndicatorX = -1;
}
else { else {
ViewInfo &viewInfo = mProject->GetViewInfo(); ViewInfo &viewInfo = mProject->GetViewInfo();

View File

@ -302,8 +302,11 @@ void Scrubber::ContinueScrubbing()
#endif #endif
} }
bool Scrubber::StopScrubbing() void Scrubber::StopScrubbing()
{ {
mScrubStartPosition = -1;
mSmoothScrollingScrub = false;
if (IsScrubbing()) if (IsScrubbing())
{ {
if (gAudioIO->IsBusy()) { if (gAudioIO->IsBusy()) {

View File

@ -35,10 +35,17 @@ public:
// Returns true iff the event should be considered consumed by this: // Returns true iff the event should be considered consumed by this:
bool MaybeStartScrubbing(const wxMouseEvent &event); bool MaybeStartScrubbing(const wxMouseEvent &event);
void ContinueScrubbing(); 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 IsScrubbing() const;
bool IsScrollScrubbing() const // If true, implies IsScrubbing() bool IsScrollScrubbing() const // If true, implies HasStartedScrubbing()
{ return mSmoothScrollingScrub; } { return mSmoothScrollingScrub; }
bool ShouldDrawScrubSpeed(); bool ShouldDrawScrubSpeed();