TrackPanel subscribes directly to ODManager for events...
... cutting middleman AudacityProject out
This commit is contained in:
parent
22f6ee789c
commit
9c75ebe7f7
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;}
|
||||
|
||||
|
|
Loading…
Reference in New Issue