1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-18 17:10:05 +02:00

Fix: slowdown with many labels caused by LyricsWindow. (Bug 144)

This commit is contained in:
james.k.crook 2011-02-12 18:33:49 +00:00
parent 8c805c03dd
commit fd9ac6bf09
2 changed files with 8 additions and 0 deletions

View File

@ -4493,6 +4493,7 @@ void AudacityProject::OnKaraoke()
if (!mLyricsWindow) if (!mLyricsWindow)
mLyricsWindow = new LyricsWindow(this); mLyricsWindow = new LyricsWindow(this);
mLyricsWindow->Show(); mLyricsWindow->Show();
UpdateLyrics();
mLyricsWindow->Raise(); mLyricsWindow->Raise();
} }

View File

@ -3653,6 +3653,13 @@ void AudacityProject::UpdateLyrics()
mLyricsWindow->Show(false); // Don't show it. Need to update content regardless. mLyricsWindow->Show(false); // Don't show it. Need to update content regardless.
} }
// The code that updates the lyrics is rather expensive when there
// are a lot of labels.
// So - bail out early if the lyrics window is not visible.
// We will later force an update when the lyrics window is made visible.
if( !mLyricsWindow->IsVisible() )
return;
Lyrics* pLyricsPanel = mLyricsWindow->GetLyricsPanel(); Lyrics* pLyricsPanel = mLyricsWindow->GetLyricsPanel();
pLyricsPanel->Clear(); pLyricsPanel->Clear();
for (int i = 0; i < pLabelTrack->GetNumLabels(); i++) for (int i = 0; i < pLabelTrack->GetNumLabels(); i++)