Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28717
Modified Files: Tag: devel_0_39 desire.tk Log Message: started to look into wire_draw stuff.
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** desire.tk 30 Jul 2005 16:12:16 -0000 1.1.2.3 --- desire.tk 1 Aug 2005 08:18:20 -0000 1.1.2.4 *************** *** 1597,1602 **** puts "wire reachs inlet, draw proper wire!!" ! pd "$self add-wire x$wire_from x$wire_to ;" } --- 1597,1621 ---- puts "wire reachs inlet, draw proper wire!!" ! set d $wire_from ! foreach item $wire_to {lappend d $item} ! #add a last 0 for wire_update, not sure what's for.... ! lappend d 0 ! ! puts "d = $d" ! ! #tmp only ! wire_update 18136070 $d ! wire_draw2 18136070 $name; + #trace: + #wire_update:: l8146070 813ea70 0 813f160 0 0 + #what's the last argument of wire_update? + #wire_draw2:: l8146070 .x813e670.c + #wire_draw:: l8146070 .x813e670.c 1 43 57 156 138 + + #pd "$self add-wire x$wire_from x$wire_to ;" + + puts "::::connect from $wire_from to $wire_to" + #::::connect from 81168af 2 to 81168ae 0 } *************** *** 1862,1865 **** --- 1881,1952 ----
#-----------------------------------------------------------------------------------# + + # modes: + # 0: creation + # 1: resize (or move) + proc wire_draw {self canvas thick x1 y1 x2 y2} { + puts "wire_draw:: $self $canvas $thick $x1 $y1 $x2 $y2" + + global look + set xys [list $x1 $y1 $x2 $y2] + set length [expr sqrt(pow($x2-$x1,2)+pow($y2-$y1,2))] + # set step [expr 1/floor(1+$length/4)] + # for {set i 0} {$i<=1.001} {set i [expr $i+$step]} { + # set r [expr (rand()-0.5)*$i*(1-$i)*150] + # set r [expr sin($i/$step)*$i*(1-$i)*100] + # set q [expr sin(1+$i/$step)*$i*(1-$i)*100] + # #lappend xys [expr $x1+($x2-$x1)*$i+$r*[expr ($y1-$y2)/$length]] + # #lappend xys [expr $y1+($y2-$y1)*$i+$q*[expr ($x2-$x1)/$length]] + # lappend xys [expr $x1+($x2-$x1)*$i+(rand()-0.5)*150*$i*(1-$i)] + # lappend xys [expr $y1+($y2-$y1)*$i+(rand()-0.5)*150*$i*(1-$i)] + # } + + set arrowsize [expr $length<100 ? $length/10 : 10] + if {$arrowsize < 5} {set arrow none} {set arrow last} + set arrowshape [list $arrowsize [expr $arrowsize*4/5] [expr $arrowsize/3]] + + if {[llength [$canvas gettags $self]] != 0} { + $canvas coords $self $xys + $canvas itemconfigure -arrow $arrow -arrowshape $arrowshape + } { + $canvas create line $xys -tags $self -width $thick \ + -arrow $arrow -arrowshape $arrowshape -fill $look(wirefg) + # -smooth yes + } + } + + #-----------------------------------------------------------------------------------# + proc wire_draw2 {self canvas} { + puts "wire_draw2:: $self $canvas" + + global _ + set bbox1 [$canvas bbox $_($self:obj1)o$_($self:port1)] + set bbox2 [$canvas bbox $_($self:obj2)i$_($self:port2)] + if {[llength $bbox1] < 4} {puts stderr "wire_draw2: crap ($_($self:obj1) outlet)"; return} + if {[llength $bbox2] < 4} {puts stderr "wire_draw2: crap ($_($self:obj2) inlet)"; return} + foreach {x1 y1} [l/2 [l+ [lrange $bbox1 0 1] [lrange $bbox1 2 3]]] {} + foreach {x2 y2} [l/2 [l+ [lrange $bbox2 0 1] [lrange $bbox2 2 3]]] {} + wire_draw $self $canvas 1 $x1 $y1 $x2 $y2 + } #-----------------------------------------------------------------------------------# + proc wire_select {self canvas flag} { + puts "wire_select:: $self $canvas $flag" + + global _ look + if {$flag} {set colour #ff8000} {set colour $look(wirefg)} + $canvas itemconfigure $self -fill $colour + } + #-----------------------------------------------------------------------------------# + proc wire_erase {self canvas} { + puts "wire_erase:: $self $canvas" + + $canvas delete $self + } #-----------------------------------------------------------------------------------# + proc wire_update {self d} { + puts "wire_update:: $self $d" + + global _ + foreach [list _($self:obj1) _($self:port1) _($self:obj2) _($self:port2)] \ + [lrange $d 0 3] {} + }