1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-03 09:09:47 +02:00

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.
This commit is contained in:
Paul Licameli 2016-04-18 20:28:33 -04:00
parent 33f2ff0237
commit 0514ed432a
4 changed files with 22 additions and 6 deletions

View File

@ -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)
{

View File

@ -17,6 +17,7 @@ Paul Licameli split from TrackPanel.cpp
#include "../../TrackPanelCell.h"
#include "../../TrackPanelCellIterator.h"
#include "../../widgets/Ruler.h"
#include "Scrubbing.h"
#include <wx/dc.h>
@ -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();

View File

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

View File

@ -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();