1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 16:40:07 +02:00

Merge: Bug924, addendum: pause scrubbing when Audacity loses focus...

This commit is contained in:
Paul Licameli 2015-05-27 20:17:57 -04:00
commit ca7c107fdc
2 changed files with 17 additions and 2 deletions

View File

@ -607,6 +607,7 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
mScrubStartPosition = -1; mScrubStartPosition = -1;
mMaxScrubSpeed = 1.0; mMaxScrubSpeed = 1.0;
mScrubSpeedDisplayCountdown = 0; mScrubSpeedDisplayCountdown = 0;
mScrubHasFocus = false;
#endif #endif
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL #ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
@ -2406,6 +2407,7 @@ bool TrackPanel::MaybeStartScrubbing(wxMouseEvent &event)
mScrubStartClockTimeMillis = ::wxGetLocalTimeMillis(); mScrubStartClockTimeMillis = ::wxGetLocalTimeMillis();
if (IsScrubbing()) { if (IsScrubbing()) {
mScrubHasFocus = true;
//mMouseCapture = IsMiddleButtonScrubbing; //mMouseCapture = IsMiddleButtonScrubbing;
//CaptureMouse(); //CaptureMouse();
} }
@ -2417,8 +2419,11 @@ bool TrackPanel::MaybeStartScrubbing(wxMouseEvent &event)
bool TrackPanel::ContinueScrubbing(wxCoord position, bool maySkip) bool TrackPanel::ContinueScrubbing(wxCoord position, bool maySkip)
{ {
wxCoord leadPosition = position; // When we don't have focus, enqueue silent scrubs until we regain focus.
double newEnd = PositionToTime(leadPosition, GetLeftOffset()); if (!mScrubHasFocus)
return gAudioIO->EnqueueScrubBySignedSpeed(0, mMaxScrubSpeed, maySkip);
const double newEnd = PositionToTime(position, GetLeftOffset());
if (maySkip) if (maySkip)
// Cause OnTimer() to suppress the speed display // Cause OnTimer() to suppress the speed display
@ -7371,6 +7376,9 @@ void TrackPanel::DrawEverythingElse(wxDC * dc,
#ifdef EXPERIMENTAL_SCRUBBING_BASIC #ifdef EXPERIMENTAL_SCRUBBING_BASIC
void TrackPanel::DrawScrubSpeed(wxDC &dc) void TrackPanel::DrawScrubSpeed(wxDC &dc)
{ {
if (!mScrubHasFocus)
return;
// Don't draw it during stutter play with shift down // Don't draw it during stutter play with shift down
if (!::wxGetMouseState().ShiftDown() && ( if (!::wxGetMouseState().ShiftDown() && (
@ -9777,12 +9785,18 @@ void TrackPanel::SetFocusedTrack( Track *t )
void TrackPanel::OnSetFocus(wxFocusEvent & WXUNUSED(event)) void TrackPanel::OnSetFocus(wxFocusEvent & WXUNUSED(event))
{ {
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
mScrubHasFocus = IsScrubbing();
#endif
SetFocusedTrack( GetFocusedTrack() ); SetFocusedTrack( GetFocusedTrack() );
Refresh( false ); Refresh( false );
} }
void TrackPanel::OnKillFocus(wxFocusEvent & WXUNUSED(event)) void TrackPanel::OnKillFocus(wxFocusEvent & WXUNUSED(event))
{ {
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
mScrubHasFocus = false;
#endif
Refresh( false); Refresh( false);
} }

View File

@ -783,6 +783,7 @@ protected:
wxCoord mScrubStartPosition; wxCoord mScrubStartPosition;
double mMaxScrubSpeed; double mMaxScrubSpeed;
int mScrubSpeedDisplayCountdown; int mScrubSpeedDisplayCountdown;
bool mScrubHasFocus;
#endif #endif
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL #ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL