1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 16:40:07 +02:00

Eliminate idle event handler of CellularPanel...

... achieving the intent of b7386c2db1a136c4684f1e52e53d2f21262032dd 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() void AdornedRulerPanel::UpdatePrefs()
{ {
if (mNeedButtonUpdate) { if (mNeedButtonUpdate) {

View File

@ -39,6 +39,10 @@ public:
~AdornedRulerPanel(); ~AdornedRulerPanel();
void Refresh
(bool eraseBackground = true, const wxRect *rect = (const wxRect *) NULL)
override;
bool AcceptsFocus() const override { return s_AcceptsFocus; } bool AcceptsFocus() const override { return s_AcceptsFocus; }
bool AcceptsFocusFromKeyboard() const override { return true; } bool AcceptsFocusFromKeyboard() const override { return true; }
void SetFocusFromKbd() override; void SetFocusFromKbd() override;

View File

@ -103,7 +103,6 @@ BEGIN_EVENT_TABLE(CellularPanel, OverlayPanel)
EVT_SET_FOCUS(CellularPanel::OnSetFocus) EVT_SET_FOCUS(CellularPanel::OnSetFocus)
EVT_KILL_FOCUS(CellularPanel::OnKillFocus) EVT_KILL_FOCUS(CellularPanel::OnKillFocus)
EVT_CONTEXT_MENU(CellularPanel::OnContextMenu) EVT_CONTEXT_MENU(CellularPanel::OnContextMenu)
EVT_IDLE(CellularPanel::OnIdle)
END_EVENT_TABLE() END_EVENT_TABLE()
CellularPanel::CellularPanel( CellularPanel::CellularPanel(
@ -473,12 +472,6 @@ void CellularPanel::OnContextMenu(wxContextMenuEvent & WXUNUSED(event))
DoContextMenu(); DoContextMenu();
} }
void CellularPanel::OnIdle(wxIdleEvent &event)
{
event.Skip();
HandleCursorForPresentMouseState();
}
/// Handle mouse wheel rotation (for zoom in/out, vertical and horizontal scrolling) /// Handle mouse wheel rotation (for zoom in/out, vertical and horizontal scrolling)
void CellularPanel::HandleWheelRotation( TrackPanelMouseEvent &tpmEvent ) void CellularPanel::HandleWheelRotation( TrackPanelMouseEvent &tpmEvent )
{ {

View File

@ -141,8 +141,6 @@ private:
void OnContextMenu(wxContextMenuEvent & event); void OnContextMenu(wxContextMenuEvent & event);
void OnIdle(wxIdleEvent & event);
void HandleInterruptedDrag(); void HandleInterruptedDrag();
void Uncapture( bool escaping, wxMouseState *pState = nullptr ); void Uncapture( bool escaping, wxMouseState *pState = nullptr );
bool HandleEscapeKey(bool down); bool HandleEscapeKey(bool down);

View File

@ -314,6 +314,12 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
theProject->Bind(EVT_UNDO_RESET, &TrackPanel::OnUndoReset, this); 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(); UpdatePrefs();
} }
@ -822,6 +828,15 @@ void TrackPanel::Refresh(bool eraseBackground /* = TRUE */,
mRefreshBacking = true; mRefreshBacking = true;
} }
wxWindow::Refresh(eraseBackground, rect); 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" #include "TrackPanelDrawingContext.h"

View File

@ -85,6 +85,8 @@ class AUDACITY_DLL_API TrackPanel final
void UpdatePrefs() override; void UpdatePrefs() override;
void OnAudioIO(wxCommandEvent & evt);
void OnPaint(wxPaintEvent & event); void OnPaint(wxPaintEvent & event);
void OnMouseEvent(wxMouseEvent & event); void OnMouseEvent(wxMouseEvent & event);
void OnKeyDown(wxKeyEvent & event); void OnKeyDown(wxKeyEvent & event);