Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5720
Modified Files: Tag: devel_0_39 desire.tk defaults.ddrc Log Message: adding auto wire reconnection (opposite of auto object insertionX)
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.512 retrieving revision 1.1.2.513 diff -C2 -d -r1.1.2.512 -r1.1.2.513 *** desire.tk 18 Oct 2006 12:16:42 -0000 1.1.2.512 --- desire.tk 18 Oct 2006 16:10:22 -0000 1.1.2.513 *************** *** 1613,1617 **** --- 1613,1624 ---- }
+ def Canvas insertxy {} {return [list $@insert_x $@insert_y]} + def Canvas insert_object {} { + $self do_insert_obj "none" "none" + } + + def Canvas do_insert_obj {x y} { + if {$x == "none" && $y == "none"} { if {[llength $@selection_wire] == 1} { puts "insert object for $@selection_wire" *************** *** 1635,1638 **** --- 1642,1650 ---- return } + } else { + pd .$self "obj" $x $y + set @action insert + + } }
*************** *** 2612,2615 **** --- 2624,2664 ---- }
+ def Canvas clear_wires {} { + if {[llength $@selection] != 1} return + set @auto_wire_obj2 {}; set @auto_wire_obj1 {} + set obj $@selection + set nouts [$obj noutlets]; set nins [$obj ninlets] + foreach wire $@wires { + mset {obj1 port1 obj2 port2} [$wire report] + if {$obj1 == $obj} { + $self disconnect [$wire connects] + if {!$port1} {lappend @auto_wire_obj2 $obj2} + } + if {$obj2 == $obj} { + $self disconnect [$wire connects] + if {!$port2} {lappend @auto_wire_obj1 $obj1} + } + + } + } + + def Canvas auto_wire {} { + $self clear_wires + #set obj1_idx [$self children_idx $@auto_wire_obj1] + #set obj2_idx [$self children_idx $@auto_wire_obj2] + #$self connect [list $obj1_idx 0 $obj2_idx 0] + foreach obj1 $@auto_wire_obj1 { + set idx1 [$self children_idx $obj1] + foreach obj2 $@auto_wire_obj2 { + 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 end_action {} { switch -- $@action { *************** *** 2774,2782 **** set @click_at [list $x $y] ! if {$f&8} {set c [$self widget];$self popup $id [winfo pointerx $c] [winfo pointery $c]; return} if {!$@editmode} { if {[llength $id]} { ! puts "target = $target :: [$id class]" ! if {[$id class] != "Canvas"} { $id click $x $y $f $target} } return --- 2823,2846 ---- set @click_at [list $x $y] ! if {$f&8} { ! if {!$@editmode} {return} ! set c [$self widget] ! set @insert_x $x; set @insert_y $y ! $self popup $id [winfo pointerx $c] [winfo pointery $c] ! return ! } if {!$@editmode} { if {[llength $id]} { ! if {[$id class] != "Canvas"} { ! $id click $x $y $f $target ! } else { ! if {[$id subpatch]} { ! if {![$id mapped]} { ! $id popup_open ! } else { ! raise .$id ! } ! } ! } } return *************** *** 3513,3517 ****
def Wire report {} {list $@obj1 $@port1 $@obj2 $@port2} ! proc xys {x1 y1 x2 y2} { set r {} --- 3577,3581 ----
def Wire report {} {list $@obj1 $@port1 $@obj2 $@port2} ! def Wire connects {} {return $@connects} proc xys {x1 y1 x2 y2} { set r {} *************** *** 3577,3581 ****
def Wire popup_insert {} { ! $@canvas insert_object }
--- 3641,3647 ----
def Wire popup_insert {} { ! if {![llength [$@canvas selection_wire]]} {$@canvas selection_wire= $self} ! mset {x y} [$@canvas insertxy] ! $@canvas do_insert_obj $x $y }
*************** *** 6323,6330 **** key Canvas {cut copy} key Canvas {undo redo} ! key Canvas paste key Canvas select_all key Canvas {reload redraw} key Canvas editmodeswitch subsection Client general key Canvas Pdwindow --- 6389,6397 ---- key Canvas {cut copy} key Canvas {undo redo} ! key Canvas {paste duplicate} key Canvas select_all key Canvas {reload redraw} key Canvas editmodeswitch + key Canvas {insert_object chain_object} subsection Client general key Canvas Pdwindow
Index: defaults.ddrc =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/defaults.ddrc,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -C2 -d -r1.1.2.7 -r1.1.2.8 *** defaults.ddrc 16 Oct 2006 13:39:08 -0000 1.1.2.7 --- defaults.ddrc 18 Oct 2006 16:10:24 -0000 1.1.2.8 *************** *** 137,140 **** --- 137,142 ---- insert_object Ctrl+i chain_object Ctrl+6 + clear_wires Ctrl+k + auto_wire Ctrl+j } Client {