[PD-cvs] pd/src desire.tk,1.1.2.15,1.1.2.16

chunlee chunlee at users.sourceforge.net
Mon Aug 29 20:40:45 CEST 2005


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
still working on loading simple file, can load canvas and objects now


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.15
retrieving revision 1.1.2.16
diff -C2 -d -r1.1.2.15 -r1.1.2.16
*** desire.tk	28 Aug 2005 03:40:36 -0000	1.1.2.15
--- desire.tk	29 Aug 2005 18:40:43 -0000	1.1.2.16
***************
*** 3,30 ****
  #thanks for taking time looking at this code:)
  #
! #few notes:
! #
! #1. "wish +++++.tk" to run it
! #2. use Ctrl+1 to add object, use BackSpace to delete it
! #3. other keybindings are not working yet, so there will be error
! #4. only 1 canvas for now
! #5. wire drawing functions are not there yet, so don't try to connect:)
! #6. type any name in the object box, all object for now have 3 outlets and 1 inlet
! #7. the foo button is for testing and debug, it does nothing
! #8. close this code from the foo buttn window
! #
! #things to look at:
! #
! #1. when creating/editing text object, the tmp text input field is not handled in tk
! #2. all the mouse position stuff (selection, hilight...) are now also done in tk
! #3. text object creation/edit/delet is not done in tk
! #
! #i think that's it
! #
! #oh, these codes are not clean, i mean, there are codes that are left over from before, sorry:/
! 
! #26072005, chun at goto10.org
  #-----------------------------------------------------------------------------------#
  
  set pd_nt 0
  
--- 3,21 ----
  #thanks for taking time looking at this code:)
  #
! #this is desiredata
! #this code is still in early development
  #-----------------------------------------------------------------------------------#
  
+ #some variables i created, some are tmp only.
+ 
+ set canvas .x80f2b50
+ set offset 0
+ set offset_wire 0 
+ set offset_canvas 0
+ set offset_canvas_file 0
+ set offset_wire_file 0
+ set offset_obj_file 0
+ 
+ #-----------------------------------------------------------------------------------#
  set pd_nt 0
  
***************
*** 292,296 ****
  }
  
! set offset_canvas 0
  
  proc menu_new {} {
--- 283,287 ----
  }
  
! 
  
  proc menu_new {} {
***************
*** 339,343 ****
      puts "open_file $filename"
  
!     global pd_opendir
      set directory [string range $filename 0 [expr [string last / $filename] - 1]]
      set pd_opendir $directory
--- 330,335 ----
      puts "open_file $filename"
  
!     global pd_opendir offset_canvas_file offset_wire_file offset_obj_file _ font
!     
      set directory [string range $filename 0 [expr [string last / $filename] - 1]]
      set pd_opendir $directory
***************
*** 355,361 ****
--- 347,359 ----
  	puts "read $no_lines lines"
  	
+ 	set canvas 0
+ 	
  	
  	foreach line $lines {
  	
+ 	#set offset_canvas_file 0
+ 	#set offset_wire_file 0
+ 	#set offset_obj_file 0
+ 	
  		#puts "[lindex $line 0]"
  		
***************
*** 365,368 ****
--- 363,381 ----
  		
  				puts "creates canvas"
+ 				puts "XY offset: [lindex $line 2] : [lindex $line 3]"
+ 				puts "canvas size: [lindex $line 4] : [lindex $line 5]"
+ 				
+ 				
+ 				set canvas_id [format %x [expr 0x0000000 + $offset_canvas_file]]
+ 				set canvas_id .x$canvas_id
+ 				set canvas $canvas_id
+ 				set offset_canvas_file [expr $offset_canvas_file + 1]
+ 
+ 				puts "new canvas id -> $canvas_id"
+ 
+     
+     				pdtk_canvas_new $canvas_id [lindex $line 4] [lindex $line 5] \
+ 				+[lindex $line 2]+[lindex $line 3] 1
+ 				
  		
  			} else {
***************
*** 372,381 ****
  		
  				set ow [lindex $line 1]
! 		
! 					if {$ow != "connect"} {
  		
  						puts "create obj"
  		
! 					} else {
  		
  						puts "create wires"
--- 385,423 ----
  		
  				set ow [lindex $line 1]
! 				
! 					if {$ow == "obj"} {
! 						set object_id [format %x [expr 0x1111111 + $offset_obj_file]]
! 						set offset_obj_file [expr $offset_obj_file + 1]
  		
  						puts "create obj"
+ 						set obj_name [lrange $line 4 end]
+ 						set lsize [expr [llength $line] - 1]
+ 						set last_str [string trimright [lindex $line $lsize] ";"]
+ 						set obj_name [lreplace $obj_name end end]
+ 						set obj_name [lappend obj_name $last_str]
+ 						set _($object_id:name_len) [string length $obj_name]
+ 						
+ 						puts "obj x: [lindex $line 2] y: [lindex $line 3]"
+ 						
+ 						set _($object_id:cx) [lindex $line 2]
+ 						set _($object_id:cy) [lindex $line 3]
+ 						
+ 						#puts "last in the list :: [lindex $line $lsize]"
+ 						#puts "trimed :: $last_str"
+ 						puts "obj_name :: $obj_name"
+ 						
+ 						objectbox_draw $object_id $canvas.c \
+ 						[expr ($_($object_id:name_len)*$font(width)) + $font(padx)] \
+ 						[expr $font(height) + $font(pady)] 1 3
+ 						
+ 						pdtk_text_new \
+ 						$canvas.c ${object_id}TEXT [expr $_($object_id:cx)+2] [expr $_($object_id:cy)+2] \
+ 						$obj_name $font(size) #000000
+ 	
+ 								
  		
! 					} 
! 					
! 					if {$ow == "connect"} {
  		
  						puts "create wires"
***************
*** 502,508 ****
  
  
! set canvas .x80f2b50
! set offset 0
! set offset_wire 0 
  
  set font(size) 12
--- 544,549 ----
  
  
! 
! 
  
  set font(size) 12
***************
*** 1139,1143 ****
  #-----------------------------------------------------------------------------------#
  proc objectbox_draw {self canvas xs ys ins outs} {
! 	puts "objectbox_draw"
  
          global _ look
--- 1180,1184 ----
  #-----------------------------------------------------------------------------------#
  proc objectbox_draw {self canvas xs ys ins outs} {
! 	puts "objectbox_draw ::: $self $canvas $xs $ys $ins $outs"
  
          global _ look





More information about the Pd-cvs mailing list