]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fmapbase.cpp
generate a text event even if SetValue() didn't really chaneg anything
[wxWidgets.git] / src / common / fmapbase.cpp
index fa6dcd0d65eb693774c2c590cea1f6861060ee82..b49754d7f93f4faf22fe601869ad3d99b8019cab 100644 (file)
@@ -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