[PD-cvs] pd/src desire.tk,1.1.2.600.2.263,1.1.2.600.2.264

chunlee chunlee at users.sourceforge.net
Thu Aug 2 03:45:43 CEST 2007


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

Modified Files:
      Tag: desiredata
	desire.tk 
Log Message:
new feature: mouse click/drag copy


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.600.2.263
retrieving revision 1.1.2.600.2.264
diff -C2 -d -r1.1.2.600.2.263 -r1.1.2.600.2.264
*** desire.tk	1 Aug 2007 19:56:20 -0000	1.1.2.600.2.263
--- desire.tk	2 Aug 2007 01:45:39 -0000	1.1.2.600.2.264
***************
*** 1994,1998 ****
  	if {$@keynav} {$self update_Active $obj}
  }
! def Canvas new_object_select {obj} {$self selection+= $obj}
  def Canvas new_wire_select {wire} {$self selection_wire+= $wire}
  def Canvas new_object_edit     {obj} {
--- 1994,2002 ----
  	if {$@keynav} {$self update_Active $obj}
  }
! def Canvas new_object_copyselect {obj} {
! 	$self selection+= $obj
! 	#set @action "move"
! 	#$self click_on_object $obj 0
! }
  def Canvas new_wire_select {wire} {$self selection_wire+= $wire}
  def Canvas new_object_edit     {obj} {
***************
*** 2815,2818 ****
--- 2819,2823 ----
  		chain_obj {}
  		imove {$self motion_imove $oldpos $x $y; return}
+ 		mouse_copy {$self motion_move $oldpos $x $y; return}
  		none {}
  		default {$@action motion $x $y $f $target}
***************
*** 3504,3508 ****
  			default {
  				if {$in} {set goto ""} else {
! 					netsend [$self paste_coords $mess $offset] [list $self new_object_select]
  				}
  			}
--- 3509,3514 ----
  			default {
  				if {$in} {set goto ""} else {
! 					netsend [$self paste_coords $mess $offset] \
! 					    [list $self new_object_copyselect]
  				}
  			}
***************
*** 3540,3552 ****
  
  def Canvas duplicate {} {
  	global clipboard
  	set backup $clipboard
  	set clipboard [Clipboard2 new]
  	$self copy
! 	$self do_paste 15
  	$clipboard delete
  	set clipboard $backup
  }
  
  def Canvas select_all {} {
  	foreach o $@children {$o selected?= 1}
--- 3546,3567 ----
  
  def Canvas duplicate {} {
+ 	$self do_duplicate 15
+ }
+ 
+ 
+ def Canvas do_duplicate {offset} {
  	global clipboard
  	set backup $clipboard
  	set clipboard [Clipboard2 new]
  	$self copy
! 	$self do_paste $offset
  	$clipboard delete
  	set clipboard $backup
  }
  
+ def Canvas mouse_copy {} {
+ 	$self do_duplicate 0
+ }
+ 
  def Canvas select_all {} {
  	foreach o $@children {$o selected?= 1}
***************
*** 4023,4026 ****
--- 4038,4045 ----
  	if {!$@editmode} {$self click_runmode $id $x $y $f $target; return}
  	set in_selection [expr [lsearch $@selection $id]>=0]
+ 	switch $@action {
+ 		mouse_copy {$self move_selection}
+ 
+ 	}
  	switch $type {
  		outlet {}
***************
*** 4072,4075 ****
--- 4091,4095 ----
  	switch [expr $f&255] {
  		0 {
+ 			if {[$self action] == "mouse_copy"} {$self action= "none"; return}
  			# if $id is the content of GOP
  			if {[$id canvas] != $self} {
***************
*** 4077,4083 ****
  			} else {set obj $id}
  			if {[lsearch $@selection $obj] < 0 || [llength $@selection] == 0} {
! 			$self deselect_all
! 			$self selection+= $obj
! 			set @action edit
  			} else {set @action edit}
  		}
--- 4097,4103 ----
  			} else {set obj $id}
  			if {[lsearch $@selection $obj] < 0 || [llength $@selection] == 0} {
! 				$self deselect_all
! 				$self selection+= $obj
! 				set @action edit
  			} else {set @action edit}
  		}
***************
*** 4093,4097 ****
  			$self deselect_all
  			$self selection+= $id
! 			$self auto_wire
  		}
  	}
--- 4113,4130 ----
  			$self deselect_all
  			$self selection+= $id
! 			$self remove_obj_from_path
! 		}
! 		3 {
! 			if {[$id canvas] != $self} {
! 				set obj [$id get_parent_gop $self]
! 			} else {set obj $id}
! 			if {![llength $@selection]} {$self selection+= $obj}
! 			if {[lsearch $@selection $obj] >= 0} {
! 				$self action= "mouse_copy"
! 			} else {
! 				$self deselect_all
! 				$self selection+= $obj
! 				$self action= "mouse_copy"
! 			}
  		}
  	}
***************
*** 4140,4143 ****
--- 4173,4177 ----
  		chain_obj {}
  		imove {}
+ 		mouse_copy {}
  		default {$@action unclick $x $y $f $target}
  	}
***************
*** 4172,4175 ****
--- 4206,4210 ----
  			insert {}
  			chain_obj {}
+ 			mouse_copy {$self mouse_copy}
  			imove {$self unclick_move}
  			default {$@action unclick $x $y $f $target}
***************
*** 4181,4184 ****
--- 4216,4224 ----
  
  def Canvas unclick_move {} {
+ 	$self move_selection
+ 	set @action none
+ }
+ 
+ def Canvas move_selection {} {
  	foreach obj $@selection {
  		if {![[$obj class] <= Box]} {
***************
*** 4187,4196 ****
  		}
  		mset {x1 y1} [$obj xy]
! 		$obj position= [$obj backupxy]
  		$obj moveto $x1 $y1
  		if {[$obj edit?]} {focus [[$obj canvas] widget].${obj}text}
  	}
  	set objs $@selection
- 	set @action none
  }
  
--- 4227,4238 ----
  		}
  		mset {x1 y1} [$obj xy]
! 		switch $@action {
! 			mouse_copy {}
! 			default {$obj position= [$obj backupxy]}
! 		}
  		$obj moveto $x1 $y1
  		if {[$obj edit?]} {focus [[$obj canvas] widget].${obj}text}
  	}
  	set objs $@selection
  }
  





More information about the Pd-cvs mailing list