From fd281aca5bd3fdba1b4ec40dcf43d40933db8552 Mon Sep 17 00:00:00 2001 From: "Zane U. Ji" Date: Thu, 9 Aug 2012 19:22:21 +0800 Subject: [PATCH] Updated code of checking wxWidgets versions --- src/associatedialog.cpp | 2 +- src/findreplacepanel.cpp | 6 +++--- src/wrapdaisy.cpp | 22 +++++++++++----------- src/xmlcopyeditor.cpp | 28 +++++++++------------------- 4 files changed, 24 insertions(+), 34 deletions(-) diff --git a/src/associatedialog.cpp b/src/associatedialog.cpp index 2338a84..0d19ddf 100755 --- a/src/associatedialog.cpp +++ b/src/associatedialog.cpp @@ -171,7 +171,7 @@ void AssociateDialog::OnBrowse ( wxCommandEvent& e ) _T ( "" ), _T ( "" ), extensionArgument, -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR #else wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR diff --git a/src/findreplacepanel.cpp b/src/findreplacepanel.cpp index 434805f..ed0b198 100755 --- a/src/findreplacepanel.cpp +++ b/src/findreplacepanel.cpp @@ -159,7 +159,7 @@ void FindReplacePanel::OnReplace ( wxCommandEvent& event ) replaceEvent.SetFlags ( wxFR_DOWN ); replaceEvent.SetFindString ( findEdit->GetValue() ); replaceEvent.SetReplaceString ( replaceEdit->GetValue() ); -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) parent->ProcessWindowEvent( replaceEvent ); #else parent->ProcessEvent ( replaceEvent ); @@ -172,7 +172,7 @@ void FindReplacePanel::OnReplaceAll ( wxCommandEvent& event ) replaceAllEvent.SetFlags ( wxFR_DOWN ); replaceAllEvent.SetFindString ( findEdit->GetValue() ); replaceAllEvent.SetReplaceString ( replaceEdit->GetValue() ); -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) parent->ProcessWindowEvent( replaceAllEvent ); #else parent->ProcessEvent ( replaceAllEvent ); @@ -223,7 +223,7 @@ void FindReplacePanel::sendFindEvent ( size_t flags ) MyFrame *frame = ( MyFrame * ) parent; frame->setStrictScrolling ( true ); -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) frame->ProcessWindowEvent(findEvent); #else frame->ProcessEvent ( findEvent ); // was parent-> diff --git a/src/wrapdaisy.cpp b/src/wrapdaisy.cpp index 262ee1e..1cc7218 100755 --- a/src/wrapdaisy.cpp +++ b/src/wrapdaisy.cpp @@ -110,7 +110,7 @@ bool WrapDaisy::run ( if ( !stdStylesheet.empty() ) // stylesheet found { // #1: convert to canonical XHTML -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) pd->GetEventHandler()->ProcessPendingEvents(); #else pd->ProcessPendingEvents(); @@ -156,7 +156,7 @@ bool WrapDaisy::run ( if ( suppressOptional ) { -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) pd->GetEventHandler()->ProcessPendingEvents(); #else pd->ProcessPendingEvents(); @@ -183,7 +183,7 @@ bool WrapDaisy::run ( if ( quiet ) { // #1.5: apply quiet setting if req'd -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) pd->GetEventHandler()->ProcessPendingEvents(); #else pd->ProcessPendingEvents(); @@ -269,7 +269,7 @@ bool WrapDaisy::run ( } // copy images -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) pd->GetEventHandler()->ProcessPendingEvents(); #else pd->ProcessPendingEvents(); @@ -308,7 +308,7 @@ bool WrapDaisy::run ( canonicalStream.close(); // #2: convert to DTBook -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) pd->GetEventHandler()->ProcessPendingEvents(); #else pd->ProcessPendingEvents(); @@ -365,7 +365,7 @@ bool WrapDaisy::run ( return false; // #2.5: create ePub version -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) pd->GetEventHandler()->ProcessPendingEvents(); #else pd->ProcessPendingEvents(); @@ -428,7 +428,7 @@ bool WrapDaisy::run ( // #2.9: convert to RTF if ( rtf || doc ) { -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) pd->GetEventHandler()->ProcessPendingEvents(); #else pd->ProcessPendingEvents(); @@ -498,7 +498,7 @@ bool WrapDaisy::run ( // #2.9.5: convert to binary Word // (Win only; otherwise create copy with *.doc extension) -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) pd->GetEventHandler()->ProcessPendingEvents(); #else pd->ProcessPendingEvents(); @@ -553,7 +553,7 @@ bool WrapDaisy::run ( } // #3: convert to full DAISY book -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) pd->GetEventHandler()->ProcessPendingEvents(); #else pd->ProcessPendingEvents(); @@ -619,7 +619,7 @@ bool WrapDaisy::run ( return true; // #4: create MP3 album -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) pd->GetEventHandler()->ProcessPendingEvents(); #else pd->ProcessPendingEvents(); @@ -700,7 +700,7 @@ bool WrapDaisy::run ( return false; -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) pd->GetEventHandler()->ProcessPendingEvents(); #else pd->ProcessPendingEvents(); diff --git a/src/xmlcopyeditor.cpp b/src/xmlcopyeditor.cpp index 1299dbf..70a72c5 100755 --- a/src/xmlcopyeditor.cpp +++ b/src/xmlcopyeditor.cpp @@ -186,7 +186,7 @@ END_EVENT_TABLE() IMPLEMENT_APP ( MyApp) 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" ) ) ) #else config ( new wxFileConfig ( _T ( "xmlcopyeditor" ) ) ) @@ -338,7 +338,7 @@ bool MyApp::OnInit() wxString argument, what; wxChar *whatBuffer; what = _T ( "Data" ); -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) whatBuffer = (wxChar *)what.wchar_str(); #else whatBuffer = (wxChar *)what.c_str(); @@ -2054,7 +2054,7 @@ void MyFrame::OnImportMSWord ( wxCommandEvent& event ) _T ( "" ), _T ( "" ), _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 #else wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR @@ -2283,7 +2283,7 @@ void MyFrame::OnExportMSWord ( wxCommandEvent& event ) _T ( "" ), _T ( "" ), _T ( "Microsoft Word (*.doc)|*.doc" ), -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) wxFD_SAVE | wxFD_OVERWRITE_PROMPT)); #else wxSAVE | wxOVERWRITE_PROMPT ) ); @@ -2898,7 +2898,7 @@ void MyFrame::OnOpen ( wxCommandEvent& event ) defaultDir, wxEmptyString, 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 #else wxOPEN | wxMULTIPLE | wxFILE_MUST_EXIST | wxCHANGE_DIR @@ -3129,7 +3129,7 @@ bool MyFrame::openFile ( wxString& fileName, bool largeFile ) nconv = iconv ( cd, -#if defined(__WXMSW__) && !wxCHECK_VERSION(2,9,2) +#if defined(__WXMSW__) && !wxCHECK_VERSION(2,9,0) ( const char ** ) #endif &docBuffer, @@ -3524,7 +3524,7 @@ void MyFrame::saveAs() defaultDir, defaultFile, FILE_FILTER, -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) wxFD_SAVE | wxFD_OVERWRITE_PROMPT ) ); #else wxSAVE | wxOVERWRITE_PROMPT ) ); @@ -4748,20 +4748,10 @@ bool MyFrame::saveFile ( XmlDoc *doc, wxString& fileName, bool checkLastModified finalBuffer = iconvBuffer; // iconvBuffer will be incremented by iconv size_t nconv; -#if defined(__WXMSW__) && !wxCHECK_VERSION(2,9,2) - const char * -#else - char * -#endif - utf8BufferPtr = - ( char * ) - utf8Buffer.c_str(); + char *utf8BufferPtr = ( char * ) utf8Buffer.c_str(); nconv = iconv ( cd, -#if defined(__WXMSW__) && !wxCHECK_VERSION(2,9,2) - ( const char ** ) -#endif &utf8BufferPtr, &utf8BufferLeft, &iconvBuffer, @@ -6152,7 +6142,7 @@ void MyFrame::OnActivateApp ( wxActivateEvent& event ) void MyFrame::OnIconize ( wxIconizeEvent& event ) { event.Skip(); -#if wxCHECK_VERSION(2,9,2) +#if wxCHECK_VERSION(2,9,0) if (event.IsIconized()) #else if ( event.Iconized() )