Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1603
Modified Files: Tag: devel_0_39 desire.tk Log Message: some more hacks for drawing array...
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.480 retrieving revision 1.1.2.481 diff -C2 -d -r1.1.2.480 -r1.1.2.481 *** desire.tk 22 Sep 2006 16:41:55 -0000 1.1.2.480 --- desire.tk 22 Sep 2006 23:37:36 -0000 1.1.2.481 *************** *** 2142,2145 **** --- 2142,2150 ---- if {!$@editmode & [$self focus] != $self & [$self focus] != ""} {[$self focus] motion $x $y $f $target} mset {type id detail} $target + # graphical array is different with iemgui in the way that there is no bounding box + # a array consists of a bunch of horizontal bars over the canvas it belongs to + # so as soon as the target does not return the Array anymore, nothing will get to its drawing + # method. so i put a tk canvas behind all the bars, so that the target will always return + # the Array id.. if {$id != ""} {if {[$id class] == "Array"} {$id motion $x $y $f $target; return}} switch $@action { *************** *** 2670,2673 **** --- 2675,2680 ---- } else { if {[$self focus] != ""} {[$self focus] unclick $x $y $f $target} + mset {type id detail} $target + if {$id != ""} {if {[$id class] == "Array"} {$id unclick $x $y $f $target; return}} } $self adjust_scrollbars *************** *** 4504,4507 **** --- 4511,4515 ---- set @length 0 set @data {} + set @draw 0 }
*************** *** 4528,4532 **** set i 0 #cheats ! $self item RECT polygon [list 0 0 $c_width 0 $c_width $c_height 0 $c_height] -outline red -fill white foreach val $@data { set y [expr $c_height - ((($val+abs($yfrom))/($yto-($yfrom)) * $c_height))] --- 4536,4541 ---- set i 0 #cheats ! if {[$@canvas editmode]} {set bg [$@canvas look bgedit]} else {set bg [$@canvas look bgrun]} ! $self item RECT polygon [list 0 0 $c_width 0 $c_width $c_height 0 $c_height] -outline red -fill $bg foreach val $@data { set y [expr $c_height - ((($val+abs($yfrom))/($yto-($yfrom)) * $c_height))] *************** *** 4544,4553 **** }
! def Array click {x y f target} {puts "click on array........."} def Array motion {x y f target} { mset {c_width c_height} [$@canvas get_dimen] set width [expr $c_width / $@length] set i [format %d [expr int($x/$width)]] - puts " drawing this elem::: $i -> $width" set x1 [expr $width * $i] set x2 [expr $x1 + $width] --- 4553,4563 ---- }
! def Array click {x y f target} {set @draw 1} ! def Array unclick {x y f target} {set @draw 0} def Array motion {x y f target} { + if {!$@draw} return mset {c_width c_height} [$@canvas get_dimen] set width [expr $c_width / $@length] set i [format %d [expr int($x/$width)]] set x1 [expr $width * $i] set x2 [expr $x1 + $width] *************** *** 4555,4559 ****
$self item elem${i} line $line -fill [$@canvas look compfg] -width 2 -tags " $self ${self}elem${i} " ! } def Array length= {val} {set @length $val} --- 4565,4571 ----
$self item elem${i} line $line -fill [$@canvas look compfg] -width 2 -tags " $self ${self}elem${i} " ! #hack.. ! if {[$@canvas editmode]} {set bg [$@canvas look bgedit]} else {set bg [$@canvas look bgrun]} ! $self item RECT polygon [list 0 0 $c_width 0 $c_width $c_height 0 $c_height] -outline red -fill $bg } def Array length= {val} {set @length $val}