mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-02 08:39:46 +02:00
Bug924, addendum: pause scrubbing when Audacity loses focus...
... And it resumes if Audacity regains focus. Actually this fix causes pausing and resuming depending on whether Track Panel has focus, so clicks in other parts of the Audacity window may also pause the scrubbing. I hope that is acceptable.
This commit is contained in:
parent
f07a487e47
commit
e60057fd85
@ -607,6 +607,7 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
|
||||
mScrubStartPosition = -1;
|
||||
mMaxScrubSpeed = 1.0;
|
||||
mScrubSpeedDisplayCountdown = 0;
|
||||
mScrubHasFocus = false;
|
||||
#endif
|
||||
|
||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
||||
@ -2406,6 +2407,7 @@ bool TrackPanel::MaybeStartScrubbing(wxMouseEvent &event)
|
||||
mScrubStartClockTimeMillis = ::wxGetLocalTimeMillis();
|
||||
|
||||
if (IsScrubbing()) {
|
||||
mScrubHasFocus = true;
|
||||
//mMouseCapture = IsMiddleButtonScrubbing;
|
||||
//CaptureMouse();
|
||||
}
|
||||
@ -2417,8 +2419,11 @@ bool TrackPanel::MaybeStartScrubbing(wxMouseEvent &event)
|
||||
|
||||
bool TrackPanel::ContinueScrubbing(wxCoord position, bool maySkip)
|
||||
{
|
||||
wxCoord leadPosition = position;
|
||||
double newEnd = PositionToTime(leadPosition, GetLeftOffset());
|
||||
// When we don't have focus, enqueue silent scrubs until we regain focus.
|
||||
if (!mScrubHasFocus)
|
||||
return gAudioIO->EnqueueScrubBySignedSpeed(0, mMaxScrubSpeed, maySkip);
|
||||
|
||||
const double newEnd = PositionToTime(position, GetLeftOffset());
|
||||
|
||||
if (maySkip)
|
||||
// Cause OnTimer() to suppress the speed display
|
||||
@ -7371,6 +7376,9 @@ void TrackPanel::DrawEverythingElse(wxDC * dc,
|
||||
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
|
||||
void TrackPanel::DrawScrubSpeed(wxDC &dc)
|
||||
{
|
||||
if (!mScrubHasFocus)
|
||||
return;
|
||||
|
||||
// Don't draw it during stutter play with shift down
|
||||
if (!::wxGetMouseState().ShiftDown() && (
|
||||
|
||||
@ -9777,12 +9785,18 @@ void TrackPanel::SetFocusedTrack( Track *t )
|
||||
|
||||
void TrackPanel::OnSetFocus(wxFocusEvent & WXUNUSED(event))
|
||||
{
|
||||
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
|
||||
mScrubHasFocus = IsScrubbing();
|
||||
#endif
|
||||
SetFocusedTrack( GetFocusedTrack() );
|
||||
Refresh( false );
|
||||
}
|
||||
|
||||
void TrackPanel::OnKillFocus(wxFocusEvent & WXUNUSED(event))
|
||||
{
|
||||
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
|
||||
mScrubHasFocus = false;
|
||||
#endif
|
||||
Refresh( false);
|
||||
}
|
||||
|
||||
|
@ -783,6 +783,7 @@ protected:
|
||||
wxCoord mScrubStartPosition;
|
||||
double mMaxScrubSpeed;
|
||||
int mScrubSpeedDisplayCountdown;
|
||||
bool mScrubHasFocus;
|
||||
#endif
|
||||
|
||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
||||
|
Loading…
x
Reference in New Issue
Block a user