Update of /cvsroot/mahogany/M/src/modules
In directory sc8-pr-cvs1:/tmp/cvs-serv11211/src/modules

Modified Files:
        BareBonesEditor.cpp 
Log Message:
set the font in the composer to reflect the current encoding

Index: BareBonesEditor.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/BareBonesEditor.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -b -u -2 -r1.19 -r1.20
--- BareBonesEditor.cpp 1 Oct 2003 23:07:02 -0000       1.19
+++ BareBonesEditor.cpp 2 Oct 2003 10:35:17 -0000       1.20
@@ -125,4 +125,9 @@
 
 private:
+   // must be called when the encoding changes to reflect it at wxTextCtrl
+   // level
+   void SetFontEncoding();
+
+
    wxBareBonesEditorNotebook *m_notebook;
    wxTextCtrl *m_textControl;
@@ -884,7 +889,31 @@
 }
 
+void BareBonesEditor::SetFontEncoding()
+{
+   wxFont fontOld = m_textControl->GetFont();
+#if 0 // FIXME: wxGtk2.4/wxFont::SetEncoding doesn't work for some reason
+   wxFont fontNew(fontOld);
+   fontNew.SetEncoding(m_encoding);
+#else
+   wxFont fontNew(fontOld.GetPointSize(),
+                  fontOld.GetFamily(),
+                  fontOld.GetStyle(),
+                  fontOld.GetWeight(),
+                  fontOld.GetUnderlined(),
+                  fontOld.GetFaceName(),
+                  m_encoding);
+#endif
+
+   if ( fontNew.Ok() )
+   {
+      m_textControl->SetFont(fontNew);
+   }
+}
+
 void BareBonesEditor::SetEncoding(wxFontEncoding encoding)
 {
    m_encoding = encoding;
+
+   SetFontEncoding();
 }
 
@@ -990,24 +1019,5 @@
    if ( EnsureAvailableTextEncoding(&m_encoding, &text, true /* may ask */) )
    {
-      wxFont fontOld = m_textControl->GetFont();
-#if 0 // FIXME: wxGtk2.4/wxFont::SetEncoding doesn't work for some reason
-      wxFont fontNew(fontOld);
-      fontNew.SetEncoding(m_encoding);
-#else
-      wxFont fontNew(
-         fontOld.GetPointSize(),
-         fontOld.GetFamily(),
-         fontOld.GetStyle(),
-         fontOld.GetWeight(),
-         fontOld.GetUnderlined(),
-         fontOld.GetFaceName(),
-         m_encoding
-      );
-#endif
-
-      if ( fontNew.Ok() )
-      {
-         m_textControl->SetFont(fontNew);
-      }
+      SetFontEncoding();
    }
    //else: don't change the font, encoding is not supported anyhow



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to