Eliminate idle event handler of CellularPanel...

... achieving the intent of b7386c2db1 by other
means
This commit is contained in:
Paul Licameli 2019-07-07 13:39:16 -04:00
parent 9b98f4be0c
commit bff30b6ae9
6 changed files with 27 additions and 9 deletions

View File

@ -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) {

View File

@ -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;

View File

@ -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 )
{

View File

@ -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);

View File

@ -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"

View File

@ -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);