Remove the usage of dummy wxTimerEvent

This commit is contained in:
wangqr 2019-07-24 09:11:17 -04:00 committed by Thomas Goyne
parent bb5090ac3a
commit 716c2eae0d
2 changed files with 8 additions and 4 deletions

View file

@ -280,8 +280,7 @@ void AudioKaraoke::OnMouse(wxMouseEvent &event) {
split_area->Refresh(false); split_area->Refresh(false);
scroll_timer.Start(50); scroll_timer.Start(50);
split_area->CaptureMouse(); split_area->CaptureMouse();
wxTimerEvent evt; OnScrollTimer();
OnScrollTimer(evt);
} }
return; return;
} }
@ -317,7 +316,7 @@ void AudioKaraoke::OnMouse(wxMouseEvent &event) {
split_area->Refresh(false); split_area->Refresh(false);
} }
void AudioKaraoke::OnScrollTimer(wxTimerEvent &) { void AudioKaraoke::OnScrollTimer() {
scroll_x += scroll_dir * char_width * 3; scroll_x += scroll_dir * char_width * 3;
int max_scroll = rendered_line.GetWidth() + 20 - split_area->GetClientSize().GetWidth(); int max_scroll = rendered_line.GetWidth() + 20 - split_area->GetClientSize().GetWidth();
@ -329,6 +328,10 @@ void AudioKaraoke::OnScrollTimer(wxTimerEvent &) {
split_area->Refresh(false); split_area->Refresh(false);
} }
void AudioKaraoke::OnScrollTimer(wxTimerEvent&) {
OnScrollTimer();
}
void AudioKaraoke::LoadFromLine() { void AudioKaraoke::LoadFromLine() {
scroll_x = 0; scroll_x = 0;
scroll_timer.Stop(); scroll_timer.Stop();

View file

@ -142,7 +142,8 @@ class AudioKaraoke final : public wxWindow {
void OnPaint(wxPaintEvent &event); void OnPaint(wxPaintEvent &event);
void OnSize(wxSizeEvent &event); void OnSize(wxSizeEvent &event);
void OnAudioOpened(agi::AudioProvider *provider); void OnAudioOpened(agi::AudioProvider *provider);
void OnScrollTimer(wxTimerEvent &event); void OnScrollTimer();
void OnScrollTimer(wxTimerEvent& event);
public: public:
/// Constructor /// Constructor