Update of /cvsroot/audacity/audacity-src/src/xml In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv22018/src/xml
Modified Files: XMLFileReader.cpp XMLFileReader.h XMLTagHandler.cpp XMLTagHandler.h Log Message: Fixes saving/loading of programs (presets) with proper handling of program chunks Adds better feedback for screen readers Fixes several GUI vs non-GUI handling issues Fixes processing of multiple tracks (now resets properly between them) Index: XMLFileReader.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/xml/XMLFileReader.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- XMLFileReader.cpp 5 May 2008 20:15:45 -0000 1.13 +++ XMLFileReader.cpp 24 May 2009 11:31:06 -0000 1.14 @@ -27,7 +27,7 @@ mParser = XML_ParserCreate(NULL); XML_SetUserData(mParser, (void *)this); XML_SetElementHandler(mParser, startElement, endElement); - + XML_SetCharacterDataHandler(mParser, charHandler); mBaseHandler = NULL; mMaxDepth = 128; mHandler = new XMLTagHandler*[mMaxDepth]; @@ -128,6 +128,15 @@ This->mDepth--; } +// static +void XMLFileReader::charHandler(void *userData, const char *s, int len) +{ + XMLFileReader *This = (XMLFileReader *)userData; + + if (This->mHandler[This->mDepth]) + This->mHandler[This->mDepth]->ReadXMLContent(s, len); +} + // Indentation settings for Vim and Emacs and unique identifier for Arch, a // version control system. Please do not modify past this point. // Index: XMLTagHandler.h =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/xml/XMLTagHandler.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- XMLTagHandler.h 20 May 2009 05:55:51 -0000 1.12 +++ XMLTagHandler.h 24 May 2009 11:31:07 -0000 1.13 @@ -65,6 +65,11 @@ // It is optional to override this method. virtual void HandleXMLEndTag(const wxChar *tag) {} + // This method will be called when element content has been + // encountered. + // It is optional to override this method. + virtual void HandleXMLContent(const wxString & content) {} + // If the XML document has children of your tag, this method // should be called. Typically you should construct a new // object for the child, insert it into your own local data @@ -76,6 +81,7 @@ // conversion and then pass the data to the handlers above. bool ReadXMLTag(const char *tag, const char **attrs); void ReadXMLEndTag(const char *tag); + void ReadXMLContent(const char *s, int len); XMLTagHandler *ReadXMLChild(const char *tag); }; Index: XMLFileReader.h =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/xml/XMLFileReader.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- XMLFileReader.h 10 Jul 2008 23:36:01 -0000 1.5 +++ XMLFileReader.h 24 May 2009 11:31:07 -0000 1.6 @@ -31,6 +31,8 @@ static void endElement(void *userData, const char *name); + static void charHandler(void *userData, const char *s, int len); + private: XML_Parser mParser; int mMaxDepth; Index: XMLTagHandler.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/xml/XMLTagHandler.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- XMLTagHandler.cpp 20 May 2009 05:55:51 -0000 1.13 +++ XMLTagHandler.cpp 24 May 2009 11:31:07 -0000 1.14 @@ -180,6 +180,11 @@ HandleXMLEndTag(UTF8CTOWX(tag).c_str()); } +void XMLTagHandler::ReadXMLContent(const char *s, int len) +{ + HandleXMLContent(wxString(s, wxConvUTF8, len)); +} + XMLTagHandler *XMLTagHandler::ReadXMLChild(const char *tag) { return HandleXMLChild(UTF8CTOWX(tag).c_str()); ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://www.creativitycat.com _______________________________________________ Audacity-cvs mailing list Audacity-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/audacity-cvs