diff --git a/src/AdornedRulerPanel.cpp b/src/AdornedRulerPanel.cpp index a36d51889..8dcf19797 100644 --- a/src/AdornedRulerPanel.cpp +++ b/src/AdornedRulerPanel.cpp @@ -948,6 +948,12 @@ AdornedRulerPanel::~AdornedRulerPanel() { } +void AdornedRulerPanel::Refresh( bool eraseBackground, const wxRect *rect ) +{ + CellularPanel::Refresh( eraseBackground, rect ); + CellularPanel::HandleCursorForPresentMouseState(); +} + void AdornedRulerPanel::UpdatePrefs() { if (mNeedButtonUpdate) { diff --git a/src/AdornedRulerPanel.h b/src/AdornedRulerPanel.h index 867676c4a..1ecc1f150 100644 --- a/src/AdornedRulerPanel.h +++ b/src/AdornedRulerPanel.h @@ -39,6 +39,10 @@ public: ~AdornedRulerPanel(); + void Refresh + (bool eraseBackground = true, const wxRect *rect = (const wxRect *) NULL) + override; + bool AcceptsFocus() const override { return s_AcceptsFocus; } bool AcceptsFocusFromKeyboard() const override { return true; } void SetFocusFromKbd() override; diff --git a/src/CellularPanel.cpp b/src/CellularPanel.cpp index f6d1c2f1e..e10dbb049 100644 --- a/src/CellularPanel.cpp +++ b/src/CellularPanel.cpp @@ -103,7 +103,6 @@ BEGIN_EVENT_TABLE(CellularPanel, OverlayPanel) EVT_SET_FOCUS(CellularPanel::OnSetFocus) EVT_KILL_FOCUS(CellularPanel::OnKillFocus) EVT_CONTEXT_MENU(CellularPanel::OnContextMenu) - EVT_IDLE(CellularPanel::OnIdle) END_EVENT_TABLE() CellularPanel::CellularPanel( @@ -473,12 +472,6 @@ void CellularPanel::OnContextMenu(wxContextMenuEvent & WXUNUSED(event)) DoContextMenu(); } -void CellularPanel::OnIdle(wxIdleEvent &event) -{ - event.Skip(); - HandleCursorForPresentMouseState(); -} - /// Handle mouse wheel rotation (for zoom in/out, vertical and horizontal scrolling) void CellularPanel::HandleWheelRotation( TrackPanelMouseEvent &tpmEvent ) { diff --git a/src/CellularPanel.h b/src/CellularPanel.h index 97aff138a..5852395ab 100644 --- a/src/CellularPanel.h +++ b/src/CellularPanel.h @@ -141,8 +141,6 @@ private: void OnContextMenu(wxContextMenuEvent & event); - void OnIdle(wxIdleEvent & event); - void HandleInterruptedDrag(); void Uncapture( bool escaping, wxMouseState *pState = nullptr ); bool HandleEscapeKey(bool down); diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index cf38a50b6..21fba4b3d 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -314,6 +314,12 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id, theProject->Bind(EVT_UNDO_RESET, &TrackPanel::OnUndoReset, this); + wxTheApp->Bind(EVT_AUDIOIO_PLAYBACK, + &TrackPanel::OnAudioIO, + this); + wxTheApp->Bind(EVT_AUDIOIO_CAPTURE, + &TrackPanel::OnAudioIO, + this); UpdatePrefs(); } @@ -822,6 +828,15 @@ void TrackPanel::Refresh(bool eraseBackground /* = TRUE */, mRefreshBacking = true; } wxWindow::Refresh(eraseBackground, rect); + + this->CellularPanel::HandleCursorForPresentMouseState(); +} + +void TrackPanel::OnAudioIO(wxCommandEvent & evt) +{ + evt.Skip(); + // Some hit tests want to change their cursor to and from the ban symbol + CallAfter( [this]{ CellularPanel::HandleCursorForPresentMouseState(); } ); } #include "TrackPanelDrawingContext.h" diff --git a/src/TrackPanel.h b/src/TrackPanel.h index 7864ca8f4..6ac60760c 100644 --- a/src/TrackPanel.h +++ b/src/TrackPanel.h @@ -85,6 +85,8 @@ class AUDACITY_DLL_API TrackPanel final void UpdatePrefs() override; + void OnAudioIO(wxCommandEvent & evt); + void OnPaint(wxPaintEvent & event); void OnMouseEvent(wxMouseEvent & event); void OnKeyDown(wxKeyEvent & event);