[GRASS-SVN] r30153 - grass/trunk/gui/tcltk/gis.m

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Feb 14 11:07:04 EST 2008


Author: cmbarton
Date: 2008-02-14 11:07:04 -0500 (Thu, 14 Feb 2008)
New Revision: 30153

Modified:
   grass/trunk/gui/tcltk/gis.m/gmlib.tcl
Log:
Traps a bwidget idiosyncrasy in which clicking on an undefined custom color square in the bottom row of the color chooser returns the string "white" instead of the hex color #FFFFFF. 

Modified: grass/trunk/gui/tcltk/gis.m/gmlib.tcl
===================================================================
--- grass/trunk/gui/tcltk/gis.m/gmlib.tcl	2008-02-14 16:06:19 UTC (rev 30152)
+++ grass/trunk/gui/tcltk/gis.m/gmlib.tcl	2008-02-14 16:07:04 UTC (rev 30153)
@@ -28,14 +28,20 @@
 #read_moncap
 
 proc GmLib::color { color } {
-
-    regexp -- {#(..)(..)(..)} $color x r g b
-
-    set r [expr 0x$r ]
-    set g [expr 0x$g ]
-    set b [expr 0x$b ]
-
-    return "$r:$g:$b"
+        
+        if {$color == "white"} {
+                set r 255
+                set g 255
+                set b 255
+        } else {
+                regexp -- {#(..)(..)(..)} $color x r g b
+                        
+                set r [expr 0x$r ]
+                set g [expr 0x$g ]
+                set b [expr 0x$b ]
+        }
+        
+        return "$r:$g:$b"
 }
 
 



More information about the grass-commit mailing list