Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31804
Modified Files: Tag: devel_0_39 desire.tk Log Message: more on array
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.488 retrieving revision 1.1.2.489 diff -C2 -d -r1.1.2.488 -r1.1.2.489 *** desire.tk 29 Sep 2006 11:00:05 -0000 1.1.2.488 --- desire.tk 29 Sep 2006 15:24:35 -0000 1.1.2.489 *************** *** 1342,1346 **** }
! if {$@mapped && !$@gop} {if {![winfo exists .$self.c]} {$self init_window}} } } --- 1342,1348 ---- }
! if {$@mapped && !$@gop} { ! if {![winfo exists .$self.c]} {$self init_window} ! } } } *************** *** 1356,1359 **** --- 1358,1363 ---- }
+ def Canvas gop {} {return $@gop} + def Canvas get_dimen {} { return [list $@canvasxs $@canvasys] *************** *** 2154,2163 **** 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 { move { --- 2158,2161 ---- *************** *** 2211,2214 **** --- 2209,2215 ---- #set stack [lreverse [$c find overlapping [expr $cx-2] [expr $cy-2] [expr $cx+2] [expr $cy+2]]] set stack [$c find overlapping [expr $cx-2] [expr $cy-2] [expr $cx+2] [expr $cy+2]] + #puts "stack:::: $stack" + + #foreach tag $stack { puts "tags::: [$c gettags $tag]"} foreach tag $stack { set tags [$c gettags $tag] *************** *** 2233,2237 **** return [list "inlet" $id $val] } ! return [list "object" $id] } #puts "skipped a $class" --- 2234,2243 ---- return [list "inlet" $id $val] } ! #if {$class != "Canvas"} { return [list "object" $id]} ! if {$class == "Canvas" && [$id gop]} { ! if {[llength $stack] == 1} { return [list "object" $id]} ! } else { ! return [list "object" $id] ! } } #puts "skipped a $class" *************** *** 4558,4562 **** foreach val $@data { if {!$val} {set val 0.0} ! set y [expr (($val+abs($yfrom))/($yto-($yfrom)) * $pixheight) + $y_off] set x1 [expr ($width * $i) + $x_off] set x2 [expr $x1 + $width] --- 4564,4568 ---- foreach val $@data { if {!$val} {set val 0.0} ! set y [expr ($pixheight - (($val+abs($yfrom))/($yto-($yfrom)) * $pixheight)) + $y_off] set x1 [expr ($width * $i) + $x_off] set x2 [expr $x1 + $width] *************** *** 4564,4568 **** set c $@canvas $@canvas item elem${i} line $line -fill [$@canvas look compfg] -width 2 \ ! -tags "$@canvas ${c}elem${i}" incr i } --- 4570,4574 ---- set c $@canvas $@canvas item elem${i} line $line -fill [$@canvas look compfg] -width 2 \ ! -tags "$self ${c}elem${i}" incr i } *************** *** 4570,4586 **** }
! def Array click {x y f target} {$@canvas focus= $self; set @draw 1} ! def Array unclick {x y f target} {$@canvas focus= ""; set @draw 0} def Array motion {x y f target} { if {!$@draw} return ! mset {c_width c_height} [$@canvas get_dimen] ! mset {xfrom yto xto yfrom pixwidth pixheight} [$@canvas get_mess] ! set width [expr $c_width / $@length] ! set i [format %d [expr int($x/$width)]] ! set x1 [expr $width * $i] ! set x2 [expr $x1 + $width] ! set line [list $x1 $y $x2 $y] ! set val [expr (($c_height-$y)/$c_height) * ($yto-($yfrom)) + ($yfrom)] ! pd .$self $i $val } def Array length= {val} {set @length $val} --- 4576,4618 ---- }
! def Array click {x y f target} { ! if {[$@canvas mapped]} { ! $@canvas focus= $self ! } else { ! set canvas [$@canvas canvas] ! $canvas focus= $self ! } ! set @draw 1 ! } ! def Array unclick {x y f target} { ! if {[$@canvas mapped]} { ! $@canvas focus= "" ! } else { ! set canvas [$@canvas canvas] ! $canvas focus= "" ! } ! ! set @draw 0 ! } def Array motion {x y f target} { if {!$@draw} return ! if {[$@canvas mapped]} { ! mset {c_width c_height} [$@canvas get_dimen] ! mset {xfrom yto xto yfrom pixwidth pixheight} [$@canvas get_mess] ! set width [expr $c_width / $@length] ! set i [format %d [expr int($x/$width)]] ! set x1 [expr $width * $i] ! set x2 [expr $x1 + $width] ! set line [list $x1 $y $x2 $y] ! set val [expr (($c_height-$y)/$c_height) * ($yto-($yfrom)) + ($yfrom)] ! pd .$self $i $val ! } else { ! mset {xfrom yto xto yfrom pixwidth pixheight} [$@canvas get_mess] ! mset {x_off y_off} [$@canvas xy] ! set width [expr $pixwidth / $@length] ! set i [format %d [expr int(($x-$x_off)/$width)]] ! set val [expr (($pixheight-$y+$y_off)/$pixheight) * ($yto-($yfrom)) + ($yfrom)] ! pd .$self $i $val ! } } def Array length= {val} {set @length $val} *************** *** 4592,4596 **** lappend @data [lindex $data_list $i] } - puts " data set:::: $@data" } else { puts "error....." --- 4624,4627 ----