]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fontmap.cpp
restore the stream position in wxImageHandler itself instead of forcing all
[wxWidgets.git] / src / common / fontmap.cpp
index ab990ef8eb38007b2641395dfbc5f7a230b3683d..6c591571f0a68feef889f96a2f88ec71c291f008 100644 (file)
@@ -178,27 +178,6 @@ static const wxChar* gs_encodingNames[] =
     wxT( "utf-8" ),
 };
 
-// ----------------------------------------------------------------------------
-// global data
-// ----------------------------------------------------------------------------
-
-wxFontMapper * wxTheFontMapper = NULL;
-
-class wxFontMapperModule: public wxModule
-{
-public:
-    wxFontMapperModule() : wxModule() { }
-    virtual bool OnInit() { wxTheFontMapper = new wxFontMapper; return TRUE; }
-    virtual void OnExit()
-    {
-        delete wxTheFontMapper;
-        wxTheFontMapper = NULL;
-    }
-
-    DECLARE_DYNAMIC_CLASS(wxFontMapperModule)
-};
-
-IMPLEMENT_DYNAMIC_CLASS(wxFontMapperModule, wxModule)
 
 // ----------------------------------------------------------------------------
 // private classes
@@ -256,6 +235,34 @@ wxFontMapper::~wxFontMapper()
 #endif // wxUSE_CONFIG
 }
 
+wxFontMapper *wxFontMapper::sm_instance = NULL;
+
+/*static*/ wxFontMapper *wxFontMapper::Get()
+{
+    if ( !sm_instance )
+        sm_instance = new wxFontMapper;
+    return sm_instance;
+}
+
+/*static*/ wxFontMapper *wxFontMapper::Set(wxFontMapper *mapper)
+{
+    wxFontMapper *old = sm_instance;
+    sm_instance = mapper;
+    return old;
+}
+
+class wxFontMapperModule: public wxModule
+{
+public:
+    wxFontMapperModule() : wxModule() {}
+    virtual bool OnInit() { return TRUE; }
+    virtual void OnExit() { delete wxFontMapper::Set(NULL); }
+
+    DECLARE_DYNAMIC_CLASS(wxFontMapperModule)
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxFontMapperModule, wxModule)
+
 // ----------------------------------------------------------------------------
 // customisation
 // ----------------------------------------------------------------------------
@@ -875,7 +882,7 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
             wxFontData data;
             data.SetEncoding(encoding);
             data.EncodingInfo() = *info;
-            wxFontDialog dialog(m_windowParent, &data);
+            wxFontDialog dialog(m_windowParent, data);
             if ( dialog.ShowModal() == wxID_OK )
             {
                 wxFontData retData = dialog.GetFontData();