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

Modified Files:
        BareBonesEditor.cpp 
Log Message:
CRLF fix and font fix for minimal editor

Index: BareBonesEditor.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/BareBonesEditor.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -b -u -2 -r1.6 -r1.7
--- BareBonesEditor.cpp 31 Aug 2003 21:11:18 -0000      1.6
+++ BareBonesEditor.cpp 1 Sep 2003 15:35:31 -0000       1.7
@@ -24,4 +24,5 @@
 #ifndef USE_PCH
    #include "Mcommon.h"
+   #include "strutil.h"
 
    #include <wx/textctrl.h>
@@ -126,7 +127,4 @@
    wxListCtrl *m_attachments;
 
-   wxFont m_originalFont;
-   bool m_originalFontValid;
-
    int m_getNextAttachement;
 };
@@ -715,5 +713,4 @@
 {
    m_textControl = NULL;
-   m_originalFontValid = false;
    m_getNextAttachement = -1;
 }
@@ -747,4 +744,11 @@
    m_attachments = m_notebook->GetList();
 
+   if ( !GetOptions().m_font.empty() )
+   {
+      wxFont font(GetOptions().GetFont());
+      if ( font.Ok() )
+         m_textControl->SetFont(font);
+   }
+   
    Enable(true);
    Clear();
@@ -853,20 +857,20 @@
 void BareBonesEditor::SetEncoding(wxFontEncoding encoding)
 {
-   if(!m_originalFontValid)
-   {
-      m_originalFont = m_textControl->GetFont();
-      m_originalFontValid = true;
-   }
-
+   const wxFont& previous = m_textControl->GetFont();
+#if 0 // FIXME: wxGtk2.4/wxFont::SetEncoding doesn't work for some reason
+   wxFont next(previous);
+   next.SetEncoding(encoding);
+#else
    wxFont next(
-      m_originalFont.GetPointSize(),
-      m_originalFont.GetFamily(),
-      wxNORMAL, // Italic off
-      wxNORMAL, // Bold off
-      false, // Underline off
-      m_originalFont.GetFaceName(),
+      previous.GetPointSize(),
+      previous.GetFamily(),
+      previous.GetStyle(),
+      previous.GetWeight(),
+      previous.GetUnderlined(),
+      previous.GetFaceName(),
       encoding
    );
-
+#endif
+   if ( next.Ok() )
    m_textControl->SetFont(next);
 }
@@ -963,5 +967,5 @@
       m_textControl->Clear();
    m_textControl->Freeze();
-   m_textControl->WriteText(text);
+   m_textControl->WriteText(strutil_enforceLF(text));
    m_textControl->Thaw();
 }
@@ -974,5 +978,6 @@
 {
    m_getNextAttachement = 0;
-   return new EditorContentPart(m_textControl->GetValue());
+   return new EditorContentPart(strutil_enforceCRLF(
+      m_textControl->GetValue()));
 }
 



-------------------------------------------------------
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