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;
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;
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 )
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
#endif // wxUSE_CONFIG
}
- return encoding;
+ return (wxFontEncoding)encoding;
}
// ----------------------------------------------------------------------------