Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32002
Modified Files: Tag: devel_0_39 desire.tk Log Message: fixes for numbox (not quite finished yet...)
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.259 retrieving revision 1.1.2.260 diff -C2 -d -r1.1.2.259 -r1.1.2.260 *** desire.tk 21 Jun 2006 09:30:47 -0000 1.1.2.259 --- desire.tk 21 Jun 2006 11:46:45 -0000 1.1.2.260 *************** *** 2379,2383 **** set c .$self.c $self hide_tooltip - puts "focus ::::::::::: [$self focus]" if {[$self focus] != ""} { [$self focus] key $key $shift --- 2379,2382 ---- *************** *** 3267,3274 **** set @yt [expr $y1+$ys/2+3+$xs/34] if {[$self selected?]} {set fcol red} else {set fcol $look(objectfg)} ! if {[string length $@buf] <= $@w} { ! $self item TEXT text [list $@xt $@yt] -anchor w -text $@text \ ! -font $font(str) -fill $fcol } }
--- 3266,3277 ---- set @yt [expr $y1+$ys/2+3+$xs/34] if {[$self selected?]} {set fcol red} else {set fcol $look(objectfg)} ! if {[string length $@buf] <= $@w} { ! set string $@text ! } else { ! set string [string range $@text 0 [expr $@w-1]] } + $self item TEXT text [list $@xt $@yt] -anchor w -text $string \ + -font $font(str) -fill $fcol + }
*************** *** 3290,3294 **** $self changed } ! period {append @buf ".";set @text $@buf} default { if {[regexp {^[0-9]{1}$} $key]} { --- 3293,3297 ---- $self changed } ! period {append @buf ".";set @text $@buf; $self changed} default { if {[regexp {^[0-9]{1}$} $key]} { *************** *** 3399,3403 **** }
! def* NumBox draw {} { $self update_size global look font --- 3402,3406 ---- }
! def NumBox draw {} { $self update_size global look font *************** *** 3411,3415 **** set outs [expr [string compare $@snd empty]==0] set points [list $x1 $y1 [expr $x2-4] $y1 $x2 [expr $y1+4] $x2 $y2 $x1 $y2] - #set font $font(str) set xt [expr $x1+$ys/2+2] set yt [expr $y1+$ys/2+1+$xs/34] --- 3414,3417 ---- *************** *** 3419,3424 **** $self item BASE polygon $points -fill [parse_color $@bcol] -outline $look(objectframe3) $self item BASE4 polygon $points2 -fill $color4 -outline $look(objectframe3) - #$self item NUMBER text [list $xt $yt] -anchor w -text [$self ftoa] \ - # -font [list $font $@fs bold] -fill [parse_color $@fcol] $self item NUMBER text [list $xt $yt] -anchor w -text [$self ftoa] \ -font $font(str) -fill [parse_color $@fcol] --- 3421,3424 ---- *************** *** 3460,3463 **** --- 3460,3464 ---- $@canvas focus= $self .$@canvas.c itemconfigure ${self}BASE4 -fill #00ff00 + set @clickpos [list $x $y] set @mouse [list $x $y] set @oval $@val *************** *** 3469,3477 **** set focused [$self == [$@canvas focus]] if {!$focused} {return} mset {ox oy} $@mouse set @val [expr $@val-$@rate*($y-$oy)] set @mouse [list $x $y] ! if {$@clicking} {pd .$self float $@val;} ! #$self changed }
--- 3470,3479 ---- set focused [$self == [$@canvas focus]] if {!$focused} {return} + if {$@clicking} { mset {ox oy} $@mouse set @val [expr $@val-$@rate*($y-$oy)] set @mouse [list $x $y] ! pd .$self float $@val; ! } }
*************** *** 3481,3496 **** global look set @clicking 0 ! if {$@oval!=$@val} { $@canvas focus= "" .$@canvas.c itemconfigure ${self}BASE4 -fill $look(objectbg) pd .$self float $@val } }
def* NumBox key {key shift} { switch -regexp -- $key { ! ^[\d\.eE+-]$ { ! set @buf "$@buf$key" $self changed } ^Return$ { --- 3483,3512 ---- global look set @clicking 0 ! #if {$@oval!=$@val} { ! # $@canvas focus= "" ! # .$@canvas.c itemconfigure ${self}BASE4 -fill $look(objectbg) ! # pd .$self float $@val ! #} ! ! if {[lindex $@clickpos 0] == $x && [lindex $@clickpos 1] == $y} { ! $@canvas focus= $self ! set @clicking 0 ! } { $@canvas focus= "" .$@canvas.c itemconfigure ${self}BASE4 -fill $look(objectbg) pd .$self float $@val + pd .$self bang } + }
def* NumBox key {key shift} { switch -regexp -- $key { ! ^[\d]$ { ! if {[string length $@buf] < $@w} { ! #set @buf "$@buf$key" ! set @val "$@val$key" $self changed + } } ^Return$ { *************** *** 3498,3507 **** $@canvas focus= "" pd .$self float $@val set @buf "" $self changed } ^BackSpace|Delete$ { if {[string length $@buf] >= 0} { ! set @buf [string range $@buf 0 end-1] } $self changed --- 3514,3526 ---- $@canvas focus= "" pd .$self float $@val + pd .$self bang set @buf "" $self changed } + ^period$ {if {[string length $@buf] < $@w} {append @val ".";set @text $@val; $self changed} } + ^minus$ {append @val "-";set @text $@val; $self changed} ^BackSpace|Delete$ { if {[string length $@buf] >= 0} { ! set @val [string range $@val 0 end-1] } $self changed