From f78d1a40181d47dba11573305f8d3fe00b21ffec Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Thu, 28 Apr 2016 00:30:08 +0100 Subject: [PATCH] utilities: Remove wx2.8 code and uses of wxMAJOR_VERSION --- common/include/Utilities/AppTrait.h | 4 ---- common/include/Utilities/Assertions.h | 2 -- common/include/Utilities/Console.h | 4 ---- common/include/Utilities/StringHelpers.h | 6 ------ common/include/Utilities/TraceLog.h | 6 ------ common/include/Utilities/wxGuiTools.h | 4 ---- common/src/Utilities/Console.cpp | 2 -- common/src/Utilities/Exceptions.cpp | 6 ------ common/src/Utilities/FastFormatString.cpp | 2 -- common/src/Utilities/pxTranslate.cpp | 11 ++--------- common/src/Utilities/pxWindowTextWriter.cpp | 4 ---- 11 files changed, 2 insertions(+), 49 deletions(-) diff --git a/common/include/Utilities/AppTrait.h b/common/include/Utilities/AppTrait.h index 005f157999..6ddce2658e 100644 --- a/common/include/Utilities/AppTrait.h +++ b/common/include/Utilities/AppTrait.h @@ -34,11 +34,7 @@ public: wxMessageOutput* CreateMessageOutput(); #ifdef wxUSE_STDPATHS -#if wxMAJOR_VERSION < 3 - wxStandardPathsBase& GetStandardPaths(); -#else wxStandardPaths& GetStandardPaths(); #endif -#endif }; diff --git a/common/include/Utilities/Assertions.h b/common/include/Utilities/Assertions.h index 0f268d028e..3bdefb7165 100644 --- a/common/include/Utilities/Assertions.h +++ b/common/include/Utilities/Assertions.h @@ -184,10 +184,8 @@ extern pxDoAssertFnType* pxDoAssert; extern void pxOnAssert( const DiagnosticOrigin& origin, const wxChar* msg=NULL ); extern void pxOnAssert( const DiagnosticOrigin& origin, const char* msg ); -#if wxMAJOR_VERSION >= 3 extern void pxOnAssert( const DiagnosticOrigin& origin, const wxString& msg); extern void pxOnAssert( const DiagnosticOrigin& origin, const FastFormatUnicode& msg); -#endif // -------------------------------------------------------------------------------------- // jNO_DEFAULT -- disables the default case in a switch, which improves switch optimization diff --git a/common/include/Utilities/Console.h b/common/include/Utilities/Console.h index b296edd523..476519e8c4 100644 --- a/common/include/Utilities/Console.h +++ b/common/include/Utilities/Console.h @@ -121,12 +121,10 @@ struct IConsoleWriter bool Error( const wxChar* fmt, ... ) const; bool Warning( const wxChar* fmt, ... ) const; -#if wxMAJOR_VERSION >= 3 bool WriteLn( ConsoleColors color, const wxString fmt, ... ) const; bool WriteLn( const wxString fmt, ... ) const; bool Error( const wxString fmt, ... ) const; bool Warning( const wxString fmt, ... ) const; -#endif }; // -------------------------------------------------------------------------------------- @@ -163,12 +161,10 @@ struct NullConsoleWriter bool Error( const wxChar* fmt, ... ) const { return false; } bool Warning( const wxChar* fmt, ... ) const { return false; } -#if wxMAJOR_VERSION >= 3 bool WriteLn( ConsoleColors color, const wxString fmt, ... ) const { return false; } bool WriteLn( const wxString fmt, ... ) const { return false; } bool Error( const wxString fmt, ... ) const { return false; } bool Warning( const wxString fmt, ... ) const { return false; } -#endif }; // -------------------------------------------------------------------------------------- diff --git a/common/include/Utilities/StringHelpers.h b/common/include/Utilities/StringHelpers.h index c0ec12937f..975e1ba75a 100644 --- a/common/include/Utilities/StringHelpers.h +++ b/common/include/Utilities/StringHelpers.h @@ -25,11 +25,7 @@ #define WX_STR(str) (str.wc_str()) #else // Stupid wx3.0 doesn't support c_str for vararg function -#if wxMAJOR_VERSION >= 3 #define WX_STR(str) (static_cast(str.c_str())) -#else - #define WX_STR(str) (str.c_str()) -#endif #endif // -------------------------------------------------------------------------------------- @@ -196,9 +192,7 @@ public: FastFormatUnicode& Write( const char* fmt, ... ); FastFormatUnicode& Write( const wxChar* fmt, ... ); -#if wxMAJOR_VERSION >= 3 FastFormatUnicode& Write( const wxString fmt, ... ); -#endif FastFormatUnicode& WriteV( const char* fmt, va_list argptr ); FastFormatUnicode& WriteV( const wxChar* fmt, va_list argptr ); diff --git a/common/include/Utilities/TraceLog.h b/common/include/Utilities/TraceLog.h index 5884100cf8..f7b6f21088 100644 --- a/common/include/Utilities/TraceLog.h +++ b/common/include/Utilities/TraceLog.h @@ -193,7 +193,6 @@ public: return false; } -#if wxMAJOR_VERSION >= 3 bool Write( const wxString fmt, ... ) const { va_list list; @@ -203,7 +202,6 @@ public: return false; } -#endif // Writes to the console using the specified color. This overrides the default color setting // for this log. @@ -239,7 +237,6 @@ public: return false; } -#if wxMAJOR_VERSION >= 3 bool Warn( const wxString fmt, ... ) const { va_list list; @@ -249,7 +246,6 @@ public: return false; } -#endif // Writes to the console using bold red text -- overrides the log source's default // color settings. @@ -263,7 +259,6 @@ public: return false; } -#if wxMAJOR_VERSION >= 3 bool Error( const wxString fmt, ... ) const { va_list list; @@ -273,7 +268,6 @@ public: return false; } -#endif bool WriteV( const char *fmt, va_list list ) const; bool WriteV( const wxChar *fmt, va_list list ) const; diff --git a/common/include/Utilities/wxGuiTools.h b/common/include/Utilities/wxGuiTools.h index 4892eefb47..9cb220a744 100644 --- a/common/include/Utilities/wxGuiTools.h +++ b/common/include/Utilities/wxGuiTools.h @@ -676,9 +676,7 @@ protected: int m_leading; virtual void _DoWriteLn( const wxChar* msg ); -#if wxMAJOR_VERSION >= 3 void _DoWriteLn( const wxString msg ); -#endif void _DoWrite( const wxChar* msg ); public: @@ -692,9 +690,7 @@ public: pxWindowTextWriter& WriteLn( const wxChar* fmt ); pxWindowTextWriter& SetFont( const wxFont& font ); pxWindowTextWriter& Align( const wxAlignment& align ); -#if wxMAJOR_VERSION >= 3 pxWindowTextWriter& WriteLn( const wxString fmt ); -#endif pxWindowTextWriter& SetLeading( int lead ) { diff --git a/common/src/Utilities/Console.cpp b/common/src/Utilities/Console.cpp index 9761b43b7e..dea8cf4c11 100644 --- a/common/src/Utilities/Console.cpp +++ b/common/src/Utilities/Console.cpp @@ -479,7 +479,6 @@ bool IConsoleWriter::Warning( const wxChar* fmt, ... ) const return false; } -#if wxMAJOR_VERSION >= 3 // -------------------------------------------------------------------------------------- // Write Variants - Unknown style // -------------------------------------------------------------------------------------- @@ -525,7 +524,6 @@ bool IConsoleWriter::Warning( const wxString fmt, ... ) const return false; } -#endif // -------------------------------------------------------------------------------------- diff --git a/common/src/Utilities/Exceptions.cpp b/common/src/Utilities/Exceptions.cpp index d600c7553c..801b8a4479 100644 --- a/common/src/Utilities/Exceptions.cpp +++ b/common/src/Utilities/Exceptions.cpp @@ -140,7 +140,6 @@ __fi void pxOnAssert( const DiagnosticOrigin& origin, const char* msg) pxOnAssert( origin, fromUTF8(msg) ); } -#if wxMAJOR_VERSION >= 3 __fi void pxOnAssert( const DiagnosticOrigin& origin, const wxString& msg) { pxOnAssert( origin, msg.wc_str() ); @@ -150,7 +149,6 @@ __fi void pxOnAssert( const DiagnosticOrigin& origin, const FastFormatUnicode& m { pxOnAssert( origin, msg.c_str()); } -#endif // -------------------------------------------------------------------------------------- // BaseException (implementations) @@ -160,11 +158,7 @@ BaseException::~BaseException() throw() {} BaseException& BaseException::SetBothMsgs( const wxChar* msg_diag ) { -#if wxMAJOR_VERSION >= 3 m_message_user = msg_diag ? wxString(wxGetTranslation( msg_diag )) : wxString(""); -#else - m_message_user = msg_diag ? wxGetTranslation( msg_diag ) : wxEmptyString; -#endif return SetDiagMsg( msg_diag ); } diff --git a/common/src/Utilities/FastFormatString.cpp b/common/src/Utilities/FastFormatString.cpp index 144e25789f..863fb9b3c8 100644 --- a/common/src/Utilities/FastFormatString.cpp +++ b/common/src/Utilities/FastFormatString.cpp @@ -313,7 +313,6 @@ FastFormatUnicode& FastFormatUnicode::Write( const wxChar* fmt, ... ) return *this; } -#if wxMAJOR_VERSION >= 3 FastFormatUnicode& FastFormatUnicode::Write( const wxString fmt, ... ) { va_list list; @@ -322,7 +321,6 @@ FastFormatUnicode& FastFormatUnicode::Write( const wxString fmt, ... ) va_end(list); return *this; } -#endif bool FastFormatUnicode::IsEmpty() const { diff --git a/common/src/Utilities/pxTranslate.cpp b/common/src/Utilities/pxTranslate.cpp index 1d314ea68b..11ed31a6d5 100644 --- a/common/src/Utilities/pxTranslate.cpp +++ b/common/src/Utilities/pxTranslate.cpp @@ -26,11 +26,7 @@ bool pxIsEnglish( int id ) // -------------------------------------------------------------------------------------- const wxChar* __fastcall pxExpandMsg( const wxChar* englishContent ) { -#if _WIN32 || wxMAJOR_VERSION < 3 - return wxGetTranslation(englishContent); -#else return wxGetTranslation(englishContent).wc_str(); -#endif } // ------------------------------------------------------------------------ @@ -49,9 +45,6 @@ const wxChar* __fastcall pxGetTranslation( const wxChar* message ) Console.WriteLn( Color_Green, L"Message: %s", message ); } } -#if _WIN32 || wxMAJOR_VERSION < 3 - return wxGetTranslation(message); -#else - return wxGetTranslation( message ).wc_str(); -#endif + + return wxGetTranslation(message).wc_str(); } diff --git a/common/src/Utilities/pxWindowTextWriter.cpp b/common/src/Utilities/pxWindowTextWriter.cpp index d87c9f4cf3..fdbecfd860 100644 --- a/common/src/Utilities/pxWindowTextWriter.cpp +++ b/common/src/Utilities/pxWindowTextWriter.cpp @@ -106,12 +106,10 @@ void pxWindowTextWriter::_DoWriteLn( const wxChar* msg ) m_curpos.y += tHeight + m_leading; } -#if wxMAJOR_VERSION >= 3 void pxWindowTextWriter::_DoWriteLn( const wxString msg ) { _DoWriteLn(msg.wc_str()); } -#endif // Splits incoming multi-line strings into pieces, and dispatches each line individually // to the text writer. @@ -160,10 +158,8 @@ pxWindowTextWriter& pxWindowTextWriter::FormatLn( const wxChar* fmt, ... ) return *this; } -#if wxMAJOR_VERSION >= 3 pxWindowTextWriter& pxWindowTextWriter::WriteLn( const wxString fmt ) { _DoWrite( fmt.wc_str() ); return *this; } -#endif