diff options
author | hobbs <hobbs> | 2001-11-12 18:30:53 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2001-11-12 18:30:53 (GMT) |
commit | 91b797d5497d13bbb8a231e03b5fd3fe1348b1fb (patch) | |
tree | 8ea756f07c518a684e1c4bb2ad454cbbaf8166cf /library/clrpick.tcl | |
parent | 34b54239ebfc56c1a662404422042b457b478358 (diff) | |
download | tk-91b797d5497d13bbb8a231e03b5fd3fe1348b1fb.zip tk-91b797d5497d13bbb8a231e03b5fd3fe1348b1fb.tar.gz tk-91b797d5497d13bbb8a231e03b5fd3fe1348b1fb.tar.bz2 |
fixed unix tk_chooseColor to allow full 0..255 range selection via mouse
Diffstat (limited to 'library/clrpick.tcl')
-rw-r--r-- | library/clrpick.tcl | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/library/clrpick.tcl b/library/clrpick.tcl index bb3d6b2..22aa355 100644 --- a/library/clrpick.tcl +++ b/library/clrpick.tcl @@ -3,7 +3,7 @@ # Color selection dialog for platforms that do not support a # standard color selection dialog. # -# RCS: @(#) $Id: clrpick.tcl,v 1.13 2001/08/01 16:21:11 dgp Exp $ +# RCS: @(#) $Id: clrpick.tcl,v 1.14 2001/11/12 18:30:53 hobbs Exp $ # # Copyright (c) 1996 Sun Microsystems, Inc. # @@ -47,11 +47,11 @@ proc ::tk::dialog::color:: {args} { # Note that the bars may be of any width. # However, NUM_COLORBARS must be a number that evenly divides 256. # Such as 256, 128, 64, etc. - set data(NUM_COLORBARS) 8 + set data(NUM_COLORBARS) 16 # BARS_WIDTH is the number of pixels wide the color bar portion of the # canvas is. This number must be a multiple of NUM_COLORBARS - set data(BARS_WIDTH) 128 + set data(BARS_WIDTH) 160 # PLGN_WIDTH is the number of pixels wide of the triangular selection # polygon. This also results in the definition of the padding on the @@ -340,7 +340,9 @@ proc ::tk::dialog::color::SetRGBValue {w color} { proc ::tk::dialog::color::XToRgb {w x} { upvar ::tk::dialog::color::[winfo name $w] data - return [expr {($x * $data(intensityIncr))/ $data(colorbarWidth)}] + set x [expr {($x * $data(intensityIncr))/ $data(colorbarWidth)}] + if {$x > 255} { set x 255 } + return $x } # ::tk::dialog::color::RgbToX @@ -557,8 +559,8 @@ proc ::tk::dialog::color::MoveSelector {w sel color x delta} { if { $x < 0 } { set x 0 - } elseif { $x >= $data(BARS_WIDTH)} { - set x [expr {$data(BARS_WIDTH) - 1}] + } elseif { $x > $data(BARS_WIDTH)} { + set x $data(BARS_WIDTH) } set diff [expr {$x - $data($color,x)}] $sel move $data($color,index) $diff 0 |