equal
deleted
inserted
replaced
138 |
138 |
139 set xmin [lindex [lindex $points $icolors] 0] |
139 set xmin [lindex [lindex $points $icolors] 0] |
140 set xmax [lindex [lindex $points [expr {$icolors + 1}]] 0] |
140 set xmax [lindex [lindex $points [expr {$icolors + 1}]] 0] |
141 set nxmin $xmin |
141 set nxmin $xmin |
142 set nxmax $xmax |
142 set nxmax $xmax |
143 prepare_colors $type $nxmin $nxmax |
143 prepare_colors_center $type $nxmin $nxmax |
144 } |
144 prepare_colors_margins $type $nxmin $nxmax |
145 |
145 } |
146 proc prepare_colors { type nxmin nxmax } { |
146 |
147 global gradient |
147 |
148 |
148 proc prepare_colors_margins { type nxmin nxmax } { |
149 switch -- $type { |
149 switch -- $type { |
150 r { |
150 r { |
151 set cmin [color $nxmin 0 0] |
151 set cmin [color $nxmin 0 0] |
152 set cmax [color $nxmax 0 0] |
152 set cmax [color $nxmax 0 0] |
153 } g { |
153 } g { |
161 } |
161 } |
162 |
162 |
163 # Set the bg and fg color to xmin and xmax |
163 # Set the bg and fg color to xmin and xmax |
164 .leftcol.c configure -background $cmin -foreground $cmax |
164 .leftcol.c configure -background $cmin -foreground $cmax |
165 .rightcol.c configure -background $cmin -foreground $cmax |
165 .rightcol.c configure -background $cmin -foreground $cmax |
|
166 } |
|
167 |
|
168 proc prepare_colors_center { type nxmin nxmax } { |
|
169 global gradient |
166 |
170 |
167 # Prepare the colors of the middle buttons |
171 # Prepare the colors of the middle buttons |
168 for {set i 0} {$i < $gradient} {incr i} { |
172 for {set i 0} {$i < $gradient} {incr i} { |
169 set x [stepvalue $nxmin $nxmax $i] |
173 set x [stepvalue $nxmin $nxmax $i] |
170 switch -- $type { |
174 switch -- $type { |
195 set nxmin $nvalue_min |
199 set nxmin $nvalue_min |
196 set nxmax $nvalue_max |
200 set nxmax $nvalue_max |
197 |
201 |
198 if {[expr {$nxmax - $nxmin}] > $th_prec} { |
202 if {[expr {$nxmax - $nxmin}] > $th_prec} { |
199 puts "$type - More precision needed" |
203 puts "$type - More precision needed" |
200 prepare_colors $type $nxmin $nxmax |
204 prepare_colors_center $type $nxmin $nxmax |
201 } else { |
205 } else { |
202 |
206 |
203 puts "$type - New point!" |
207 puts "$type - New point!" |
204 # Add the point - middle range |
208 # Add the point - middle range |
205 set middle [expr {$nxmin + ($nxmax - $nxmin)/2}] |
209 set middle [expr {$nxmin + ($nxmax - $nxmin)/2}] |