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

Modified Files:
        Import.cpp 
Log Message:
Import plugin priority override: first try to import via plugin which had it's 
filter selected by user. Implies that there's only one filter for each import 
plugin.

Index: Import.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/import/Import.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- Import.cpp  4 Jun 2008 09:55:44 -0000       1.41
+++ Import.cpp  14 Jun 2008 17:20:17 -0000      1.42
@@ -114,12 +114,30 @@
    int numTracks = 0;
 
    wxString extension = fName.AfterLast(wxT('.'));
-   
+
+   // If user explicitly selected a filter,
+   // then we should try importing via corresponding plugin first
+   wxString type = gPrefs->Read(wxT("/DefaultOpenType"),wxT(""));
+   ImportPluginList::Node *tryFirstNode = mImportPluginList->GetFirst();
+   while(tryFirstNode)
+   {
+      ImportPlugin *plugin = tryFirstNode->GetData();
+      if (plugin->GetPluginFormatDescription().CompareTo(type) == 0)
+         break;
+      tryFirstNode= tryFirstNode->GetNext();
+   }
+
    // see if any of the plugins expect this extension and if so give
    // that plugin first dibs
    ImportPluginList::Node *importPluginNode = mImportPluginList->GetFirst();
+   ImportPluginList::Node *tmpNode;
    while(importPluginNode)
    {
+      if (tryFirstNode)
+      {
+         tmpNode = importPluginNode;
+         importPluginNode = tryFirstNode;
+      }
       ImportPlugin *plugin = importPluginNode->GetData();
       if (plugin->SupportsExtension(extension))
       {
@@ -167,7 +185,13 @@
             // continue.
          }
       }
-      importPluginNode = importPluginNode->GetNext();
+      if (tryFirstNode)
+      {
+         importPluginNode = tmpNode;
+         tryFirstNode = NULL;
+      }
+      else
+         importPluginNode = importPluginNode->GetNext();
    }
 
    // None of our plugins can handle this file.  It might be that


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Audacity-cvs mailing list
Audacity-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to