Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv29317

Modified Files:
        DirManager.cpp 
Log Message:
Use project level progress dialogs.

Index: DirManager.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/DirManager.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- DirManager.cpp      17 Sep 2006 01:03:25 -0000      1.69
+++ DirManager.cpp      17 Sep 2006 03:03:23 -0000      1.70
@@ -69,6 +69,7 @@
 #include "blockfile/PCMAliasBlockFile.h"
 #include "DirManager.h"
 #include "Internat.h"
+#include "Project.h"
 #include "Prefs.h"
 #include "widgets/Warning.h"
 #include "widgets/MultiDialog.h"
@@ -162,7 +163,7 @@
                                   wxString dirspec,
                                   int files_p,int dirs_p,
                                   int progress_count,int progress_bias,
-                                  const wxChar *prompt, wxProgressDialog 
**progress){
+                                  const wxChar *prompt){
 
    int count=0;
    bool cont;
@@ -181,18 +182,9 @@
             
             cont = dir.GetNext(&name);
             
-            if (prompt && progress && !*progress && wxGetElapsedTime(false) > 
500)
-               *progress =
-                  new wxProgressDialog(_("Progress"),
-                                       prompt,
-                                       1000,
-                                       NULL,
-                                       wxPD_REMAINING_TIME | wxPD_AUTO_HIDE);
-
-            if (progress && *progress)
-               (*progress)->Update(int ((count+progress_bias * 1000.0) / 
-                                        progress_count));
-
+            if (prompt)
+               GetActiveProject()->ProgressUpdate(int ((count+progress_bias * 
1000.0) / 
+                                                  progress_count));
          }
       }
 
@@ -201,7 +193,7 @@
          wxString subdirpath=dirpath + wxFILE_SEP_PATH + name;
          count+=rm_dash_rf_enumerate_i(subdirpath,flist,wxEmptyString,
                                      files_p,dirs_p,progress_count,
-                                     count+progress_bias,prompt,progress);  
+                                     count+progress_bias,prompt);  
          cont = dir.GetNext(&name);
       }
    }
@@ -222,15 +214,13 @@
                                        int progress_count,
                                        const wxChar *prompt){
 
-   wxProgressDialog *progress = NULL;
-   wxStartTimer();
+   GetActiveProject()->ProgressShow(_("Progress"), prompt);
 
    int count=rm_dash_rf_enumerate_i(dirpath, flist, dirspec, files_p,dirs_p,
                                     progress_count,0,
-                                    prompt, &progress);
-   
-   if (progress)
-      delete progress;
+                                    prompt);
+
+   GetActiveProject()->ProgressHide();
 
    return count;
 }
@@ -241,7 +231,7 @@
                                 int files_p,int dirs_p){
 
    return rm_dash_rf_enumerate_i(dirpath, flist, dirspec, files_p,dirs_p,
-                                    0,0,0,0);
+                                    0,0,NULL);
 
 }
 
@@ -250,12 +240,11 @@
                                int count, int files_p, int dirs_p,
                                const wxChar *prompt){
 
-   wxProgressDialog *progress = NULL;
-   wxStartTimer();
-
+   if (prompt)
+      GetActiveProject()->ProgressShow(_("Progress"), prompt);
+  
    for (int i = 0; i < count; i++) {
-      const wxChar *file = fList[i].fn_str();
-
+      const wxChar *file = fList[i].c_str();
       if(files_p){
          wxRemoveFile(file);
       }
@@ -263,20 +252,12 @@
          wxRmdir(file);
       }
 
-      if (prompt && !progress && wxGetElapsedTime(false) > 500)
-         progress =
-            new wxProgressDialog(_("Progress"),
-                                 prompt,
-                                 1000,
-                                 NULL,
-                                 wxPD_REMAINING_TIME | wxPD_AUTO_HIDE);
-      
-      if (progress)
-         progress->Update(int ((i * 1000.0) / count));
+      if (prompt)
+         GetActiveProject()->ProgressUpdate(int ((i * 1000.0) / count));
    }
    
-   if (progress)
-      delete progress;
+   if (prompt)
+      GetActiveProject()->ProgressHide();
 }
 
 // static
@@ -291,7 +272,6 @@
    // don't count the global temp directory, which this will find and
    // list last
    count=rm_dash_rf_enumerate(globaltemp,flist,wxT("project*"),1,1)-1;
-   
    if (count == 0) 
       return;
 
@@ -340,10 +320,11 @@
       saved version of the old project must not be moved,
       otherwise the old project would not be safe. */
 
-   wxProgressDialog *progress = NULL;
+   GetActiveProject()->ProgressShow(_("Progress"),
+                                    _("Saving project data files"));
+
    int total=blockFileHash.size();
    int count=0;
-   wxStartTimer();
 
    BlockHash::iterator i=blockFileHash.begin();
    bool success = true;
@@ -356,18 +337,7 @@
          success = MoveToNewProjectDirectory(b);
       }
 
-
-      if (!progress && wxGetElapsedTime(false) > 500)
-         progress =
-            new wxProgressDialog(_("Progress"),
-                                 _("Saving project data files"),
-                                 1000,
-                                 NULL,
-                                 wxPD_REMAINING_TIME | 
-                                 wxPD_AUTO_HIDE);
-      
-      if (progress)
-         progress->Update(int ((count * 1000.0) / total));
+      GetActiveProject()->ProgressUpdate(int ((count * 1000.0) / total));
 
       i++;
       count++;
@@ -387,8 +357,8 @@
          BlockFile *b = i->second;
          MoveToNewProjectDirectory(b);
 
-         if (progress && count>=0)
-            progress->Update(int ((count * 1000.0) / total));
+         if (count>=0)
+            GetActiveProject()->ProgressUpdate(int ((count * 1000.0) / total));
 
          i++;
          count--;
@@ -398,14 +368,12 @@
       this->projPath = oldPath;
       this->projName = oldName;
 
-      if (progress)
-         delete progress;
+      GetActiveProject()->ProgressHide();
 
       return false;
    }
 
-   if (progress)
-      delete progress;
+   GetActiveProject()->ProgressHide();
 
    // Some subtlety; SetProject is used both to move a temp project
    // into a permanent home as well as just set up path variables when


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to