From fd9ac6bf099e8501a53faa6d5b34c80a0afc9c1d Mon Sep 17 00:00:00 2001 From: "james.k.crook" Date: Sat, 12 Feb 2011 18:33:49 +0000 Subject: [PATCH] Fix: slowdown with many labels caused by LyricsWindow. (Bug 144) --- src/Menus.cpp | 1 + src/Project.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/Menus.cpp b/src/Menus.cpp index 55b5d3a46..d67e26ad8 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -4493,6 +4493,7 @@ void AudacityProject::OnKaraoke() if (!mLyricsWindow) mLyricsWindow = new LyricsWindow(this); mLyricsWindow->Show(); + UpdateLyrics(); mLyricsWindow->Raise(); } diff --git a/src/Project.cpp b/src/Project.cpp index 892ab6928..76a0fb53e 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -3653,6 +3653,13 @@ void AudacityProject::UpdateLyrics() 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(); pLyricsPanel->Clear(); for (int i = 0; i < pLabelTrack->GetNumLabels(); i++)