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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user