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

Modified Files:
        wxOptionsDlg.cpp 
Log Message:
added highlighting of options with non default values

Index: wxOptionsDlg.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxOptionsDlg.cpp,v
retrieving revision 1.402
retrieving revision 1.403
diff -b -u -2 -r1.402 -r1.403
--- wxOptionsDlg.cpp    10 Feb 2004 22:44:06 -0000      1.402
+++ wxOptionsDlg.cpp    14 Mar 2004 23:12:44 -0000      1.403
@@ -72,4 +72,6 @@
 #include "InitPython.h"
 
+#include "ColourNames.h"
+
 // ----------------------------------------------------------------------------
 // persistent msgboxes we use here
@@ -540,4 +542,10 @@
    ConfigField_ConfirmExit,
    ConfigField_RunOneOnly,
+
+   ConfigField_ShowOptionsOriginHelp,
+   ConfigField_ShowOptionsOrigin,
+   ConfigField_ShowOptionsOriginHere,
+   ConfigField_ShowOptionsOriginInherited,
+
    ConfigField_HelpDir,
 #ifdef OS_UNIX
@@ -1652,6 +1660,14 @@
    { gettext_noop("Confirm &exit"),                Field_Bool | Field_Restart, -1     
                },
    { gettext_noop("Always run only &one instance"),Field_Bool | Field_Restart, -1     
                },
-   { gettext_noop("Directory with the help files"), Field_Dir, -1 },
 
+   { gettext_noop("\n"
+                  "Mahogany may highlight the options having non default\n"
+                  "values, whether they are set specifically at this folder\n"
+                  "level or inherited from parent."), Field_Message, 
ConfigField_ShowOptionsOrigin },
+   { gettext_noop("Show option values &origin"),   Field_Bool, -1 },
+   { gettext_noop("Colour for options set here"),  Field_Color, 
ConfigField_ShowOptionsOrigin },
+   { gettext_noop("Colour for inherited options"), Field_Color, 
ConfigField_ShowOptionsOrigin },
+
+   { gettext_noop("Directory with the help files"), Field_Dir, -1 },
 #ifdef OS_UNIX
    { gettext_noop("&Path where to find AFM files"), Field_Dir,    -1                  
   },
@@ -2106,4 +2122,10 @@
    CONFIG_ENTRY(MP_CONFIRMEXIT),
    CONFIG_ENTRY(MP_RUNONEONLY),
+
+   CONFIG_NONE(),
+   CONFIG_ENTRY(MP_OPTION_SHOW_ORIGIN),
+   CONFIG_ENTRY(MP_OPTION_ORIGIN_HERE),
+   CONFIG_ENTRY(MP_OPTION_ORIGIN_INHERITED),
+
    CONFIG_ENTRY(MP_HELPDIR),
 #ifdef OS_UNIX
@@ -2601,4 +2623,16 @@
    ProfileEnvVarSave suspend(m_Profile, false);
 
+   // we may highlight the settings which have values different from default
+   // with colour
+   const bool showOrigin = READ_APPCONFIG_BOOL(MP_OPTION_SHOW_ORIGIN);
+   wxColour colOwn,
+            colInherited;
+   if ( showOrigin )
+   {
+      ReadColour(&colOwn, mApplication->GetProfile(), MP_OPTION_ORIGIN_HERE);
+      ReadColour(&colInherited, mApplication->GetProfile(),
+                     MP_OPTION_ORIGIN_INHERITED);
+   }
+
    Profile::ReadResult readResult;
    String strValue;
@@ -2722,6 +2756,12 @@
       }
 
-#ifdef EXPERIMENTAL_zeitlin
-      if ( readResult )
+      // indicate where does the value come from if enabled
+      if ( showOrigin )
+      {
+#if wxUSE_TOOLTIPS
+         wxString ttip;
+#endif // wxUSE_TOOLTIPS
+
+         if ( readResult != Profile::Read_Default )
       {
          if ( !label )
@@ -2729,9 +2769,40 @@
 
          if ( label )
-            label->SetForegroundColour(readResult == Profile::Read_FromHere
-                                          ? *wxRED
-                                          : *wxBLUE);
+            {
+               wxColour col;
+               switch ( readResult )
+               {
+                  case Profile::Read_FromHere:
+                     col = colOwn;
+                     break;
+
+                  case Profile::Read_FromParent:
+                     col = colInherited;
+                     break;
+
+                  default:
+                     FAIL_MSG( _T("unexpected readResult") );
+               }
+
+               label->SetForegroundColour(col);
+            }
+
+#if wxUSE_TOOLTIPS
+            ttip = readResult == Profile::Read_FromHere
+                     ? _("Set at this level")
+                     : _("Inherited from parent");
+#endif // wxUSE_TOOLTIPS
+         }
+         else // this control has default value
+         {
+            ttip = _("Default value");
+         }
+
+#if wxUSE_TOOLTIPS
+         // don't overwrite an existing tooltip, if any
+         if ( !control->GetToolTip() )
+            control->SetToolTip(ttip);
+#endif // wxUSE_TOOLTIPS
       }
-#endif // EXPERIMENTAL_zeitlin
 
       // the dirty flag was set from the OnChange() callback, reset it!



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to