[PD-cvs] pd/src desire.tk,1.1.2.350,1.1.2.351
Mathieu Bouchard
matju at users.sourceforge.net
Wed Aug 16 19:50:50 CEST 2006
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10760
Modified Files:
Tag: devel_0_39
desire.tk
Log Message:
fixed slider rendering: out of bounds values; zoom.
Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.350
retrieving revision 1.1.2.351
diff -C2 -d -r1.1.2.350 -r1.1.2.351
*** desire.tk 16 Aug 2006 15:56:48 -0000 1.1.2.350
--- desire.tk 16 Aug 2006 17:50:47 -0000 1.1.2.351
***************
*** 1945,1949 ****
#!@#$ this method is too long
! def* Canvas motion {x y f target} {
global font canvas tooltip crosshair
set canvas(current) $self
--- 1945,1949 ----
#!@#$ this method is too long
! def Canvas motion {x y f target} {
global font canvas tooltip crosshair
set canvas(current) $self
***************
*** 1976,1983 ****
}
none {}
! #default {error "unknown action '$@action'"}
! default {
! $@action motion $x $y $f $target
! }
}
switch $type {
--- 1976,1980 ----
}
none {}
! default {$@action motion $x $y $f $target}
}
switch $type {
***************
*** 2010,2013 ****
--- 2007,2011 ----
# now it's same priority, so just stacking order (and it's prolly wrong)
set class [$id _class]
+ if {[$self == $id]} {continue}
if {[$class inherit? Wire]} {return [list "wire" $id]}
if {[$class inherit? Box]} {
***************
*** 2277,2281 ****
foreach tag $sel {
if {[regexp {^[xz]?[0-9a-f]{6,8}} [$c gettags $tag] id]} {
! if {$@canvas == $id} {continue}
switch $_($id:_class) {
SelRect {}
--- 2275,2279 ----
foreach tag $sel {
if {[regexp {^[xz]?[0-9a-f]{6,8}} [$c gettags $tag] id]} {
! if {[$@canvas == $id]} {continue}
switch $_($id:_class) {
SelRect {}
***************
*** 3860,3864 ****
}
! def* Slider draw {} {
mset {x1 y1 x2 y2} [$self bbox]
set xs $@w
--- 3858,3883 ----
}
! def Slider draw_knob {} {
! mset {x1 y1 x2 y2} [$self bbox]
! set l [expr [$self orient]?$@h:$@w]
! set span [expr $@max-$@min]
! set color [bluify #ffffff]
! if {[$self orient]} {
! set size $@w
! set y1 [expr $y1+$@h-$@value*($l-1)/$span-2]
! set y2 [expr $y1-2]
! set coords [list [expr $x1+2] $y1 [expr $x1+$size-2] $y2]
! } {
! set size $@h
! set x1 [expr $x1+$@value*($l-1)/$span]
! set x2 [expr $x1+2]
! set y2 [expr $y1+$size]
! set coords [list $x1 [expr $y1+2] $x2 [expr $y1+$size-2]]
! }
! $self item KNOB rectangle $coords \
! -outline red -fill [darker $color]
! }
!
! def Slider draw {} {
mset {x1 y1 x2 y2} [$self bbox]
set xs $@w
***************
*** 3870,3895 ****
set outs [expr [string compare $@snd empty]==0]
super
! set color [bluify #ffffff]
! $self item KNOB rectangle [list $x1 $y1 [expr $x1 + 10] [expr $y1 + 10]] \
! -outline red -fill [darker $color]
! set c .$@canvas.c
! set span [expr $@max-$@min]
! set l [expr $orient?$@h:$@w]
#set value [expr $@val*$span/($l-1)/100]
! #set value $@value
! set value $@val
! set @value $value
! if {$orient} {
! set size $xs
! set y1 [expr $y1+$ys-$value*($l-1)/$span-2]
! set y2 [expr $y1-2]
! $c coords ${self}KNOB [expr $x1+2] $y1 [expr $x1+$size-2] $y2
! } {
! set size $ys
! set x1 [expr $x1+$value*($l-1)/$span]
! set x2 [expr $x1+2]
! set y2 [expr $y1+$size]
! $c coords ${self}KNOB $x1 [expr $y1+2] $x2 [expr $y1+$size-2]
! }
}
--- 3889,3896 ----
set outs [expr [string compare $@snd empty]==0]
super
! $self draw_knob
#set value [expr $@val*$span/($l-1)/100]
! # why is there both @val and @value again?
! set @value $@val
}
***************
*** 3908,3917 ****
set coords [list $x1 $y3 [expr $x1+$xs] $y3]
}
! $@canvas create line $coords -dash [list 1 $eighth 1 $eighth] -width $thick -fill [darker [look sliderbg]]
}
def Slider click {x y f target} {
$@canvas focus= $self
! set @first [list $x $y]
set @ovalue $@value
set @clicking 1
--- 3909,3918 ----
set coords [list $x1 $y3 [expr $x1+$xs] $y3]
}
! $@canvas item NOTCH $coords -dash [list 1 $eighth 1 $eighth] -width $thick -fill [darker [look sliderbg]]
}
def Slider click {x y f target} {
$@canvas focus= $self
! set @click_at [list $x $y]
set @ovalue $@value
set @clicking 1
***************
*** 3921,3929 ****
def Slider unclick {x y f target} {
set @clicking 0
! if {[lindex $@first 1] != $y} {
$@canvas focus= ""
$self draw
pd .$self float $@value
-
}
}
--- 3922,3929 ----
def Slider unclick {x y f target} {
set @clicking 0
! if {[lindex $@click_at 1] != $y} {
$@canvas focus= ""
$self draw
pd .$self float $@value
}
}
***************
*** 3932,3944 ****
set focused [$self == [$@canvas focus]]
if {!$focused} {return}
! set dx [expr $x-[lindex $@first 0]]
! set dy [expr $y-[lindex $@first 1]]
set orient [$self orient]
set span [expr $@max-$@min]
! set l [expr $orient?$@h:$@w]
set d [expr ($orient?-$dy:$dx)*$span/($l+0.0)]
! set @value [expr $@ovalue+$d*$@rate]
! puts "slider value ----------------- $@value"
! puts "max ::: $@max ---------- min ::: $@min"
pd .$self float $@value
}
--- 3932,3943 ----
set focused [$self == [$@canvas focus]]
if {!$focused} {return}
! mset {clx cly} $@click_at
! set dx [expr $x-$clx]
! set dy [expr $y-$cly]
set orient [$self orient]
set span [expr $@max-$@min]
! set l [expr ($orient?$@h:$@w)]
set d [expr ($orient?-$dy:$dx)*$span/($l+0.0)]
! set @value [min $@max [max $@min [expr $@ovalue+$d*$@rate]]]
pd .$self float $@value
}
***************
*** 3954,3960 ****
set ly [expr $y1+$@ldy]
set label $@lab; switch -- $label { empty { set label "" }}
! set lfont [list \
! [lindex {courier helvetica times} $@fstyle] \
! $@fs bold]
set lcolor [parse_color $@lcol]
$self item LABEL text [list $lx $ly] -text $label -anchor w -font $lfont -fill $lcolor
--- 3953,3957 ----
set ly [expr $y1+$@ldy]
set label $@lab; switch -- $label { empty { set label "" }}
! set lfont [list [lindex {courier helvetica times} $@fstyle] $@fs bold]
set lcolor [parse_color $@lcol]
$self item LABEL text [list $lx $ly] -text $label -anchor w -font $lfont -fill $lcolor
***************
*** 4437,4441 ****
}
! def* Canvas hide_crosshair {} {
.$self.c delete ${self}VHAIR1 ${self}HHAIR1 ${self}VHAIR2 ${self}HHAIR2 ${self}EYE
}
--- 4434,4438 ----
}
! def Canvas hide_crosshair {} {
.$self.c delete ${self}VHAIR1 ${self}HHAIR1 ${self}VHAIR2 ${self}HHAIR2 ${self}EYE
}
More information about the Pd-cvs
mailing list