Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv3948/src/gui

Modified Files:
        wxComposeView.cpp wxFolderView.cpp wxMApp.cpp 
Added Files:
        wxMGuiUtils.cpp 
Log Message:
better/more general fix for the font-overriding problem:
 1. added new CreateFontFromDesc() function (and put it new wxMGuiUtils.cpp
    together with EnsureAvailableTextEncoding() which used to be in
    wxMApp.cpp)
 2. default font family and size are now wxDEFAULT/-1
 3. use CreateFontFromDesc() from message view, composer and folder view
    and don't use the returned font if it's invalid


***** Error reading new file: [Errno 2] No such file or directory: 
'wxMGuiUtils.cpp'
Index: wxComposeView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxComposeView.cpp,v
retrieving revision 1.414
retrieving revision 1.415
diff -b -u -2 -r1.414 -r1.415
--- wxComposeView.cpp   19 Aug 2006 12:03:39 -0000      1.414
+++ wxComposeView.cpp   19 Aug 2006 13:11:59 -0000      1.415
@@ -925,15 +925,5 @@
 wxFont ComposerOptions::GetFont() const
 {
-   wxFont font;
-   if ( !m_font.empty() )
-   {
-      wxNativeFontInfo fontInfo;
-      if ( fontInfo.FromString(m_font) )
-      {
-         font.SetNativeFontInfo(fontInfo);
-      }
-   }
-
-   return font;
+   return CreateFontFromDesc(m_font, m_fontSize, m_fontFamily);
 }
 

Index: wxFolderView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxFolderView.cpp,v
retrieving revision 1.682
retrieving revision 1.683
diff -b -u -2 -r1.682 -r1.683
--- wxFolderView.cpp    19 Aug 2006 12:03:39 -0000      1.682
+++ wxFolderView.cpp    19 Aug 2006 13:12:00 -0000      1.683
@@ -1609,14 +1609,5 @@
    SetBackgroundColour( bg );
 
-   wxFont font;
-   if ( !fontDesc.empty() )
-   {
-      wxNativeFontInfo fontInfo;
-      if ( fontInfo.FromString(fontDesc) )
-      {
-         font.SetNativeFontInfo(fontInfo);
-      }
-   }
-
+   wxFont font(CreateFontFromDesc(fontDesc, fontSize, fontFamily));
    if ( font.Ok() )
    {

Index: wxMApp.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMApp.cpp,v
retrieving revision 1.305
retrieving revision 1.306
diff -b -u -2 -r1.305 -r1.306
--- wxMApp.cpp  19 Apr 2006 00:55:04 -0000      1.305
+++ wxMApp.cpp  19 Aug 2006 13:12:00 -0000      1.306
@@ -2504,71 +2504,4 @@
 }
 
-// ----------------------------------------------------------------------------
-// global functions implemented here
-// ----------------------------------------------------------------------------
-
-extern bool EnsureAvailableTextEncoding(wxFontEncoding *enc,
-                                        wxString *text,
-                                        bool mayAskUser)
-{
-   CHECK( enc, false, _T("CheckEncodingAvailability: NULL encoding") );
-
-   if ( !wxFontMapper::Get()->IsEncodingAvailable(*enc) )
-   {
-      // try to find another encoding
-      wxFontEncoding encAlt;
-      if ( wxFontMapper::Get()->
-            GetAltForEncoding(*enc, &encAlt, wxEmptyString, mayAskUser) )
-      {
-         // translate the text (if any) to the equivalent encoding
-         if ( text && !text->empty() )
-         {
-#if wxUSE_WCHAR_T
-            // try converting via Unicode
-            wxCSConv a2w(*enc);
-            wxWCharBuffer wbuf(a2w.cMB2WC(text->c_str()));
-            if ( *wbuf )
-            {
-               // special case of UTF-8 which is used all the time under wxGTK
-               if ( encAlt == wxFONTENCODING_UTF8 )
-               {
-                  *text = wxConvUTF8.cWC2MB(wbuf);
-               }
-               else // all the other encodings, use generic converter
-               {
-                  wxCSConv w2a(encAlt);
-                  *text = w2a.cWC2MB(wbuf);
-               }
-
-               if ( !text->empty() )
-                  return true;
-               //else: fall back to wxEncodingConverter
-            }
-            //else: conversion to Unicode failed
-#endif // wxUSE_WCHAR_T
-
-            wxEncodingConverter conv;
-            if ( !conv.Init(*enc, encAlt) )
-            {
-               // failed to convert the text
-               return false;
-            }
-
-            *text = conv.Convert(*text);
-         }
-         //else: just return the encoding
-
-         *enc = encAlt;
-      }
-      else // no equivalent encoding
-      {
-         return false;
-      }
-   }
-
-   // we have either the requested encoding or an equivalent one
-   return true;
-}
-
 // ============================================================================
 // IPC and multiple program instances handling


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to