diff --git a/src/.cproject b/src/.cproject index e6963f6..80e6296 100644 --- a/src/.cproject +++ b/src/.cproject @@ -26,8 +26,9 @@ - - + + + @@ -51,24 +52,22 @@ - - - - - - - - - - - + + + + + + + + + + + - - @@ -87,7 +86,7 @@ - + @@ -129,8 +128,9 @@ - - + + + @@ -153,24 +153,22 @@ - - - - - - - - - - - + + + + + + + + + + + - - @@ -189,7 +187,7 @@ - + @@ -238,6 +236,6 @@ - + diff --git a/src/housestyle.cpp b/src/housestyle.cpp index aa25904..afe56c2 100755 --- a/src/housestyle.cpp +++ b/src/housestyle.cpp @@ -146,7 +146,7 @@ void HouseStyle::collectRules ( string& fileName, if ( report != "" ) throw runtime_error ( report.c_str() ); else - throw runtime_error ( xrr->getLastError().c_str() ); + throw runtime_error ( ( const char * ) xrr->getLastError().utf8_str() ); } // add current file to exclude set diff --git a/src/mynotebook.cpp b/src/mynotebook.cpp index 796efd6..7d0909e 100755 --- a/src/mynotebook.cpp +++ b/src/mynotebook.cpp @@ -39,7 +39,7 @@ MyNotebook::MyNotebook ( { rightClickPage = -1; - wxApp::GetInstance()->Connect ( wxEVT_KEY_DOWN, + wxTheApp->Connect ( wxEVT_KEY_DOWN, wxKeyEventHandler ( MyNotebook::OnKeyDown ), NULL, this ); } @@ -125,7 +125,8 @@ void MyNotebook::OnKeyDown ( wxKeyEvent &event ) AdvanceSelection ( !event.m_shiftDown ); - XmlDoc *doc = ( XmlDoc * ) GetCurrentPage(); + int cur = GetSelection(); + XmlDoc *doc = ( XmlDoc * ) GetPage ( cur ); if ( doc != NULL ) doc->SetFocus(); } diff --git a/src/mypropertysheet.cpp b/src/mypropertysheet.cpp index 27b1c30..4099c28 100755 --- a/src/mypropertysheet.cpp +++ b/src/mypropertysheet.cpp @@ -41,6 +41,7 @@ MyPropertySheet::MyPropertySheet ( bool expandInternalEntitiesParameter, bool showFullPathOnFrameParameter, int lang, + const wxArrayString &translations, wxWindowID id, wxString title, const wxPoint& position, @@ -165,24 +166,19 @@ MyPropertySheet::MyPropertySheet ( generalPanel, wxID_ANY ); - wxTranslations *t = wxTranslations::Get(); - if ( t != NULL ) + int index; + const wxLanguageInfo *info; + wxArrayString::const_iterator trans = translations.begin(); + for ( ; trans != translations.end(); trans++ ) { - int index; - const wxLanguageInfo *info; - wxArrayString langs = t->GetAvailableTranslations ( _T ( "messages" ) ); - for ( size_t i = 0; i < langs.Count(); i++ ) - { - info = wxLocale::FindLanguageInfo ( langs[i] ); - if ( info == NULL ) continue; + info = wxLocale::FindLanguageInfo ( *trans ); + if ( info == NULL ) continue; - index = languageBox->Append ( info->Description, (void*)info->Language ); - if (lang == info->Language) - languageBox->SetSelection ( index ); - } + index = languageBox->Append ( info->Description, (void*)info->Language ); + if (lang == info->Language) + languageBox->SetSelection ( index ); } - libxmlNetAccessBox = new wxCheckBox ( generalPanel, wxID_ANY, _ ( "&Enable network access for DTD validation" ) ); libxmlNetAccessBox->SetValue ( libxmlNetAccessParameter ); diff --git a/src/mypropertysheet.h b/src/mypropertysheet.h index 687fc32..8c0103a 100755 --- a/src/mypropertysheet.h +++ b/src/mypropertysheet.h @@ -47,6 +47,7 @@ class MyPropertySheet : public wxPropertySheetDialog bool expandInternalEntities, bool showFullPathOnFrame, int lang, + const wxArrayString &translations, wxWindowID id = wxID_ANY, wxString title = _T ( "" ), const wxPoint& position = wxDefaultPosition, diff --git a/src/validationthread.cpp b/src/validationthread.cpp index 02bef58..b6a370c 100644 --- a/src/validationthread.cpp +++ b/src/validationthread.cpp @@ -6,7 +6,7 @@ #include -wxDEFINE_EVENT(wxEVT_COMMAND_VALIDATION_COMPLETED, wxThreadEvent); +DEFINE_EVENT_TYPE(wxEVT_COMMAND_VALIDATION_COMPLETED); ValidationThread::ValidationThread ( wxEvtHandler *handler, @@ -67,8 +67,8 @@ void *ValidationThread::Entry() myMessage = validator->getLastError(); } - wxEvent *event = new wxThreadEvent(wxEVT_THREAD, wxEVT_COMMAND_VALIDATION_COMPLETED); - wxQueueEvent ( myEventHandler, event ); + wxCommandEvent event ( wxEVT_COMMAND_VALIDATION_COMPLETED ); + wxPostEvent ( myEventHandler, event ); return NULL; } diff --git a/src/validationthread.h b/src/validationthread.h index 4e53fe6..2d0adf1 100644 --- a/src/validationthread.h +++ b/src/validationthread.h @@ -6,7 +6,7 @@ #include #include -wxDECLARE_EVENT(wxEVT_COMMAND_VALIDATION_COMPLETED, wxThreadEvent); +DECLARE_EVENT_TYPE(wxEVT_COMMAND_VALIDATION_COMPLETED, wxID_ANY); class ValidationThread : public wxThread { diff --git a/src/wrapdaisy.cpp b/src/wrapdaisy.cpp index 1cc7218..c12f717 100755 --- a/src/wrapdaisy.cpp +++ b/src/wrapdaisy.cpp @@ -173,8 +173,7 @@ bool WrapDaisy::run ( if ( !xsp->parse ( output.c_str() ) ) { frame->newDocument ( output ); - std::string stdError = xsp->getLastError(); - error = wxString ( stdError.c_str(), wxConvUTF8, stdError.size() ); + error = xsp->getLastError(); return false; } output = xsp->getBuffer(); @@ -200,8 +199,7 @@ bool WrapDaisy::run ( if ( !xp->parse ( output.c_str() ) ) { frame->newDocument ( output ); - std::string stdError = xp->getLastError(); - error = wxString ( stdError.c_str(), wxConvUTF8, stdError.size() ); + error = xp->getLastError(); return false; } output = xp->getBuffer(); @@ -289,8 +287,7 @@ bool WrapDaisy::run ( if ( !xci->parse ( output.c_str() ) ) { frame->newDocument ( output ); - std::string stdError = xci->getLastError(); - error = wxString ( stdError.c_str(), wxConvUTF8, stdError.size() ); + error = xci->getLastError(); return false; } output = xci->getBuffer(); @@ -301,7 +298,7 @@ bool WrapDaisy::run ( std::ofstream canonicalStream ( stdCanonicalFile.c_str() );//canonicalFile.name().c_str() ); if ( !canonicalStream ) { - error = _T( "Cannot write canonical XHTML file" ); + error = _ ( "Cannot write canonical XHTML file" ); return false; } canonicalStream << output.c_str() << std::endl; @@ -316,9 +313,9 @@ bool WrapDaisy::run ( while (wxTheApp->Pending()) wxTheApp->Dispatch(); - if ( !pd->Update ( 40, _T("Preparing DTBook...") ) ) + if ( !pd->Update ( 40, _ ("Preparing DTBook...") ) ) { - error = _T ( "Cancelled" ); + error = _ ( "Cancelled" ); return false; } diff --git a/src/wrapexpat.cpp b/src/wrapexpat.cpp index bfaa2ea..06ad740 100755 --- a/src/wrapexpat.cpp +++ b/src/wrapexpat.cpp @@ -68,17 +68,17 @@ pair WrapExpat::getErrorPosition() XML_GetCurrentColumnNumber ( p ) ); } -string WrapExpat::getLastError() +wxString WrapExpat::getLastError() { if ( !p ) - return "Unable to create parser instance"; + return _ ( "Unable to create parser instance" ); stringstream ss; ss << "Error at line "; ss << XML_GetCurrentLineNumber ( p ); ss << ", column " << XML_GetCurrentColumnNumber ( p ) + 1 << ":" << endl; ss << XML_ErrorString ( XML_GetErrorCode ( p ) ); - return ss.str(); + return wxString ( ss.str().c_str(), wxConvUTF8 ); } string WrapExpat::xmliseTextNode ( const string &textnode ) diff --git a/src/wrapexpat.h b/src/wrapexpat.h index 36483fc..039b480 100755 --- a/src/wrapexpat.h +++ b/src/wrapexpat.h @@ -20,6 +20,7 @@ #ifndef WRAP_EXPAT #define WRAP_EXPAT +#include #include #include #include @@ -36,7 +37,7 @@ class WrapExpat bool parse ( const string &buffer, bool isFinal = true ); bool parse ( const char *buffer, size_t size, bool isFinal = true ); pair getErrorPosition(); - string getLastError(); + wxString getLastError(); bool isEncodingError(); static string xmliseTextNode ( const string &textnode ); static string xmliseAttribute ( const string &attribute ); diff --git a/src/wrapxerces.cpp b/src/wrapxerces.cpp index 5e20611..d578ffd 100755 --- a/src/wrapxerces.cpp +++ b/src/wrapxerces.cpp @@ -96,7 +96,7 @@ bool WrapXerces::validate ( const std::string& fileName ) delete parser; lastError << _T ( "Validation stopped at line " ) << e.getLineNumber() << _T ( ", column " ) << e.getColumnNumber() - << ": " << toString ( e.getMessage() ); + << _T ( ": " ) << toString ( e.getMessage() ); errorPosition = std::make_pair ( e.getLineNumber(), e.getColumnNumber() ); return false; } diff --git a/src/xmlcopyeditor.cpp b/src/xmlcopyeditor.cpp index 4d0068f..a1845bb 100755 --- a/src/xmlcopyeditor.cpp +++ b/src/xmlcopyeditor.cpp @@ -58,6 +58,8 @@ #include #include #include +#include +#include #define ngettext wxGetTranslation @@ -301,14 +303,23 @@ MyApp::MyApp() : checker ( NULL ), server ( NULL ), connection ( NULL ), } myLocale.Init ( lang, wxLOCALE_LOAD_DEFAULT ); - wxLocale::AddCatalogLookupPathPrefix ( wxT ( "." ) ); - wxLocale::AddCatalogLookupPathPrefix ( wxT ( ".." ) ); + wxArrayString prefixes; +#ifdef __WXGTK__ + prefixes.Add ( wxT ( "/usr/share/locale" ) ); + prefixes.Add ( wxT ( "/usr/local/share/locale" ) ); +#endif wxString poDir = wxStandardPaths::Get().GetDataDir() + wxFileName::GetPathSeparator() + _T ( "po" ) + wxFileName::GetPathSeparator(); - wxLocale::AddCatalogLookupPathPrefix ( poDir ); + prefixes.Add ( poDir ); + wxArrayString::const_iterator itr; + for ( itr = prefixes.begin(); itr != prefixes.end(); itr++ ) + wxLocale::AddCatalogLookupPathPrefix ( *itr ); - if ( !myLocale.AddCatalog ( _T ( "messages" ) ) ) + wxString catalog = _T ( "messages" ); + getAvailableTranslations ( &prefixes, &catalog ); + + if ( !myLocale.AddCatalog ( catalog ) ) ; #ifndef __WXMSW__ @@ -328,7 +339,6 @@ MyApp::~MyApp() bool MyApp::OnInit() { - wxString name, service, hostName; name.Printf ( _T ( "xmlcopyeditor-%s" ), wxGetUserId().c_str() ); service = IPC_SERVICE; @@ -347,14 +357,8 @@ bool MyApp::OnInit() break; else { - wxString argument, what; - wxChar *whatBuffer; - what = _T ( "Data" ); -#if wxCHECK_VERSION(2,9,0) - whatBuffer = (wxChar *)what.wchar_str(); -#else - whatBuffer = (wxChar *)what.c_str(); -#endif + wxString argument; + wxChar whatBuffer[] = _T ( "Data" ); if ( this->argc > 1 ) { for ( int i = 1; i < this->argc; i++ ) @@ -403,7 +407,7 @@ bool MyApp::OnInit() catch ( const XMLException &e ) { wxString error; - error << _ ( "Failed to initialize Xerces-c:\n" ) + error << _ ( "Failed to initialize Xerces-C:\n" ) << WrapXerces::toString ( e.getMessage() ); wxMessageBox ( error, _ ( "Error" ), wxOK | wxICON_ERROR ); return false; @@ -568,6 +572,66 @@ void MyApp::HandleEvent ( wxEvtHandler *handler, wxEventFunction func, wxEvent& } #endif +const wxArrayString &MyApp::getAvailableTranslations ( + const wxArrayString *catalogLookupPathPrefixes /*= NULL*/, + const wxString *catalog /*= NULL*/ ) +{ + static class Translations // Most of the code was copied from wxTranslations + { + public: + Translations ( const wxArrayString *catalogLookupPathPrefixes, + const wxString *catalog ) + { + if ( catalogLookupPathPrefixes == NULL ) + throw std::invalid_argument ( "catalogLookupPathPrefixes" ); + if ( catalog == NULL ) + throw std::invalid_argument ( "catelog" ); + +#if wxCHECK_VERSION(2,9,0) + wxTranslations *t = wxTranslations::Get(); + if ( t != NULL ) + translations = t->GetAvailableTranslations ( *catalog ); +#else + wxArrayString::const_iterator i = catalogLookupPathPrefixes->begin(); + for ( i = catalogLookupPathPrefixes->begin(); + i != catalogLookupPathPrefixes->end(); ++i ) + { + if ( i->empty() ) + continue; + + wxDir dir; + if ( !dir.Open(*i) ) + continue; + + wxString lang; + for ( bool ok = dir.GetFirst ( &lang, wxEmptyString, wxDIR_DIRS ); ok; + ok = dir.GetNext (&lang) ) { + const wxString langdir = *i + wxFILE_SEP_PATH + lang; + if ( HasMsgCatalogInDir ( langdir, *catalog ) ) { +#ifdef __WXOSX__ + wxString rest; + if ( lang.EndsWith(".lproj", &rest) ) + lang = rest; +#endif // __WXOSX__ + translations.push_back(lang); + } + } + } +#endif + } + bool HasMsgCatalogInDir ( const wxString &dir, const wxString &catelog ) + { + return wxFileName ( dir, catelog, _T ( "mo" ) ).FileExists() + || wxFileName ( dir + wxFILE_SEP_PATH + _T ( "LC_MESSAGES" ), catelog, _T ( "mo" ) ).FileExists(); + } + const wxArrayString &operator()() { return translations; } + protected: + wxArrayString translations; + } translations ( catalogLookupPathPrefixes, catalog ); + + return translations(); +} + MyFrame::MyFrame ( const wxString& title, wxFileConfig *configParameter, @@ -2509,6 +2573,7 @@ void MyFrame::OnOptions ( wxCommandEvent& WXUNUSED ( event ) ) #else ( _ ( "Preferences" ) ); #endif + MyApp *app = ( MyApp * ) wxTheApp; std::auto_ptr mpsd ( new MyPropertySheet ( this, properties, @@ -2522,6 +2587,7 @@ void MyFrame::OnOptions ( wxCommandEvent& WXUNUSED ( event ) ) expandInternalEntities, showFullPathOnFrame, lang, + app->getAvailableTranslations(), wxID_ANY, title ) ); if ( mpsd->ShowModal() == wxID_OK ) @@ -2859,10 +2925,11 @@ void MyFrame::newDocument ( const std::string& s, const std::string& path, bool catalogUtilityPath, path, auxPath ); - mainBook->AddPage ( ( wxWindow * ) doc, documentLabel, true ); + mainBook->AddPage ( ( wxWindow * ) doc, documentLabel ); Thaw(); - mainBook->Refresh(); + mainBook->Layout(); + if ( properties.completion ) doc->updatePromptMaps(); doc->setShortFileName ( documentLabel ); @@ -2915,9 +2982,12 @@ void MyFrame::OnOpen ( wxCommandEvent& event ) size_t count = paths.Count(); if ( !count ) return; + Freeze(); for ( size_t i = 0; i < count; ++i ) if ( !openFile ( paths[i], largeFile ) ) break; + Thaw(); + mainBook->Layout(); } bool MyFrame::openFile ( wxString& fileName, bool largeFile ) @@ -3186,7 +3256,7 @@ bool MyFrame::openFile ( wxString& fileName, bool largeFile ) Thaw(); statusProgress ( wxEmptyString ); - mainBook->Refresh(); + mainBook->Layout(); wxFileName fn ( fileName ); doc->setLastModified ( fn.GetModificationTime() ); @@ -3247,11 +3317,9 @@ bool MyFrame::openFile ( wxString& fileName, bool largeFile ) if ( !optimisedParseSuccess ) { - std::string error = we->getLastError(); - wideError = wxString ( error.c_str(), wxConvUTF8, error.size() ); posPair = we->getErrorPosition(); -- ( posPair.first ); - messagePane ( wideError, CONST_WARNING ); + messagePane ( we->getLastError(), CONST_WARNING ); int newPosition = doc->PositionFromLine ( posPair.first ); doc->SetSelection ( newPosition, newPosition ); @@ -5250,7 +5318,7 @@ wxMenuBar *MyFrame::getMenuBar() _ ( "&Spelling...\tF7" ), _ ( "Spelling..." ) ); spellingItem->SetBitmap ( spelling16Bitmap ); - + wxMenuItem *styleItem = new wxMenuItem ( NULL, @@ -5267,6 +5335,7 @@ wxMenuBar *MyFrame::getMenuBar() _ ( "Word Count" ) ); wordCountItem->SetBitmap ( wxNullBitmap ); + wxMenuItem *commandItem = new wxMenuItem ( NULL, @@ -5300,6 +5369,8 @@ wxMenuBar *MyFrame::getMenuBar() new wxMenuItem ( NULL, wxID_HELP, _ ( "&XML Copy Editor Help\tF1" ), _ ( "Help" ) ); helpItem->SetBitmap ( helpBitmap ); + + wxMenuItem *homeItem = new wxMenuItem ( NULL, ID_HOME, _ ( "&Home Page" ), _ ( "Home Page" ) ); @@ -5316,6 +5387,7 @@ wxMenuBar *MyFrame::getMenuBar() _ ( "&Browse Source" ), _ ( "Browse Source" ) ); downloadSourceItem->SetBitmap ( wxNullBitmap ); helpMenu->Append ( helpItem ); + helpMenu->AppendSeparator(); helpMenu->Append ( homeItem ); helpMenu->Append ( feedbackItem ); @@ -5364,7 +5436,6 @@ void MyFrame::updateFileMenu ( bool deleteExisting ) wxMenuItem *saveItem = new wxMenuItem ( NULL, wxID_SAVE, _ ( "&Save\tCtrl+S" ), _ ( "Save" ) ); saveItem->SetBitmap ( save16Bitmap ); - wxMenuItem *saveAsItem = new wxMenuItem ( NULL, wxID_SAVEAS, _ ( "S&ave As...\tF12" ), _ ( "Save As..." ) ); saveAsItem->SetBitmap ( wxNullBitmap ); @@ -5423,6 +5494,7 @@ void MyFrame::updateFileMenu ( bool deleteExisting ) fileMenu->Append ( exportMSWordItem ); #endif history.AddFilesToMenu ( fileMenu ); + fileMenu->AppendSeparator(); fileMenu->Append ( exitItem ); } @@ -5808,7 +5880,7 @@ void MyFrame::OnAssociate ( wxCommandEvent& event ) message.Printf ( _ ( "Cannot associate %s: %s" ), type.c_str(), - wellformedparser->getLastError() ); + wellformedparser->getLastError().c_str() ); messagePane ( message, CONST_STOP ); return; } @@ -5907,18 +5979,19 @@ void MyFrame::OnAssociate ( wxCommandEvent& event ) void MyFrame::openRememberedTabs() { - if ( openTabsOnClose.empty() ) - return; - wxArrayString v = wxSplit ( openTabsOnClose, _T ( '|' ) ); - if ( v.empty() ) - return; + Freeze(); - wxArrayString::iterator vit; - for ( vit = v.begin(); vit != v.end(); vit++ ) + wxStringTokenizer files ( openTabsOnClose, _T ( "|" ) ); + while ( files.HasMoreTokens() ) { - if ( vit->IsEmpty() || !openFile ( *vit ) ) + wxString file = files.GetNextToken(); + if ( file.IsEmpty() || !openFile ( file ) ) continue; //break; // Ignore errors } + + Thaw(); + mainBook->Layout(); + XmlDoc *doc; if ( ( doc = getActiveDocument() ) != NULL ) doc->SetFocus(); @@ -5948,11 +6021,8 @@ void MyFrame::OnWordCount ( wxCommandEvent& event ) wxString msg; if ( !xwc->parse ( buffer.c_str() ) ) { - std::string error = xwc->getLastError(); - wxString werror = wxString ( error.c_str(), wxConvUTF8, error.size() ); statusProgress ( wxEmptyString ); - - msg.Printf ( _ ( "Cannot count words: %s" ), werror.c_str() ); + msg.Printf ( _ ( "Cannot count words: %s" ), xwc->getLastError().c_str() ); messagePane ( msg, CONST_STOP ); return; } diff --git a/src/xmlcopyeditor.h b/src/xmlcopyeditor.h index b3ae5c7..50338f8 100755 --- a/src/xmlcopyeditor.h +++ b/src/xmlcopyeditor.h @@ -176,6 +176,9 @@ class MyApp : public wxApp #ifndef __WXMSW__ virtual void HandleEvent ( wxEvtHandler *handler, wxEventFunction func, wxEvent& event ) const; #endif + const wxArrayString &getAvailableTranslations ( + const wxArrayString *catalogLookupPathPrefixes = NULL, + const wxString *catelog = NULL ); protected: wxLocale myLocale; private: diff --git a/src/xmlcopyeditorcopy.h b/src/xmlcopyeditorcopy.h index 2caeb7a..bbdc5c5 100755 --- a/src/xmlcopyeditorcopy.h +++ b/src/xmlcopyeditorcopy.h @@ -23,7 +23,11 @@ #else #define FILE_FILTER _("All files (*)|*|XML (*.xml)|*.xml|XHTML (*.html)|*.html|DTD (*.dtd)|*.dtd|XML Schema (*.xsd)|*.xsd|RELAX NG grammar (*.rng)|*.rng|XSL (*.xsl)|*.xsl") #endif +#if wxCHECK_VERSION(2,9,0) #define ABOUT_COPYRIGHT _(_T("Copyright © 2005-2009 Gerald Schmidt ")) +#else +#define ABOUT_COPYRIGHT _("Copyright © 2005-2009 Gerald Schmidt ") +#endif #define ABOUT_DESCRIPTION _("\nXML Copy Editor is free software released under the GNU\nGeneral Public License.\n\nMany thanks are due to ") #define ABOUT_CONTRIBUTORS _T(\ "Tim van Niekerk, Matt Smigielski,\n"\ diff --git a/src/xmlctrl.cpp b/src/xmlctrl.cpp index 8769dd9..0bc8c4f 100755 --- a/src/xmlctrl.cpp +++ b/src/xmlctrl.cpp @@ -40,7 +40,7 @@ BEGIN_EVENT_TABLE ( XmlCtrl, wxStyledTextCtrl ) EVT_LEFT_UP ( XmlCtrl::OnMouseLeftUp ) EVT_RIGHT_UP ( XmlCtrl::OnMouseRightUp ) EVT_MIDDLE_DOWN ( XmlCtrl::OnMiddleDown ) - EVT_THREAD(wxEVT_COMMAND_VALIDATION_COMPLETED, XmlCtrl::OnValidationCompleted) + EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_VALIDATION_COMPLETED, XmlCtrl::OnValidationCompleted) END_EVENT_TABLE() // global protection for validation threads @@ -94,7 +94,11 @@ XmlCtrl::XmlCtrl ( bufferLen = strlen ( DEFAULT_XML_DECLARATION_UTF8 ); } +#if wxCHECK_VERSION(2,9,0) AddTextRaw ( buffer, bufferLen ); +#else + SendMsg ( 2001, bufferLen, ( long ) ( const char * ) buffer ); +#endif SetSelection ( 0, 0 ); @@ -164,7 +168,7 @@ void XmlCtrl::OnIdle ( wxIdleEvent& event ) adjustNoColumnWidth(); // exits if unchanged } -void XmlCtrl::OnValidationCompleted ( wxThreadEvent &event ) +void XmlCtrl::OnValidationCompleted ( wxCommandEvent &event ) { wxCriticalSectionLocker locker ( xmlcopyeditorCriticalSection ); @@ -472,12 +476,7 @@ void XmlCtrl::handleOpenAngleBracket ( wxKeyEvent& event ) if ( parentCloseAngleBracket < 0 ) return; - wxString wideParent = getLastElementName ( parentCloseAngleBracket ); - if ( wideParent.empty() ) - return; - - std::string parent = ( const char * ) wideParent.mb_str ( wxConvUTF8 ); - + wxString parent = getLastElementName ( parentCloseAngleBracket ); if ( elementMap.find ( parent ) == elementMap.end() ) return; diff --git a/src/xmlctrl.h b/src/xmlctrl.h index fcfbdbc..54dd649 100755 --- a/src/xmlctrl.h +++ b/src/xmlctrl.h @@ -185,7 +185,7 @@ class XmlCtrl: public wxStyledTextCtrl void OnMarginClick ( wxStyledTextEvent& event ); void OnChar ( wxKeyEvent& event ); void OnIdle ( wxIdleEvent& event ); - void OnValidationCompleted (wxThreadEvent &event); + void OnValidationCompleted (wxCommandEvent &event); void OnKeyPressed ( wxKeyEvent& event ); void OnMouseLeftDown ( wxMouseEvent& event ); void OnMouseLeftUp ( wxMouseEvent& event ); diff --git a/src/xmlpromptgenerator.cpp b/src/xmlpromptgenerator.cpp index 75687bf..6758a01 100755 --- a/src/xmlpromptgenerator.cpp +++ b/src/xmlpromptgenerator.cpp @@ -261,7 +261,9 @@ void XMLCALL XmlPromptGenerator::attlistdeclhandler ( PromptGeneratorData *d; d = ( PromptGeneratorData * ) data; - std::set &attributeValues = d->attributeMap[elname][attname]; + wxString element ( elname, wxConvUTF8 ); + wxString attribute ( attname, wxConvUTF8 ); + std::set &attributeValues = d->attributeMap[element][attribute]; if ( *att_type == '(' ) // change to exclude _known_ identifiers? { const char *s, *word; @@ -283,7 +285,7 @@ void XMLCALL XmlPromptGenerator::attlistdeclhandler ( if ( isrequired ) { - d->requiredAttributeMap[elname].insert ( wxString ( attname, wxConvUTF8 ) ); + d->requiredAttributeMap[element].insert ( attribute ); } } diff --git a/src/xmlshallowvalidator.cpp b/src/xmlshallowvalidator.cpp index 24b2dc1..3f26244 100755 --- a/src/xmlshallowvalidator.cpp +++ b/src/xmlshallowvalidator.cpp @@ -145,9 +145,9 @@ void XMLCALL XmlShallowValidator::skippedentity ( { if ( is_parameter_entity ) return; - XmlShallowValidatorData *vd; - vd = ( XmlShallowValidatorData * ) data; - if ( vd->entitySet.find ( entityName ) != vd->entitySet.end() ) + XmlShallowValidatorData *vd = ( XmlShallowValidatorData * ) data; + wxString entity ( entityName, wxConvUTF8 ); + if ( vd->entitySet.find ( entity ) != vd->entitySet.end() ) return; vd->isValid = false;