Update of /cvsroot/audacity/audacity-src/src
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv19603

Modified Files:
        FreqWindow.cpp 
Log Message:
Apply patch for a progress dialogue on the Plot Spectrum command by Sam Lewis, 
with the addition of a divider to reduce the update frequency to minimise the 
performance penalty for doing lots of progress bar updates.


Index: FreqWindow.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/FreqWindow.cpp,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- FreqWindow.cpp      20 Sep 2009 19:06:04 -0000      1.80
+++ FreqWindow.cpp      2 Nov 2009 20:52:47 -0000       1.81
@@ -994,6 +994,9 @@
    else
       wss = 1.0;
 
+   //add progress dialog
+   ProgressDialog *mProgress = new ProgressDialog(_("FreqWindow"),_("Drawing 
Spectrum"));
+
    int start = 0;
    int windows = 0;
    while (start + mWindowSize <= mDataLen) {
@@ -1080,6 +1083,12 @@
 
       start += half;
       windows++;
+      // only update the progress dialogue infrequently to reduce it's overhead
+      // If we do it every time, it spends as much time updating X11 as doing
+      // the calculations. 10 seems a reasonable compromise on Linux that
+      // doesn't make it unresponsive, but avoids the slowdown.
+      if ((windows % 10) == 0)
+         mProgress->Update(1 - static_cast<float>(mDataLen - start) / 
mDataLen);
    }
 
    switch (alg) {
@@ -1195,6 +1204,7 @@
 
    DrawPlot();
    mFreqPlot->Refresh(true);
+   delete mProgress;
 }
 
 void FreqWindow::OnExport(wxCommandEvent & WXUNUSED(event))


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Audacity-cvs mailing list
Audacity-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to