[PD-cvs] pd/src desire.tk,1.1.2.600.2.105,1.1.2.600.2.106

Mathieu Bouchard matju at users.sourceforge.net
Tue Dec 19 02:49:14 CET 2006


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10568

Modified Files:
      Tag: desiredata
	desire.tk 
Log Message:
using rect_centre


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.600.2.105
retrieving revision 1.1.2.600.2.106
diff -C2 -d -r1.1.2.600.2.105 -r1.1.2.600.2.106
*** desire.tk	19 Dec 2006 01:34:51 -0000	1.1.2.600.2.105
--- desire.tk	19 Dec 2006 01:49:10 -0000	1.1.2.600.2.106
***************
*** 3176,3197 ****
  	mset {type from port} $target
  	switch $type {
! 	outlet {
  		set @from $from
  		set @outlet $port
  		set @to ""
  		set @inlet ""
! 		mset {x1 y1 x2 y2} [lmap / [[$@canvas widget] bbox ${from}o${port}] [$@canvas zoom]]
! 	}
! 	inlet {
  		set @from ""
  		set @outlet ""
  		set @to $from
  		set @inlet $port
! 		mset {x1 y1 x2 y2} [lmap / [[$@canvas widget] bbox ${from}i${port}] [$@canvas zoom]]
! 	}
  	}
! 	#mset {x1 y1 x2 y2} [lmap / [[$@canvas widget] bbox ${from}o${outlet}] [$@canvas zoom]]
! 	set @x1 [expr ($x1+$x2)/2]
! 	set @y1 [expr ($y1+$y2)/2]
  	$self motion $@x1 $@y1 $f $target
  }
--- 3176,3197 ----
  	mset {type from port} $target
  	switch $type {
! 	    outlet {
  		set @from $from
  		set @outlet $port
  		set @to ""
  		set @inlet ""
! 		set type o
! 	    }
! 	    inlet {
  		set @from ""
  		set @outlet ""
  		set @to $from
  		set @inlet $port
! 		set type i
! 	    }
  	}
! 	mset {x y} [lmap / [rect_centre [[$@canvas widget] bbox ${from}i${port}]] [$@canvas zoom]]
! 	set @x1 $x
! 	set @y1 $y
  	$self motion $@x1 $@y1 $f $target
  }
***************
*** 3356,3368 ****
  			set from [lindex $@children [lindex $wire 0]]; set outlet [lindex $wire 1]
  			set to   [lindex $@children [lindex $wire 2]]; set  inlet [lindex $wire 3]
! 			mset {x1 y1 x2 y2} [lmap / [$c bbox ${from}o${outlet}] [$self zoom]]
! 			mset {x3 y3 x4 y4} [lmap / [$c bbox   ${to}i${inlet}]  [$self zoom]]
! 			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]]]
! 			if {$d_outlet > $d_inlet} {
! 				set x5 $x1; set y5 $y1
  				set target [list outlet $from $outlet]
  			} else {
- 				set x5 [expr ($x3+$x4)/2]; set y5 [expr ($y3+$y4)/2]
  				set target [list inlet $to $inlet]
  			}
--- 3356,3365 ----
  			set from [lindex $@children [lindex $wire 0]]; set outlet [lindex $wire 1]
  			set to   [lindex $@children [lindex $wire 2]]; set  inlet [lindex $wire 3]
! 			set opos [lmap / [rect_centre [$c bbox ${from}o${outlet}]] [$self zoom]]
! 			set ipos [lmap / [rect_centre [$c bbox   ${to}i${inlet}]]  [$self zoom]]
! 			set  pos [list $x $y]
! 			if {[distance $pos $opos] > [distance $pos $ipos]} {
  				set target [list outlet $from $outlet]
  			} else {
  				set target [list inlet $to $inlet]
  			}
***************
*** 4192,4205 ****
  
  def Wire bbox {} {
! 	set obj1 $@obj1
! 	set obj2 $@obj2
! 	set port1 $@port1
! 	set port2 $@port2
  	set zoom [$@canvas zoom]
  	set c [$@canvas widget]
! 	mset {x1 y1 x2 y2} [lmap / [$c bbox ${obj1}o${port1}] $zoom]
! 	mset {x3 y3 x4 y4} [lmap / [$c bbox ${obj2}i${port2}] $zoom]
! 	list [expr ($x1+$x2)/2] [expr ($y1+$y2)/2] \
! 	     [expr ($x3+$x4)/2] [expr ($y3+$y4)/2]
  }
  
--- 4189,4199 ----
  
  def Wire bbox {} {
! 	set obj1 $@obj1; set port1 $@port1
! 	set obj2 $@obj2; set port2 $@port2
  	set zoom [$@canvas zoom]
  	set c [$@canvas widget]
! 	mset {x1 y1} [lmap / [rect_centre [$c bbox ${obj1}o${port1}]] $zoom]
! 	mset {x2 y2} [lmap / [rect_centre [$c bbox ${obj2}i${port2}]] $zoom]
! 	list $x1 $y1 $x2 $y2
  }
  
***************
*** 4233,4239 ****
  	set iowidth [$@obj1 look iowidth]
  	mset {ox1 oy1 ox2 oy2} [$@obj1 io_bbox o $@port1]
! 	mset {ix1 iy1 iy2 iy2} [$@obj2 io_bbox i $@port2]
! 	set x1 [expr $ox1 + $iowidth/2]; set y1 $oy2
! 	set x2 [expr $ix1 + $iowidth/2]; set y2 $iy1
  	set xys [xys $x1 $y1 $x2 $y2]
  	set length [expr sqrt(pow($x2-$x1,2)+pow($y2-$y1,2))]
--- 4227,4233 ----
  	set iowidth [$@obj1 look iowidth]
  	mset {ox1 oy1 ox2 oy2} [$@obj1 io_bbox o $@port1]
! 	mset {ix1 iy1 ix2 iy2} [$@obj2 io_bbox i $@port2]
! 	set x1 [expr ($ox1+$ox2)/2]; set y1 $oy2
! 	set x2 [expr ($ix1+$ix2)/2]; set y2 $iy1
  	set xys [xys $x1 $y1 $x2 $y2]
  	set length [expr sqrt(pow($x2-$x1,2)+pow($y2-$y1,2))]





More information about the Pd-cvs mailing list