Fixed compiling problem with wxWidgets 2.8.12

This commit is contained in:
Zane U. Ji 2012-08-18 23:41:27 +08:00
parent 7bad0039c5
commit 807a96c1a0
18 changed files with 189 additions and 117 deletions

View File

@ -26,8 +26,9 @@
<option id="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level.693304093" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.334981297" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="${BOOSTINC}"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}\include"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}\lib\gcc_lib\mswud"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}/include"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}/contrib/include"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}/lib/gcc_lib/mswud"/>
</option>
<option id="gnu.cpp.compiler.option.other.other.1952331323" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" value="-c -fmessage-length=0" valueType="string"/>
<option id="gnu.cpp.compiler.option.preprocessor.def.1236209686" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
@ -51,24 +52,22 @@
<listOptionValue builtIn="false" value="pcre"/>
<listOptionValue builtIn="false" value="xerces-c"/>
<listOptionValue builtIn="false" value="aspell"/>
<listOptionValue builtIn="false" value="wxmsw29ud_richtext"/>
<listOptionValue builtIn="false" value="wxmsw29ud_html"/>
<listOptionValue builtIn="false" value="wxmsw29ud_stc"/>
<listOptionValue builtIn="false" value="wxmsw29ud_aui"/>
<listOptionValue builtIn="false" value="wxmsw29ud_adv"/>
<listOptionValue builtIn="false" value="wxmsw29ud_stc"/>
<listOptionValue builtIn="false" value="wxmsw29ud_core"/>
<listOptionValue builtIn="false" value="wxmsw29ud_richtext"/>
<listOptionValue builtIn="false" value="wxbase29ud_xml"/>
<listOptionValue builtIn="false" value="wxbase29ud_net"/>
<listOptionValue builtIn="false" value="wxbase29ud"/>
<listOptionValue builtIn="false" value="wxmsw28ud_richtext"/>
<listOptionValue builtIn="false" value="wxmsw28ud_html"/>
<listOptionValue builtIn="false" value="wxmsw28ud_stc"/>
<listOptionValue builtIn="false" value="wxmsw28ud_aui"/>
<listOptionValue builtIn="false" value="wxmsw28ud_adv"/>
<listOptionValue builtIn="false" value="wxmsw28ud_stc"/>
<listOptionValue builtIn="false" value="wxmsw28ud_core"/>
<listOptionValue builtIn="false" value="wxmsw28ud_richtext"/>
<listOptionValue builtIn="false" value="wxbase28ud_xml"/>
<listOptionValue builtIn="false" value="wxbase28ud_net"/>
<listOptionValue builtIn="false" value="wxbase28ud"/>
<listOptionValue builtIn="false" value="wxtiffd"/>
<listOptionValue builtIn="false" value="wxjpegd"/>
<listOptionValue builtIn="false" value="wxpngd"/>
<listOptionValue builtIn="false" value="wxzlibd"/>
<listOptionValue builtIn="false" value="wxregexud"/>
<listOptionValue builtIn="false" value="wxscintillad"/>
<listOptionValue builtIn="false" value="wxregexud"/>
<listOptionValue builtIn="false" value="kernel32"/>
<listOptionValue builtIn="false" value="user32"/>
<listOptionValue builtIn="false" value="gdi32"/>
@ -87,7 +86,7 @@
<listOptionValue builtIn="false" value="pthread"/>
</option>
<option id="gnu.cpp.link.option.paths.1556491407" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="${WXWIDGETS}\lib\gcc_lib"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}/lib/gcc_lib"/>
</option>
<option id="gnu.cpp.link.option.userobjs.598298270" name="Other objects" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs">
<listOptionValue builtIn="false" value="${ConfigName}/xmlcopyeditor_rc.o"/>
@ -129,8 +128,9 @@
<option id="gnu.cpp.compiler.mingw.exe.release.option.debugging.level.1567946828" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.1851942004" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="${BOOSTINC}"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}\include"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}\lib\gcc_lib\mswu"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}/include"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}/contrib/include"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}/lib/gcc_lib/mswu"/>
</option>
<option id="gnu.cpp.compiler.option.other.other.1853611325" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" value="-c -fmessage-length=0" valueType="string"/>
<option id="gnu.cpp.compiler.option.preprocessor.def.1550164037" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
@ -153,24 +153,22 @@
<listOptionValue builtIn="false" value="pcre"/>
<listOptionValue builtIn="false" value="xerces-c"/>
<listOptionValue builtIn="false" value="aspell"/>
<listOptionValue builtIn="false" value="wxmsw29u_richtext"/>
<listOptionValue builtIn="false" value="wxmsw29u_html"/>
<listOptionValue builtIn="false" value="wxmsw29u_stc"/>
<listOptionValue builtIn="false" value="wxmsw29u_aui"/>
<listOptionValue builtIn="false" value="wxmsw29u_adv"/>
<listOptionValue builtIn="false" value="wxmsw29u_stc"/>
<listOptionValue builtIn="false" value="wxmsw29u_core"/>
<listOptionValue builtIn="false" value="wxmsw29u_richtext"/>
<listOptionValue builtIn="false" value="wxbase29u_xml"/>
<listOptionValue builtIn="false" value="wxbase29u_net"/>
<listOptionValue builtIn="false" value="wxbase29u"/>
<listOptionValue builtIn="false" value="wxmsw28u_richtext"/>
<listOptionValue builtIn="false" value="wxmsw28u_html"/>
<listOptionValue builtIn="false" value="wxmsw28u_stc"/>
<listOptionValue builtIn="false" value="wxmsw28u_aui"/>
<listOptionValue builtIn="false" value="wxmsw28u_adv"/>
<listOptionValue builtIn="false" value="wxmsw28u_stc"/>
<listOptionValue builtIn="false" value="wxmsw28u_core"/>
<listOptionValue builtIn="false" value="wxmsw28u_richtext"/>
<listOptionValue builtIn="false" value="wxbase28u_xml"/>
<listOptionValue builtIn="false" value="wxbase28u_net"/>
<listOptionValue builtIn="false" value="wxbase28u"/>
<listOptionValue builtIn="false" value="wxtiff"/>
<listOptionValue builtIn="false" value="wxjpeg"/>
<listOptionValue builtIn="false" value="wxpng"/>
<listOptionValue builtIn="false" value="wxzlib"/>
<listOptionValue builtIn="false" value="wxregexu"/>
<listOptionValue builtIn="false" value="wxscintilla"/>
<listOptionValue builtIn="false" value="wxregexu"/>
<listOptionValue builtIn="false" value="kernel32"/>
<listOptionValue builtIn="false" value="user32"/>
<listOptionValue builtIn="false" value="gdi32"/>
@ -189,7 +187,7 @@
<listOptionValue builtIn="false" value="pthread"/>
</option>
<option id="gnu.cpp.link.option.paths.161756907" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="${WXWIDGETS}\lib\gcc_lib"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}/lib/gcc_lib"/>
</option>
<option id="gnu.cpp.link.option.userobjs.30870315" name="Other objects" superClass="gnu.cpp.link.option.userobjs" valueType="userObjs">
<listOptionValue builtIn="false" value="${ConfigName}/xmlcopyeditor_rc.o"/>
@ -238,6 +236,6 @@
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="refreshScope" versionNumber="1">
<resource resourceType="PROJECT" workspacePath="/XmlCopyEditor"/>
<resource resourceType="PROJECT" workspacePath="/XmlCopyEditor"/>
</storageModule>
</cproject>

