1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-09 06:06:24 +01:00

Control scrub with motion, click, drag, wheel almost anywhere in main window...

... if the event is not handled and skipped by sub-windows first, such as for
toolbar button clicks.

(But track panel clicks are skipped even after doing something, so they may
also cause seeking besides other responses.  So click can seek AND set cursor.)

This is meant to make drag to seek and wheel for change of speed easier,
without needing to keep the mouse in the narrow time ruler.

Also lets you click in the ruler, then move in any direction, and not miss the
motion event that should start the scrub playback.

The event handling is a bit of a hack, using propagation.  It does not use
capture.
This commit is contained in:
Paul Licameli
2016-04-21 20:59:38 -04:00
parent 3d222bcd87
commit 9ab0e42f29
13 changed files with 120 additions and 25 deletions

View File

@@ -276,6 +276,7 @@ DEFINE_EVENT_TYPE(EVT_TOOLBAR_UPDATED)
BEGIN_EVENT_TABLE( ToolBar, wxPanel )
EVT_PAINT( ToolBar::OnPaint )
EVT_ERASE_BACKGROUND( ToolBar::OnErase )
EVT_MOUSE_EVENTS( ToolBar::OnMouseEvents )
END_EVENT_TABLE()
//
@@ -841,6 +842,13 @@ void ToolBar::OnPaint( wxPaintEvent & event )
#endif
}
void ToolBar::OnMouseEvents(wxMouseEvent &event)
{
// Do this hack so scrubber can detect mouse drags anywhere
event.ResumePropagation(wxEVENT_PROPAGATE_MAX);
event.Skip();
}
int ToolBar::GetResizeGrabberWidth()
{
return RWIDTH;

View File

@@ -188,6 +188,7 @@ class ToolBar /* not final */ : public wxPanel
void OnErase(wxEraseEvent & event);
void OnPaint(wxPaintEvent & event);
void OnMouseEvents(wxMouseEvent &event);
protected:
wxString mLabel;

View File

@@ -64,6 +64,7 @@ BEGIN_EVENT_TABLE( ToolDock, wxPanel )
EVT_ERASE_BACKGROUND( ToolDock::OnErase )
EVT_PAINT( ToolDock::OnPaint )
EVT_SIZE( ToolDock::OnSize )
EVT_MOUSE_EVENTS( ToolDock::OnMouseEvents )
END_EVENT_TABLE()
//
@@ -556,3 +557,10 @@ void ToolDock::OnPaint( wxPaintEvent & WXUNUSED(event) )
}
}
}
void ToolDock::OnMouseEvents(wxMouseEvent &event)
{
// Do this hack so scrubber can detect mouse drags anywhere
event.ResumePropagation(wxEVENT_PROPAGATE_MAX);
event.Skip();
}

View File

@@ -70,6 +70,7 @@ class ToolDock final : public wxPanel
void OnSize( wxSizeEvent & event );
void OnPaint( wxPaintEvent & event );
void OnGrabber( GrabberEvent & event );
void OnMouseEvents(wxMouseEvent &event);
private: