Updated code of checking wxWidgets versions

This commit is contained in:
Zane U. Ji 2012-08-09 19:22:21 +08:00
parent 16b9efaf3d
commit fd281aca5b
4 changed files with 24 additions and 34 deletions

View File

@ -171,7 +171,7 @@ void AssociateDialog::OnBrowse ( wxCommandEvent& e )
_T ( "" ), _T ( "" ),
_T ( "" ), _T ( "" ),
extensionArgument, extensionArgument,
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR
#else #else
wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR

View File

@ -159,7 +159,7 @@ void FindReplacePanel::OnReplace ( wxCommandEvent& event )
replaceEvent.SetFlags ( wxFR_DOWN ); replaceEvent.SetFlags ( wxFR_DOWN );
replaceEvent.SetFindString ( findEdit->GetValue() ); replaceEvent.SetFindString ( findEdit->GetValue() );
replaceEvent.SetReplaceString ( replaceEdit->GetValue() ); replaceEvent.SetReplaceString ( replaceEdit->GetValue() );
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
parent->ProcessWindowEvent( replaceEvent ); parent->ProcessWindowEvent( replaceEvent );
#else #else
parent->ProcessEvent ( replaceEvent ); parent->ProcessEvent ( replaceEvent );
@ -172,7 +172,7 @@ void FindReplacePanel::OnReplaceAll ( wxCommandEvent& event )
replaceAllEvent.SetFlags ( wxFR_DOWN ); replaceAllEvent.SetFlags ( wxFR_DOWN );
replaceAllEvent.SetFindString ( findEdit->GetValue() ); replaceAllEvent.SetFindString ( findEdit->GetValue() );
replaceAllEvent.SetReplaceString ( replaceEdit->GetValue() ); replaceAllEvent.SetReplaceString ( replaceEdit->GetValue() );
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
parent->ProcessWindowEvent( replaceAllEvent ); parent->ProcessWindowEvent( replaceAllEvent );
#else #else
parent->ProcessEvent ( replaceAllEvent ); parent->ProcessEvent ( replaceAllEvent );
@ -223,7 +223,7 @@ void FindReplacePanel::sendFindEvent ( size_t flags )
MyFrame *frame = ( MyFrame * ) parent; MyFrame *frame = ( MyFrame * ) parent;
frame->setStrictScrolling ( true ); frame->setStrictScrolling ( true );
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
frame->ProcessWindowEvent(findEvent); frame->ProcessWindowEvent(findEvent);
#else #else
frame->ProcessEvent ( findEvent ); // was parent-> frame->ProcessEvent ( findEvent ); // was parent->

View File

