public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdbtk: Make color of changed vars customizable
@ 2012-03-22 14:31 Roland Schwingel
  0 siblings, 0 replies; only message in thread
From: Roland Schwingel @ 2012-03-22 14:31 UTC (permalink / raw)
  To: insight

[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]

Hi...

In Insight one can change most colors beside of one.
In the local variables window the changed vars are
colored in (yet hardcoded) 100%green. If you have a
pure white background it is sometimes hard to read
as it is IMHO a little too bright and too anyoing.
The attached patch fixes this.

It now uses the same color as PC color from global
preferences. I adjusted the "PC" color label in source
prefs to "PC/Changed vars". Also I changed the default
color for this field to brightest green to a somewhat
darker green.

Changelog:

2012-03-22  Roland Schwingel <roland.schwingel@onevision.com>

     * library/locals.tcl (constructor): Take default for change
     color from PC_TAG prefs.
     (reconfig): New method for getting prefs updates.
     * library/srcpref.itb (_build_win): Change text of PC color chooser.
     * library/prefs.tcl (pref_set_defaults): Change default of PC_TAG
     color to a somewhat darker green. Remove hardwired color value
     for changed variables.
     * library/vartree.itb (update_var): use changed field color from
     global colors list.
     (_init_data): Remove local copy of changed vars color.

Any comments? Is this ok?

Roland



[-- Attachment #2: custom_color_changed_vars.patch --]
[-- Type: text/plain, Size: 2977 bytes --]

diff -ruN gdbtk_orig/library/locals.tcl gdbtk/library/locals.tcl
--- gdbtk_orig/library/locals.tcl	2007-01-30 16:39:21.000000000 +0100
+++ gdbtk/library/locals.tcl	2012-03-22 09:01:03.648300100 +0100
@@ -32,6 +32,9 @@
     add_hook gdb_clear_file_hook [code $this clear_file]
     add_hook file_changed_hook [code $this clear_file]
 
+    global Colors
+    set Colors(change) [pref get gdb/src/PC_TAG]
+
     update dummy
   }
   
@@ -45,6 +48,16 @@
     cursor watch
   }
 
+  # ------------------------------------------------------------------
+  #  PUBLIC METHOD:  reconfig - used when preferences change
+  # ------------------------------------------------------------------
+  method reconfig {} {
+    debug
+    global Colors
+    set Colors(change) [pref get gdb/src/PC_TAG]
+    $tree update
+  }
+
   # Re-enable the UI
   method idle {event} {
     debug
diff -ruN gdbtk_orig/library/prefs.tcl gdbtk/library/prefs.tcl
--- gdbtk_orig/library/prefs.tcl	2008-03-04 00:25:03.000000000 +0100
+++ gdbtk/library/prefs.tcl	2012-03-22 10:01:08.631451500 +0100
@@ -338,7 +338,7 @@
   pref define gdb/console/font            global/fixed
 
   # Source window defaults
-  pref define gdb/src/PC_TAG              green
+  pref define gdb/src/PC_TAG              \#00b300
   pref define gdb/src/STACK_TAG           gold
   pref define gdb/src/BROWSE_TAG          \#9595e2
   pref define gdb/src/handlebg            red
@@ -719,11 +719,6 @@
 proc pref_set_option_db {makebg} {
   global Colors
 
-  # The color of text that indicates changed items
-  # We standardize on one color here so that changed
-  # items don't blend into any OS color scheme
-  set Colors(change) "green"
-
   option add *background $Colors(bg)
   option add *buttonBackground $Colors(bg)
   option add *Text*background $Colors(textbg)
diff -ruN gdbtk_orig/library/srcpref.itb gdbtk/library/srcpref.itb
--- gdbtk_orig/library/srcpref.itb	2008-08-03 00:08:32.000000000 +0200
+++ gdbtk/library/srcpref.itb	2012-03-21 16:29:42.639519400 +0100
@@ -54,7 +54,7 @@
   set w [$f.colors get_frame]
 
   set color [pref get gdb/src/PC_TAG]
-  label $w.pcl -text {PC}
+  label $w.pcl -text {PC/Var change}
   button $w.pcb -text {     } -activebackground $color -bg $color \
     -command [code $this _pick $color $w.pcb PC_TAG]
   
diff -ruN gdbtk_orig/library/vartree.itb gdbtk/library/vartree.itb
--- gdbtk_orig/library/vartree.itb	2012-01-03 13:27:01.000000000 +0100
+++ gdbtk/library/vartree.itb	2012-03-21 15:36:04.871794200 +0100
@@ -135,7 +135,7 @@
     if {[catch {$var value} value]} {
       set color $colors(error)      
     } elseif {[$c itemcget $val -text] != $value} {
-      set color $colors(change)
+      set color $::Colors(change)
     } else {
       set color $colors(value)
     }
@@ -404,7 +404,6 @@
   set colors(type) "red"
   set colors(error) "red"
   set colors(value) "black"
-  set colors(change) $::Colors(change)
   set colors(disabled) "gray50"
   set colors(line) "gray50"
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-03-22 14:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-22 14:31 [PATCH] gdbtk: Make color of changed vars customizable Roland Schwingel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).