[PD-cvs] pd/src desire.tk,1.1.2.327,1.1.2.328

Mathieu Bouchard matju at users.sourceforge.net
Mon Aug 14 00:11:22 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
can undo wire deletion


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.327
retrieving revision 1.1.2.328
diff -C2 -d -r1.1.2.327 -r1.1.2.328
*** desire.tk	13 Aug 2006 19:09:04 -0000	1.1.2.327
--- desire.tk	13 Aug 2006 22:11:19 -0000	1.1.2.328
***************
*** 1807,1821 ****
  }
  
! def* Canvas wires {} {return $@wires}
  
! def* Canvas delete_selection {} {
! 	set c .$self.c
  	foreach obj $@selection {
- 	    #pd .$self object_delete !$obj
- 	    puts "wire to erase: $_($obj:wires)"
  	    foreach wire $_($obj:wires) {
  		set find [lsearch $@wires_pair $wire]
  		if { $find != -1} {
! 			pd .$self disconnect [lindex $@wires_pair [expr $find - 1]]
  			## remove the selected wire from the @wires_pair...
  			set @wires_pair [lreplace $@wires_pair $find $find]
--- 1807,1819 ----
  }
  
! def Canvas wires {} {return $@wires}
  
! def Canvas delete_selection {} {
! 	#if {![llength $@selection] && ![llength $@selection_wire]} {return}
  	foreach obj $@selection {
  	    foreach wire $_($obj:wires) {
  		set find [lsearch $@wires_pair $wire]
  		if { $find != -1} {
! 			$self disconnect [lindex $@wires_pair [expr $find - 1]]
  			## remove the selected wire from the @wires_pair...
  			set @wires_pair [lreplace $@wires_pair $find $find]
***************
*** 1824,1831 ****
  		$wire delete
  	    }
- 	    #$obj erase
  	    pd .$self object_delete !$obj
  	}
! 	# before obj is deleted, it will be selected, therefore 
  	# $@obj_in_edit != {}, so don't forget to set it to {}.
  	# needs to handle obj_in_edit and selection!!!
--- 1822,1837 ----
  		$wire delete
  	    }
  	    pd .$self object_delete !$obj
  	}
! 	foreach x $@selection_wire {
! 	  set find [lsearch $@wires_pair $x]
! 	  if {$find != -1} {
! 	    $self disconnect [lindex $@wires_pair [expr $find - 1]]
! 	    set @wires_pair [lreplace $@wires_pair [expr $find - 1] [expr $find - 1]]
! 	  }
! 	  $x delete
! 	}
! 	set $@selection_wire {}
! 	# before obj is deleted, it will be selected, therefore
  	# $@obj_in_edit != {}, so don't forget to set it to {}.
  	# needs to handle obj_in_edit and selection!!!
***************
*** 2124,2127 ****
--- 2130,2142 ----
  }
  
+ def Canvas disconnect {wire} {
+ 	mset {from outlet to inlet} $wire; pd .$self disconnect $from $outlet $to $inlet
+ 	$@history add [list $self    connect $wire]
+ }
+ def Canvas    connect {wire} {
+ 	mset {from outlet to inlet} $wire; pd .$self    connect $from $outlet $to $inlet
+ 	$@history add [list $self disconnect $wire]
+ }
+ 
  #!@#$ this method is too long
  def* Canvas clickedit {x y b f} {
***************
*** 2150,2154 ****
  	     set y2 [expr $y2 * $@scale]
  	     set outs 0; set outs [$id noutlets]
! 	     set ins 0; set ins [$id ninlets]
  	     if {$y>=$y2-6 && $outs} {
  	     	set out [expr int(($x-$x1)*$outs/($x2-$x1))]
--- 2165,2169 ----
  	     set y2 [expr $y2 * $@scale]
  	     set outs 0; set outs [$id noutlets]
! 	     set ins  0; set  ins [$id  ninlets]
  	     if {$y>=$y2-6 && $outs} {
  	     	set out [expr int(($x-$x1)*$outs/($x2-$x1))]
***************
*** 2176,2181 ****
  			mset {from outlet} $@shift_wires
  			mset {to    inlet} $@wire_to
! 			pd .$self connect [lsearch $@children $from] $outlet \
! 			    [lsearch $@children $to]  $inlet
  			}
  			return
--- 2191,2195 ----
  			mset {from outlet} $@shift_wires
  			mset {to    inlet} $@wire_to
! 			$self connect [lsearch $@children $from] $outlet [lsearch $@children $to] $inlet
  			}
  			return
***************
*** 2603,2618 ****
      #if {$iso != ""} {scan $iso %c key}
      if {$key == "BackSpace" || $key == "Delete" || $key == "KP_Delete"} {
! 	if {[llength $@selection] > 0} {$self delete_selection}
! 	if {[llength $@selection_wire] > 0} {
! 		foreach x $@selection_wire {
! 		  set find [lsearch $@wires_pair $x]
! 		  if {$find != -1} {
! 		    pd .$self disconnect [lindex $@wires_pair [expr $find - 1]]
! 		    set @wires_pair [lreplace $@wires_pair [expr $find - 1] [expr $find - 1]]
! 		  }
! 		  $x delete
! 		}
! 		set $@selection_wire {}
! 	}
      }
      if {$shift} {set motion 10} {set motion 1}
--- 2617,2621 ----
      #if {$iso != ""} {scan $iso %c key}
      if {$key == "BackSpace" || $key == "Delete" || $key == "KP_Delete"} {
! 	$self delete_selection
      }
      if {$shift} {set motion 10} {set motion 1}





More information about the Pd-cvs mailing list