mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-19 14:17:41 +02:00
Bugs 994, 1030: Scrubbing behavior with pointer outside of the track panel...
... first: suspend scrubbing only when the application is deactivated -- not necessarily when track panel loses focus; resume when reactivated. second: click and drag to seek happens only when the pointer is in the track panel, and either over a wave track, or over no track.
This commit is contained in:
parent
191ccb0ecc
commit
409cbb2996
@ -1064,7 +1064,7 @@ void Envelope::GetValues(double *buffer, int bufferLen,
|
||||
t0 -= mOffset;
|
||||
|
||||
// JC: If bufferLen ==0 we have probably just allocated a zero sized buffer.
|
||||
wxASSERT( bufferLen > 0 );
|
||||
// wxASSERT( bufferLen > 0 );
|
||||
|
||||
int len = mEnv.Count();
|
||||
|
||||
|
@ -608,12 +608,23 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
|
||||
#endif
|
||||
|
||||
mInitialTrackSelection = new std::vector<bool>;
|
||||
|
||||
if (wxTheApp)
|
||||
wxTheApp->Connect
|
||||
(wxEVT_ACTIVATE_APP,
|
||||
wxActivateEventHandler(TrackPanel::OnActivateOrDeactivateApp), NULL, this);
|
||||
}
|
||||
|
||||
|
||||
TrackPanel::~TrackPanel()
|
||||
{
|
||||
mTimer.Stop();
|
||||
|
||||
if (wxTheApp)
|
||||
wxTheApp->Disconnect
|
||||
(wxEVT_ACTIVATE_APP,
|
||||
wxActivateEventHandler(TrackPanel::OnActivateOrDeactivateApp), NULL, this);
|
||||
|
||||
// Unregister for tracklist updates
|
||||
mTracks->Disconnect(EVT_TRACKLIST_UPDATED,
|
||||
wxCommandEventHandler(TrackPanel::OnTrackListUpdated),
|
||||
@ -6853,9 +6864,10 @@ void TrackPanel::HandleTrackSpecificMouseEvent(wxMouseEvent & event)
|
||||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
|
||||
if ((!pTrack ||
|
||||
pTrack->GetKind() == Track::Wave) &&
|
||||
IsScrubbing()) {
|
||||
if (IsScrubbing() &&
|
||||
GetRect().Contains(event.GetPosition()) &&
|
||||
(!pTrack ||
|
||||
pTrack->GetKind() == Track::Wave)) {
|
||||
if (event.LeftDown()) {
|
||||
mScrubSeekPress = true;
|
||||
return;
|
||||
@ -7399,11 +7411,13 @@ void TrackPanel::TimerUpdateScrubbing()
|
||||
// Thus scrubbing relies mostly on periodic polling of mouse and keys,
|
||||
// not event notifications. But there are a few event handlers that
|
||||
// leave messages for this routine, in mScrubSeekPress and in mScrubHasFocus.
|
||||
wxMouseState state(::wxGetMouseState());
|
||||
wxCoord position = state.GetX();
|
||||
const bool seek = mScrubSeekPress || PollIsSeeking();
|
||||
ScreenToClient(&position, NULL);
|
||||
if (ContinueScrubbing(position, mScrubHasFocus, seek))
|
||||
|
||||
// Seek only when the pointer is in the panel. Else, scrub.
|
||||
const wxMouseState state(::wxGetMouseState());
|
||||
const wxPoint position = ScreenToClient(state.GetPosition());
|
||||
const bool inPanel = GetRect().Contains(position);
|
||||
const bool seek = inPanel && (mScrubSeekPress || PollIsSeeking());
|
||||
if (ContinueScrubbing(position.x, mScrubHasFocus, seek))
|
||||
mScrubSeekPress = false;
|
||||
// else, if seek requested, try again at a later time when we might
|
||||
// enqueue a long enough stutter
|
||||
@ -10115,21 +10129,27 @@ 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);
|
||||
}
|
||||
|
||||
void TrackPanel::OnActivateOrDeactivateApp(wxActivateEvent &event)
|
||||
{
|
||||
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
|
||||
if (event.GetActive())
|
||||
mScrubHasFocus = IsScrubbing();
|
||||
else
|
||||
mScrubHasFocus = false;
|
||||
#endif
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
||||
TrackInfo code is destined to move out of this file.
|
||||
|
@ -151,6 +151,7 @@ class AUDACITY_DLL_API TrackPanel:public wxPanel {
|
||||
|
||||
virtual void OnSetFocus(wxFocusEvent & event);
|
||||
virtual void OnKillFocus(wxFocusEvent & event);
|
||||
virtual void OnActivateOrDeactivateApp(wxActivateEvent & event);
|
||||
|
||||
virtual void OnContextMenu(wxContextMenuEvent & event);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user