[PD-cvs] pd/src desire.tk,1.1.2.264,1.1.2.265

Mathieu Bouchard matju at users.sourceforge.net
Sun Jun 25 13:37:00 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
SymbolAtom works!


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.264
retrieving revision 1.1.2.265
diff -C2 -d -r1.1.2.264 -r1.1.2.265
*** desire.tk	25 Jun 2006 11:08:57 -0000	1.1.2.264
--- desire.tk	25 Jun 2006 11:36:57 -0000	1.1.2.265
***************
*** 2692,2698 ****
  set classinfo(canvas)  {Canvas}
  set classinfo(cnv)     {Cnv}
  set classinfo(floatatom)   {FloatAtom}
  set classinfo(symbolatom) {SymbolAtom}
- 
  #
  # a hack to get around the file loading process
--- 2692,2698 ----
  set classinfo(canvas)  {Canvas}
  set classinfo(cnv)     {Cnv}
+ set classinfo(text)    {Comment}
  set classinfo(floatatom)   {FloatAtom}
  set classinfo(symbolatom) {SymbolAtom}
  #
  # a hack to get around the file loading process
***************
*** 2957,2964 ****
  }
  
! class_new comment {View}
! def comment draw {xs ys ins outs} {
! 	if {[llength [$canvas gettags $self]] != 0} {}
! 	mset {x1 y1} [$self xy]
  }
  
--- 2957,2965 ----
  }
  
! #class_new Comment {View}
! class_new Comment {Box}
! def Comment draw {} {
! 	super
! 	# should draw uh...
  }
  
***************
*** 3265,3269 ****
  }
  
! class_new FloatAtom {AtomBox}
  
  def* AtomBox init {args} {
--- 3266,3271 ----
  }
  
! class_new FloatAtom  {AtomBox}
! class_new SymbolAtom {AtomBox}
  
  def* AtomBox init {args} {
***************
*** 3277,3293 ****
  	set @clickpos {}
  	set @key_input 0
- 	set @text 0
  	set @edit 0
  	#set @isnew 1
- 	
  }
  
! def* FloatAtom key {key shift} {
! 	global font look
  	set @clicking 0
  	switch $key {
  		Return {
  			$@canvas focus= ""
! 			pd .$self set [expr $@val]
  			pd .$self bang
  			set @text $@val
--- 3279,3306 ----
  	set @clickpos {}
  	set @key_input 0
  	set @edit 0
  	#set @isnew 1
  }
  
! def FloatAtom init {args} {
! 	eval [concat [list super] $args]
! 	set @text 0
! }
! 
! def SymbolAtom init {args} {
! 	eval [concat [list super] $args]
! 	set @text ""
! }
! 
! def* AtomBox   canonize {x} {return x}
! def* FloatAtom canonize {x} {return [expr $x]}
! 
! def* AtomBox key {key shift} {
  	set @clicking 0
  	switch $key {
  		Return {
  			$@canvas focus= ""
! 			pd .$self set [$self canonize $@val]
! 			pd .$self set $@val
  			pd .$self bang
  			set @text $@val
***************
*** 3302,3320 ****
  			$self changed
  		}
  		period {if {[string length $@val] < $@w} {append @val ".";set @text $@val; $self changed}}
  		default {
  			if {[regexp {^[0-9]{1}$} $key]} {
! 			if {[string length $@val] < $@w} {
! 		 	append @val $key
! 		 	set @text $@val
! 		 	$self changed
  			}
  		}
- 		if {$key == "minus"} {set @val "-"; set @text $@val; $self changed} 
- 		 
- 		}
  	}
  }
  
  
  def* FloatAtom ftoa {} {
--- 3315,3350 ----
  			$self changed
  		}
+ 		default {return 0}
+ 	}
+ 	return 1
+ }
+ 
+ def* FloatAtom key {key shift} {
+ 	global font look
+ 	if {[super $key $shift]} {return}
+ 	switch $key {
  		period {if {[string length $@val] < $@w} {append @val ".";set @text $@val; $self changed}}
+ 		minus {set @val "-"; set @text $@val; $self changed}
  		default {
  			if {[regexp {^[0-9]{1}$} $key]} {
! 				if {[string length $@val] < $@w} {
! 				 	append @val $key
! 				 	set @text $@val
! 				 	$self changed
! 				}
  			}
  		}
  	}
  }
  
+ def* SymbolAtom key {key shift} {
+ 	global font look
+ 	if {[super $key $shift]} {return}
+ 	if {[string length $@val] < $@w} {
+ 	 	append @val $key
+  		set @text $@val
+ 	 	$self changed
+ 	}
+ }
  
  def* FloatAtom ftoa {} {
***************
*** 3351,3355 ****
  }
  
! def* FloatAtom click {x y b f} {
  	set c .$@canvas.c
  	set @clickpos [list $x $y]
--- 3381,3385 ----
  }
  
! def* AtomBox click {x y b f} {
  	set c .$@canvas.c
  	set @clickpos [list $x $y]
***************
*** 3363,3378 ****
  }
  
! def* FloatAtom unclick {x y b} {
  	global look
  	set @clicking 0
  	if {[lindex $@clickpos 0] == $x && [lindex $@clickpos 1] == $y} {
! 	$@canvas focus= $self
! 	set @val ""
! 	set @clicking 0
! 	set @key_input 1
  	} { 
! 	$@canvas focus= ""
! 	$self selected?= 0
! 	if {$@key_input} {set @val $@old_val; set @key_input 0; set @text $@val}
  	}
  }
--- 3393,3408 ----
  }
  
! def* AtomBox unclick {x y b} {
  	global look
  	set @clicking 0
  	if {[lindex $@clickpos 0] == $x && [lindex $@clickpos 1] == $y} {
! 		$@canvas focus= $self
! 		set @val ""
! 		set @clicking 0
! 		set @key_input 1
  	} { 
! 		$@canvas focus= ""
! 		$self selected?= 0
! 		if {$@key_input} {set @val $@old_val; set @key_input 0; set @text $@val}
  	}
  }
***************
*** 3395,3416 ****
  }
  
- class_new SymbolAtom {AtomBox}
- 
- # copypaste from FloatAtom init
- def* SymbolAtom init {args} {
- 	super
- 	global font look
- 	eval [concat [list super] $args]
- 	set @clicking 0
- 	set @val 0
- 	set @old_val 0
- 	set @valid 0
- 	set @clickpos {}
- 	set @key_input 0
- 	set @text 0
- 	set @edit 0
- 	#set @isnew 1
- }
- 
  class_new NumBox {Labeled Box}
  def* NumBox init {args} {
--- 3425,3428 ----





More information about the Pd-cvs mailing list