utilities: Remove wx2.8 code and uses of wxMAJOR_VERSION

This commit is contained in:
Jonathan Li 2016-04-28 00:30:08 +01:00
parent d89043d8ac
commit f78d1a4018
11 changed files with 2 additions and 49 deletions

View File

@ -34,11 +34,7 @@ public:
wxMessageOutput* CreateMessageOutput(); wxMessageOutput* CreateMessageOutput();
#ifdef wxUSE_STDPATHS #ifdef wxUSE_STDPATHS
#if wxMAJOR_VERSION < 3
wxStandardPathsBase& GetStandardPaths();
#else
wxStandardPaths& GetStandardPaths(); wxStandardPaths& GetStandardPaths();
#endif #endif
#endif
}; };

View File

@ -184,10 +184,8 @@ extern pxDoAssertFnType* pxDoAssert;
extern void pxOnAssert( const DiagnosticOrigin& origin, const wxChar* msg=NULL ); extern void pxOnAssert( const DiagnosticOrigin& origin, const wxChar* msg=NULL );
extern void pxOnAssert( const DiagnosticOrigin& origin, const char* msg ); 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 wxString& msg);
extern void pxOnAssert( const DiagnosticOrigin& origin, const FastFormatUnicode& msg); extern void pxOnAssert( const DiagnosticOrigin& origin, const FastFormatUnicode& msg);
#endif
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// jNO_DEFAULT -- disables the default case in a switch, which improves switch optimization // jNO_DEFAULT -- disables the default case in a switch, which improves switch optimization

View File

@ -121,12 +121,10 @@ struct IConsoleWriter
bool Error( const wxChar* fmt, ... ) const; bool Error( const wxChar* fmt, ... ) const;
bool Warning( const wxChar* fmt, ... ) const; bool Warning( const wxChar* fmt, ... ) const;
#if wxMAJOR_VERSION >= 3
bool WriteLn( ConsoleColors color, const wxString fmt, ... ) const; bool WriteLn( ConsoleColors color, const wxString fmt, ... ) const;
bool WriteLn( const wxString fmt, ... ) const; bool WriteLn( const wxString fmt, ... ) const;
bool Error( const wxString fmt, ... ) const; bool Error( const wxString fmt, ... ) const;
bool Warning( 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 Error( const wxChar* fmt, ... ) const { return false; }
bool Warning( 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( ConsoleColors color, const wxString fmt, ... ) const { return false; }
bool WriteLn( const wxString fmt, ... ) const { return false; } bool WriteLn( const wxString fmt, ... ) const { return false; }
bool Error( const wxString fmt, ... ) const { return false; } bool Error( const wxString fmt, ... ) const { return false; }
bool Warning( const wxString fmt, ... ) const { return false; } bool Warning( const wxString fmt, ... ) const { return false; }
#endif
}; };
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------

View File

@ -25,11 +25,7 @@
#define WX_STR(str) (str.wc_str()) #define WX_STR(str) (str.wc_str())
#else #else
// Stupid wx3.0 doesn't support c_str for vararg function // Stupid wx3.0 doesn't support c_str for vararg function
#if wxMAJOR_VERSION >= 3
#define WX_STR(str) (static_cast<const char*>(str.c_str())) #define WX_STR(str) (static_cast<const char*>(str.c_str()))
#else
#define WX_STR(str) (str.c_str())
#endif
#endif #endif
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
@ -196,9 +192,7 @@ public:
FastFormatUnicode& Write( const char* fmt, ... ); FastFormatUnicode& Write( const char* fmt, ... );
FastFormatUnicode& Write( const wxChar* fmt, ... ); FastFormatUnicode& Write( const wxChar* fmt, ... );
#if wxMAJOR_VERSION >= 3
FastFormatUnicode& Write( const wxString fmt, ... ); FastFormatUnicode& Write( const wxString fmt, ... );
#endif
FastFormatUnicode& WriteV( const char* fmt, va_list argptr ); FastFormatUnicode& WriteV( const char* fmt, va_list argptr );
FastFormatUnicode& WriteV( const wxChar* fmt, va_list argptr ); FastFormatUnicode& WriteV( const wxChar* fmt, va_list argptr );

View File

@ -193,7 +193,6 @@ public:
return false; return false;
} }
#if wxMAJOR_VERSION >= 3
bool Write( const wxString fmt, ... ) const bool Write( const wxString fmt, ... ) const
{ {
va_list list; va_list list;
@ -203,7 +202,6 @@ public:
return false; return false;
} }
#endif
// Writes to the console using the specified color. This overrides the default color setting // Writes to the console using the specified color. This overrides the default color setting
// for this log. // for this log.
@ -239,7 +237,6 @@ public:
return false; return false;
} }
#if wxMAJOR_VERSION >= 3
bool Warn( const wxString fmt, ... ) const bool Warn( const wxString fmt, ... ) const
{ {
va_list list; va_list list;
@ -249,7 +246,6 @@ public:
return false; return false;
} }
#endif
// Writes to the console using bold red text -- overrides the log source's default // Writes to the console using bold red text -- overrides the log source's default
// color settings. // color settings.
@ -263,7 +259,6 @@ public:
return false; return false;
} }
#if wxMAJOR_VERSION >= 3
bool Error( const wxString fmt, ... ) const bool Error( const wxString fmt, ... ) const
{ {
va_list list; va_list list;
@ -273,7 +268,6 @@ public:
return false; return false;
} }
#endif
bool WriteV( const char *fmt, va_list list ) const; bool WriteV( const char *fmt, va_list list ) const;
bool WriteV( const wxChar *fmt, va_list list ) const; bool WriteV( const wxChar *fmt, va_list list ) const;

View File

