Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22291
Modified Files: Tag: desiredata desire.tk Log Message: NumBox FloatBox stuff (unfinished)
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.347 retrieving revision 1.1.2.600.2.348 diff -C2 -d -r1.1.2.600.2.347 -r1.1.2.600.2.348 *** desire.tk 12 Aug 2007 01:25:19 -0000 1.1.2.600.2.347 --- desire.tk 12 Aug 2007 03:49:06 -0000 1.1.2.600.2.348 *************** *** 5807,5810 **** --- 5807,5811 ---- set canvas [$self get_canvas] set t [$canvas widget].${self}text + set @ovalue $@text set @clickpos [list $x $y] set @mouse [list $x $y] *************** *** 5820,5830 **** def AtomBox motion {x y f target} { if {$@edit} {return} ! mset {ox oy} $@mouse ! set @text [expr $@text-$@rate*($y-$oy)] ! $self changed text ! set @mouse [list $x $y] netsend [list .$self float [expr {0+$@text}]] }
def AtomBox key_incr {val1 val2} { set @text [expr $@text - $val2] --- 5821,5852 ---- def AtomBox motion {x y f target} { if {$@edit} {return} ! mset {clx cly} $@clickpos ! set d [$self calc $x $y $clx $cly] ! if {[$self class] == "NumBox"} { ! set t [expr $@is_log ? $@ovalue*exp($d*$@rate*[$self log_ratio]) : $@ovalue+$d*$@rate] ! #set @text [expr $@is_log ? [expr $@min*exp($t*[$sealf log_ratio])] : $t] ! } else { ! set t [expr $@ovalue+$d*$@rate] ! } ! set @text [clip $t $@min $@max] netsend [list .$self float [expr {0+$@text}]] }
+ def AtomBox log_ratio {} { + set diff [expr $@is_log ? log($@max/$@min) : ($@max-$@min)] + return [expr $diff / $@max] + } + + def AtomBox calc {x y x1 y1} { + set span [expr $@max-$@min] + if {[$self class] == "NumBox"} { + set l [expr $@is_log ? $@log_height : ($@max-$@min)] + } else {set l [expr $@max-$@min]} + if {!$l} {set l 127} + set d [expr {($y1-$y)*$span/($l+0.0)}] + return $d + } + + def AtomBox key_incr {val1 val2} { set @text [expr $@text - $val2]