git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21903
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// wxFontMapperPathChanger: change the config path during our lifetime
// ----------------------------------------------------------------------------
// wxFontMapperPathChanger: change the config path during our lifetime
// ----------------------------------------------------------------------------
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
class wxFontMapperPathChanger
{
class wxFontMapperPathChanger
{
#include "wx/fontutil.h" // for wxNativeEncodingInfo
#endif // wxUSE_GUI
#include "wx/fontutil.h" // for wxNativeEncodingInfo
#endif // wxUSE_GUI
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
class WXDLLIMPEXP_BASE wxConfigBase;
#endif // wxUSE_CONFIG
class WXDLLIMPEXP_BASE wxConfigBase;
#endif // wxUSE_CONFIG
// return instance of the wxFontMapper singleton
static wxFontMapper *Get();
// return instance of the wxFontMapper singleton
static wxFontMapper *Get();
- // set the sigleton to 'mapper' instance and return previous one
+ // set the singleton to 'mapper' instance and return previous one
static wxFontMapper *Set(wxFontMapper *mapper);
static wxFontMapper *Set(wxFontMapper *mapper);
// translates charset strings to encoding
// --------------------------------------
// translates charset strings to encoding
// --------------------------------------
virtual wxFontEncoding CharsetToEncoding(const wxString& charset,
bool interactive = true);
virtual wxFontEncoding CharsetToEncoding(const wxString& charset,
bool interactive = true);
// information about supported encodings
// -------------------------------------
// information about supported encodings
// -------------------------------------
// GetDefaultConfigPath()
// ----------------------------------------------------------------------
// GetDefaultConfigPath()
// ----------------------------------------------------------------------
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
// set the config object to use (may be NULL to use default)
void SetConfig(wxConfigBase *config) { m_config = config; }
// set the config object to use (may be NULL to use default)
void SetConfig(wxConfigBase *config) { m_config = config; }
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
// get the config object we're using -- if it wasn't set explicitly, this
// function will use wxConfig::Get() to get the global one
wxConfigBase *GetConfig();
// get the config object we're using -- if it wasn't set explicitly, this
// function will use wxConfig::Get() to get the global one
wxConfigBase *GetConfig();
GetConfig()->SetPath(pathOld);
}
GetConfig()->SetPath(pathOld);
}
// ----------------------------------------------------------------------------
// charset/encoding correspondence
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// charset/encoding correspondence
// ----------------------------------------------------------------------------
-#endif // wxUSE_CONFIG
-
encoding = GetEncoding(n);
}
encoding = GetEncoding(n);
}
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
// save the result in the config now
wxFontMapperPathChanger path(this, FONTMAPPER_CHARSET_PATH);
if ( path.IsOk() )
// save the result in the config now
wxFontMapperPathChanger path(this, FONTMAPPER_CHARSET_PATH);
if ( path.IsOk() )
if ( wxGetNativeFontEncoding(encReplacement, info) &&
wxTestFontEncoding(*info) )
{
if ( wxGetNativeFontEncoding(encReplacement, info) &&
wxTestFontEncoding(*info) )
{
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
// remember the mapping in the config
wxFontMapperPathChanger path(this, FONTMAPPER_FONT_FROM_ENCODING_PATH);
// remember the mapping in the config
wxFontMapperPathChanger path(this, FONTMAPPER_FONT_FROM_ENCODING_PATH);
}
configEntry += encName;
}
configEntry += encName;
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
// do we have a font spec for this encoding?
wxString fontinfo;
wxFontMapperPathChanger path(this, FONTMAPPER_FONT_FROM_ENCODING_PATH);
// do we have a font spec for this encoding?
wxString fontinfo;
wxFontMapperPathChanger path(this, FONTMAPPER_FONT_FROM_ENCODING_PATH);
*info = retData.EncodingInfo();
info->encoding = retData.GetEncoding();
*info = retData.EncodingInfo();
info->encoding = retData.GetEncoding();
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
// remember this in the config
wxFontMapperPathChanger path(this,
FONTMAPPER_FONT_FROM_ENCODING_PATH);
// remember this in the config
wxFontMapperPathChanger path(this,
FONTMAPPER_FONT_FROM_ENCODING_PATH);
// or selected to use equivalent encoding
//
// remember it to avoid asking the same question again later
// or selected to use equivalent encoding
//
// remember it to avoid asking the same question again later
+#if wxUSE_CONFIG && wxUSE_FILECONFIG
wxFontMapperPathChanger path(this,
FONTMAPPER_FONT_FROM_ENCODING_PATH);
if ( path.IsOk() )
wxFontMapperPathChanger path(this,
FONTMAPPER_FONT_FROM_ENCODING_PATH);
if ( path.IsOk() )