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

Modified Files:
      Tag: Audacity_UmixIt
        DirManager.cpp DirManager.h Project.cpp Project.h 
Log Message:
<import> tag for AUP files

Index: Project.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Project.h,v
retrieving revision 1.70.2.3.2.1
retrieving revision 1.70.2.3.2.2
diff -u -d -r1.70.2.3.2.1 -r1.70.2.3.2.2
--- Project.h   15 Nov 2006 22:35:38 -0000      1.70.2.3.2.1
+++ Project.h   23 Nov 2006 03:48:09 -0000      1.70.2.3.2.2
@@ -92,6 +92,18 @@
    AudacityProject *mProject;
 };
 
+class ImportXMLTagHandler : public XMLTagHandler 
+{
+ public:
+   ImportXMLTagHandler(AudacityProject* pProject) { mProject = pProject; };
+
+   virtual bool HandleXMLTag(const char *tag, const char **attrs);
+   virtual XMLTagHandler *HandleXMLChild(const char *tag) { return NULL; };
+   virtual void WriteXML(int depth, FILE *fp) {}; //vvv
+ private: 
+   AudacityProject* mProject;
+};
+
 class AudacityProject:public wxFrame,
                       public TrackPanelListener,
                       public AStatusListener,
@@ -338,6 +350,8 @@
    // Recent File and Project History
    wxFileHistory *mRecentFiles;
 
+   ImportXMLTagHandler* mImportXMLTagHandler;
+
  public:
     DECLARE_EVENT_TABLE()
 };

Index: Project.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Project.cpp,v
retrieving revision 1.178.2.17.2.1
retrieving revision 1.178.2.17.2.2
diff -u -d -r1.178.2.17.2.1 -r1.178.2.17.2.2
--- Project.cpp 15 Nov 2006 22:35:38 -0000      1.178.2.17.2.1
+++ Project.cpp 23 Nov 2006 03:48:09 -0000      1.178.2.17.2.2
@@ -162,6 +162,19 @@
    return true;
 }
 
+bool ImportXMLTagHandler::HandleXMLTag(const char *tag, const char **attrs) 
+{
+   if (strcmp(tag, "import") || strcmp(*attrs++, "filename")) return false;
+   wxString strPathname = *attrs;
+   if (!wxFile::Exists(strPathname)) {
+      strPathname = mProject->GetDirManager()->GetProjectDataDir() + "\\" + 
strPathname;
+      if (!wxFile::Exists(strPathname)) return false;
+   }
+   mProject->Import(strPathname);
+   return true; //vvv UmixIt   result from Import?
+}
+
+
 AudacityProject *CreateNewAudacityProject(wxWindow * parentWindow)
 {
    bool bMaximized;
@@ -360,7 +373,8 @@
      mTotalToolBarHeight(0),
      mDraggingToolBar(NoneID),
      mAudioIOToken(-1),
-     mIsDeleting(false)
+     mIsDeleting(false), 
+     mImportXMLTagHandler(NULL)
 {
    mDrag = NULL;
 
@@ -632,6 +646,9 @@
    delete mRecentFiles;
    mRecentFiles = NULL;
 
+   delete mImportXMLTagHandler;
+   mImportXMLTagHandler = NULL;
+
    // MM: Tell the DirManager it can now delete itself
    // if it finds it is no longer needed. If it is still
    // used (f.e. by the clipboard), it will recognize this
@@ -2035,6 +2052,11 @@
       return newTrack;
    }
 
+   if (!strcmp(tag, "import")) {
+      if (mImportXMLTagHandler == NULL) mImportXMLTagHandler = new 
ImportXMLTagHandler(this);
+      return mImportXMLTagHandler;
+   }
+
    return NULL;
 }
 
@@ -2409,6 +2431,10 @@
 
 void AudacityProject::InitialState()
 {
+   if (mImportXMLTagHandler != NULL) { //vvv UmixIt   Just keep it dirty, or 
auto-save?
+      this->Save();
+   }
+   
    mUndoManager.ClearStates();
 
    TrackList *l = new TrackList(mTracks);

Index: DirManager.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/DirManager.h,v
retrieving revision 1.17.2.3
retrieving revision 1.17.2.3.2.1
diff -u -d -r1.17.2.3 -r1.17.2.3.2.1
--- DirManager.h        25 Jul 2004 18:46:06 -0000      1.17.2.3
+++ DirManager.h        23 Nov 2006 03:48:09 -0000      1.17.2.3.2.1
@@ -60,6 +60,7 @@
    // but it doesn't already exist, SetProject fails and returns false.
    bool SetProject(wxString & projPath, wxString & projName, bool create);
 
+   wxString GetProjectDataDir();
    wxString GetProjectName();
 
    wxLongLong GetFreeDiskSpace();

Index: DirManager.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/DirManager.cpp,v
retrieving revision 1.35.2.5
retrieving revision 1.35.2.5.2.1
diff -u -d -r1.35.2.5 -r1.35.2.5.2.1
--- DirManager.cpp      25 Jul 2004 18:46:06 -0000      1.35.2.5
+++ DirManager.cpp      23 Nov 2006 03:48:08 -0000      1.35.2.5.2.1
@@ -250,6 +250,11 @@
    return true;
 }
 
+wxString DirManager::GetProjectDataDir()
+{
+   return projFull;
+}
+
 wxString DirManager::GetProjectName()
 {
    return projName;


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to