Update of /cvsroot/mahogany/M/src/gui
In directory usw-pr-cvs1:/tmp/cvs-serv4502/src/gui

Modified Files:
        wxComposeView.cpp wxOptionsDlg.cpp 
Log Message:
added an option to use the user-specified font/colours for the header fields and not 
only for the composer window

Index: wxComposeView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxComposeView.cpp,v
retrieving revision 1.309
retrieving revision 1.310
diff -b -u -2 -r1.309 -r1.310
--- wxComposeView.cpp   20 Oct 2002 15:57:44 -0000      1.309
+++ wxComposeView.cpp   30 Oct 2002 18:43:34 -0000      1.310
@@ -63,4 +63,5 @@
 #include <wx/tokenzr.h>
 #include <wx/textbuf.h>
+#include <wx/fontutil.h>      // for wxNativeFontInfo
 
 #include "wx/persctrl.h"
@@ -109,4 +110,5 @@
 extern const MOption MP_CURRENT_IDENTITY;
 extern const MOption MP_CVIEW_BGCOLOUR;
+extern const MOption MP_CVIEW_COLOUR_HEADERS;
 extern const MOption MP_CVIEW_FGCOLOUR;
 extern const MOption MP_CVIEW_FONT;
@@ -425,12 +427,5 @@
 public:
    // ctor
-   wxAddressTextCtrl(wxWindow *parent,
-                     wxRcptControl *rcptControl)
-      : wxTextCtrl(parent, -1, "",
-                   wxDefaultPosition, wxDefaultSize,
-                   wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB)
-   {
-      m_rcptControl = rcptControl;
-   }
+   wxAddressTextCtrl(wxWindow *parent, wxRcptControl *rcptControl);
 
    // expand the text in the control using the address book(s)
@@ -656,4 +651,27 @@
 }
 
+wxFont Composer::Options::GetFont() const
+{
+   wxFont font;
+   if ( !m_font.empty() )
+   {
+      wxNativeFontInfo fontInfo;
+      if ( fontInfo.FromString(m_font) )
+      {
+         font.SetNativeFontInfo(fontInfo);
+      }
+   }
+
+   if ( !font.Ok() )
+   {
+      font = wxFont(m_fontSize,
+                    m_fontFamily,
+                    wxFONTSTYLE_NORMAL,
+                    wxFONTWEIGHT_NORMAL);
+   }
+
+   return font;
+}
+
 // ----------------------------------------------------------------------------
 // EditorContentPart
@@ -746,4 +764,6 @@
    sizer->Add(m_btnExpand, 0, wxLEFT, LAYOUT_MARGIN);
 
+   m_composeView->SetTextAppearance(m_text);
+
    return sizer;
 }
@@ -984,4 +1004,13 @@
 // ----------------------------------------------------------------------------
 
+wxAddressTextCtrl::wxAddressTextCtrl(wxWindow *parent,
+                                     wxRcptControl *rcptControl)
+                 : wxTextCtrl(parent, -1, "",
+                              wxDefaultPosition, wxDefaultSize,
+                              wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB)
+{
+   m_rcptControl = rcptControl;
+}
+
 void wxAddressTextCtrl::OnEnter(wxCommandEvent& /* event */)
 {
@@ -1537,4 +1566,5 @@
       m_txtFrom = new wxTextCtrl(m_panel, -1, _T(""));
       sizerFrom->Add(m_txtFrom, 1, wxALIGN_CENTRE_VERTICAL);
+      SetTextAppearance(m_txtFrom);
 
       wxChoice *choiceIdent = CreateIdentCombo(m_panel);
@@ -1559,4 +1589,5 @@
    m_txtSubject = new wxTextCtrl(m_panel, -1, _T(""));
    sizerHeaders->Add(m_txtSubject, 1, wxEXPAND | wxALIGN_CENTRE_VERTICAL);
+   SetTextAppearance(m_txtSubject);
 
    sizerTop->Add(sizerHeaders, 0, wxALL | wxEXPAND, LAYOUT_MARGIN);
@@ -1713,4 +1744,24 @@
 {
    m_options.Read(m_Profile);
+}
+
+void wxComposeView::SetTextAppearance(wxTextCtrl *text)
+{
+   CHECK_RET( text, _T("NULL text in wxComposeView::SetTextAppearance") );
+
+   if ( READ_CONFIG(m_Profile, MP_CVIEW_COLOUR_HEADERS) )
+   {
+      text->SetForegroundColour(m_options.m_fg);
+      text->SetBackgroundColour(m_options.m_bg);
+      text->SetFont(m_options.GetFont());
+
+      wxSizer *sizer = text->GetContainingSizer();
+      if ( sizer )
+      {
+         // we need to relayout as the text height with the new font could be
+         // different
+         sizer->SetItemMinSize(text, text->GetBestSize());
+      }
+   }
 }
 

Index: wxOptionsDlg.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxOptionsDlg.cpp,v
retrieving revision 1.343
retrieving revision 1.344
diff -b -u -2 -r1.343 -r1.344
--- wxOptionsDlg.cpp    14 Sep 2002 22:39:57 -0000      1.343
+++ wxOptionsDlg.cpp    30 Oct 2002 18:43:34 -0000      1.344
@@ -265,4 +265,6 @@
    ConfigField_XFaceFile,
    // not very useful ConfigField_AdbSubstring,
+
+   ConfigField_ComposerAppearanceHelp,
 #ifdef USE_FONT_DESC
    ConfigField_ComposeViewFont,
@@ -273,4 +275,5 @@
    ConfigField_ComposeViewFGColour,
    ConfigField_ComposeViewBGColour,
+   ConfigField_ComposeViewColourHeaders,
 
    ConfigField_ComposePreviewHelp,
@@ -1120,4 +1123,8 @@
    { gettext_noop("Configure &XFace..."),          Field_XFace,   -1          },
    // not very useful { gettext_noop("Mail alias substring ex&pansion"), Field_Bool,  
  -1,                        },
+
+   { gettext_noop("\n"
+                  "The following settings control the appearance\n"
+                  "of the composer window:"),      Field_Message, -1 },
 #ifdef USE_FONT_DESC
    { gettext_noop("&Font to use"),                 Field_Font | Field_Global, -1 },
@@ -1131,6 +1138,9 @@
    { gettext_noop("Foreground c&olour"),           Field_Color | Field_Global,   -1},
    { gettext_noop("Back&ground colour"),           Field_Color | Field_Global,   -1},
+   { gettext_noop("Use these settings for &headers too:"),
+                                                   Field_Bool | Field_Global,   -1},
 
-   { gettext_noop("The settings below allow you to have a last look at the\n"
+   { gettext_noop("\n"
+                  "The settings below allow you to have a last look at the\n"
                   "message before sending it and/or change your mind about\n"
                   "sending it even after pressing the \"Send\" button."),
@@ -1710,4 +1720,6 @@
    CONFIG_ENTRY(MP_COMPOSE_XFACE_FILE),
    // not very useful: CONFIG_ENTRY(MP_ADB_SUBSTRINGEXPANSION),
+
+   CONFIG_NONE(),
 #ifdef USE_FONT_DESC
    CONFIG_ENTRY(MP_CVIEW_FONT_DESC),
@@ -1718,4 +1730,5 @@
    CONFIG_ENTRY(MP_CVIEW_FGCOLOUR),
    CONFIG_ENTRY(MP_CVIEW_BGCOLOUR),
+   CONFIG_ENTRY(MP_CVIEW_COLOUR_HEADERS),
 
    CONFIG_NONE(), // preview help



-------------------------------------------------------
This sf.net email is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to