X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1c193821a999730fbf6a9bea83763f37daae68f1..e7c9692f16127b39de2723457cdb2d46e563b383:/src/common/fmapbase.cpp diff --git a/src/common/fmapbase.cpp b/src/common/fmapbase.cpp index fa6dcd0d65..b49754d7f9 100644 --- a/src/common/fmapbase.cpp +++ b/src/common/fmapbase.cpp @@ -43,7 +43,8 @@ #include "wx/apptrait.h" #include "wx/module.h" -#if wxUSE_CONFIG +// wxMemoryConfig uses wxFileConfig +#if wxUSE_CONFIG && wxUSE_FILECONFIG #include "wx/config.h" #include "wx/memconf.h" #endif @@ -197,7 +198,7 @@ wxFontMapper *wxFontMapperBase::sm_instance = NULL; wxFontMapperBase::wxFontMapperBase() { -#if wxUSE_CONFIG +#if wxUSE_CONFIG && wxUSE_FILECONFIG m_config = NULL; m_configIsDummy = FALSE; #endif // wxUSE_CONFIG @@ -205,7 +206,7 @@ wxFontMapperBase::wxFontMapperBase() wxFontMapperBase::~wxFontMapperBase() { -#if wxUSE_CONFIG +#if wxUSE_CONFIG && wxUSE_FILECONFIG if ( m_configIsDummy ) delete m_config; #endif // wxUSE_CONFIG @@ -244,7 +245,7 @@ wxFontMapper *wxFontMapperBase::Set(wxFontMapper *mapper) return old; } -#if wxUSE_CONFIG +#if wxUSE_CONFIG && wxUSE_FILECONFIG // ---------------------------------------------------------------------------- // config usage customisation @@ -352,6 +353,8 @@ void wxFontMapperBase::RestorePath(const wxString& pathOld) GetConfig()->SetPath(pathOld); } +#endif + // ---------------------------------------------------------------------------- // charset/encoding correspondence // ---------------------------------------------------------------------------- @@ -359,13 +362,27 @@ void wxFontMapperBase::RestorePath(const wxString& pathOld) wxFontEncoding wxFontMapperBase::CharsetToEncoding(const wxString& charset, bool WXUNUSED(interactive)) +{ + int enc = NonInteractiveCharsetToEncoding(charset); + if ( enc == wxFONTENCODING_UNKNOWN ) + { + // we should return wxFONTENCODING_SYSTEM from here for unknown + // encodings + enc = wxFONTENCODING_SYSTEM; + } + + return (wxFontEncoding)enc; +} + +int +wxFontMapperBase::NonInteractiveCharsetToEncoding(const wxString& charset) { wxFontEncoding encoding = wxFONTENCODING_SYSTEM; // we're going to modify it, make a copy wxString cs = charset; -#if wxUSE_CONFIG +#if wxUSE_CONFIG && wxUSE_FILECONFIG // first try the user-defined settings wxFontMapperPathChanger path(this, FONTMAPPER_CHARSET_PATH); if ( path.IsOk() ) @@ -379,7 +396,7 @@ wxFontMapperBase::CharsetToEncoding(const wxString& charset, if ( value == wxFONTENCODING_UNKNOWN ) { // don't try to find it, in particular don't ask the user - return wxFONTENCODING_SYSTEM; + return value; } if ( value >= 0 && value <= wxFONTENCODING_MAX ) @@ -641,7 +658,5 @@ wxString wxFontMapperBase::GetEncodingName(wxFontEncoding encoding) return str; } -#endif // wxUSE_CONFIG - #endif // wxUSE_FONTMAP