Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5930
Modified Files: Tag: devel_0_39 desire.tk Log Message: ok, wires hopefully should be born and dead correctly now. well, not tried the dead part, but its next....
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.144 retrieving revision 1.1.2.145 diff -C2 -d -r1.1.2.144 -r1.1.2.145 *** desire.tk 18 Feb 2006 15:40:57 -0000 1.1.2.144 --- desire.tk 22 Feb 2006 16:38:14 -0000 1.1.2.145 *************** *** 994,997 **** --- 994,999 ---- set @dehighlight {} set @wires {} + # stores wires in the format of {0 1 1 0} id {1 1 2 0} id + set @wires_pair {} #set @wire_hilite {} global history *************** *** 1407,1410 **** --- 1409,1413 ---- def* canvas children= {children} { # think of the children!!! + puts "-----------------------------------------------" set born [lwithout $children $@children]; foreach x $born {$x subscribe $self; $x changed; $x canvas= $self} puts "---------------- born:$born" *************** *** 1428,1462 ****
def* canvas wires= {wires2} { ! puts "-----------------------------------------lol" set wires {} ! #set born [lwithout $wires $@wires]; foreach x $born {$x subscribe $self; $x changed; $x canvas= $self} ! #puts "===== born:$born" ! #set dead [lwithout $@wires $wires]; foreach x $dead {$x unsubscribe $self; $x erase} ! #set @wires $wires ! #puts "===== [concat [list wire_new $self]]" ! foreach x $wires2 { ! if {[llength $x]==4} { ! lappend wires [eval [concat [list wire_new $self] $x]] ! } { ! lappend wires $x ! } } - puts "wires: $wires" ! set born [lwithout $wires $@wires]; foreach x $born {$x subscribe $self; $x changed; $x canvas= $self} puts "===== born:$born" set dead [lwithout $@wires $wires]; foreach x $dead {$x unsubscribe $self; $x erase} puts "===== dead:$dead" set @wires $wires ! puts "===== [concat [list wire_new $self]]" puts "==== self:$self wires:$wires" $self changed ! #$wires changed }
def* canvas wires_new {whoout outno whoin inno} { ! # post %s BOO }
--- 1431,1467 ----
def* canvas wires= {wires2} { ! puts "-----------------------------------------wires!!" ! global _ set wires {} ! # look up for wire id foreach x $wires2 { ! set find [lsearch $@wires_pair $x] ! if { $find != -1} { ! lappend wires [lindex $@wires_pair [expr $find + 1]] ! } } ! set born [lwithout $wires $@wires];foreach x $born {$x subscribe $self;$x changed;$x canvas= $self} puts "===== born:$born" + + set dead [lwithout $@wires $wires]; foreach x $dead {$x unsubscribe $self; $x erase} puts "===== dead:$dead" set @wires $wires ! puts "===== [concat [list $self]]" puts "==== self:$self wires:$wires" $self changed ! }
def* canvas wires_new {whoout outno whoin inno} { ! # @wires_pair is a workaround for looking up the wire id with {0 1 1 0} format ! # i moved calling wire_new here instead of where it was (canvas wires=) ! # is because i don't need to figure out which of the wire2 is new ! # todo: need to put some things here to prevent from creating the same connection twice ! ! lappend @wires_pair [list $whoout $outno $whoin $inno] ! lappend @wires_pair [eval [list wire_new $self $whoout $outno $whoin $inno]] }
*************** *** 1995,1998 **** --- 2000,2004 ---- super global _ + set @connects [list $from $outno $to $inno] #puts "------ children:$_($canvas:children)" #hack