[PD-cvs] pd/src desire.tk,1.1.2.148,1.1.2.149

chunlee chunlee at users.sourceforge.net
Tue Apr 11 00:23:08 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
more wire fixes, conclusion: there has to be a better way to delete 
wires....


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.148
retrieving revision 1.1.2.149
diff -C2 -d -r1.1.2.148 -r1.1.2.149
*** desire.tk	8 Apr 2006 16:00:55 -0000	1.1.2.148
--- desire.tk	10 Apr 2006 22:23:06 -0000	1.1.2.149
***************
*** 1469,1473 ****
  
  def canvas delete_selection {} {
! 	foreach obj $@selection {$obj erase}
  	# before obj is deleted, it will be selected, therefore 
  	# $@obj_in_edit != {}, so don't forget to set it to {}.
--- 1469,1505 ----
  
  def canvas delete_selection {} {
! 	global _
! 	set c .$self.c
! 	foreach obj $@selection {
! 	    puts "wire to erase: $_($obj:wires)"
! 	    foreach wire $_($obj:wires) {
! 	    	set find [lsearch $@wires_pair $wire]
! 		if { $find != -1} {
! 		## remove the selected wire from the @wire_pair...
! 		set @wires_pair [lreplace $@wires_pair $find $find]
! 		set @wires_pair [lreplace $@wires_pair [expr $find - 1] [expr $find - 1]]
! 		}
! 		
! 		## removes the wire from the $_($obj1:wires)
! 		set obj1 $_($wire:obj1)
! 		set find [lsearch $_($obj1:wires) $wire]
! 		if { $find != -1} {
! 		set _($obj1:wires) [lreplace $_($obj1:wires) $find $find]
! 		}
! 		## removes the wire from the $_($obj2:wires)
! 		set obj2 $_($wire:obj2)
! 		set find [lsearch $_($obj2:wires) $wire]
! 		if { $find != -1} {
! 		set _($obj2:wires) [lreplace $_($obj2:wires) $find $find]
! 		}
! 		
! 		## i don't know why wires are taged as 00000000WIRE...
! 		## not sure why $x erase don't work, look later...
! 		$c delete ${wire}WIRE
! 	    } 
! 	
! 	$obj erase
! 	
! 	}
  	# before obj is deleted, it will be selected, therefore 
  	# $@obj_in_edit != {}, so don't forget to set it to {}.
***************
*** 1477,1480 ****
--- 1509,1543 ----
  }
  
+ def canvas delete_wire {} {
+ 	global _
+ 	
+ 	set find [lsearch $@wires_pair $x]
+ 	if { $find != -1} {
+ 	#remove the selected wire from the @wire_pair...
+ 	set @wires_pair [lreplace $@wires_pair $find $find]
+ 	set @wires_pair [lreplace $@wires_pair [expr $find - 1] [expr $find - 1]]
+ 	}
+ 		
+ 	# removes the wire from the $_($obj1:wires)
+ 	set obj1 $_($x:obj1)
+ 	set find [lsearch $_($obj1:wires) $x]
+ 	if { $find != -1} {
+ 	set _($obj1:wires) [lreplace $_($obj1:wires) $find $find]
+ 	}
+ 	# removes the wire from the $_($obj2:wires)
+ 	set obj2 $_($x:obj2)
+ 	set find [lsearch $_($obj2:wires) $x]
+ 	if { $find != -1} {
+ 	set _($obj2:wires) [lreplace $_($obj2:wires) $find $find]
+ 	}
+ 		
+ 	# i don't know why wires are taged as 00000000WIRE...
+ 	# not sure why $x erase don't work, look later...
+ 	$c delete ${x}WIRE
+ 	
+ }
+ 
+ 
+ 
  proc distance {point1 point2} {
  	set off [l- $point1 $point2]
***************
*** 1882,1886 ****
  
  def canvas key {x y key iso shift} {
!     global OS
      set c .$self.c
      $self hide_tooltip
--- 1945,1949 ----
  
  def canvas key {x y key iso shift} {
!     global OS _
      set c .$self.c
      $self hide_tooltip
***************
*** 1903,1916 ****
  	if {[llength $@selection_wire] > 0} {
  		puts "delete this $self :: $@selection_wire"
! 		#puts "wires: $@wires_pair"
  		
  		foreach x $@selection_wire {
! 		  set find [lsearch $@wires_pair $x]
  		  if { $find != -1} {
! 		  #remove the selected wire from the @wire_pair...
  		  set @wires_pair [lreplace $@wires_pair $find $find]
  		  set @wires_pair [lreplace $@wires_pair [expr $find - 1] [expr $find - 1]]
  		  }
  		# i don't know why wires are taged as 00000000WIRE...
  		$c delete ${x}WIRE
  		}
--- 1966,1995 ----
  	if {[llength $@selection_wire] > 0} {
  		puts "delete this $self :: $@selection_wire"
! 		puts "wires: $@wires_pair"
  		
  		foreach x $@selection_wire {
! 		  
! 		 set find [lsearch $@wires_pair $x]
  		  if { $find != -1} {
! 		  # remove the selected wire from the @wire_pair...
  		  set @wires_pair [lreplace $@wires_pair $find $find]
  		  set @wires_pair [lreplace $@wires_pair [expr $find - 1] [expr $find - 1]]
  		  }
+ 		
+ 		  # removes the wire from the $_($obj1:wires)
+ 		  set obj1 $_($x:obj1)
+ 		  set find [lsearch $_($obj1:wires) $x]
+ 		  if { $find != -1} {
+ 		  set _($obj1:wires) [lreplace $_($obj1:wires) $find $find]
+ 		  }
+ 		  # removes the wire from the $_($obj2:wires)
+ 		  set obj2 $_($x:obj2)
+ 		  set find [lsearch $_($obj2:wires) $x]
+ 		  if { $find != -1} {
+ 		  set _($obj2:wires) [lreplace $_($obj2:wires) $find $find]
+ 		  }
+ 		
  		# i don't know why wires are taged as 00000000WIRE...
+ 		# not sure why $x erase don't work, look later...
  		$c delete ${x}WIRE
  		}
***************
*** 2088,2091 ****
--- 2167,2183 ----
  }
  
+ #def wire delete {} {
+ #	set find [lsearch $_($@obj1:wires) $x]
+ #	if { $find != -1} {
+ #	set _($obj1:wires) [lreplace $_($obj1:wires) $find $find]
+ #	}
+ #	# removes the wire from the $_($obj2:wires)
+ #	set obj2 $_($x:obj2)
+ #	set find [lsearch $_($obj2:wires) $x]
+ #	if { $find != -1} {
+ #	set _($obj2:wires) [lreplace $_($obj2:wires) $find $find]
+ #	}	
+ #}
+ 
  #-----------------------------------------------------------------------------------#
  ############ colouring





More information about the Pd-cvs mailing list