mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-19 22:27:43 +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;
|
t0 -= mOffset;
|
||||||
|
|
||||||
// JC: If bufferLen ==0 we have probably just allocated a zero sized buffer.
|
// JC: If bufferLen ==0 we have probably just allocated a zero sized buffer.
|
||||||
wxASSERT( bufferLen > 0 );
|
// wxASSERT( bufferLen > 0 );
|
||||||
|
|
||||||
int len = mEnv.Count();
|
int len = mEnv.Count();
|
||||||
|
|
||||||
|
@ -608,12 +608,23 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
mInitialTrackSelection = new std::vector<bool>;
|
mInitialTrackSelection = new std::vector<bool>;
|
||||||
|
|
||||||
|
if (wxTheApp)
|
||||||
|
wxTheApp->Connect
|
||||||
|
(wxEVT_ACTIVATE_APP,
|
||||||
|
wxActivateEventHandler(TrackPanel::OnActivateOrDeactivateApp), NULL, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TrackPanel::~TrackPanel()
|
TrackPanel::~TrackPanel()
|
||||||
{
|
{
|
||||||
mTimer.Stop();
|
mTimer.Stop();
|
||||||
|
|
||||||
|
if (wxTheApp)
|
||||||
|
wxTheApp->Disconnect
|
||||||
|
(wxEVT_ACTIVATE_APP,
|
||||||
|
wxActivateEventHandler(TrackPanel::OnActivateOrDeactivateApp), NULL, this);
|
||||||
|
|
||||||
// Unregister for tracklist updates
|
// Unregister for tracklist updates
|
||||||
mTracks->Disconnect(EVT_TRACKLIST_UPDATED,
|
mTracks->Disconnect(EVT_TRACKLIST_UPDATED,
|
||||||
wxCommandEventHandler(TrackPanel::OnTrackListUpdated),
|
wxCommandEventHandler(TrackPanel::OnTrackListUpdated),
|
||||||
@ -6853,9 +6864,10 @@ void TrackPanel::HandleTrackSpecificMouseEvent(wxMouseEvent & event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
|
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
|
||||||
if ((!pTrack ||
|
if (IsScrubbing() &&
|
||||||
pTrack->GetKind() == Track::Wave) &&
|
GetRect().Contains(event.GetPosition()) &&
|
||||||
IsScrubbing()) {
|
(!pTrack ||
|
||||||
|
pTrack->GetKind() == Track::Wave)) {
|
||||||
if (event.LeftDown()) {
|
if (event.LeftDown()) {
|
||||||
mScrubSeekPress = true;
|
mScrubSeekPress = true;
|
||||||
return;
|
return;
|
||||||
@ -7399,11 +7411,13 @@ void TrackPanel::TimerUpdateScrubbing()
|
|||||||
// Thus scrubbing relies mostly on periodic polling of mouse and keys,
|
// Thus scrubbing relies mostly on periodic polling of mouse and keys,
|
||||||
// not event notifications. But there are a few event handlers that
|
// not event notifications. But there are a few event handlers that
|
||||||
// leave messages for this routine, in mScrubSeekPress and in mScrubHasFocus.
|
// leave messages for this routine, in mScrubSeekPress and in mScrubHasFocus.
|
||||||
wxMouseState state(::wxGetMouseState());
|
|
||||||
wxCoord position = state.GetX();
|
// Seek only when the pointer is in the panel. Else, scrub.
|
||||||
const bool seek = mScrubSeekPress || PollIsSeeking();
|
const wxMouseState state(::wxGetMouseState());
|
||||||
ScreenToClient(&position, NULL);
|
const wxPoint position = ScreenToClient(state.GetPosition());
|
||||||
if (ContinueScrubbing(position, mScrubHasFocus, seek))
|
const bool inPanel = GetRect().Contains(position);
|
||||||
|
const bool seek = inPanel && (mScrubSeekPress || PollIsSeeking());
|
||||||
|
if (ContinueScrubbing(position.x, mScrubHasFocus, seek))
|
||||||
mScrubSeekPress = false;
|
mScrubSeekPress = false;
|
||||||
// else, if seek requested, try again at a later time when we might
|
// else, if seek requested, try again at a later time when we might
|
||||||
// enqueue a long enough stutter
|
// enqueue a long enough stutter
|
||||||
@ -10115,21 +10129,27 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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.
|
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 OnSetFocus(wxFocusEvent & event);
|
||||||
virtual void OnKillFocus(wxFocusEvent & event);
|
virtual void OnKillFocus(wxFocusEvent & event);
|
||||||
|
virtual void OnActivateOrDeactivateApp(wxActivateEvent & event);
|
||||||
|
|
||||||
virtual void OnContextMenu(wxContextMenuEvent & event);
|
virtual void OnContextMenu(wxContextMenuEvent & event);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user