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

Modified Files:
        wxFolderTree.cpp wxOptionsDlg.cpp 
Log Message:
clean up of the folder tree options page, added a possibility to set the
default folder tree foreground there as well


Index: wxFolderTree.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxFolderTree.cpp,v
retrieving revision 1.185
retrieving revision 1.186
diff -b -u -2 -r1.185 -r1.186
--- wxFolderTree.cpp    9 Jan 2002 16:01:03 -0000       1.185
+++ wxFolderTree.cpp    20 Feb 2002 17:56:46 -0000      1.186
@@ -92,5 +92,6 @@
 
 extern const MOption MP_FOCUS_FOLLOWSMOUSE;
-extern const MOption MP_FOLDER_BGCOLOUR;
+extern const MOption MP_FTREE_BGCOLOUR;
+extern const MOption MP_FTREE_FGCOLOUR;
 extern const MOption MP_FOLDER_TREEINDEX;
 extern const MOption MP_FTREE_FORMAT;
@@ -316,6 +317,6 @@
    bool ProcessMenuCommand(int id);
 
-      // update the bg colour
-   void UpdateBackground();
+      // update the tree colours
+   void UpdateColours();
 
    // callbacks
@@ -533,6 +534,7 @@
 #endif // wxGTK
 
-   // the bg colour name
-   wxString m_colBgName;
+   // the fg and bg colour names
+   wxString m_colFgName,
+            m_colBgName;
 
    // the id of the item being edited in place
@@ -1416,7 +1418,14 @@
       }
 
+      bool found;
       wxString colorName = profile->readEntry(GetOptionName(*opt),
-                                              GetStringDefault(*opt));
+                                              GetStringDefault(*opt),
+                                              &found);
+
+      // use the default tree foreground colour for the folders not explicitly
+      // configured to use another colour
       wxColour col;
+      if ( found || (statusShown != Folder_Normal) )
+      {
       if ( !ParseColourString(colorName, &col) )
       {
@@ -1424,4 +1433,12 @@
          col = *wxBLACK;
       }
+      }
+      else // use default foreground
+      {
+         // NB: we still need to set the colour even if it is now going to be
+         //     the default one simply because it could have been a different
+         //     one before
+         col = tree->GetForegroundColour();
+      }
 
       tree->SetItemTextColour(GetId(), col);
@@ -1610,5 +1627,5 @@
    SetImageList(imageList);
 
-   UpdateBackground();
+   UpdateColours();
 
 #if wxUSE_DRAG_AND_DROP
@@ -1635,10 +1652,10 @@
 }
 
-void wxFolderTreeImpl::UpdateBackground()
+void wxFolderTreeImpl::UpdateColours()
 {
-   wxString colName = READ_APPCONFIG(MP_FOLDER_BGCOLOUR);
+   wxString colName = READ_APPCONFIG(MP_FTREE_BGCOLOUR);
    if ( colName != m_colBgName )
    {
-      if ( !!colName )
+      if ( !colName.empty() )
       {
          wxColour col;
@@ -1651,6 +1668,20 @@
       m_colBgName = colName;
    }
-}
 
+   colName = READ_APPCONFIG_TEXT(MP_FTREE_FGCOLOUR);
+   if ( colName != m_colFgName )
+   {
+      if ( !colName.empty() )
+      {
+         wxColour col;
+         if ( ParseColourString(colName, &col) )
+         {
+            SetForegroundColour(col);
+         }
+      }
+
+      m_colFgName = colName;
+   }
+}
 
 void wxFolderTreeImpl::DoPopupMenu(const wxPoint& pos)
@@ -2569,5 +2600,5 @@
 
       // reread the bg colour setting
-      UpdateBackground();
+      UpdateColours();
 
       MEventOptionsChangeData& event = (MEventOptionsChangeData &)ev;

Index: wxOptionsDlg.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxOptionsDlg.cpp,v
retrieving revision 1.316
retrieving revision 1.317
diff -b -u -2 -r1.316 -r1.317
--- wxOptionsDlg.cpp    16 Feb 2002 16:55:07 -0000      1.316
+++ wxOptionsDlg.cpp    20 Feb 2002 17:56:46 -0000      1.317
@@ -414,4 +414,6 @@
    // folder tree options
    ConfigField_FolderTreeFirst = ConfigField_FolderViewLast,
+   ConfigField_FolderTreeColourHelp,
+   ConfigField_FolderTreeFgColour,
    ConfigField_FolderTreeBgColour,
    ConfigField_FolderTreeFormatHelp,
@@ -1346,5 +1348,9 @@
 
    // folder tree
-   { gettext_noop("Tree &background colour"), Field_Color, -1 },
+   { gettext_noop("The two options below are common for all folders,\n"
+                  "but note that the first of them may be overridden by setting\n"
+                  "the normal folder colour in the \"Folder View\" page."), 
+Field_Message | Field_AppWide, -1 },
+   { gettext_noop("Tree &foreground colour"), Field_Color | Field_AppWide, -1 },
+   { gettext_noop("Tree &background colour"), Field_Color | Field_AppWide, -1 },
    { gettext_noop("Mahogany can show the number of messages in the folder\n"
                   "directly in the folder tree. You may wish to disable\n"
@@ -1365,8 +1371,8 @@
                   "But if you select it, this one will be skipped even it has\n"
                   "unread mail (again, this is mainly useful for \"Trash\"\n"
-                  "folder, for example)."), Field_Message, -1 },
-   { gettext_noop("&Skip this folder"), Field_Bool, -1 },
-   { gettext_noop("Open folder on single &click"), Field_Bool | Field_AppWide, -1 },
-   { gettext_noop("Show &hidden folders in the folder tree"), Field_Bool | 
Field_AppWide, -1 },
+                  "folder, for example)."), Field_Message | Field_NotApp, -1 },
+   { gettext_noop("&Skip this folder"), Field_Bool | Field_NotApp, -1 },
+   { gettext_noop("Open folder on single &click"), Field_Bool | Field_AppWide | 
+Field_Global, -1 },
+   { gettext_noop("Show &hidden folders in the folder tree"), Field_Bool | 
+Field_AppWide | Field_Global,-1 },
 
    // adb: autocollect and bbdb options
@@ -1791,5 +1797,7 @@
 
    // folder tree
-   CONFIG_ENTRY(MP_FOLDER_BGCOLOUR),
+   CONFIG_NONE(),
+   CONFIG_ENTRY(MP_FTREE_FGCOLOUR),
+   CONFIG_ENTRY(MP_FTREE_BGCOLOUR),
    CONFIG_NONE(),
    CONFIG_ENTRY(MP_FTREE_FORMAT),


_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to