Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19749
Modified Files: Tag: desiredata desire.tk Log Message: no more @wires_pair plus small fixes on wire rendering
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.76 retrieving revision 1.1.2.600.2.77 diff -C2 -d -r1.1.2.600.2.76 -r1.1.2.600.2.77 *** desire.tk 13 Dec 2006 23:25:19 -0000 1.1.2.600.2.76 --- desire.tk 14 Dec 2006 00:53:16 -0000 1.1.2.600.2.77 *************** *** 11,15 **** # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. ! # # See file ../COPYING.desire-client.txt for further informations on licensing terms. # --- 11,15 ---- # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. ! # See file ../COPYING.desire-client.txt for further informations on licensing terms. # *************** *** 1463,1467 **** set @dehighlight {} set @wires {} - set @wires_pair {} ;# stores wires in the format of {0 1 1 0} id {1 1 2 0} id # if {$@mapped} {$self init_window} ;#!@#$ @mapped can't possibly be 1 at this point set @history $history --- 1463,1466 ---- *************** *** 2281,2287 **** if {[$@canvas action] == "insert"} { set wire [$@canvas selection_wire] - set wire2 [$@canvas get_wire $wire] mset {obj1 outlet obj2 inlet} [$wire report] ! $@canvas disconnect $wire2 set obj1_idx [$@canvas children_idx $obj1] set obj2_idx [$@canvas children_idx $obj2] --- 2280,2285 ---- if {[$@canvas action] == "insert"} { set wire [$@canvas selection_wire] mset {obj1 outlet obj2 inlet} [$wire report] ! $@canvas disconnect [$wire connects] set obj1_idx [$@canvas children_idx $obj1] set obj2_idx [$@canvas children_idx $obj2] *************** *** 2431,2441 **** def Canvas wires {} {return $@wires}
- def Canvas get_wire {wire} { - set find [lsearch $@wires_pair $wire] - if {$find != -1} { - return [lindex $@wires_pair [expr $find -1]] - } - } - def Canvas delete_selection {} { if {![llength $@selection] && ![llength $@selection_wire]} {return} --- 2429,2432 ---- *************** *** 2453,2464 **** $x delete } - #set $@selection_wire {} - # before obj is deleted, it will be selected, therefore - # $@obj_in_edit != {}, so don't forget to set it to {}. - # needs to handle obj_in_edit and selection!!! set @obj_in_edit {} ! #set @selection {} ! $self selection= {} ! $self selection_wire= {} }
--- 2444,2451 ---- $x delete } set @obj_in_edit {} ! # don't use $self selection= here, otherwise it might call changed on deleted stuff.. ! set @selection {} ! set @selection_wire {} }
*************** *** 2607,2613 **** mset {type id detail} [$self identify_target $x $y 0] if {$type == "wire"} { - set wire2 [$self get_wire $id] mset {obj1 outlet obj2 inlet} [$id report] ! $self disconnect $wire2 set obj1_idx [$self children_idx $obj1] set obj2_idx [$self children_idx $obj2] --- 2594,2599 ---- mset {type id detail} [$self identify_target $x $y 0] if {$type == "wire"} { mset {obj1 outlet obj2 inlet} [$id report] ! $self disconnect [$wire connects] set obj1_idx [$self children_idx $obj1] set obj2_idx [$self children_idx $obj2] *************** *** 3002,3011 ****
def Canvas disconnect {wire} { - puts "$@wires_pair" set @keynav_tab_sel "wire" - #$self selection_wire-= [lindex $@wires_pair [expr [lsearch $@wires_pair $wire]+1]] - #mset {from outlet to inlet} $wire mset {from outlet to inlet} [$wire connects] netsend [list .$self disconnect $from $outlet $to $inlet] $@history add [list $self connect [$wire connects]] } --- 2988,2995 ----
def Canvas disconnect {wire} { set @keynav_tab_sel "wire" mset {from outlet to inlet} [$wire connects] netsend [list .$self disconnect $from $outlet $to $inlet] + #netsend [list .$self disconnect $wire] $@history add [list $self connect [$wire connects]] } *************** *** 3071,3082 **** set idx2 [$self children_idx $obj2] set wire [list $idx1 0 $idx2 0] ! if {[lsearch $@wires_pair [list $idx1 0 $idx2 0]] < 0} { $self connect [list $idx1 0 $idx2 0] } - #$self connect [list $idx1 0 $idx2 0] } } }
def Canvas subpatcherize {} { global subpatcherize --- 3055,3077 ---- set idx2 [$self children_idx $obj2] set wire [list $idx1 0 $idx2 0] ! if {[$self wire_idx [list $idx1 0 $idx2 0]] < 0} { $self connect [list $idx1 0 $idx2 0] } } } }
+ def Canvas wire_idx {connects} { + set wire ""; set idx 0 + foreach x $@wires { + if {[string compare [join $connects] [join [$x connects]]] == 0} { + set wire $x + break + } + incr idx + } + if {$wire != ""} {return $idx} else {return -1} + } + def Canvas subpatcherize {} { global subpatcherize *************** *** 3299,3303 **** 2 { set c [$self widget] ! set wire [lindex $@wires_pair [expr [lsearch $@wires_pair $id]-1]] $self disconnect $wire set from [lindex $@children [lindex $wire 0]]; set outlet [lindex $wire 1] --- 3294,3298 ---- 2 { set c [$self widget] ! set wire [$id connects] $self disconnect $wire set from [lindex $@children [lindex $wire 0]]; set outlet [lindex $wire 1] *************** *** 3919,3922 **** --- 3914,3918 ---- foreach f $fields($@pdclass) {set _($self:$f) [lindex $mess $i]; incr i} } + $self outside_of_the_box }