[PD-cvs] pd/src desire.tk,1.1.2.33,1.1.2.34

chunlee chunlee at users.sourceforge.net
Tue Sep 6 10:14:56 CEST 2005


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
added edit/run mode support for textobj and bang
also can move bang now


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.33
retrieving revision 1.1.2.34
diff -C2 -d -r1.1.2.33 -r1.1.2.34
*** desire.tk	6 Sep 2005 04:48:31 -0000	1.1.2.33
--- desire.tk	6 Sep 2005 08:14:54 -0000	1.1.2.34
***************
*** 437,440 ****
--- 437,441 ----
  		set offset_canvas_file [expr $offset_canvas_file + 1]
  		set _($canvas_id:obj_list) {}
+ 		set _($canvas_id:class) canvas
  
  		puts "new canvas id -> $canvas_id"
***************
*** 798,801 ****
--- 799,804 ----
      global look _
      set self [canvastosym $name.c]
+     
+     
      if {$value} {
  	$name.m.edit entryconfigure "Edit mode" -indicatoron true
***************
*** 991,994 ****
--- 994,998 ----
      set _($self:current_x) 30
      set _($self:current_y) 30
+     set _($self:editable) $editable
      puts "pdtk_canvas_new::: $name $width $height $geometry $editable"
  }
***************
*** 1337,1346 ****
  class_new textobj {
  	global offset _
- 	set offset [expr $offset + 1]
  	set canvas $_(focus)
  	set object_id [format %x [expr 0x81168b0 - $offset]]
  	set _($object_id:class) textobj
  	puts "new object id -> $object_id"
  	object_add $object_id $canvas
  }
  
--- 1341,1354 ----
  class_new textobj {
  	global offset _
  	set canvas $_(focus)
+ 	set self [canvastosym $canvas]
+ 	
+ 	if {$_($self:mode) == "edit"} {
+ 	set offset [expr $offset + 1]
  	set object_id [format %x [expr 0x81168b0 - $offset]]
  	set _($object_id:class) textobj
  	puts "new object id -> $object_id"
  	object_add $object_id $canvas
+ 	}
  }
  
***************
*** 1525,1529 ****
      		set _($obj:cy) [expr $_($obj:cy) + $cy-$old_y]
      		
!     		objectbox_draw $obj $canvas \
  		[expr ($_($obj:name_len)*$font(width)) + $font(padx)] \
  		[expr $font(height) + $font(pady)] 1 3
--- 1533,1546 ----
      		set _($obj:cy) [expr $_($obj:cy) + $cy-$old_y]
      		
! 		puts "**** class==> $_($obj:class) *****"
! 		
! 		switch $_($obj:class) {
! 		
! 		
! 		textobj {
! 		
! 		puts "move textobj"
! 		
! 		objectbox_draw $obj $canvas \
  		[expr ($_($obj:name_len)*$font(width)) + $font(padx)] \
  		[expr $font(height) + $font(pady)] 1 3
***************
*** 1534,1537 ****
--- 1551,1569 ----
  		if {$_($self:obj_in_edit)} {$canvas coords ${obj}text $text_pos}
  		$canvas coords ${obj}TEXT $text_pos2
+ 		
+ 		
+ 		}
+ 		
+ 		bang {
+ 		
+ 		puts "move bang"
+ 		bang_draw $obj $canvas
+ 		
+ 		}
+ 		
+ 		
+ 		}
+ 		
+     		
  	
  		#----handles the wire update----
***************
*** 1733,1736 ****
--- 1765,1770 ----
  
  # this proc is too long, should be cut in several parts --matju
+ # agree, but could i do this a bit later? --chun
+ 
  proc pdtk_canvas_click2 {canvas x y b f} {
      puts "pdtk_canvas_click2::: $canvas $x $y $b $f"
***************
*** 1752,1756 ****
        object {
          set run [expr !$edit || ($f&2)]
! 	pd "$self click-on-object x$id $cx $cy $b $f;"
  	if {[string length $_($self:grab)]} {set gid $_($self:grab)}
  	if {$f&8} {
--- 1786,1790 ----
        object {
          set run [expr !$edit || ($f&2)]
! 	#pd "$self click-on-object x$id $cx $cy $b $f;"
  	if {[string length $_($self:grab)]} {set gid $_($self:grab)}
  	if {$f&8} {
***************
*** 1759,1764 ****
  	} else {
  		if {$run} {
  			event $id clickevent     $canvas $cx $cy $b $f} {
! 			event $id clickeditevent $canvas $cx $cy $b $f}
  	}
  	if {!($f&8) && $edit && [llength [$canvas bbox ${id}BASE]]} {
--- 1793,1801 ----
  	} else {
  		if {$run} {
+ 			puts "click click click"
+ 			if {$_($id:class) == "bang"} {bang_bang $id $canvas}
  			event $id clickevent     $canvas $cx $cy $b $f} {
! 			event $id clickeditevent $canvas $cx $cy $b $f
! 			}
  	}
  	if {!($f&8) && $edit && [llength [$canvas bbox ${id}BASE]]} {
***************
*** 1793,1803 ****
  		#pd "$self deselect-all ; $self select-object x$id ;"
  		puts "___select this object --> $id"
! 		# my click select object code begins --chun
! 		switch $_($id:class) {
! 		    bang {
! 			puts "clicked on bang"
! 			bang_bang $id $canvas
! 		    }
! 		    textobj {
  			# may need to call canvas_select_object here to work out 
  			# the shift+click selection
--- 1830,1842 ----
  		#pd "$self deselect-all ; $self select-object x$id ;"
  		puts "___select this object --> $id"
! 	# my click select object code begins --chun
! 		#switch $_($id:class) {
! 		    #bang {
! 			#puts "clicked on bang :: editable = $edit"
! 			
! 			#bang_bang $id $canvas
! 			
! 		    #}
! 		    #textobj {
  			# may need to call canvas_select_object here to work out 
  			# the shift+click selection
***************
*** 1826,1831 ****
  			}
  			set _($self:select_by) "click"
! 		    }    		
! 		}
  		# my click select object code ends
  		
--- 1865,1870 ----
  			}
  			set _($self:select_by) "click"
! 		    #}    		
! 		#}
  		# my click select object code ends
  		
***************
*** 1879,1890 ****
  		switch $pd_nt { 2 {} default { $canvas itemconfigure selrect -dash {3 3 3 3}}}
  	}
        }
      }
!     #pd "[canvastosym $canvas] mouse $cx $cy $b $f ;"
!     #if {[llength $_($self:selection)]} {
!     #	puts "something has been hilighted"
!     #} {
!     #	puts "nothing hilighted"
!     #}
  }
  
--- 1918,1927 ----
  		switch $pd_nt { 2 {} default { $canvas itemconfigure selrect -dash {3 3 3 3}}}
  	}
+ 	
+ 
+ 	
        }
      }
!     
  }
  
***************
*** 2080,2087 ****
--- 2117,2131 ----
  	
  	if {$_($self:select_by) == "click"} {
+ 	
+ 		switch $_($_($self:selection):class) {
+ 		
+ 		textobj {
  		if {$_($self:obj_in_edit) == 0} {
  			set _($self:obj_in_edit) 1
  			object_edit [lindex $_($self:selection) 0] $canvas
      		}
+ 		}
+ 		
+ 		}
  	}
      	#object_edit $_($self:edit_object) $canvas





More information about the Pd-cvs mailing list