Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv12822
Modified Files:
Project.cpp Project.h AudacityApp.cpp AudacityApp.h
Log Message:
Generate import file filter dynamically and add an "All supported file" filter
(This relocates the Importer from the Project to the App)
Index: Project.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Project.h,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- Project.h 7 May 2007 09:25:15 -0000 1.117
+++ Project.h 27 May 2007 21:11:30 -0000 1.118
@@ -312,7 +312,7 @@
static bool IsAutoSaveEnabled();
void DeleteCurrentAutoSaveFile();
- static wxString GetImportFilesFilter();
+ wxString GetImportFilesFilter();
static bool GetCacheBlockFiles();
@@ -371,7 +371,6 @@
AdornedRulerPanel *mRuler;
TrackPanel *mTrackPanel;
TrackFactory *mTrackFactory;
- Importer *mImporter;
wxPanel * mMainPanel;
wxScrollBar *mHsbar;
wxScrollBar *mVsbar;
Index: Project.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Project.cpp,v
retrieving revision 1.308
retrieving revision 1.309
diff -u -d -r1.308 -r1.309
--- Project.cpp 14 May 2007 01:33:27 -0000 1.308
+++ Project.cpp 27 May 2007 21:11:30 -0000 1.309
@@ -536,7 +536,6 @@
mDirty(false),
mTrackPanel(NULL),
mTrackFactory(NULL),
- mImporter(NULL),
mAutoScrolling(false),
mActive(true),
mHistoryWindow(NULL),
@@ -770,7 +769,6 @@
mTags = new Tags();
mTrackFactory = new TrackFactory(mDirManager);
- mImporter = new Importer;
mImportingRaw = false;
wxString msg = wxString::Format(_("Welcome to Audacity version %s"),
@@ -1518,9 +1516,6 @@
DestroyChildren();
- delete mImporter;
- mImporter = NULL;
-
delete mTrackFactory;
mTrackFactory = NULL;
@@ -1628,7 +1623,7 @@
bCleanSpeechMode ?
_("Music files (*.wav;*.mp3)|*.wav;*.mp3|WAV files
(*.wav)|*.wav|MP3 files (*.mp3)|*.mp3")
:
- GetImportFilesFilter().c_str(),
+ proj->GetImportFilesFilter().c_str(),
wxOPEN | wxMULTIPLE);
int result = dlog.ShowModal();
@@ -2349,7 +2344,7 @@
without looking at the file header. Same as "Import Raw" */
description = _("Raw");
else
- description = self->mImporter->GetFileDescription();
+ description = wxGetApp().mImporter->GetFileDescription();
wxString dialogMessage;
dialogMessage.Printf(_("Importing %s File..."),
@@ -2441,7 +2436,7 @@
ProgressShow(_("Import"));
- numTracks = mImporter->Import(fileName, mTrackFactory, &newTracks,
+ numTracks = wxGetApp().mImporter->Import(fileName, mTrackFactory,
&newTracks,
errorMessage,
AudacityProject::ImportProgressCallback,
this);
@@ -3359,13 +3354,31 @@
wxString AudacityProject::GetImportFilesFilter()
{
- wxString filter = _("All files (*.*)|*.*|Audacity projects
(*.aup)|*.aup|WAV files (*.wav)|*.wav|AIFF files (*.aif)|*.aif|AU files
(*.au)|*.au|MP3 files (*.mp3)|*.mp3|MP2/MPEG files
(*.mp2;*.mpa;*.mpg;*.mpeg)|*.mp2;*.mpa;*.mpg;*.mpeg|Ogg Vorbis files
(*.ogg)|*.ogg|FLAC files (*.flac)|*.flac|List of Files (*.lof)|*.lof");
+ FormatList l;
+ wxString filter;
+ wxString all;
- #if USE_QUICKTIME
- filter += _("|iTunes MPEG-4 Audio (*.m4a)|*.m4a");
- #endif
+ wxGetApp().mImporter->GetSupportedImportFormats(&l);
- return filter;
+ FormatList::Node *n = l.GetFirst();
+ while (n) {
+ Format *f = n->GetData();
+
+ filter += f->formatName + wxT("|");
+ for (size_t i = 0; i < f->formatExtensions.GetCount(); i++) {
+ filter += wxT("*.") + f->formatExtensions[i] + wxT(";");
+ all += wxT("*.") + f->formatExtensions[i] + wxT(";");
+ }
+ filter.RemoveLast(1);
+
+ filter += wxT("|");
+
+ n = n->GetNext();
+ }
+ all.RemoveLast(1);
+ filter.RemoveLast(1);
+
+ return _("All files|*.*|All supported files|") + all + wxT("|") + filter;
}
bool AudacityProject::GetCacheBlockFiles()
Index: AudacityApp.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/AudacityApp.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- AudacityApp.h 11 Apr 2007 06:07:18 -0000 1.34
+++ AudacityApp.h 27 May 2007 21:11:30 -0000 1.35
@@ -19,6 +19,7 @@
class wxLocale;
class wxSingleInstanceChecker;
class IPCServ;
+class Importer;
void SaveWindowSize();
@@ -104,6 +105,7 @@
int flags, // wxFILE, wxDIR, or 0
wxArrayString &results);
+ Importer *mImporter;
private:
wxLocale *mLocale;
Index: AudacityApp.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/AudacityApp.cpp,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -d -r1.172 -r1.173
--- AudacityApp.cpp 14 May 2007 01:33:27 -0000 1.172
+++ AudacityApp.cpp 27 May 2007 21:11:30 -0000 1.173
@@ -72,6 +72,7 @@
#include "FileNames.h"
#include "AutoRecovery.h"
+#include "import/Import.h"
#ifdef USE_QUICKTIME
#include "import/ImportQT.h"
#endif
@@ -235,7 +236,7 @@
}
}
}
-
+
if (gFreqWindow)
gFreqWindow->Destroy();
@@ -726,6 +727,8 @@
QuitAudacity(true);
}
+ mImporter = new Importer;
+
//
// Command-line parsing, but only if we didn't recover
//
@@ -1211,6 +1214,9 @@
delete mIPCServ;
#endif
+ if (mImporter)
+ delete mImporter;
+
if(gPrefs)
{
bool bFalse = false;
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs