[PD-cvs] pd/src desire.tk,1.1.2.72,1.1.2.73

chunlee chunlee at users.sourceforge.net
Wed Sep 21 01:13:52 CEST 2005


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
render fix, object created by ctrl+1 will be created at where the 
mouse is pointing and object created by button will be created at the 
default location.


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.72
retrieving revision 1.1.2.73
diff -C2 -d -r1.1.2.72 -r1.1.2.73
*** desire.tk	20 Sep 2005 09:49:30 -0000	1.1.2.72
--- desire.tk	20 Sep 2005 23:13:49 -0000	1.1.2.73
***************
*** 111,135 ****
  set OS $tcl_platform(platform)
  
- #some questions to matju --chun
- #
- #1. so from now on, things that to do with objects will be using this system?
- #
- #2. the model you taled about once, is it essentially a (field) variable that holds
- # the status of the each object?
- #
- #3. is this what you mean by class_new? so that later we can have textobj_new, canvas_new, 
- #   bang_new,  toggle_new, and so on? 
- #
- #-----------------------------------------------------------------------------------#
- #some variables i created, some are tmp only. --chun
- 
- set offset 0
- set offset_wire 0 
- set offset_canvas_file 0
- set offset_wire_file 0
- set offset_obj_file 0
- 
- #-----------------------------------------------------------------------------------#
- 
  #option add *background #ffffff
  option add *foreground #000000
--- 111,114 ----
***************
*** 653,657 ****
  
  set canvasmenu(put) {
! 	{Object  {pd "%W obj 0 ;"} "Ctrl+1"}
  	{Message {pd "%W msg 0 ;"} "Ctrl+2"}
  	{Number  {pd "%W floatatom 0 ;"} "Ctrl+3"}
--- 632,636 ----
  
  set canvasmenu(put) {
! 	{Object  {obj_create $focus(canvas) ctrl} "Ctrl+1"}
  	{Message {pd "%W msg 0 ;"} "Ctrl+2"}
  	{Number  {pd "%W floatatom 0 ;"} "Ctrl+3"}
***************
*** 755,760 ****
  class_new canvas
  def* canvas init {width height geometry editable} {
!     global pd_opendir pd_tearoff OS cmdline canvasmenu
      set name .x$self
      set _(focus) $self
      toplevel $name -menu $name.m
--- 734,740 ----
  class_new canvas
  def* canvas init {width height geometry editable} {
!     global pd_opendir pd_tearoff OS cmdline canvasmenu focus
      set name .x$self
+     set focus(canvas) $self
      set _(focus) $self
      toplevel $name -menu $name.m
***************
*** 937,941 ****
  #-----------------------------------------------------------------------------------#
  def* canvas ctrlkey {key shift} {
!     global accels
      set top .x$self
      set name .x$self.c
--- 917,921 ----
  #-----------------------------------------------------------------------------------#
  def* canvas ctrlkey {key shift} {
!     global accels focus
      set top .x$self
      set name .x$self.c
***************
*** 990,999 ****
  #-----------------------------------------------------------------------------------#
  def view xy {canvas} {
  	if {![info exists @cx]} {
  		#don't delete these two lines
  		#set @cx 40; catch {set @cx $_($canvas:current_x)}
  		#set @cy 40; catch {set @cy $_($canvas:current_y)}
! 		set @cx 40
! 		set @cy 40
  	}
  
--- 970,996 ----
  #-----------------------------------------------------------------------------------#
  def view xy {canvas} {
+ 	global focus
  	if {![info exists @cx]} {
  		#don't delete these two lines
  		#set @cx 40; catch {set @cx $_($canvas:current_x)}
  		#set @cy 40; catch {set @cy $_($canvas:current_y)}
! 		switch $focus(createdby) {
! 		butt {
! 			set @cx 40
! 			set @cy 40
! 		}
! 		ctrl {
! 			if {[string length $focus(objname)] > 0} {
! 			set @cx $focus(old_cx)
! 			set @cy $focus(old_cy)
! 		
! 			} else {
! 			set @cx $_($canvas:current_x)
! 			set @cy $_($canvas:current_y)
! 			set focus(old_cx) $@cx
! 			set focus(old_cy) $@cy
! 			}
! 		}
! 		}
  	}
  
***************
*** 1231,1235 ****
  
  def objectbox motionedit {args} {
! 	puts "motions in $self in edit mode"
  }
  
--- 1228,1232 ----
  
  def objectbox motionedit {args} {
! 	#puts "motions in $self in edit mode"
  }
  
***************
*** 1358,1362 ****
  	if {$@editmode && [llength [$id bbox]]} {
  	  mset {x1 y1 x2 y2} [$id bbox]
- 	  #puts "***** -> $y1+3-$y = [expr $y1+3-$y]"
  	  if {abs($y1+3-$y)<=3} {
  		#set port [$self hilite_in $_($id:cx) $_($id:cy)]
--- 1355,1358 ----
***************
*** 1368,1372 ****
  		return
  	  }
- 	  puts "***** -> $y2-3-$y = [expr $y2-3-$y]"
  	  if {abs($y2-3-$y)<=3} {
  		#set port [$self hilite_out $x $y]
--- 1364,1367 ----
***************
*** 1454,1458 ****
  
  def objectbox bbox {} {
- 	puts "bbox : $@cx $@cy [expr $@cx+$@xs] [expr $@cy+$@ys]"
  	list $@cx $@cy [expr $@cx+$@xs] [expr $@cy+$@ys]
  	
--- 1449,1452 ----
***************
*** 1537,1541 ****
  
  def* canvas click {x y b f} {
!     global OS mouse font look
      set c .x$self.c
      set x [$c canvasx $x]
--- 1531,1535 ----
  
  def* canvas click {x y b f} {
!     global OS mouse font look focus
      set c .x$self.c
      set x [$c canvasx $x]
***************
*** 1556,1560 ****
  				[lindex $@selection 0] unedit $self
  				set @obj_in_edit 0
! 				#puts "completing it!"
  			}
  		}
--- 1550,1554 ----
  				[lindex $@selection 0] unedit $self
  				set @obj_in_edit 0
! 				
  			}
  		}
***************
*** 2756,2760 ****
  set buttons_loaded 0
  proc make_button_bar {self doc} {
! 	global buttons_loaded butt createdby
  	if {!$buttons_loaded} {load_button_bar}
  	frame $self
--- 2750,2755 ----
  set buttons_loaded 0
  proc make_button_bar {self doc} {
! 	global buttons_loaded butt focus
! 	set focus(canvas) $doc
  	if {!$buttons_loaded} {load_button_bar}
  	frame $self
***************
*** 2764,2770 ****
--- 2759,2771 ----
  	foreach b $butt {
  		catch {
+ 			if {[lindex $b 0] == "object"} {
+ 			button "$self.[lindex $b 0]" -image "icon_[lindex $b 0]" -border 1 \
+ 				-command {obj_create $focus(canvas) butt}
+ 			pack $self.[lindex $b 0] -side left
+ 			} else {
  			button "$self.[lindex $b 0]" -image "icon_[lindex $b 0]" -border 1 \
  				-command [list pd "$doc [lindex $b 1] ;"]
  			pack $self.[lindex $b 0] -side left
+ 			}
  		}
  	}
***************
*** 2776,2779 ****
--- 2777,2786 ----
  }
  
+ proc obj_create {doc flag} {
+ 	global _ focus
+ 	set  focus(createdby) $flag
+ 	#puts " ||| $doc :: $_($doc:createdby)"
+ 	pd "$doc obj 0 ;"
+ }
  
  ############ tooltips





More information about the Pd-cvs mailing list