Update of /cvsroot/audacity/audacity-src/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv26004/src
Modified Files: BatchProcessDialog.cpp Log Message: Commit patch from sam lewis to provide the correct list of import file filters in the "apply chain to files" selection dialogue, rather than the hard-coded list of file types Index: BatchProcessDialog.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/BatchProcessDialog.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- BatchProcessDialog.cpp 3 Jul 2009 22:28:47 -0000 1.30 +++ BatchProcessDialog.cpp 7 Nov 2009 16:02:08 -0000 1.31 @@ -46,6 +46,7 @@ #include "AllThemeResources.h" #include "FileDialog.h" +#include "import/Import.h" #define ChainsListID 7001 #define ApplyToProjectID 7002 @@ -204,15 +205,56 @@ wxString prompt = project->GetCleanSpeechMode() ? _("Select vocal file(s) for batch CleanSpeech Chain...") : _("Select file(s) for batch processing..."); - wxString fileSelector = project->GetCleanSpeechMode() ? - _("Vocal files (*.wav;*.mp3)|*.wav;*.mp3|WAV files (*.wav)|*.wav|MP3 files (*.mp3)|*.mp3") : - _("All files (*.*)|*.*|WAV files (*.wav)|*.wav|AIFF files (*.aif)|*.aif|AU files (*.au)|*.au|MP3 files (*.mp3)|*.mp3|Ogg Vorbis files (*.ogg)|*.ogg|FLAC files (*.flac)|*.flac" - ); + // CleanSpeech used to hard-code a restricted file type list here + + FormatList l; + wxString filter; + wxString all; - FileDialog dlog(this, prompt, - path, wxT(""), fileSelector, + l.DeleteContents(true); + wxGetApp().mImporter->GetSupportedImportFormats(&l); + for (FormatList::compatibility_iterator n = l.GetFirst(); n; n = n->GetNext()) { + Format *f = n->GetData(); + + wxString newfilter = f->formatName + wxT("|"); + for (size_t i = 0; i < f->formatExtensions.GetCount(); i++) { + if (!newfilter.Contains(wxT("*.") + f->formatExtensions[i] + wxT(";"))) + newfilter += wxT("*.") + f->formatExtensions[i] + wxT(";"); + if (!all.Contains(wxT("*.") + f->formatExtensions[i] + wxT(";"))) + all += wxT("*.") + f->formatExtensions[i] + wxT(";"); + } + newfilter.RemoveLast(1); + filter += newfilter; + filter += wxT("|"); + } + all.RemoveLast(1); + filter.RemoveLast(1); + + wxString mask = _("All files|*|All supported files|") + + all + wxT("|") + + filter; + + wxString type = gPrefs->Read(wxT("/DefaultOpenType"),mask.BeforeFirst(wxT('|'))); + // Convert the type to the filter index + int index = mask.First(type + wxT("|")); + if (index == wxNOT_FOUND) { + index = 0; + } + else { + index = mask.Left(index).Freq(wxT('|')) / 2; + if (index < 0) { + index = 0; + } + } + + FileDialog dlog(this, + prompt, + path, + wxT(""), + mask, wxFD_OPEN | wxFD_MULTIPLE | wxRESIZE_BORDER); + dlog.SetFilterIndex(index); if (dlog.ShowModal() != wxID_OK) { return; } ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Audacity-cvs mailing list Audacity-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/audacity-cvs