View File

@ -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

View File

@ -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();
}

View File

@ -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 );

View File

@ -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,

View File

@ -6,7 +6,7 @@
#include <memory>
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;
}

View File

@ -6,7 +6,7 @@
#include <string>
#include <wx/thread.h>
wxDECLARE_EVENT(wxEVT_COMMAND_VALIDATION_COMPLETED, wxThreadEvent);
DECLARE_EVENT_TYPE(wxEVT_COMMAND_VALIDATION_COMPLETED, wxID_ANY);
class ValidationThread : public wxThread
{

View File

@ -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;
}

View File

@ -68,17 +68,17 @@ pair<int, int> 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 )

View File

@ -20,6 +20,7 @@
#ifndef WRAP_EXPAT
#define WRAP_EXPAT
#include <wx/wx.h>
#include <expat.h>
#include <string>
#include <vector>
@ -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<int, int> getErrorPosition();
string getLastError();
wxString getLastError();
bool isEncodingError();
static string xmliseTextNode ( const string &textnode );
static string xmliseAttribute ( const string &attribute );

View File

@ -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;
}

View File

@ -58,6 +58,8 @@
#include <wx/stockitem.h>
#include <iconv.h>
#include <wx/stdpaths.h>
#include <wx/tokenzr.h>
#include <wx/dir.h>
#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<MyPropertySheet> 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;
}

View File

@ -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:

View File

@ -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 <gnschmidt@users.sourceforge.net>"))
#else
#define ABOUT_COPYRIGHT _("Copyright © 2005-2009 Gerald Schmidt <gnschmidt@users.sourceforge.net>")
#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"\

View File

@ -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;

View File

@ -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 );

View File

@ -261,7 +261,9 @@ void XMLCALL XmlPromptGenerator::attlistdeclhandler (
PromptGeneratorData *d;
d = ( PromptGeneratorData * ) data;
std::set<wxString> &attributeValues = d->attributeMap[elname][attname];
wxString element ( elname, wxConvUTF8 );
wxString attribute ( attname, wxConvUTF8 );
std::set<wxString> &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 );
}
}

View File

@ -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;