diff --git a/src/Project.cpp b/src/Project.cpp index 628087e44..49aa8925a 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -1098,8 +1098,6 @@ BEGIN_EVENT_TABLE(AudacityProject, wxFrame) EVT_COMMAND(wxID_ANY, EVT_OPEN_AUDIO_FILE, AudacityProject::OnOpenAudioFile) EVT_COMMAND(wxID_ANY, EVT_TOOLBAR_UPDATED, AudacityProject::OnToolBarUpdate) //mchinen:multithreaded calls - may not be threadsafe with CommandEvent: may have to change. - EVT_COMMAND(wxID_ANY, EVT_ODTASK_UPDATE, AudacityProject::OnODTaskUpdate) - EVT_COMMAND(wxID_ANY, EVT_ODTASK_COMPLETE, AudacityProject::OnODTaskComplete) END_EVENT_TABLE() AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, @@ -2381,22 +2379,6 @@ void AudacityProject::OnToolBarUpdate(wxCommandEvent & event) event.Skip(false); /* No need to propagate any further */ } -///Handles the redrawing necessary for tasks as they partially update in the background. -void AudacityProject::OnODTaskUpdate(wxCommandEvent & WXUNUSED(event)) -{ - //todo: add track data to the event - check to see if the project contains it before redrawing. - if(mTrackPanel) - mTrackPanel->Refresh(false); - -} - -//redraws the task and does other book keeping after the task is complete. -void AudacityProject::OnODTaskComplete(wxCommandEvent & WXUNUSED(event)) -{ - if(mTrackPanel) - mTrackPanel->Refresh(false); -} - void AudacityProject::OnScroll(wxScrollEvent & WXUNUSED(event)) { const wxInt64 offset = PixelWidthBeforeTime(0.0); diff --git a/src/Project.h b/src/Project.h index bbfe23723..93d6e121d 100644 --- a/src/Project.h +++ b/src/Project.h @@ -384,8 +384,6 @@ public: void OnTimer(wxTimerEvent & event); void OnToolBarUpdate(wxCommandEvent & event); void OnOpenAudioFile(wxCommandEvent & event); - void OnODTaskUpdate(wxCommandEvent & event); - void OnODTaskComplete(wxCommandEvent & event); void HandleResize(); void UpdateLayout(); diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index 5168444d8..da1190be3 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -88,6 +88,9 @@ is time to refresh some aspect of the screen. #include "NoteTrack.h" #endif +#include "ondemand/ODManager.h" +#include "ondemand/ODTask.h" + #include "toolbars/ControlToolBar.h" #include "toolbars/ToolsToolBar.h" @@ -180,6 +183,9 @@ BEGIN_EVENT_TABLE(TrackPanel, CellularPanel) EVT_PAINT(TrackPanel::OnPaint) EVT_TIMER(wxID_ANY, TrackPanel::OnTimer) + + EVT_COMMAND(wxID_ANY, EVT_ODTASK_UPDATE, TrackPanel::OnODTask) + EVT_COMMAND(wxID_ANY, EVT_ODTASK_COMPLETE, TrackPanel::OnODTask) END_EVENT_TABLE() /// Makes a cursor from an XPM, uses CursorId as a fallback. @@ -473,6 +479,14 @@ void TrackPanel::OnTimer(wxTimerEvent& ) mTimeCount = 0; } +///Handles the redrawing necessary for tasks as they partially update in the +///background, or finish. +void TrackPanel::OnODTask(wxCommandEvent & WXUNUSED(event)) +{ + //todo: add track data to the event - check to see if the project contains it before redrawing. + Refresh(false); +} + double TrackPanel::GetScreenEndTime() const { int width; diff --git a/src/TrackPanel.h b/src/TrackPanel.h index a0be30a96..64f798cdb 100644 --- a/src/TrackPanel.h +++ b/src/TrackPanel.h @@ -280,6 +280,7 @@ class AUDACITY_DLL_API TrackPanel final void OnIdle(wxIdleEvent & event); void OnTimer(wxTimerEvent& event); + void OnODTask(wxCommandEvent &event); int GetLeftOffset() const { return GetLabelWidth() + 1;}