]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fontmap.cpp
TRUE, not true; FALSE not false
[wxWidgets.git] / src / common / fontmap.cpp
index 6ab97b4c2f5416c7bfe8fd95f3301df03549b3cd..6c591571f0a68feef889f96a2f88ec71c291f008 100644 (file)
@@ -36,6 +36,7 @@
     #include "wx/intl.h"
 #endif // PCH
 
     #include "wx/intl.h"
 #endif // PCH
 
+#include "wx/module.h"
 #include "wx/fontmap.h"
 
 #if wxUSE_CONFIG
 #include "wx/fontmap.h"
 
 #if wxUSE_CONFIG
@@ -177,15 +178,6 @@ static const wxChar* gs_encodingNames[] =
     wxT( "utf-8" ),
 };
 
     wxT( "utf-8" ),
 };
 
-// ----------------------------------------------------------------------------
-// global data
-// ----------------------------------------------------------------------------
-
-// private object
-static wxFontMapper gs_fontMapper;
-
-// and public pointer
-wxFontMapper * wxTheFontMapper = &gs_fontMapper;
 
 // ----------------------------------------------------------------------------
 // private classes
 
 // ----------------------------------------------------------------------------
 // private classes
@@ -243,6 +235,34 @@ wxFontMapper::~wxFontMapper()
 #endif // wxUSE_CONFIG
 }
 
 #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
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // customisation
 // ----------------------------------------------------------------------------
@@ -743,9 +763,9 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
     // message
     if ( encoding == wxFONTENCODING_SYSTEM )
     {
     // message
     if ( encoding == wxFONTENCODING_SYSTEM )
     {
-        wxFatalError(_("can't load any font, aborting"));
+        wxLogFatalError(_("can't load any font, aborting"));
 
 
-        // wxFatalError doesn't return
+        // wxLogFatalError doesn't return
     }
 
     wxString configEntry,
     }
 
     wxString configEntry,
@@ -862,7 +882,7 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
             wxFontData data;
             data.SetEncoding(encoding);
             data.EncodingInfo() = *info;
             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();
             if ( dialog.ShowModal() == wxID_OK )
             {
                 wxFontData retData = dialog.GetFontData();