1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 22:12:58 +02:00

Bug1075, and define and use new event type for TrackPanel timer ticks...

... Thus allowing TrackPanel.cpp to work without including Lyrics headers.
Also eliminates some of its direct notification of MixerBoard.
This commit is contained in:
Paul Licameli
2015-07-12 08:47:56 -04:00
parent 4f0a2ee804
commit fdf0759301
7 changed files with 76 additions and 48 deletions

View File

@@ -13,7 +13,9 @@
#include "LyricsWindow.h"
#include "Lyrics.h"
#include "AudioIO.h"
#include "Project.h"
#include "TrackPanel.h" // for EVT_TRACK_PANEL_TIMER
#include <wx/radiobut.h>
#include <wx/toolbar.h>
@@ -123,10 +125,21 @@ LyricsWindow::LyricsWindow(AudacityProject *parent):
// default:
// pRadioButton_Highlight->SetValue(true); break;
//}
// Events from the project don't propagate directly to this other frame, so...
mProject->Connect(EVT_TRACK_PANEL_TIMER,
wxCommandEventHandler(LyricsWindow::OnTimer),
NULL,
this);
}
LyricsWindow::~LyricsWindow()
{}
{
mProject->Disconnect(EVT_TRACK_PANEL_TIMER,
wxCommandEventHandler(LyricsWindow::OnTimer),
NULL,
this);
}
void LyricsWindow::OnCloseWindow(wxCloseEvent & WXUNUSED(event))
{
@@ -143,3 +156,18 @@ void LyricsWindow::OnStyle_Highlight(wxCommandEvent & WXUNUSED(event))
mLyricsPanel->SetLyricsStyle(Lyrics::kHighlightLyrics);
}
void LyricsWindow::OnTimer(wxCommandEvent &event)
{
if (mProject->IsAudioActive())
{
GetLyricsPanel()->Update(gAudioIO->GetStreamTime());
}
else
{
// Reset lyrics display.
GetLyricsPanel()->Update(mProject->GetSel0());
}
// Let other listeners get the notification
event.Skip();
}