[PD-cvs] pd/src desire.tk,1.1.2.600.2.125,1.1.2.600.2.126

chunlee chunlee at users.sourceforge.net
Wed Dec 20 04:59:23 CET 2006


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

Modified Files:
      Tag: desiredata
	desire.tk 
Log Message:
fix Canvas do_paste


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.600.2.125
retrieving revision 1.1.2.600.2.126
diff -C2 -d -r1.1.2.600.2.125 -r1.1.2.600.2.126
*** desire.tk	20 Dec 2006 02:09:00 -0000	1.1.2.600.2.125
--- desire.tk	20 Dec 2006 03:59:19 -0000	1.1.2.600.2.126
***************
*** 1864,1868 ****
  	netsend [concat [list .$self $sel $x $y] $args] $goto
  }
! 
  def Canvas new_object_callback {obj} {}
  def Canvas new_object_select {obj} {$self selection+= $obj}
--- 1864,1868 ----
  	netsend [concat [list .$self $sel $x $y] $args] $goto
  }
! def Canvas new_wire_callback {wire} {}
  def Canvas new_object_callback {obj} {}
  def Canvas new_object_select {obj} {$self selection+= $obj}
***************
*** 2915,2923 ****
  	set in 0
  	$self deselect_all
- 	mset {vx1 vy1 vx2 vy2} [$self visible_rect]
- 	mset {xcoords ycoords} [$self clipboard_coords $offset]
- 	set visible [$self paste_visible? $vx1 $vy1 $vx2 $vy2 $offset]
- 	set ref [lsearch $ycoords [lindex [lsort -increasing $ycoords] 0]]
- 	#pd .$self push
  	netsend [list .$self "push"]
  	set paste(state) $self
--- 2915,2918 ----
***************
*** 2925,2957 ****
  		set type [lindex $mess 1]
  		switch $type {
! 			canvas {set in 1; netsend $mess} "" {}
  			connect {
  				mset {from outlet to inlet} [lrange $mess 2 end]
  				set count [llength $@children]
  				set mess2 [list #X connect [expr $from+$count] $outlet [expr $to+$count] $inlet]
! 				if {$in} {netsend $mess} else {netsend $mess2 [list $self new_wire_select]}
  			}
  			default {
! 				if {$type == "restore"} {set in 0}
! 				mset {x y} [lmap + [lrange $mess 2 3] $offset]
! 				set mess2 [lreplace $mess 2 3 $x $y]
! 				if {$in} {
! 					netsend $mess [list $self new_object_callback]
! 				} else {
! 					if {!$visible} {
! 						set xoff [expr ($vx2 - $vx1) * 0.25]
! 						set yoff [expr ($vy2 - $vy1) * 0.25]
! 						set x2 [expr [lindex $mess 2] - [lindex $xcoords $ref] + $vx1 + $xoff]
! 						set y2 [expr [lindex $mess 3] - [lindex $ycoords $ref] + $vy1 + $yoff]
! 						set mess2 [lreplace $mess 2 3 $x2 $y2]
! 					}
! 					netsend $mess2 [list $self new_object_select]
  				}
  			} 
  		}
  	}
  	netsend [list #X pop 1]
  }
  
  def Canvas cut {} {
  	$@history atomically [list cut] {
--- 2920,2970 ----
  		set type [lindex $mess 1]
  		switch $type {
! 			"" {}
! 			canvas {set in 1; set goto [list $self new_object_select]}
  			connect {
  				mset {from outlet to inlet} [lrange $mess 2 end]
  				set count [llength $@children]
  				set mess2 [list #X connect [expr $from+$count] $outlet [expr $to+$count] $inlet]
! 				if {$in} {set goto ""} else {
! 					set mess $mess2
! 					set goto [list $self new_wire_select]
! 				}
  			}
+ 			restore {set in 0; set goto "";set mess [$self paste_coords $mess $offset]}
  			default {
! 				if {$in} {set goto ""} else {
! 					set mess [$self paste_coords $mess $offset]
! 					set goto [list $self new_object_select]
  				}
  			} 
  		}
+ 		switch $goto {
+ 			"" {netsend $mess}
+ 			default {netsend $mess $goto}
+ 		}
  	}
  	netsend [list #X pop 1]
  }
  
+ def Canvas paste_coords {mess offset} {
+ 	set x [lindex $mess 2]; set y [lindex $mess 3]
+ 	mset {vx1 vy1 vx2 vy2} [$self visible_rect]
+ 	mset {xcoords ycoords} [$self clipboard_coords $offset]
+ 	set visible [$self paste_visible? $vx1 $vy1 $vx2 $vy2 $offset]
+ 	set ref [lsearch $ycoords [lindex [lsort -increasing $ycoords] 0]]
+ 	if {!$visible} {
+ 		set xoff [expr ($vx2 - $vx1) * 0.25]
+ 		set yoff [expr ($vy2 - $vy1) * 0.25]
+ 		set x2 [expr [lindex $mess 2] - [lindex $xcoords $ref] + $vx1 + $xoff]
+ 		set y2 [expr [lindex $mess 3] - [lindex $ycoords $ref] + $vy1 + $yoff]
+ 		set mess2 [lreplace $mess 2 3 $x2 $y2]
+ 		return $mess2
+ 	} else {
+ 		set mess2 [lreplace $mess 2 3 [expr $x+$offset] [expr $y+$offset]]
+ 		return $mess2
+ 	}
+ 
+ }
+ 
  def Canvas cut {} {
  	$@history atomically [list cut] {





More information about the Pd-cvs mailing list