@ -676,9 +676,7 @@ protected:
int m_leading; int m_leading;
virtual void _DoWriteLn( const wxChar* msg ); virtual void _DoWriteLn( const wxChar* msg );
#if wxMAJOR_VERSION >= 3
void _DoWriteLn( const wxString msg ); void _DoWriteLn( const wxString msg );
#endif
void _DoWrite( const wxChar* msg ); void _DoWrite( const wxChar* msg );
public: public:
@ -692,9 +690,7 @@ public:
pxWindowTextWriter& WriteLn( const wxChar* fmt ); pxWindowTextWriter& WriteLn( const wxChar* fmt );
pxWindowTextWriter& SetFont( const wxFont& font ); pxWindowTextWriter& SetFont( const wxFont& font );
pxWindowTextWriter& Align( const wxAlignment& align ); pxWindowTextWriter& Align( const wxAlignment& align );
#if wxMAJOR_VERSION >= 3
pxWindowTextWriter& WriteLn( const wxString fmt ); pxWindowTextWriter& WriteLn( const wxString fmt );
#endif
pxWindowTextWriter& SetLeading( int lead ) pxWindowTextWriter& SetLeading( int lead )
{ {

View File

@ -479,7 +479,6 @@ bool IConsoleWriter::Warning( const wxChar* fmt, ... ) const
return false; return false;
} }
#if wxMAJOR_VERSION >= 3
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// Write Variants - Unknown style // Write Variants - Unknown style
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
@ -525,7 +524,6 @@ bool IConsoleWriter::Warning( const wxString fmt, ... ) const
return false; return false;
} }
#endif
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------

View File

@ -140,7 +140,6 @@ __fi void pxOnAssert( const DiagnosticOrigin& origin, const char* msg)
pxOnAssert( origin, fromUTF8(msg) ); pxOnAssert( origin, fromUTF8(msg) );
} }
#if wxMAJOR_VERSION >= 3
__fi void pxOnAssert( const DiagnosticOrigin& origin, const wxString& msg) __fi void pxOnAssert( const DiagnosticOrigin& origin, const wxString& msg)
{ {
pxOnAssert( origin, msg.wc_str() ); pxOnAssert( origin, msg.wc_str() );
@ -150,7 +149,6 @@ __fi void pxOnAssert( const DiagnosticOrigin& origin, const FastFormatUnicode& m
{ {
pxOnAssert( origin, msg.c_str()); pxOnAssert( origin, msg.c_str());
} }
#endif
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// BaseException (implementations) // BaseException (implementations)
@ -160,11 +158,7 @@ BaseException::~BaseException() throw() {}
BaseException& BaseException::SetBothMsgs( const wxChar* msg_diag ) BaseException& BaseException::SetBothMsgs( const wxChar* msg_diag )
{ {
#if wxMAJOR_VERSION >= 3
m_message_user = msg_diag ? wxString(wxGetTranslation( msg_diag )) : wxString(""); 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 ); return SetDiagMsg( msg_diag );
} }

View File

@ -313,7 +313,6 @@ FastFormatUnicode& FastFormatUnicode::Write( const wxChar* fmt, ... )
return *this; return *this;
} }
#if wxMAJOR_VERSION >= 3
FastFormatUnicode& FastFormatUnicode::Write( const wxString fmt, ... ) FastFormatUnicode& FastFormatUnicode::Write( const wxString fmt, ... )
{ {
va_list list; va_list list;
@ -322,7 +321,6 @@ FastFormatUnicode& FastFormatUnicode::Write( const wxString fmt, ... )
va_end(list); va_end(list);
return *this; return *this;
} }
#endif
bool FastFormatUnicode::IsEmpty() const bool FastFormatUnicode::IsEmpty() const
{ {

View File

@ -26,11 +26,7 @@ bool pxIsEnglish( int id )
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
const wxChar* __fastcall pxExpandMsg( const wxChar* englishContent ) const wxChar* __fastcall pxExpandMsg( const wxChar* englishContent )
{ {
#if _WIN32 || wxMAJOR_VERSION < 3
return wxGetTranslation(englishContent);
#else
return wxGetTranslation(englishContent).wc_str(); 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 ); Console.WriteLn( Color_Green, L"Message: %s", message );
} }
} }
#if _WIN32 || wxMAJOR_VERSION < 3
return wxGetTranslation(message); return wxGetTranslation(message).wc_str();
#else
return wxGetTranslation( message ).wc_str();
#endif
} }

View File

@ -106,12 +106,10 @@ void pxWindowTextWriter::_DoWriteLn( const wxChar* msg )
m_curpos.y += tHeight + m_leading; m_curpos.y += tHeight + m_leading;
} }
#if wxMAJOR_VERSION >= 3
void pxWindowTextWriter::_DoWriteLn( const wxString msg ) void pxWindowTextWriter::_DoWriteLn( const wxString msg )
{ {
_DoWriteLn(msg.wc_str()); _DoWriteLn(msg.wc_str());
} }
#endif
// Splits incoming multi-line strings into pieces, and dispatches each line individually // Splits incoming multi-line strings into pieces, and dispatches each line individually
// to the text writer. // to the text writer.
@ -160,10 +158,8 @@ pxWindowTextWriter& pxWindowTextWriter::FormatLn( const wxChar* fmt, ... )
return *this; return *this;
} }
#if wxMAJOR_VERSION >= 3
pxWindowTextWriter& pxWindowTextWriter::WriteLn( const wxString fmt ) pxWindowTextWriter& pxWindowTextWriter::WriteLn( const wxString fmt )
{ {
_DoWrite( fmt.wc_str() ); _DoWrite( fmt.wc_str() );
return *this; return *this;
} }
#endif