From 0d77b3b0c7b12b493c869e8c89c3bf796af50dc2 Mon Sep 17 00:00:00 2001 From: Gerald Schmidt Date: Sat, 17 Jan 2009 22:52:54 +0000 Subject: [PATCH] Updated for 1.2.0.3 --- src/catalogresolver.cpp | 20 ++++--- src/catalogresolver.h | 10 ++-- src/getword.cpp | 2 +- src/housestyle.cpp | 21 ++++++-- src/housestyle.h | 24 ++++++--- src/myipc.cpp | 1 + src/myipc.h | 2 + src/styledialog.cpp | 29 +++++++--- src/styledialog.h | 6 ++- src/validationthread.cpp | 10 ++-- src/validationthread.h | 12 ++++- src/wrapaspell.cpp | 14 +++-- src/wrapaspell.h | 9 +++- src/wrapexpat.cpp | 2 +- src/wraplibxml.cpp | 13 ++++- src/wrapxerces.cpp | 17 ++++-- src/wrapxerces.h | 5 +- src/xmlcopyeditor.cpp | 104 ++++++++++++++++++++++-------------- src/xmlcopyeditor.h | 72 +++++++++++++------------ src/xmlcopyeditor_private.h | 19 ------- src/xmlcopyeditorcopy.h | 2 +- src/xmlctrl.cpp | 47 +++++++++------- src/xmlctrl.h | 3 +- src/xmldoc.cpp | 2 + src/xmldoc.h | 1 + src/xmlencodinghandler.cpp | 1 + src/xmlpromptgenerator.cpp | 12 +++-- src/xmlpromptgenerator.h | 2 +- 28 files changed, 293 insertions(+), 169 deletions(-) diff --git a/src/catalogresolver.cpp b/src/catalogresolver.cpp index dce1075..008658a 100755 --- a/src/catalogresolver.cpp +++ b/src/catalogresolver.cpp @@ -18,13 +18,21 @@ */ #include -#include "wraplibxml.h" #include "catalogresolver.h" -std::string CatalogResolver::lookupPublicId ( - const std::string& publicId, - const std::string& catalogPath ) +CatalogResolver::CatalogResolver( const std::string& catalogPath ) { - std::auto_ptr libxml ( new WrapLibxml ( false, catalogPath ) ); - return libxml->lookupPublicId ( publicId ); + wl = new WrapLibxml ( false, catalogPath ); +} + +CatalogResolver::~CatalogResolver() +{ + delete wl; +} + +std::string CatalogResolver::lookupPublicId ( + const std::string& publicId) +{ + //std::auto_ptr libxml ( new WrapLibxml ( false, catalogPath ) ); + return wl->lookupPublicId ( publicId ); } diff --git a/src/catalogresolver.h b/src/catalogresolver.h index 5661a63..f3b51f6 100755 --- a/src/catalogresolver.h +++ b/src/catalogresolver.h @@ -21,13 +21,17 @@ #define CATALOG_RESOLVER_H #include +#include "wraplibxml.h" class CatalogResolver { public: - static std::string lookupPublicId ( - const std::string& publicId, - const std::string& catalogPath ); + CatalogResolver( const std::string& catalogPath ); + ~CatalogResolver(); + std::string lookupPublicId ( + const std::string& publicId); + private: + WrapLibxml *wl; }; #endif diff --git a/src/getword.cpp b/src/getword.cpp index f085fc7..85f7a2a 100755 --- a/src/getword.cpp +++ b/src/getword.cpp @@ -77,7 +77,7 @@ bool GetWord::isWordCharacter ( char *s, size_t *bytes ) unsigned char *us = ( unsigned char * ) s; if ( - *us < 65 || + ( *us < 65 && *us != 45 ) || ( *us > 90 && *us < 97 ) || ( *us > 123 && *us < 128 ) ) diff --git a/src/housestyle.cpp b/src/housestyle.cpp index 7879899..4c6370d 100755 --- a/src/housestyle.cpp +++ b/src/housestyle.cpp @@ -29,6 +29,10 @@ HouseStyle::HouseStyle ( const std::string& filterDirectoryParameter, const std::string& filterFileParameter, const std::string& pathSeparatorParameter, +#ifdef __WXMSW__ + const std::string& aspellDataPathParameter, + const std::string& aspellDictPathParameter, +#endif int contextRangeParameter ) : type ( typeParameter ), buffer ( bufferParameter ), @@ -37,11 +41,16 @@ HouseStyle::HouseStyle ( filterDirectory ( filterDirectoryParameter ), filterFile ( filterFileParameter ), pathSeparator ( pathSeparatorParameter ), +#ifdef __WXMSW__ + aspellDataPath ( aspellDataPathParameter ), + aspellDictPath ( aspellDictPathParameter ), +#endif contextRange ( contextRangeParameter ), ruleVector ( new std::vector > ), dictionary ( new StringSet ), passiveDictionary ( new StringSet ) -{} +{ +} HouseStyle::~HouseStyle() {} @@ -199,7 +208,13 @@ bool HouseStyle::createReport() WrapAspell *spellcheck = NULL; try { if (type == HS_TYPE_SPELL) - spellcheck = new WrapAspell( ruleFile ); + spellcheck = new WrapAspell( + ruleFile, // carries lang information +#ifdef __WXMSW__ + aspellDataPath, + aspellDictPath +#endif + ); } catch (...) { @@ -294,7 +309,7 @@ bool HouseStyle::createReport() */ } } - delete spellcheck; // ok if NULL + delete spellcheck; return true; } diff --git a/src/housestyle.h b/src/housestyle.h index d7adaee..7eb3bee 100755 --- a/src/housestyle.h +++ b/src/housestyle.h @@ -31,7 +31,6 @@ #include "xmlrulereader.h" #include "housestylereader.h" #include "xmlfilterreader.h" -//#include "spellcheck.h" #include "wrapaspell.h" #include "casehandler.h" @@ -51,6 +50,10 @@ class HouseStyle const std::string& filterDirectoryParameter, const std::string& filterFileParameter, const std::string& pathSeparatorParameter, +#ifdef __WXMSW__ + const std::string& aspellDataPathParameter, + const std::string& aspellDictPathParameter, +#endif int contextRangeParameter ); ~HouseStyle(); bool createReport(); @@ -59,13 +62,18 @@ class HouseStyle private: int type; std::string - buffer, - ruleDirectory, - ruleFile, - filterDirectory, - filterFile, - pathSeparator, - error; + buffer, + ruleDirectory, + ruleFile, + filterDirectory, + filterFile, + pathSeparator, + error, +#ifdef __WXMSW__ + aspellDataPath, + aspellDictPath +#endif + ; int contextRange; boost::shared_ptr > > ruleVector; std::map > > diff --git a/src/myipc.cpp b/src/myipc.cpp index 5d73770..881c916 100755 --- a/src/myipc.cpp +++ b/src/myipc.cpp @@ -70,6 +70,7 @@ bool MyServerConnection::OnPoke ( else { frame->openFile ( ( wxString& ) item ); + //frame->addToFileQueue ( ( wxString& ) item ); // prevent event loop problems } frame->Raise(); return true; diff --git a/src/myipc.h b/src/myipc.h index abe2679..97ca67e 100755 --- a/src/myipc.h +++ b/src/myipc.h @@ -20,6 +20,8 @@ #ifndef MY_IPC_H #define MY_IPC_H +//#define wxUSE_DDE_FOR_IPC 0 + #include #include diff --git a/src/styledialog.cpp b/src/styledialog.cpp index e5bc0f2..f30c590 100755 --- a/src/styledialog.cpp +++ b/src/styledialog.cpp @@ -57,6 +57,10 @@ StyleDialog::StyleDialog ( const wxString& browserParameter, const wxString& ruleSetPresetParameter, const wxString& filterPresetParameter, +#ifdef __WXMSW__ + const std::string& aspellDataPathParameter, + const std::string& aspellDictPathParameter, +#endif int typeParameter, bool readOnlyParameter, wxPoint position, @@ -75,6 +79,10 @@ StyleDialog::StyleDialog ( browser ( browserParameter ), ruleSetPreset ( ruleSetPresetParameter ), filterPreset ( filterPresetParameter ), +#ifdef __WXMSW__ + aspellDataPath ( aspellDataPathParameter ), + aspellDictPath ( aspellDictPathParameter ), +#endif type(typeParameter), readOnly ( readOnlyParameter ) { @@ -235,8 +243,8 @@ StyleDialog::StyleDialog ( config = new_aspell_config(); #ifdef __WXMSW__ - aspell_config_replace ( config, "data-dir", ASPELL_DATA_PATH ); - aspell_config_replace ( config, "dict-dir", ASPELL_DICT_PATH ); + aspell_config_replace ( config, "data-dir", aspellDataPath.c_str() ); //ASPELL_DATA_PATH ); + aspell_config_replace ( config, "dict-dir", aspellDictPath.c_str() ); //ASPELL_DICT_PATH ); #endif dlist = get_aspell_dict_info_list( config ); @@ -428,6 +436,10 @@ void StyleDialog::OnReport ( wxCommandEvent& event ) filterDirectoryUtf8, filterUtf8, pathSeparatorUtf8, + #ifdef __WXMSW__ + aspellDataPath, + aspellDictPath, + #endif 5 ) ); status->SetStatusText ( _ ( "Checking document..." ) ); @@ -589,6 +601,9 @@ void StyleDialog::OnStyleWebReport ( wxCommandEvent& event ) std::ofstream ofs ( tempNameUtf8.c_str() ); if ( !ofs ) return; + + WrapExpat we; + ofs << XHTML_START; ofs << "

