[PD-cvs] pd/src desire.tk,1.1.2.225,1.1.2.226

chunlee chunlee at users.sourceforge.net
Sun Jun 11 18:57:01 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
changed all copy/paste related variables to global clipboard



Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.225
retrieving revision 1.1.2.226
diff -C2 -d -r1.1.2.225 -r1.1.2.226
*** desire.tk	11 Jun 2006 16:09:30 -0000	1.1.2.225
--- desire.tk	11 Jun 2006 16:56:58 -0000	1.1.2.226
***************
*** 209,213 ****
  }
  
! def History atomically {code} {
  	set ubackup @undo; set @undo {}
  	set rbackup @redo; set @redo {}
--- 209,213 ----
  }
  
! def* History atomically {code} {
  	set ubackup @undo; set @undo {}
  	set rbackup @redo; set @redo {}
***************
*** 1670,1674 ****
  
  def Canvas wires= {wires2} {
! 	global _ canvas
  	set wires {}
  	# look up for wire id
--- 1670,1674 ----
  
  def Canvas wires= {wires2} {
! 	global _ canvas clipboard
  	set wires {}
  	# look up for wire id
***************
*** 1705,1714 ****
  			if {[llength $@selection_wire] == $canvas(dup_wire_num)} {set @duplicating 0}
  		}
! 		if {[info exists canvas(copy)]} {
! 		if {$canvas(copy)} {
  			lappend @selection_wire $x; $x selected?= 1
  			if {$i == $born_num} {
! 			set canvas(copy) 0
! 			set canvas(orig_cpcanvas) $self
  			}
  			}
--- 1705,1714 ----
  			if {[llength $@selection_wire] == $canvas(dup_wire_num)} {set @duplicating 0}
  		}
! 		if {[info exists clipboard(copying)]} {
! 		if {$clipboard(copying)} {
  			lappend @selection_wire $x; $x selected?= 1
  			if {$i == $born_num} {
! 			set clipboard(copying) 0
! 			set clipboard(orig_cpcanvas) $self
  			}
  			}
***************
*** 2000,2011 ****
  
  def* Canvas copy {} {
! 	global canvas
  	if {$@selection != ""} {
! 		set canvas(orig_cpcanvas) $self
! 		set canvas(copy_obj) $@selection
! 		set canvas(copy_wire) $@selection_wire
! 		set canvas(copy_times) 0
! 		puts "objects to copy::: $canvas(copy_obj)"
! 		puts "wires to copy::: $canvas(copy_wire)"
  	}
  
--- 2000,2011 ----
  
  def* Canvas copy {} {
! 	global clipboard
  	if {$@selection != ""} {
! 		set clipboard(orig_cpcanvas) $self
! 		set clipboard(objs) $@selection
! 		set clipboard(wires) $@selection_wire
! 		set clipboard(copy_times) 0
! 		puts "objects to copy::: $clipboard(objs)"
! 		puts "wires to copy::: $clipboard(wires)"
  	}
  
***************
*** 2013,2017 ****
  
  def* Canvas paste {} {
! 	global canvas
  	puts "***************************************"
  	set windowx [winfo width .$self.c]
--- 2013,2017 ----
  
  def* Canvas paste {} {
! 	global clipboard
  	puts "***************************************"
  	set windowx [winfo width .$self.c]
***************
*** 2022,2032 ****
  	set offy [expr ($windowy * $y1off) / [expr $y2off - $y1off]]
  	$self deselect_all
! 	set canvas(copied_obj) ""
! 	if {$canvas(orig_cpcanvas) != $self} { set canvas(copy_times) 0 } else {incr canvas(copy_times)}
  	set notvisiblex 0
  	set notvisibley 0
  	set n 0
  	
! 	foreach item $canvas(copy_obj) {
  	mset {x1 y1} [$item xy]
  	if {$x1 < $offx | $x1 > [expr $offx+$windowx]} {set notvisiblex 1}
--- 2022,2032 ----
  	set offy [expr ($windowy * $y1off) / [expr $y2off - $y1off]]
  	$self deselect_all
! 	set clipboard(copied_obj) ""
! 	if {$clipboard(orig_cpcanvas) != $self} { set clipboard(copy_times) 0 } else {incr clipboard(copy_times)}
  	set notvisiblex 0
  	set notvisibley 0
  	set n 0
  	
! 	foreach item $clipboard(objs) {
  	mset {x1 y1} [$item xy]
  	if {$x1 < $offx | $x1 > [expr $offx+$windowx]} {set notvisiblex 1}
***************
*** 2035,2053 ****
  	}
  	
! 	foreach item $canvas(copy_obj) {
  	mset {x1 y1} [$item xy]
! 	if {$canvas(orig_cpcanvas) != $self} {
! 		if {$n == [llength $canvas(copy_obj)]} {
! 		set x1 [expr $x1 + $offx +($canvas(copy_times)*15)]
! 		set y1 [expr $y1 + $offy +($canvas(copy_times)*15)]
  		}
  	
  	} else {
! 		if {$n == [llength $canvas(copy_obj)]} {
! 			set x1 [expr $x1 + $offx +($canvas(copy_times)*15)]
! 			set y1 [expr $y1 + $offy +($canvas(copy_times)*15)]
  		} else {
! 			set x1 [expr $x1+($canvas(copy_times)*15)]
! 			set y1 [expr $y1+($canvas(copy_times)*15)]
  		}
  	}
--- 2035,2053 ----
  	}
  	
! 	foreach item $clipboard(objs) {
  	mset {x1 y1} [$item xy]
! 	if {$clipboard(orig_cpcanvas) != $self} {
! 		if {$n == [llength $clipboard(objs)]} {
! 		set x1 [expr $x1 + $offx +($clipboard(copy_times)*15)]
! 		set y1 [expr $y1 + $offy +($clipboard(copy_times)*15)]
  		}
  	
  	} else {
! 		if {$n == [llength $clipboard(objs)]} {
! 			set x1 [expr $x1 + $offx +($clipboard(copy_times)*15)]
! 			set y1 [expr $y1 + $offy +($clipboard(copy_times)*15)]
  		} else {
! 			set x1 [expr $x1+($clipboard(copy_times)*15)]
! 			set y1 [expr $y1+($clipboard(copy_times)*15)]
  		}
  	}
***************
*** 2056,2060 ****
  	set name $_($item:class)
  	}
! 	set canvas(copy) 1
  	pd .$self obj $x1 $y1 $name
  	}
--- 2056,2060 ----
  	set name $_($item:class)
  	}
! 	set clipboard(copying) 1
  	pd .$self obj $x1 $y1 $name
  	}
***************
*** 2062,2071 ****
  
  def* Canvas paste_wires {} {
! 	global canvas _
  	
  	set i 0
  	# _($obj:duplicate) sotres the duplicated object so that we know how to duplicate the wires
! 	foreach obj $canvas(copy_obj) {set _($obj:duplicate) [lindex $canvas(copied_obj) $i]; incr i}
! 	foreach wire $canvas(copy_wire) {
  		set obj1 $_($wire:obj1)
  		set obj2 $_($wire:obj2)
--- 2062,2071 ----
  
  def* Canvas paste_wires {} {
! 	global canvas _ clipboard
  	
  	set i 0
  	# _($obj:duplicate) sotres the duplicated object so that we know how to duplicate the wires
! 	foreach obj $clipboard(objs) {set _($obj:duplicate) [lindex $clipboard(copied_obj) $i]; incr i}
! 	foreach wire $clipboard(wires) {
  		set obj1 $_($wire:obj1)
  		set obj2 $_($wire:obj2)
***************
*** 2081,2092 ****
  	#set canvas(copy_obj) $_($canvas(current):selection)
  	#clean up
! 	foreach obj $canvas(copy_obj) {set _($obj:duplicate) 0}
! 	set $canvas(copied_obj) ""
! 	set $canvas(copy_obj) ""
! 	set $canvas(copy_wire) ""
  
  }
  
  def* Canvas cut {} {
  	$@history atomically {
  		$self copy
--- 2081,2093 ----
  	#set canvas(copy_obj) $_($canvas(current):selection)
  	#clean up
! 	foreach obj $clipboard(objs) {set _($obj:duplicate) 0}
! 	set $clipboard(copied_obj) ""
! 	set $clipboard(objs) ""
! 	set $clipboard(wires) ""
  
  }
  
  def* Canvas cut {} {
+ 	puts "history::: $@history"
  	$@history atomically {
  		$self copy
***************
*** 2698,2702 ****
  
  proc update_object {x d ninlets noutlets} {
! 	global _ fields classinfo canvas
  	set d [string trimright $d "\n"]
  	set d [string trimright $d ";"]
--- 2699,2703 ----
  
  proc update_object {x d ninlets noutlets} {
! 	global _ fields classinfo canvas clipboard
  	set d [string trimright $d "\n"]
  	set d [string trimright $d ";"]
***************
*** 2759,2769 ****
  		}
  		
! 		if {[info exists canvas(copy)]} {
! 		if {$canvas(copy)} {
  		puts "copying stuff................ $x"
  		$x selected?= 1
  		lappend _($canvas(current):selection) $x
! 		lappend canvas(copied_obj) $x
! 			if {[llength $canvas(copy_obj)] == [llength $canvas(copied_obj)]} {
  			$canvas(current) paste_wires
  			}
--- 2760,2770 ----
  		}
  		
! 		if {[info exists clipboard(copying)]} {
! 		if {$clipboard(copying)} {
  		puts "copying stuff................ $x"
  		$x selected?= 1
  		lappend _($canvas(current):selection) $x
! 		lappend clipboard(copied_obj) $x
! 			if {[llength $clipboard(objs)] == [llength $clipboard(copied_obj)]} {
  			$canvas(current) paste_wires
  			}





More information about the Pd-cvs mailing list