wx3.0: compilation fix for arch linux

* Manually cast WxGetTranslation
* Accept string as format parameter of pxWindowTextWriter
* Manually convert wxString to wide string

Note: Wx setup.h is not the same between Debian and Arch. Unfortunately it
generated various compilations errors on wx code.

Close issue #172
This commit is contained in:
Gregory Hainaut 2014-08-02 13:34:44 +02:00
parent 3c9367825c
commit 82c7bcd761
8 changed files with 44 additions and 6 deletions

View File

@ -677,6 +677,9 @@ 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:
@ -690,6 +693,9 @@ 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 )
{

View File

@ -26,7 +26,12 @@ bool pxIsEnglish( int id )
// --------------------------------------------------------------------------------------
const wxChar* __fastcall pxExpandMsg( const wxChar* englishContent )
{
#if wxMAJOR_VERSION >= 3
wxString translation = wxGetTranslation( englishContent );
return translation.wc_str();
#else
return wxGetTranslation( englishContent );
#endif
}
// ------------------------------------------------------------------------
@ -45,5 +50,10 @@ const wxChar* __fastcall pxGetTranslation( const wxChar* message )
Console.WriteLn( Color_Green, L"Message: %s", message );
}
}
#if wxMAJOR_VERSION >= 3
wxString translation = wxGetTranslation( message );
return translation.wc_str();
#else
return wxGetTranslation( message );
#endif
}

View File

@ -106,6 +106,13 @@ 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.
void pxWindowTextWriter::_DoWrite( const wxChar* msg )
@ -153,3 +160,10 @@ 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

View File

@ -675,7 +675,7 @@ void wxAppWithHelpers::OnDeleteThread( wxCommandEvent& evt )
return;
}
pxThreadLog.Write(thr->GetName(), (wxString)L"Thread object deleted successfully" + (thr->HasPendingException() ? L" [exception pending!]" : wxEmptyString));
pxThreadLog.Write(thr->GetName(), wxString(wxString(L"Thread object deleted successfully") + (thr->HasPendingException() ? L" [exception pending!]" : L"")).wc_str() );
thr->RethrowException();
}

View File

@ -265,6 +265,14 @@ public:
Console.WriteRaw( msg );
return false;
}
#if wxMAJOR_VERSION >= 3
bool Write( const wxString msg ) const
{
return Write(msg.wc_str());
}
#endif
};
// --------------------------------------------------------------------------------------

View File

@ -211,7 +211,7 @@ void pxEvtQueue::ProcessEvents( pxEvtList& list, bool isIdle )
synclock.Release();
pxEvtLog.Write( this, deleteMe, wxsFormat(L"Executing... [%s]%s",
deleteMe->AllowCancelOnExit() ? L"Cancelable" : L"Noncancelable", isIdle ? L"(Idle)" : wxEmptyString)
deleteMe->AllowCancelOnExit() ? L"Cancelable" : L"Noncancelable", isIdle ? L"(Idle)" : wxEmptyString).wc_str()
);
if( deleteMe->AllowCancelOnExit() )
@ -224,7 +224,7 @@ void pxEvtQueue::ProcessEvents( pxEvtList& list, bool isIdle )
u64 qpc_end = GetCPUTicks();
pxEvtLog.Write( this, deleteMe, wxsFormat(L"Event completed in %ums",
(u32)(((qpc_end-m_qpc_Start)*1000) / GetTickFrequency()))
(u32)(((qpc_end-m_qpc_Start)*1000) / GetTickFrequency())).wc_str()
);
synclock.Acquire();

View File

@ -445,9 +445,9 @@ bool Panels::GameDatabasePanel::WriteFieldsToDB() {
wxString keyName (EnumToString(i)); keyName += L"Hack";
if (gameFixes[i]->IsIndeterminate())
game.deleteKey(keyName);
game.deleteKey(keyName.wc_str());
else
game.writeBool(keyName, gameFixes[i]->GetValue());
game.writeBool(keyName.wc_str(), gameFixes[i]->GetValue());
}
GameDB->updateGame(game);
return true;

View File

@ -97,7 +97,7 @@ float CfgReadFloat(const wchar_t* Section, const wchar_t* Name, float Default)
void CfgReadStr(const wchar_t* Section, const wchar_t* Name, wchar_t* Data, int DataSize, const wchar_t* Default)
{
setIni(Section);
wcscpy(Data, spuConfig->Read(Name, Default));
wcscpy(Data, spuConfig->Read(Name, Default).wc_str());
}
void CfgReadStr(const wchar_t* Section, const wchar_t* Name, wxString& Data, const wchar_t* Default)