]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed suppressing of wxFontMapper questions which was broken by GUI/base separation...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 20 Jul 2003 18:40:24 +0000 (18:40 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 20 Jul 2003 18:40:24 +0000 (18:40 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22155 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/fontmap.h
src/common/fmapbase.cpp
src/common/fontmap.cpp

index f13cf47a50e92f787a9da4056dadbc4b6a4c8303..7e3481db5b3921f1c04167716522149372f446f5 100644 (file)
@@ -141,6 +141,13 @@ protected:
     wxString m_configRootPath;
 #endif // wxUSE_CONFIG
 
+    // the real implementation of the base class version of CharsetToEncoding()
+    //
+    // returns wxFONTENCODING_UNKNOWN if encoding is unknown and we shouldn't
+    // ask the user about it, wxFONTENCODING_SYSTEM if it is unknown but we
+    // should/could ask the user
+    int NonInteractiveCharsetToEncoding(const wxString& charset);
+
 private:
     // the global fontmapper object or NULL
     static wxFontMapper *sm_instance;
index f39c95e01da9cb1e220def466a0d7887ea09ab95..b49754d7f93f4faf22fe601869ad3d99b8019cab 100644 (file)
@@ -362,6 +362,20 @@ 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;
 
@@ -382,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 )
index 4df6f648b1f0dd3bdfc56fcc70df2c8fe05c1270..ed0b001b0d5e3ec2ffbe2836cd694b81df230936 100644 (file)
@@ -108,11 +108,16 @@ wxFontEncoding
 wxFontMapper::CharsetToEncoding(const wxString& charset, bool interactive)
 {
     // try the ways not needing the users intervention first
-    wxFontEncoding
-        encoding = wxFontMapperBase::CharsetToEncoding(charset, interactive);
+    int encoding = wxFontMapperBase::NonInteractiveCharsetToEncoding(charset);
 
     // if we failed to find the encoding, ask the user -- unless disabled
-    if ( (encoding == wxFONTENCODING_SYSTEM) && interactive )
+    if ( encoding == wxFONTENCODING_UNKNOWN )
+    {
+        // this is the special value which disables asking the user (he had
+        // chosen to suppress this the last time)
+        encoding = wxFONTENCODING_SYSTEM;
+    }
+    else if ( (encoding == wxFONTENCODING_SYSTEM) && interactive )
     {
         // prepare the dialog data
 
@@ -171,7 +176,7 @@ wxFontMapper::CharsetToEncoding(const wxString& charset, bool interactive)
 #endif // wxUSE_CONFIG
     }
 
-    return encoding;
+    return (wxFontEncoding)encoding;
 }
 
 // ----------------------------------------------------------------------------