@ -110,7 +110,7 @@ bool WrapDaisy::run (
if ( !stdStylesheet.empty() ) // stylesheet found if ( !stdStylesheet.empty() ) // stylesheet found
{ {
// #1: convert to canonical XHTML // #1: convert to canonical XHTML
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
pd->GetEventHandler()->ProcessPendingEvents(); pd->GetEventHandler()->ProcessPendingEvents();
#else #else
pd->ProcessPendingEvents(); pd->ProcessPendingEvents();
@ -156,7 +156,7 @@ bool WrapDaisy::run (
if ( suppressOptional ) if ( suppressOptional )
{ {
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
pd->GetEventHandler()->ProcessPendingEvents(); pd->GetEventHandler()->ProcessPendingEvents();
#else #else
pd->ProcessPendingEvents(); pd->ProcessPendingEvents();
@ -183,7 +183,7 @@ bool WrapDaisy::run (
if ( quiet ) if ( quiet )
{ {
// #1.5: apply quiet setting if req'd // #1.5: apply quiet setting if req'd
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
pd->GetEventHandler()->ProcessPendingEvents(); pd->GetEventHandler()->ProcessPendingEvents();
#else #else
pd->ProcessPendingEvents(); pd->ProcessPendingEvents();
@ -269,7 +269,7 @@ bool WrapDaisy::run (
} }
// copy images // copy images
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
pd->GetEventHandler()->ProcessPendingEvents(); pd->GetEventHandler()->ProcessPendingEvents();
#else #else
pd->ProcessPendingEvents(); pd->ProcessPendingEvents();
@ -308,7 +308,7 @@ bool WrapDaisy::run (
canonicalStream.close(); canonicalStream.close();
// #2: convert to DTBook // #2: convert to DTBook
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
pd->GetEventHandler()->ProcessPendingEvents(); pd->GetEventHandler()->ProcessPendingEvents();
#else #else
pd->ProcessPendingEvents(); pd->ProcessPendingEvents();
@ -365,7 +365,7 @@ bool WrapDaisy::run (
return false; return false;
// #2.5: create ePub version // #2.5: create ePub version
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
pd->GetEventHandler()->ProcessPendingEvents(); pd->GetEventHandler()->ProcessPendingEvents();
#else #else
pd->ProcessPendingEvents(); pd->ProcessPendingEvents();
@ -428,7 +428,7 @@ bool WrapDaisy::run (
// #2.9: convert to RTF // #2.9: convert to RTF
if ( rtf || doc ) if ( rtf || doc )
{ {
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
pd->GetEventHandler()->ProcessPendingEvents(); pd->GetEventHandler()->ProcessPendingEvents();
#else #else
pd->ProcessPendingEvents(); pd->ProcessPendingEvents();
@ -498,7 +498,7 @@ bool WrapDaisy::run (
// #2.9.5: convert to binary Word // #2.9.5: convert to binary Word
// (Win only; otherwise create copy with *.doc extension) // (Win only; otherwise create copy with *.doc extension)
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
pd->GetEventHandler()->ProcessPendingEvents(); pd->GetEventHandler()->ProcessPendingEvents();
#else #else
pd->ProcessPendingEvents(); pd->ProcessPendingEvents();
@ -553,7 +553,7 @@ bool WrapDaisy::run (
} }
// #3: convert to full DAISY book // #3: convert to full DAISY book
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
pd->GetEventHandler()->ProcessPendingEvents(); pd->GetEventHandler()->ProcessPendingEvents();
#else #else
pd->ProcessPendingEvents(); pd->ProcessPendingEvents();
@ -619,7 +619,7 @@ bool WrapDaisy::run (
return true; return true;
// #4: create MP3 album // #4: create MP3 album
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
pd->GetEventHandler()->ProcessPendingEvents(); pd->GetEventHandler()->ProcessPendingEvents();
#else #else
pd->ProcessPendingEvents(); pd->ProcessPendingEvents();
@ -700,7 +700,7 @@ bool WrapDaisy::run (
return false; return false;
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
pd->GetEventHandler()->ProcessPendingEvents(); pd->GetEventHandler()->ProcessPendingEvents();
#else #else
pd->ProcessPendingEvents(); pd->ProcessPendingEvents();

View File

@ -186,7 +186,7 @@ END_EVENT_TABLE()
IMPLEMENT_APP ( MyApp) IMPLEMENT_APP ( MyApp)
MyApp::MyApp() : checker ( NULL ), server ( NULL ), connection ( NULL ), MyApp::MyApp() : checker ( NULL ), server ( NULL ), connection ( NULL ),
#if defined(__WXMSW__) && !wxCHECK_VERSION(2,9,2) #if defined(__WXMSW__) && !wxCHECK_VERSION(2,9,0)
config ( new wxFileConfig ( _T ( ".xmlcopyeditor" ) ) )//( _T ( "SourceForge Project\\XML Copy Editor" ) ) ) config ( new wxFileConfig ( _T ( ".xmlcopyeditor" ) ) )//( _T ( "SourceForge Project\\XML Copy Editor" ) ) )
#else #else
config ( new wxFileConfig ( _T ( "xmlcopyeditor" ) ) ) config ( new wxFileConfig ( _T ( "xmlcopyeditor" ) ) )
@ -338,7 +338,7 @@ bool MyApp::OnInit()
wxString argument, what; wxString argument, what;
wxChar *whatBuffer; wxChar *whatBuffer;
what = _T ( "Data" ); what = _T ( "Data" );
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
whatBuffer = (wxChar *)what.wchar_str(); whatBuffer = (wxChar *)what.wchar_str();
#else #else
whatBuffer = (wxChar *)what.c_str(); whatBuffer = (wxChar *)what.c_str();
@ -2054,7 +2054,7 @@ void MyFrame::OnImportMSWord ( wxCommandEvent& event )
_T ( "" ), _T ( "" ),
_T ( "" ), _T ( "" ),
_T ( "Microsoft Word (*.doc)|*.doc" ), _T ( "Microsoft Word (*.doc)|*.doc" ),
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR
#else #else
wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR
@ -2283,7 +2283,7 @@ void MyFrame::OnExportMSWord ( wxCommandEvent& event )
_T ( "" ), _T ( "" ),
_T ( "" ), _T ( "" ),
_T ( "Microsoft Word (*.doc)|*.doc" ), _T ( "Microsoft Word (*.doc)|*.doc" ),
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
wxFD_SAVE | wxFD_OVERWRITE_PROMPT)); wxFD_SAVE | wxFD_OVERWRITE_PROMPT));
#else #else
wxSAVE | wxOVERWRITE_PROMPT ) ); wxSAVE | wxOVERWRITE_PROMPT ) );
@ -2898,7 +2898,7 @@ void MyFrame::OnOpen ( wxCommandEvent& event )
defaultDir, defaultDir,
wxEmptyString, wxEmptyString,
FILE_FILTER, FILE_FILTER,
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR
#else #else
wxOPEN | wxMULTIPLE | wxFILE_MUST_EXIST | wxCHANGE_DIR wxOPEN | wxMULTIPLE | wxFILE_MUST_EXIST | wxCHANGE_DIR
@ -3129,7 +3129,7 @@ bool MyFrame::openFile ( wxString& fileName, bool largeFile )
nconv = iconv ( nconv = iconv (
cd, cd,
#if defined(__WXMSW__) && !wxCHECK_VERSION(2,9,2) #if defined(__WXMSW__) && !wxCHECK_VERSION(2,9,0)
( const char ** ) ( const char ** )
#endif #endif
&docBuffer, &docBuffer,
@ -3524,7 +3524,7 @@ void MyFrame::saveAs()
defaultDir, defaultDir,
defaultFile, defaultFile,
FILE_FILTER, FILE_FILTER,
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ) ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT ) );
#else #else
wxSAVE | wxOVERWRITE_PROMPT ) ); wxSAVE | wxOVERWRITE_PROMPT ) );
@ -4748,20 +4748,10 @@ bool MyFrame::saveFile ( XmlDoc *doc, wxString& fileName, bool checkLastModified
finalBuffer = iconvBuffer; // iconvBuffer will be incremented by iconv finalBuffer = iconvBuffer; // iconvBuffer will be incremented by iconv
size_t nconv; size_t nconv;
#if defined(__WXMSW__) && !wxCHECK_VERSION(2,9,2) char *utf8BufferPtr = ( char * ) utf8Buffer.c_str();
const char *
#else
char *
#endif
utf8BufferPtr =
( char * )
utf8Buffer.c_str();
nconv = iconv ( nconv = iconv (
cd, cd,
#if defined(__WXMSW__) && !wxCHECK_VERSION(2,9,2)
( const char ** )
#endif
&utf8BufferPtr, &utf8BufferPtr,
&utf8BufferLeft, &utf8BufferLeft,
&iconvBuffer, &iconvBuffer,
@ -6152,7 +6142,7 @@ void MyFrame::OnActivateApp ( wxActivateEvent& event )
void MyFrame::OnIconize ( wxIconizeEvent& event ) void MyFrame::OnIconize ( wxIconizeEvent& event )
{ {
event.Skip(); event.Skip();
#if wxCHECK_VERSION(2,9,2) #if wxCHECK_VERSION(2,9,0)
if (event.IsIconized()) if (event.IsIconized())
#else #else
if ( event.Iconized() ) if ( event.Iconized() )