[PD-cvs] pd/src desire.tk,1.1.2.356,1.1.2.357

Mathieu Bouchard matju at users.sourceforge.net
Thu Aug 17 03:28:13 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
multiple undo move


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.356
retrieving revision 1.1.2.357
diff -C2 -d -r1.1.2.356 -r1.1.2.357
*** desire.tk	16 Aug 2006 23:28:33 -0000	1.1.2.356
--- desire.tk	17 Aug 2006 01:28:11 -0000	1.1.2.357
***************
*** 244,249 ****
  # keep in mind that undo information is kept hierarchically.
  def History add {message} {
- 	puts "History add:        [info level [info level]]"
- 	puts "History add caller: [info level [expr [info level]-1]]"
  	lappend @undo_q [list do $message [lrange [info level -3] 1 end]]
  	set @redo_q {}
--- 244,247 ----
***************
*** 349,352 ****
--- 347,354 ----
  }
  
+ foreach tkclass {Label} {
+ 	#option add *$tkclass*background #909090
+ }
+ 
  # there are two palettes of 30 colours used in Pd
  # when placed in a 3*10 grid, the difference is that
***************
*** 1958,1962 ****
        edit {
          if {[distance [list $x $y] $@click_at] > 5} {
! 	  foreach obj $@selection {mset {x y} [$obj xy];$obj set_orig_xy $x $y}
  	  set @action move
  	  mset {ox oy} $@click_at
--- 1960,1964 ----
        edit {
          if {[distance [list $x $y] $@click_at] > 5} {
! 	  foreach obj $@selection {$obj backupxy= [$obj xy]}
  	  set @action move
  	  mset {ox oy} $@click_at
***************
*** 2052,2063 ****
      set tags [$c gettags [lindex [$c find overlapping \
  	[expr $x-2] [expr $y-2] [expr $x+2] [expr $y+2]] end]]
!     mset {type id detail} [$@canvas identify_target $x $y -1]
      switch -- $type {
        object {
  	if {[info exists _($id:pdclass)]} {set class $_($id:pdclass)} {set class unknown}
! 	set t "$id \[$class\] ($tags)"
        }
-       wire    {set t "$id wire"}
-       default {set t "type=$type ... $tags"}
      }
      if {[string length [$@canvas focus]]} {set t "focus: [$@canvas focus]"}
--- 2054,2065 ----
      set tags [$c gettags [lindex [$c find overlapping \
  	[expr $x-2] [expr $y-2] [expr $x+2] [expr $y+2]] end]]
!     set target [$@canvas identify_target $x $y -1]
!     mset {type id detail} $target
!     set t $target
      switch -- $type {
        object {
  	if {[info exists _($id:pdclass)]} {set class $_($id:pdclass)} {set class unknown}
! 	append t " \[$class\]"
        }
      }
      if {[string length [$@canvas focus]]} {set t "focus: [$@canvas focus]"}
***************
*** 2353,2359 ****
  	edit {set @obj_in_edit $id; $id edit; set @action none}
  	move {
! 	  foreach obj $@selection {pd .$self object_moveto !$obj [$obj xy]}
  	  set objs $@selection
-  	  $@history add [list $self undomove $objs]
  	  set @action none
          }
--- 2355,2363 ----
  	edit {set @obj_in_edit $id; $id edit; set @action none}
  	move {
! 	  foreach obj $@selection {
! 		mset {x1 y1} [$obj xy]; $obj moveto $x1 $y1
! 		mset {x1 y1} [$obj backupxy]; $@history add [list $obj moveto $x1 $y1]
! 	  }
  	  set objs $@selection
  	  set @action none
          }
***************
*** 2652,2660 ****
  #-----------------------------------------------------------------------------------#
  
! def* Canvas selection_move {dx dy} {
!     foreach item $@selection {
! 	mset {x1 y1 x2 y2} [$item bbox]
  	pd .$self object_moveto !$item [expr $x1+$dx] [expr $y1+$dy]
- 	$item draw_wires
      }
  }
--- 2656,2663 ----
  #-----------------------------------------------------------------------------------#
  
! def Canvas selection_move {dx dy} {
!     foreach o $@selection {
! 	mset {x1 y1} [$item xy]
  	pd .$self object_moveto !$item [expr $x1+$dx] [expr $y1+$dy]
      }
  }
***************
*** 2765,2768 ****
--- 2768,2786 ----
  }
  
+ # temporary hack... only used during the moving of objects.
+ def Box backupxy= {xy} {set @backupxy $xy}
+ def Box backupxy    {} {return $@backupxy}
+ 
+ # the only one sending to the server.
+ # View position= is when getting position from server.
+ # View xy is virtual (for GOP)
+ def Box moveto {x1 y1} {
+ 	pd .$@canvas object_moveto !$self $x1 $y1
+ 	set @x1 $x1
+ 	set @y1 $y1
+ 	$self changed
+ 	$self draw_wires
+ }
+ 
  def* Box clickedit {x y butt key in_selection selection} {
      if {($key&1) && $selection>0} {puts "add $self to selection...."}
***************
*** 2878,2913 ****
  	if {$arrowsize < 5} {set arrow none} {set arrow last}
  	set arrowshape [list $arrowsize [expr $arrowsize*4/5] [expr $arrowsize/3]]
- 	#if {$@select_by == "selrect"} {set wire_color [look wirefg2]} {set wire_color [look wirefg]}
  	if {[$self selected?]} {set wire_color [look wirefg2]} {set wire_color [look wirefg]}
- 	#set wire_color [look wirefg]
  	$self item WIRE line $xys -width [look wirethick] -smooth yes \
  		-arrow $arrow -arrowshape $arrowshape -fill $wire_color
- 	#mset {dx dy dx2 dy2} [$self bbox]
- 	mset {dx dy} [$self xy]
- 	set off 1
- 	set rect [list [expr $dx+$off] [expr $dy+$off] [expr $dx-$off] [expr $dy-$off]]
- 	$self item POO oval $rect -fill yellow -outline yellow
  }
  
! #!@#$ what's this? doesn't match the name of instance variables.
! def Wire update {source outlet target inlet kind} {
! 	error "proof that this method is used somewhere..."
! 	set @source $source
! 	set @outlet $outlet
! 	set @target $target
! 	set @inlet  $inlet
! 	set @type   $kind
! 	$self draw
! }
! 
! #!@#$ should it be called delete or _delete ?
! def Wire delete {} {
! 	set c .$@canvas.c
  	$@obj1 delete_wire $self
  	$@obj2 delete_wire $self
! 	#super
! 	#!@#$ not sure why $self erase don't work, look later...
! 	#$self erase
! 	$c delete ${self}WIRE
  }
  
--- 2896,2908 ----
  	if {$arrowsize < 5} {set arrow none} {set arrow last}
  	set arrowshape [list $arrowsize [expr $arrowsize*4/5] [expr $arrowsize/3]]
  	if {[$self selected?]} {set wire_color [look wirefg2]} {set wire_color [look wirefg]}
  	$self item WIRE line $xys -width [look wirethick] -smooth yes \
  		-arrow $arrow -arrowshape $arrowshape -fill $wire_color
  }
  
! def Wire _delete {} {
  	$@obj1 delete_wire $self
  	$@obj2 delete_wire $self
! 	super
  }
  





More information about the Pd-cvs mailing list