Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32731
Modified Files: Tag: devel_0_39 desire.tk Log Message: first commit for code that allows the detatch of the inlet for wire reconnection
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.373 retrieving revision 1.1.2.374 diff -C2 -d -r1.1.2.373 -r1.1.2.374 *** desire.tk 18 Aug 2006 12:43:28 -0000 1.1.2.373 --- desire.tk 18 Aug 2006 16:16:29 -0000 1.1.2.374 *************** *** 2226,2244 **** super set @canvas $canvas ! mset {type from outlet} $target ! set @from $from ! set @outlet $outlet ! set @to "" ! set @inlet "" ! mset {x1 y1 x2 y2} [lmap / [.$@canvas.c bbox ${from}o${outlet}] [$@canvas scale]] set @x1 [expr ($x1+$x2)/2] set @y1 [expr ($y1+$y2)/2] $self motion $@x1 $@y1 $f $target } ! def FutureWire motion {x y f target} { set @x2 $x set @y2 $y #mset {type @to @inlet} $target ;# fix objective.tcl please... ! mset [list type @to @inlet] $target $self draw } --- 2226,2265 ---- super set @canvas $canvas ! mset {type from port} $target ! #set @from $from ! #set @outlet $port ! #set @to "" ! #set @inlet "" ! switch $type { ! outlet { ! set @from $from ! set @outlet $port ! set @to "" ! set @inlet "" ! mset {x1 y1 x2 y2} [lmap / [.$@canvas.c bbox ${from}o${port}] [$@canvas scale]] ! } ! inlet { ! set @from "" ! set @outlet "" ! set @to $from ! set @inlet $port ! mset {x1 y1 x2 y2} [lmap / [.$@canvas.c bbox ${from}i${port}] [$@canvas scale]] ! } ! } ! #mset {x1 y1 x2 y2} [lmap / [.$@canvas.c bbox ${from}o${outlet}] [$@canvas scale]] set @x1 [expr ($x1+$x2)/2] set @y1 [expr ($y1+$y2)/2] $self motion $@x1 $@y1 $f $target } ! def* FutureWire motion {x y f target} { set @x2 $x set @y2 $y #mset {type @to @inlet} $target ;# fix objective.tcl please... ! #mset [list type @to @inlet] $target ! mset [list type foo bar] $target ! switch $type { ! outlet {mset [list type @from @outlet] $target} ! inlet {mset [list type @to @inlet] $target} ! } $self draw } *************** *** 2250,2253 **** --- 2271,2281 ---- [lsearch $children $@from] $@outlet \ [lsearch $children $@to ] $@inlet] + } else { + if {$@from != ""} { + set children [$@canvas children] + $@canvas connect [list \ + [lsearch $children $@from] $@outlet \ + [lsearch $children $@to ] $@inlet] + } } if {![shift? $f]} {$@canvas end_action} *************** *** 2337,2343 **** set obj1 [lindex $@children [lindex $wire 0]] set outlet [lindex $wire 1] ! #mset {x1 y1 x2 y2} [$c bbox ${obj1}o${outlet}] mset {x1 y1 x2 y2} [lmap / [$c bbox ${obj1}o${outlet}] [$@canvas scale]] ! set target [$self identify_target $x1 $y1 $f] set @action [FutureWire new $self $x1 $y1 $f $target] } --- 2365,2387 ---- set obj1 [lindex $@children [lindex $wire 0]] set outlet [lindex $wire 1] ! set obj2 [lindex $@children [lindex $wire 2]] ! set inlet [lindex $wire 3] mset {x1 y1 x2 y2} [lmap / [$c bbox ${obj1}o${outlet}] [$@canvas scale]] ! mset {x3 y3 x4 y4} [lmap / [$c bbox ${obj2}i${inlet}] [$@canvas scale]] ! puts " x3 $x3 y3 $y3 x4 $x4 y4 $y4" ! set d_outlet [distance [list $x $y] [list [expr ($x1+$x2)/2] [expr ($y1+$y2)/2]]] ! set d_inlet [distance [list $x $y] [list [expr ($x3+$x4)/2] [expr ($y3+$y4)/2]]] ! puts " to outlet:: $d_outlet || to inlet:: $d_inlet" ! if {$d_outlet > $d_inlet} { ! set x5 $x1; set y5 $y1 ! set target [list outlet $obj1 $outlet] ! } else { ! set x5 [expr ($x3+$x4)/2]; set y5 [expr ($y3+$y4)/2] ! set target [list inlet $obj2 $inlet] ! } ! #set target [$self identify_target $x1 $y1 $f] ! #target::: outlet x82d7568 0 ! #set target [$self identify_target $x5 $y5 $f] ! #puts " target::: $target" set @action [FutureWire new $self $x1 $y1 $f $target] } *************** *** 4335,4339 **** set yoff [expr ([winfo height $c] * $vy1)/$@scale] #mset {vx1 vy1 vx2 vy2} [lzip * [list $vx1 $vy1 $vx2 $vx2] $region] - puts " vx1 $vx1 vy1 $vy1 vx2 $vx2 vy2 $vy2" mset {type id detail} $target if {$crosshair(hairsnap)} { --- 4379,4382 ----