"; ofs << fileName.mb_str ( wxConvUTF8 ); @@ -606,15 +621,15 @@ void StyleDialog::OnStyleWebReport ( wxCommandEvent& event ) ofs << ++matchCount; ofs << ""; ofs << ""; - ofs << it->prelog; + ofs << we.xmliseTextNode ( it->prelog ); ofs << ""; - ofs << it->match; + ofs << we.xmliseTextNode ( it->match ); ofs << ""; - ofs << it->postlog; + ofs << we.xmliseTextNode ( it->postlog ); ofs << ""; - ofs << it->replace; + ofs << we.xmliseTextNode ( it->replace ); ofs << ""; - ofs << it->report; + ofs << we.xmliseTextNode ( it->report ); ofs << ""; } ofs << ""; diff --git a/src/styledialog.h b/src/styledialog.h index 59ae711..7a1cba2 100755 --- a/src/styledialog.h +++ b/src/styledialog.h @@ -73,6 +73,10 @@ class StyleDialog : public wxDialog const wxString& browserParameter, const wxString& ruleSetPresetParameter, const wxString& filterPresetParameter, + #ifdef __WXMSW__ + const std::string& aspellDataPath, + const std::string& aspellDictPath, + #endif int type = ID_TYPE_STYLE, bool readOnlyParameter = false, wxPoint position = wxDefaultPosition, @@ -115,7 +119,7 @@ class StyleDialog : public wxDialog wxComboBox *ruleSetCombo, *filterCombo; wxListCtrl *table; wxStatusBar *status; - std::string bufferUtf8; + std::string bufferUtf8, aspellDataPath, aspellDictPath; std::set tempFiles; wxString fileName, ruleSetDirectory, filterDirectory, browser; wxString ruleSetPreset, filterPreset; diff --git a/src/validationthread.cpp b/src/validationthread.cpp index 1ec4c9c..9f3bbed 100644 --- a/src/validationthread.cpp +++ b/src/validationthread.cpp @@ -8,6 +8,8 @@ ValidationThread::ValidationThread ( const char *buffer, const char *system, + const char *catalogPath, + const char *catalogUtilityPath, bool *finished, bool *success, bool *release, @@ -21,6 +23,8 @@ ValidationThread::ValidationThread ( myBuffer = buffer; mySystem = system; + myCatalogPath = catalogPath; + myCatalogUtilityPath = catalogUtilityPath; myFinishedPtr = finished; mySuccessPtr = success; myReleasePtr = release; @@ -30,7 +34,9 @@ ValidationThread::ValidationThread ( void *ValidationThread::Entry() { - std::auto_ptr validator ( new WrapXerces() ); + std::auto_ptr validator ( new WrapXerces( + myCatalogPath, + myCatalogUtilityPath ) ); { //wxCriticalSectionLocker locker ( xmlcopyeditorCriticalSection ); @@ -45,8 +51,6 @@ void *ValidationThread::Entry() myBuffer.c_str(), mySystem.c_str(), myBuffer.size() ); - - { //wxCriticalSectionLocker locker ( xmlcopyeditorCriticalSection ); if ( *myReleasePtr || TestDestroy() ) diff --git a/src/validationthread.h b/src/validationthread.h index 2e8d2e7..d0bbd40 100644 --- a/src/validationthread.h +++ b/src/validationthread.h @@ -8,11 +8,19 @@ class ValidationThread : public wxThread { public: - ValidationThread ( const char *buffer, const char *system, bool *finished, bool *success, bool *release, std::pair *position, std::string *message ); + ValidationThread ( + const char *buffer, + const char *system, + const char *catalogPath, + const char *catalogUtilityPath, + bool *finished, + bool *success, + bool *release, std::pair *position, + std::string *message ); virtual void *Entry(); virtual void OnExit(); private: - std::string myBuffer, mySystem; + std::string myBuffer, mySystem, myCatalogPath, myCatalogUtilityPath; bool *myFinishedPtr, *mySuccessPtr, *myReleasePtr; std::pair *myPositionPtr; std::string *myMessagePtr; diff --git a/src/wrapaspell.cpp b/src/wrapaspell.cpp index 50b1f51..a51af2b 100755 --- a/src/wrapaspell.cpp +++ b/src/wrapaspell.cpp @@ -29,13 +29,20 @@ #include "aspellpaths.h" #endif -WrapAspell::WrapAspell ( std::string lang ) +WrapAspell::WrapAspell ( + std::string lang +#ifdef __WXMSW__ + , + const std::string& aspellDataPathParameter, + const std::string& aspellDictPathParameter +#endif +) { spell_config = new_aspell_config(); #ifdef __WXMSW__ - aspell_config_replace ( spell_config, "data-dir", ASPELL_DATA_PATH ); - aspell_config_replace ( spell_config, "dict-dir", ASPELL_DICT_PATH ); + aspell_config_replace ( spell_config, "data-dir", aspellDataPathParameter.c_str() );//ASPELL_DATA_PATH ); + aspell_config_replace ( spell_config, "dict-dir", aspellDictPathParameter.c_str() );//ASPELL_DICT_PATH ); #endif aspell_config_replace ( spell_config, "lang", lang.c_str() ); @@ -101,4 +108,3 @@ bool WrapAspell::checkWord ( char *s, size_t len ) { return aspell_speller_check ( spell_checker, s, len ); } - diff --git a/src/wrapaspell.h b/src/wrapaspell.h index 5d016e3..d038825 100755 --- a/src/wrapaspell.h +++ b/src/wrapaspell.h @@ -28,7 +28,13 @@ class WrapAspell { public: - WrapAspell ( std::string lang = "en_US" ); + WrapAspell ( + std::string lang,// = "en_US", +#ifdef __WXMSW__ + const std::string& aspellDataPathParameter, + const std::string& aspellDictPath +#endif + ); ~WrapAspell(); inline bool checkWord ( std::string &s ); void checkString ( @@ -36,6 +42,7 @@ class WrapAspell std::vector &v, int contextRange ); std::string getSuggestion ( std::string &s ); + std::string getVersion(); private: AspellConfig *spell_config; AspellSpeller *spell_checker; diff --git a/src/wrapexpat.cpp b/src/wrapexpat.cpp index 218bba9..d22591c 100755 --- a/src/wrapexpat.cpp +++ b/src/wrapexpat.cpp @@ -18,7 +18,7 @@ */ #include "wrapexpat.h" -#include "expat.h" +//#include "expat.h" #include #include #include diff --git a/src/wraplibxml.cpp b/src/wraplibxml.cpp index 858bdf2..232c3ea 100755 --- a/src/wraplibxml.cpp +++ b/src/wraplibxml.cpp @@ -533,7 +533,18 @@ std::string WrapLibxml::lookupPublicId ( const std::string& id ) char *s = ( char * ) xmlCatalogResolvePublic ( ( const xmlChar * ) id.c_str() ); if ( !s ) return ret; + + char *original, *it; + original = s; + + it = strstr ( s, "file://" ); + if ( it ) + { + s = it + 6; + } + ret = s; - free ( s ); + + free ( original ); return ret; } diff --git a/src/wrapxerces.cpp b/src/wrapxerces.cpp index ce71135..10d8d6b 100755 --- a/src/wrapxerces.cpp +++ b/src/wrapxerces.cpp @@ -31,7 +31,7 @@ using namespace xercesc; -WrapXerces::WrapXerces() +WrapXerces::WrapXerces( std::string catalogPath, std::string catalogUtilityPath ) { try { @@ -42,11 +42,13 @@ WrapXerces::WrapXerces() throw std::runtime_error ( "Cannot initialize Xerces" ); } errorPosition = std::make_pair ( 1, 1 ); + catalogResolver = new XercesCatalogResolver( catalogPath, catalogUtilityPath ); } WrapXerces::~WrapXerces() { - XMLPlatformUtils::Terminate(); + delete catalogResolver; + XMLPlatformUtils::Terminate(); } bool WrapXerces::validate ( const std::string& fileName ) @@ -61,11 +63,15 @@ bool WrapXerces::validate ( const std::string& fileName ) parser->setFeature ( XMLUni::fgXercesValidationErrorAsFatal, true ); parser->setFeature ( XMLUni::fgXercesLoadExternalDTD, true ); + DefaultHandler handler; MySAX2Handler mySAX2Handler; parser->setContentHandler ( &handler ); parser->setErrorHandler ( &mySAX2Handler ); - parser->setEntityResolver ( &handler ); + + //DefaultHandler handler; + //parser->setEntityResolver ( &handler ); + parser->setEntityResolver ( catalogResolver ); try { @@ -112,7 +118,7 @@ bool WrapXerces::validateMemory ( parser->setFeature ( XMLUni::fgSAX2CoreValidation, true ); parser->setFeature ( XMLUni::fgXercesDynamic, true ); parser->setFeature ( XMLUni::fgXercesSchema, true ); - parser->setFeature ( XMLUni::fgXercesSchemaFullChecking, true ); + //parser->setFeature ( XMLUni::fgXercesSchemaFullChecking, true ); parser->setFeature ( XMLUni::fgXercesValidationErrorAsFatal, true ); parser->setFeature ( XMLUni::fgXercesLoadExternalDTD, true ); @@ -120,7 +126,8 @@ bool WrapXerces::validateMemory ( MySAX2Handler mySAX2Handler; parser->setContentHandler ( &handler ); parser->setErrorHandler ( &mySAX2Handler ); - parser->setEntityResolver ( &handler ); + //parser->setEntityResolver ( &handler ); + parser->setEntityResolver ( catalogResolver ); XMLByte* xmlBuffer = (XMLByte*) buffer; MemBufInputSource source ( diff --git a/src/wrapxerces.h b/src/wrapxerces.h index f1c8bbe..26837a1 100755 --- a/src/wrapxerces.h +++ b/src/wrapxerces.h @@ -25,19 +25,22 @@ #include #include #include +#include "xercescatalogresolver.h" using namespace xercesc; class WrapXerces { public: - WrapXerces(); + WrapXerces( std::string catalogPath = "", + std::string catalogUtilityPath = "" ); ~WrapXerces(); bool validate ( const std::string& fileName ); bool validateMemory ( const char *buffer, const char *system, unsigned len ); std::string getLastError(); std::pair getErrorPosition(); private: + XercesCatalogResolver *catalogResolver; std::string lastError; std::pair errorPosition; }; diff --git a/src/xmlcopyeditor.cpp b/src/xmlcopyeditor.cpp index 9c75fa6..b4b808e 100755 --- a/src/xmlcopyeditor.cpp +++ b/src/xmlcopyeditor.cpp @@ -158,10 +158,10 @@ BEGIN_EVENT_TABLE ( MyFrame, wxFrame ) EVT_UPDATE_UI ( wxID_CLOSE, MyFrame::OnUpdateDocRange ) EVT_UPDATE_UI ( wxID_SAVEAS, MyFrame::OnUpdateDocRange ) EVT_UPDATE_UI ( wxID_CLOSE_ALL, MyFrame::OnUpdateCloseAll ) - // EVT_UPDATE_UI_RANGE ( ID_SPLIT_TAB_TOP, ID_SPLIT_TAB_LEFT, MyFrame::OnUpdateCloseAll ) - EVT_UPDATE_UI ( wxID_REVERT, MyFrame::OnUpdateSaveUndo ) + EVT_UPDATE_UI_RANGE ( ID_SPLIT_TAB_TOP, ID_SPLIT_TAB_LEFT, MyFrame::OnUpdateCloseAll ) + EVT_UPDATE_UI ( wxID_REVERT, MyFrame::OnUpdateUndo ) EVT_UPDATE_UI ( wxID_SAVE, MyFrame::OnUpdateDocRange ) // always allow save if doc present - EVT_UPDATE_UI ( wxID_UNDO, MyFrame::OnUpdateSaveUndo ) + EVT_UPDATE_UI ( wxID_UNDO, MyFrame::OnUpdateUndo ) EVT_UPDATE_UI ( wxID_REDO, MyFrame::OnUpdateRedo ) EVT_UPDATE_UI ( wxID_PASTE, MyFrame::OnUpdatePaste ) EVT_UPDATE_UI ( wxID_CUT, MyFrame::OnUpdateCutCopy ) @@ -174,18 +174,18 @@ BEGIN_EVENT_TABLE ( MyFrame, wxFrame ) EVT_UPDATE_UI ( ID_RELOAD, MyFrame::OnUpdateReload ) EVT_IDLE ( MyFrame::OnIdle ) EVT_AUINOTEBOOK_PAGE_CLOSE ( wxID_ANY, MyFrame::OnPageClosing ) - #ifdef __WXMSW__ +#ifdef __WXMSW__ EVT_DROP_FILES ( MyFrame::OnDropFiles ) - #endif +#endif END_EVENT_TABLE() IMPLEMENT_APP ( MyApp) MyApp::MyApp() : checker ( NULL ), server ( NULL ), connection ( NULL ), #ifdef __WXMSW__ - config ( new wxConfig ( _T ( "SourceForge Project\\XML Copy Editor" ) ) ) + config ( new wxFileConfig ( _T ( ".xmlcopyeditor" ) ) )//( _T ( "SourceForge Project\\XML Copy Editor" ) ) ) #else - config ( new wxConfig ( _T ( "xmlcopyeditor" ) ) ) + config ( new wxFileConfig ( _T ( "xmlcopyeditor" ) ) ) #endif { lang = 0; @@ -315,7 +315,7 @@ bool MyApp::OnInit() if ( singleInstanceCheck ) { - checker = new wxSingleInstanceChecker ( name ); + checker = new wxSingleInstanceChecker ( name ); while ( checker->IsAnotherRunning() ) { // attempt calling server @@ -336,7 +336,8 @@ bool MyApp::OnInit() { argument = ( wxString ) this->argv[i]; argument = PathResolver::run ( argument ); - connection->Poke ( argument, whatBuffer ); + if ( ! connection->Poke ( argument, whatBuffer ) ) + break; } } else @@ -529,7 +530,7 @@ void MyApp::HandleEvent ( wxEvtHandler *handler, wxEventFunction func, wxEvent& MyFrame::MyFrame ( const wxString& title, - wxConfig *configParameter, + wxFileConfig *configParameter, wxLocale& locale, bool singleInstanceCheckParameter, int langParameter ) : @@ -981,8 +982,8 @@ MyFrame::~MyFrame() config->Write ( _T ( "protectTags" ), protectTags ); config->Write ( _T ( "visibilityState" ), visibilityState ); config->Write ( _T ( "browserCommand" ), browserCommand ); - config->Write ( _T ( "layout" ), layout ); - config->Write ( _T ( "showLocationPane" ), manager.GetPane ( locationPanel ).IsShown() ); + // config->Write ( _T ( "layout" ), layout ); // omit while unused + config->Write ( _T ( "showLocationPane" ), manager.GetPane ( locationPanel ).IsShown() ); config->Write ( _T ( "showInsertChildPane" ), manager.GetPane ( insertChildPanel ).IsShown() ); config->Write ( _T ( "showInsertSiblingPane" ), manager.GetPane ( insertSiblingPanel ).IsShown() ); config->Write ( _T ( "showInsertEntityPane" ), manager.GetPane ( insertEntityPanel ).IsShown() ); @@ -1451,22 +1452,13 @@ void MyFrame::OnPaste ( wxCommandEvent& event ) wxTextDataObject data; wxTheClipboard->GetData ( data ); wxString buffer = data.GetText(); + wxTheClipboard->Close(); xmliseWideTextNode ( buffer ); doc->adjustCursor(); doc->AddText ( buffer ); } else doc->Paste(); - - /* - XmlDoc *doc; - doc = getActiveDocument(); - if (doc && protectTags) - doc->adjustCursor(); - - doc->setValidationRequired(true); - event.Skip(); // new - */ } void MyFrame::OnIdle ( wxIdleEvent& event ) @@ -1475,6 +1467,15 @@ void MyFrame::OnIdle ( wxIdleEvent& event ) if ( !status ) return; + /* + // IPC handling: take one file from fileQueue at a time + if ( !fileQueue.empty() ) + { + openFile ( * ( fileQueue.begin() ) ); + fileQueue.erase( fileQueue.begin() ); + } + */ + // update attributes hidden field even if no document loaded wxString currentHiddenStatus = status->GetStatusText ( STATUS_HIDDEN ); if ( visibilityState == HIDE_ATTRIBUTES ) @@ -1557,7 +1558,7 @@ void MyFrame::OnIdle ( wxIdleEvent& event ) if ( frameTitle != docTitle ) SetTitle ( docTitle ); - // update modified field + // update modified field if ( !mainBook ) return; int index = mainBook->GetSelection(); @@ -1799,6 +1800,7 @@ void MyFrame::OnPasteNewDocument ( wxCommandEvent& event ) buffer.Append ( _T ( "\n" ) ); newDocument ( buffer ); + wxTheClipboard->Close(); } void MyFrame::OnDialogFind ( wxFindDialogEvent& event ) @@ -2278,7 +2280,6 @@ void MyFrame::OnSplitTab ( wxCommandEvent& event ) direction = wxAUI_NB_RIGHT; switch ( id ) { - /* ID_SPLIT_TAB_TOP: direction = wxAUI_NB_TOP; break; @@ -2291,7 +2292,6 @@ void MyFrame::OnSplitTab ( wxCommandEvent& event ) ID_SPLIT_TAB_LEFT: direction = wxAUI_NB_LEFT; break; - */ default: direction = wxAUI_NB_RIGHT; break; @@ -2726,6 +2726,7 @@ void MyFrame::newDocument ( const std::string& s, const std::string& path, bool s.c_str(), // modified s.size(), // new catalogPath, + catalogUtilityPath, path, auxPath ); mainBook->AddPage ( ( wxWindow * ) doc, documentLabel, true ); @@ -3040,6 +3041,7 @@ bool MyFrame::openFile ( wxString& fileName, bool largeFile ) finalBuffer, finalBufferLen, catalogPath, + catalogUtilityPath, ( const char * ) fileName.mb_str ( wxConvLocal ), auxPath ); #ifdef __WXMSW__ @@ -3114,7 +3116,8 @@ bool MyFrame::openFile ( wxString& fileName, bool largeFile ) if ( !largeFile && ( properties.validateAsYouType && doc->getGrammarFound() ) ) { statusProgress ( _T ( "Validating document..." ) ); - doc->backgroundValidate ( finalBuffer, doc->getFullFileName().mb_str(wxConvUTF8), finalBufferLen ); + //doc->backgroundValidate ( finalBuffer, doc->getFullFileName().mb_str(wxConvUTF8), finalBufferLen ); + doc->backgroundValidate(); statusProgress ( wxEmptyString ); } @@ -3262,9 +3265,13 @@ void MyFrame::OnSpelling ( wxCommandEvent& event ) ruleSetDir, filterDir, browserCommand, - ( type == ID_TYPE_SPELL ) ? dictionaryPreset : ruleSetPreset, + ( type == ID_TYPE_SPELL ) ? dictionaryPreset : ruleSetPreset, filterPreset, - type, + #ifdef __WXMSW__ + aspellDataPath, + aspellDictPath, + #endif + type, ( success ) ? false : true, stylePosition, styleSize ) ); @@ -3511,7 +3518,7 @@ void MyFrame::OnUpdateFindAgain ( wxUpdateUIEvent& event ) event.Enable ( true ); } -void MyFrame::OnUpdateSaveUndo ( wxUpdateUIEvent& event ) +void MyFrame::OnUpdateUndo ( wxUpdateUIEvent& event ) { XmlDoc *doc; if ( ( doc = getActiveDocument() ) == NULL ) @@ -3519,8 +3526,11 @@ void MyFrame::OnUpdateSaveUndo ( wxUpdateUIEvent& event ) event.Enable ( false ); return; } - //event.Enable((doc->CanUndo()) ? true : false); +#ifdef __WXMSW__ + event.Enable((doc->CanUndo()) ? true : false); +#else event.Enable ( ( doc->GetModify() ) ? true : false ); +#endif } void MyFrame::OnUpdateRedo ( wxUpdateUIEvent& event ) @@ -3760,6 +3770,7 @@ void MyFrame::OnValidateSchema ( wxCommandEvent& event ) // branch: if no XML Schema found, use LibXML DTD parser instead // so the catalog is read - switch when Xerces-C implements // XMLCatalogResolver +#ifdef __WXMSW__ { std::string rawBuffer, schemaLocation; getRawText ( doc, rawBuffer ); @@ -3771,6 +3782,7 @@ void MyFrame::OnValidateSchema ( wxCommandEvent& event ) return; } } +#endif wxString fileName; std::string tempFileNameLocal; @@ -3800,7 +3812,9 @@ void MyFrame::OnValidateSchema ( wxCommandEvent& event ) std::string error; wxString wideError; - std::auto_ptr validator ( new WrapXerces() ); + std::auto_ptr validator ( + new WrapXerces( catalogPath, catalogUtilityPath ) + ); std::string fileNameLocal = ( const char * ) fileName.mb_str ( wxConvLocal ); if ( !validator->validate ( fileNameLocal ) ) { @@ -3813,11 +3827,10 @@ void MyFrame::OnValidateSchema ( wxCommandEvent& event ) int cursorPos = doc->PositionFromLine ( posPair.first - 1 ); doc->SetSelection ( cursorPos, cursorPos ); - doc->setErrorIndicator ( posPair.first - 1, 0 ); //posPair.second ); + doc->setErrorIndicator ( posPair.first - 1, 0 ); } else documentOk ( _ ( "valid" ) ); -//#endif } void MyFrame::OnXPath ( wxCommandEvent& event ) @@ -4605,7 +4618,7 @@ bool MyFrame::saveFile ( XmlDoc *doc, wxString& fileName, bool checkLastModified finalBuffer = iconvBuffer; // iconvBuffer will be incremented by iconv size_t nconv; -#ifdef __WXMSW_ +#ifdef __WXMSW__ const char * #else char * @@ -4748,7 +4761,8 @@ bool MyFrame::saveFile ( XmlDoc *doc, wxString& fileName, bool checkLastModified if ( properties.validateAsYouType && isXml ) { doc->clearErrorIndicators(); - doc->backgroundValidate ( utf8Buffer.c_str(), doc->getFullFileName().mb_str(wxConvUTF8), utf8Buffer.size() ); + //doc->backgroundValidate ( utf8Buffer.c_str(), doc->getFullFileName().mb_str(wxConvUTF8), utf8Buffer.size() ); + doc->backgroundValidate(); } if ( !unlimitedUndo ) @@ -4950,13 +4964,13 @@ wxMenuBar *MyFrame::getMenuBar() break; } - /* WAIT FOR AUI LIBRARY TO SUPPORT THIS - currently always splits left + /* WAIT FOR AUI LIBRARY TO SUPPORT THIS - currently always splits left wxMenu *splitTabMenu = new wxMenu; splitTabMenu->Append ( ID_SPLIT_TAB_TOP, _ ( "&Top" ), _ ( "Top" )); splitTabMenu->Append ( ID_SPLIT_TAB_RIGHT, _ ( "&Right" ), _ ( "Right" )); splitTabMenu->Append ( ID_SPLIT_TAB_BOTTOM, _ ( "&Bottom" ), _ ( "Bottom" )); splitTabMenu->Append ( ID_SPLIT_TAB_LEFT, _ ( "&Left" ), _ ( "Left" )); - */ + */ viewMenu = new wxMenu; // use class-wide data member viewMenu->Append ( ID_PREVIOUS_DOCUMENT, _ ( "&Previous Document\tCtrl+PgUp" ), _ ( "Previous Document" ) ); @@ -5333,11 +5347,7 @@ wxToolBar *MyFrame::getToolBar() wxTB_HORIZONTAL | wxTB_DOCKABLE ); int w, h; -//#ifdef __WXMSW__ w = saveBitmap.GetWidth(), h = saveBitmap.GetHeight(); -//#else -// w = h = 24; -//#endif toolBar->SetToolBitmapSize ( wxSize ( w, h ) ); toolBar->AddTool ( @@ -5623,6 +5633,8 @@ void MyFrame::updatePaths() applicationDir + wxFileName::GetPathSeparator() + _T ( "catalog" ) + wxFileName::GetPathSeparator() + _T ( "catalog" ); catalogPath = wideCatalogPath.mb_str ( wxConvLocal ); + wxString wideCatalogUtilityPath = applicationDir + wxFileName::GetPathSeparator() + _T ( "xmlcatalog" ); + catalogUtilityPath = wideCatalogUtilityPath.mb_str ( wxConvLocal ); wxString wideXslDtdPath = applicationDir + wxFileName::GetPathSeparator() + _T ( "dtd" ) + wxFileName::GetPathSeparator() + _T ( "xslt10.dtd" ); @@ -5643,6 +5655,12 @@ void MyFrame::updatePaths() applicationDir + wxFileName::GetPathSeparator() + _T ( "dtd" ) + wxFileName::GetPathSeparator() + _T ( "xliff.dtd" ); xliffDtdPath = wideXliffDtdPath.mb_str ( wxConvLocal ); + wxString wideAspellDataPath = applicationDir + wxFileName::GetPathSeparator() + + _T ( "aspell" ) + wxFileName::GetPathSeparator() + _T ( "data" ); + aspellDataPath = wideAspellDataPath.mb_str ( wxConvLocal ); + wxString wideAspellDictPath = applicationDir + wxFileName::GetPathSeparator() + + _T ( "aspell" ) + wxFileName::GetPathSeparator() + _T ( "dict" ); + aspellDictPath = wideAspellDictPath.mb_str ( wxConvLocal ); } void MyFrame::OnAssociate ( wxCommandEvent& event ) @@ -6018,3 +6036,7 @@ void MyFrame::setStrictScrolling ( bool b ) ( b ) ? 10 : 0 ); } +void MyFrame::addToFileQueue ( wxString& fileName ) +{ + fileQueue.push_back ( fileName ); +} diff --git a/src/xmlcopyeditor.h b/src/xmlcopyeditor.h index 15ca73e..f2c7499 100755 --- a/src/xmlcopyeditor.h +++ b/src/xmlcopyeditor.h @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -184,7 +185,7 @@ class MyApp : public wxApp MyClientConnection *connection; bool singleInstanceCheck; int lang; - std::auto_ptr config; + std::auto_ptr config; }; // forward declarations @@ -203,7 +204,7 @@ class MyFrame : public wxFrame public: MyFrame ( const wxString& title, - wxConfig *configParameter, + wxFileConfig *configParameter, wxLocale& locale, bool singleInstanceCheck, int langParameter ); @@ -266,7 +267,7 @@ class MyFrame : public wxFrame void OnIdle ( wxIdleEvent& event ); void OnUpdateClosePane ( wxUpdateUIEvent& event ); void OnUpdateCloseAll ( wxUpdateUIEvent& event ); - void OnUpdateSaveUndo ( wxUpdateUIEvent& event ); + void OnUpdateUndo ( wxUpdateUIEvent& event ); void OnUpdatePreviousDocument ( wxUpdateUIEvent& event ); void OnUpdateSavedOnly ( wxUpdateUIEvent& event ); void OnUpdateNextDocument ( wxUpdateUIEvent& event ); @@ -337,10 +338,11 @@ class MyFrame : public wxFrame bool isOpen ( const wxString& fileName ); bool activateTab ( const wxString& fileName ); void reloadTab(); + void addToFileQueue ( wxString& fileName ); private: wxAuiManager manager; - wxConfig *config; // owned by MyApp - wxLocale& myLocale; + wxFileConfig *config; // owned by MyApp + wxLocale& myLocale; bool singleInstanceCheck; int lang, lastPos; wxLogNull logTarget; @@ -365,15 +367,15 @@ class MyFrame : public wxFrame MyNotebook *mainBook; MyHtmlPane *htmlReport; - std::string catalogPath, xslDtdPath, rssDtdPath, lzxDtdPath, xtmDtdPath, - xliffDtdPath; + std::string catalogPath, catalogUtilityPath, xslDtdPath, rssDtdPath, lzxDtdPath, xtmDtdPath, + xliffDtdPath, aspellDataPath, aspellDictPath; std::pair controlCoordinates; std::map > > promptMap; std::map validationPresetMap; std::set openFileSet; std::set openLargeFileSet; - std::vector tempFileVector; + std::vector tempFileVector, fileQueue; int documentCount, framePosX, framePosY, @@ -385,33 +387,33 @@ class MyFrame : public wxFrame wxPoint stylePosition, aboutPosition; wxSize styleSize; wxString applicationDir, - ruleSetPreset, - dictionaryPreset, - filterPreset, - ruleSetDir, - filterDir, - binDir, - templateDir, - helpDir, - rngDir, - htmlDir, - pngDir, - xpathExpression, - lastDtdPublic, - lastDtdSystem, - lastSchema, - lastSchemaNamespace, - lastXslStylesheet, - lastSchemaNamespaceAux, - lastRelaxNGSchema, - lastDtdPublicAux, - openTabsOnClose, - browserCommand, - layout, - defaultLayout, - lastParent, - lastGrandparent, - commandString; + ruleSetPreset, + dictionaryPreset, + filterPreset, + ruleSetDir, + filterDir, + binDir, + templateDir, + helpDir, + rngDir, + htmlDir, + pngDir, + xpathExpression, + lastDtdPublic, + lastDtdSystem, + lastSchema, + lastSchemaNamespace, + lastXslStylesheet, + lastSchemaNamespaceAux, + lastRelaxNGSchema, + lastDtdPublicAux, + openTabsOnClose, + browserCommand, + layout, + defaultLayout, + lastParent, + lastGrandparent, + commandString; bool globalReplaceAllDocuments, toolbarVisible, protectTags, diff --git a/src/xmlcopyeditor_private.h b/src/xmlcopyeditor_private.h index f9b9b72..f8bf327 100755 --- a/src/xmlcopyeditor_private.h +++ b/src/xmlcopyeditor_private.h @@ -1,22 +1,3 @@ -/* - * Copyright 2005-2007 Gerald Schmidt. - * - * This file is part of Xml Copy Editor. - * - * Xml Copy Editor is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * Xml Copy Editor is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Xml Copy Editor; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - /* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */ /* DO NOT EDIT ! */ diff --git a/src/xmlcopyeditorcopy.h b/src/xmlcopyeditorcopy.h index ab2e531..11de7a3 100755 --- a/src/xmlcopyeditorcopy.h +++ b/src/xmlcopyeditorcopy.h @@ -41,5 +41,5 @@ "License along with this program; if not, write to the Free\n"\ "Software Foundation, Inc., 59 Temple Place, Suite 330,\n"\ "Boston, MA 02111-1307 USA.") -#define ABOUT_VERSION _T("1.2.0") +#define ABOUT_VERSION _T("1.2.0.3") #define XMLCE_VAR _T("XMLCE_VAR") diff --git a/src/xmlctrl.cpp b/src/xmlctrl.cpp index 9e98c54..103f7f4 100755 --- a/src/xmlctrl.cpp +++ b/src/xmlctrl.cpp @@ -21,7 +21,7 @@ #include "xmlpromptgenerator.h" #include "xmlshallowvalidator.h" #include "xmlencodinghandler.h" -#include "wrapxerces.h" +//#include "wrapxerces.h" #include "xmlcopyeditor.h" // needed to enable validation-as-you-type alerts #include #include @@ -53,6 +53,7 @@ XmlCtrl::XmlCtrl ( const char *buffer, // could be NULL size_t bufferLen, const std::string& catalogPathParameter, + const std::string& catalogUtilityPathParameter, const std::string& basePathParameter, const std::string& auxPathParameter, const wxPoint& position, @@ -62,6 +63,7 @@ XmlCtrl::XmlCtrl ( protectTags ( protectTagsParameter ), visibilityState ( visibilityStateParameter ), catalogPath ( catalogPathParameter ), + catalogUtilityPath ( catalogUtilityPathParameter ), basePath ( basePathParameter ), auxPath ( auxPathParameter ) { @@ -142,7 +144,6 @@ XmlCtrl::~XmlCtrl() } delete validationReleasePtr; - } @@ -244,7 +245,7 @@ void XmlCtrl::handleBackspace ( wxKeyEvent& event ) if ( canMoveLeftAt ( GetCurrentPos() ) ) { - event.Skip(); + DeleteBack();//event.Skip(); return; } @@ -269,13 +270,13 @@ void XmlCtrl::handleBackspace ( wxKeyEvent& event ) if ( *protectTags ) adjustSelection(); else - event.Skip(); + DeleteBack();//event.Skip(); return; } if ( !properties.deleteWholeTag ) { if ( ! ( *protectTags ) ) - event.Skip(); + DeleteBack();//event.Skip(); return; } // delete tag to left of caret @@ -352,7 +353,11 @@ void XmlCtrl::handleDelete ( wxKeyEvent& event ) end = GetSelectionEnd(); startLine = LineFromPosition ( start ); endLine = LineFromPosition ( end ); - if ( startLine != endLine ) + + // add test so range unindentation only happens when caret is flush with left margin + int column = GetColumn ( GetCurrentPos() ); + + if ( startLine != endLine && !column) { if ( startLine > endLine ) { @@ -398,13 +403,13 @@ void XmlCtrl::handleDelete ( wxKeyEvent& event ) if ( *protectTags ) adjustSelection(); else - event.Skip(); + DeleteBack();//event.Skip(); return; } if ( !properties.deleteWholeTag ) { if ( ! ( *protectTags ) ) - event.Skip(); + DeleteBack();//event.Skip(); return; } @@ -414,7 +419,7 @@ void XmlCtrl::handleDelete ( wxKeyEvent& event ) { if ( limitPos > ( currentPos + BUFSIZ ) ) { - event.Skip(); + DeleteBack();//event.Skip(); return; } } @@ -445,7 +450,7 @@ void XmlCtrl::handleDelete ( wxKeyEvent& event ) break; else if ( GetCharAt ( limitPos ) == '\n' || limitPos > ( currentPos + BUFSIZ ) ) { - event.Skip(); + DeleteBack();//event.Skip(); return; } } @@ -1434,12 +1439,12 @@ void XmlCtrl::setColorScheme ( int scheme ) StyleSetBackground ( wxSTC_STYLE_DEFAULT, *wxWHITE ); StyleClearAll(); - baseBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "CYAN" ) ), 70 ); - alternateBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "CYAN" ) ), 90 ); + baseBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "CYAN" ) ), 75 ); + alternateBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "CYAN" ) ), 95 ); SetCaretLineBackground ( baseBackground ); SetCaretForeground ( *wxBLACK ); - SetSelBackground ( true, wxTheColourDatabase->Find ( _T ( "LIGHT GREY" ) ) ); + SetSelBackground ( true, LightColour ( wxTheColourDatabase->Find ( _T ( "YELLOW" ) ), 20));//wxTheColourDatabase->Find ( _T ( "LIGHT GREY" ) ) ); if ( type == FILE_TYPE_CSS ) { @@ -1501,12 +1506,12 @@ void XmlCtrl::setColorScheme ( int scheme ) StyleSetBackground ( wxSTC_STYLE_DEFAULT, *wxWHITE ); StyleClearAll(); - baseBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "YELLOW" ) ), 20 ); - alternateBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "YELLOW" ) ), 60 ); + baseBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "CYAN" ) ), 75 ); + alternateBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "CYAN" ) ), 95 ); SetCaretLineBackground ( baseBackground ); SetCaretForeground ( *wxBLACK ); - SetSelBackground ( true, wxTheColourDatabase->Find ( _T ( "LIGHT GREY" ) ) ); + SetSelBackground ( true, LightColour ( wxTheColourDatabase->Find ( _T ( "YELLOW" ) ), 20) );//wxTheColourDatabase->Find ( _T ( "LIGHT GREY" ) ) ); if ( type == FILE_TYPE_CSS ) { @@ -1688,8 +1693,8 @@ void XmlCtrl::setColorScheme ( int scheme ) } break; case COLOR_SCHEME_NONE: - baseBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "YELLOW" ) ), 20 ); - alternateBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "YELLOW" ) ), 60 ); + baseBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "CYAN" ) ), 75 ); + alternateBackground = LightColour ( wxTheColourDatabase->Find ( _T ( "CYAN" ) ), 95 ); SetCaretLineBackground ( baseBackground ); SetSelBackground ( true, wxTheColourDatabase->Find ( _T ( "LIGHT GREY" ) ) ); @@ -2033,6 +2038,8 @@ bool XmlCtrl::backgroundValidate() return true; std::string bufferUtf8 = myGetTextRaw(); + + XmlEncodingHandler::setUtf8( bufferUtf8, true ); return backgroundValidate ( bufferUtf8.c_str(), @@ -2043,7 +2050,7 @@ bool XmlCtrl::backgroundValidate() bool XmlCtrl::backgroundValidate ( const char *buffer, const char *system, - size_t bufferLen + size_t bufferLen ) { if ( !validationRequired ) @@ -2061,6 +2068,8 @@ bool XmlCtrl::backgroundValidate ( validationThread = new ValidationThread( buffer, system, + catalogPath.c_str(), + catalogUtilityPath.c_str(), &validationFinished, &validationSuccess, validationReleasePtr, diff --git a/src/xmlctrl.h b/src/xmlctrl.h index cb71a2b..7173bf7 100755 --- a/src/xmlctrl.h +++ b/src/xmlctrl.h @@ -102,6 +102,7 @@ class XmlCtrl: public wxStyledTextCtrl const char *buffer = NULL, size_t bufferLen = 0, const std::string& catalogPath = "", + const std::string& catalogUtilityPath = "", const std::string& basePath = "", const std::string& auxPath = "", const wxPoint &position = wxDefaultPosition, @@ -168,7 +169,7 @@ class XmlCtrl: public wxStyledTextCtrl std::map > elementMap; std::set entitySet; std::map elementStructureMap; - std::string catalogPath, basePath, auxPath; + std::string catalogPath, catalogUtilityPath, basePath, auxPath; XmlCtrlProperties properties; wxString getLastAttributeName ( int pos ); int getAttributeStartPos ( int pos ); diff --git a/src/xmldoc.cpp b/src/xmldoc.cpp index 8034b8e..706a9db 100755 --- a/src/xmldoc.cpp +++ b/src/xmldoc.cpp @@ -31,6 +31,7 @@ XmlDoc::XmlDoc ( const char *buffer, size_t bufferLen, const std::string& catalogPath, + const std::string& catalogUtilityPath, const std::string& basePath, const std::string& auxPath, const wxPoint &position, @@ -46,6 +47,7 @@ XmlDoc::XmlDoc ( buffer, bufferLen, // new catalogPath, + catalogUtilityPath, basePath, auxPath, position, diff --git a/src/xmldoc.h b/src/xmldoc.h index fe83b43..b0c0670 100755 --- a/src/xmldoc.h +++ b/src/xmldoc.h @@ -39,6 +39,7 @@ class XmlDoc : public XmlCtrl const char *buffer = NULL, size_t bufferLen = 0, const std::string& catalogPath = "", + const std::string& catalogUtilityPath = "", const std::string& basePath = "", const std::string& auxPath = "", const wxPoint& position = wxDefaultPosition, diff --git a/src/xmlencodinghandler.cpp b/src/xmlencodinghandler.cpp index 70a932a..cdfd01a 100755 --- a/src/xmlencodinghandler.cpp +++ b/src/xmlencodinghandler.cpp @@ -128,3 +128,4 @@ XmlEncodingHandler::getEncodingValueLimits ( const std::string& utf8 ) return make_pair ( -1, -1 ); return make_pair ( start - buffer, end - start ); } + diff --git a/src/xmlpromptgenerator.cpp b/src/xmlpromptgenerator.cpp index 19cd543..48a95a2 100755 --- a/src/xmlpromptgenerator.cpp +++ b/src/xmlpromptgenerator.cpp @@ -26,6 +26,8 @@ #include "replace.h" #include "getword.h" #include "pathresolver.h" + +#undef XMLCALL #include "catalogresolver.h" // Xerces-C req'd for Schema parsing @@ -39,6 +41,7 @@ #include #include #include +//#include "wrapxerces.h" using namespace xercesc; @@ -84,7 +87,7 @@ void XMLCALL XmlPromptGenerator::starthandler ( if (d->isRootElement) { d->rootElement = el; - handleSchema ( d, el, attr ); + handleSchema ( d, el, attr ); // experimental: schema has been pre-parsed d->isRootElement = false; if ( ! (d->elementMap.empty() ) )//if ( d->elementMap.size() == 1) // must be 1 for success { @@ -304,7 +307,8 @@ int XMLCALL XmlPromptGenerator::externalentityrefhandler ( if ( publicId ) stdPublicId = publicId; - std::string stdSystemId = CatalogResolver::lookupPublicId ( stdPublicId, d->catalogPath ); + CatalogResolver cr ( d->catalogPath ); + std::string stdSystemId = cr.lookupPublicId ( stdPublicId ); if ( !stdSystemId.empty() ) { @@ -312,6 +316,7 @@ int XMLCALL XmlPromptGenerator::externalentityrefhandler ( Replace::run ( stdSystemId, "%20", " ", false ); #ifdef __WXMSW__ + Replace::run ( stdSystemId, "//C:/", "C:\\", false ); Replace::run ( stdSystemId, "/C:/", "C:\\", false ); Replace::run ( stdSystemId, "/", "\\", false ); #endif @@ -523,6 +528,3 @@ void XmlPromptGenerator::handleSchema ( delete parser; XMLPlatformUtils::Terminate(); } - - - diff --git a/src/xmlpromptgenerator.h b/src/xmlpromptgenerator.h index 771455a..d3fb40c 100755 --- a/src/xmlpromptgenerator.h +++ b/src/xmlpromptgenerator.h @@ -20,7 +20,7 @@ #ifndef XML_PROMPT_GENERATOR_H #define XML_PROMPT_GENERATOR_H -#include +//#include #include #include #include