From 91b797d5497d13bbb8a231e03b5fd3fe1348b1fb Mon Sep 17 00:00:00 2001 From: hobbs Date: Mon, 12 Nov 2001 18:30:53 +0000 Subject: fixed unix tk_chooseColor to allow full 0..255 range selection via mouse --- ChangeLog | 3 +++ library/clrpick.tcl | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index d833a5b..b369cd5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,9 @@ 2001-11-09 Jeff Hobbs + * library/clrpick.tcl: changed a few parameters so that the full + 0..255 range could be accessed via the mouse. [Bug #478498] + * unix/configure: * unix/tcl.m4: added -lc to AIX libs, fixed path to ldAix 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 -- cgit v0.12