Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8753
Modified Files: Tag: desiredata desire.tk Log Message: slider is_log should be better now
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.258 retrieving revision 1.1.2.600.2.259 diff -C2 -d -r1.1.2.600.2.258 -r1.1.2.600.2.259 *** desire.tk 31 Jul 2007 04:43:34 -0000 1.1.2.600.2.258 --- desire.tk 1 Aug 2007 04:42:50 -0000 1.1.2.600.2.259 *************** *** 5738,5745 **** --- 5738,5748 ---- set l [expr $@orient ?$@h:$@w] set @value [expr $@val*$span/($l-1)/100] + #set t [expr $@val * [$self slider_ratio] * 0.01] + #set @value [expr $@min*exp($t)] }
def Slider init {mess} { super $mess + set @oposition $@min $self update_value } *************** *** 5754,5757 **** --- 5757,5766 ---- }
+ #the value/centipixel ratio + def Slider slider_ratio {} { + set diff [expr $@is_log ? log($@max/$@min) : ($@max-$@min)] + return [expr $diff / ($@orient ? ($@h-1) : ($@w-1))] + } + def Slider draw_knob {} { mset {x1 y1 x2 y2} [$self bbox] *************** *** 5805,5814 **** $canvas focus= $self set @click_at [list $x $y] ! set @ovalue $@value set @rate [expr $f&1 ? 0.01 : 1.00] if {!$@steady} { mset {x1 y1 x2 y2} [$self bbox] set @value [expr [$self calc $x $y $x1 $y2]*$@rate] ! set @ovalue $@value netsend [list .$self float $@value] } --- 5814,5823 ---- $canvas focus= $self set @click_at [list $x $y] ! set @oposition $@value set @rate [expr $f&1 ? 0.01 : 1.00] if {!$@steady} { mset {x1 y1 x2 y2} [$self bbox] set @value [expr [$self calc $x $y $x1 $y2]*$@rate] ! #set @oposition $@value netsend [list .$self float $@value] } *************** *** 5828,5833 **** mset {clx cly} $@click_at set d [$self calc $x $y $clx $cly] ! set value [clip [expr $@ovalue+$d*$@rate] $@min $@max] ! netsend [list .$self float $value] }
--- 5837,5846 ---- mset {clx cly} $@click_at set d [$self calc $x $y $clx $cly] ! set t ($@oposition+$d*$@rate) ! set value [expr $@is_log ? [expr $@min*exp($t*[$self slider_ratio])] : $t] ! set out [clip $value $@min $@max] ! #set value [clip [expr $@oposition+$d*$@rate] $@min $@max] ! #set out [expr $@is_log ? [expr $@min*exp($value*[$self slider_ratio])] : $value] ! netsend [list .$self float $out] }