[PD-cvs] pd/src desire.tk,1.1.2.261,1.1.2.262

chunlee chunlee at users.sourceforge.net
Fri Jun 23 12:04:25 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
more fixes for floatatom and numbox...


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.261
retrieving revision 1.1.2.262
diff -C2 -d -r1.1.2.261 -r1.1.2.262
*** desire.tk	23 Jun 2006 06:33:27 -0000	1.1.2.261
--- desire.tk	23 Jun 2006 10:04:22 -0000	1.1.2.262
***************
*** 3248,3252 ****
  	eval [concat [list super] $args]
  	set @clicking 0
! 	set @buf 0
  	set @valid 0
  	set @clickpos {}
--- 3248,3253 ----
  	eval [concat [list super] $args]
  	set @clicking 0
! 	set @val 0
! 	set @old_val 0
  	set @valid 0
  	set @clickpos {}
***************
*** 3269,3273 ****
  	set @yt [expr $y1+$ys/2+3+$xs/34]
  	if {[$self selected?]} {set fcol red} else {set fcol $look(objectfg)}
! 	if {[string length $@buf] <= $@w} { 
  	set string $@text
  	} else {
--- 3270,3274 ----
  	set @yt [expr $y1+$ys/2+3+$xs/34]
  	if {[$self selected?]} {set fcol red} else {set fcol $look(objectfg)}
! 	if {[string length $@val] <= $@w} { 
  	set string $@text
  	} else {
***************
*** 3285,3307 ****
  		Return {
  			$@canvas focus= ""
! 			pd .$self set [expr $@buf]
  			pd .$self bang
! 			set @text $@buf
  			$self selected?= 0
  			set @clicking 0
  		}
  		BackSpace {
! 			set @buf [string range $@buf 0 end-1]
! 			set @text $@buf
  			$self changed
  		}
! 		period {append @buf ".";set @text $@buf; $self changed}
  		default {
  			if {[regexp {^[0-9]{1}$} $key]} {
! 		 	append @buf $key
! 		 	set @text $@buf
  		 	$self changed
  		}
! 		if {$key == "minus"} {set @buf "-"; set @text $@buf; $self changed} 
  		 
  		}
--- 3286,3312 ----
  		Return {
  			$@canvas focus= ""
! 			pd .$self set [expr $@val]
  			pd .$self bang
! 			set @text $@val
  			$self selected?= 0
  			set @clicking 0
+ 			set @old_val $@val
+ 			set @key_input 0
  		}
  		BackSpace {
! 			set @val [string range $@val 0 end-1]
! 			set @text $@val
  			$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} 
  		 
  		}
***************
*** 3333,3337 ****
  def FloatAtom update_size {} {
  	global font look
! 	#set @textwidth [expr $font(padx)+$font(width)*[string length $@buf]]
  	if {!$@w} [set @w 5]
  	set @textwidth [expr $font(padx)+$font(width)*$@w]
--- 3338,3342 ----
  def FloatAtom update_size {} {
  	global font look
! 	#set @textwidth [expr $font(padx)+$font(width)*[string length $@val]]
  	if {!$@w} [set @w 5]
  	set @textwidth [expr $font(padx)+$font(width)*$@w]
***************
*** 3360,3372 ****
  	if {[lindex $@clickpos 0] == $x && [lindex $@clickpos 1] == $y} {
  	$@canvas focus= $self
! 	#puts "-----> no mouse movement <------"
! 	set @buf ""
  	set @clicking 0
  	} { 
  	$@canvas focus= ""
  	$self selected?= 0
! 	set @text $@buf
! 	pd .$self set $@buf
! 	pd .$self bang
  	}
  }
--- 3365,3375 ----
  	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}
  	}
  }
***************
*** 3377,3384 ****
  	if {$@clicking} {
  	mset {ox oy} $@mouse
! 	set @buf [expr $@buf-$@rate*($y-$oy)]
! 	set @text $@buf
  	set @mouse [list $x $y]
! 	pd .$self set $@buf
  	pd .$self bang
  	}
--- 3380,3388 ----
  	if {$@clicking} {
  	mset {ox oy} $@mouse
! 	set @val [expr $@val-$@rate*($y-$oy)]
! 	set @text $@val
! 	set @old_val $@val
  	set @mouse [list $x $y]
! 	pd .$self set $@val
  	pd .$self bang
  	}
***************
*** 3392,3397 ****
--- 3396,3404 ----
  	eval [concat [list super] $args]
  	set @clicking 0
+ 	set @old_val 0
  	set @buf ""
+ 	set @text 0
  	set @valid 0
+ 	set @key_input 0
  }
  
***************
*** 3424,3428 ****
  	$self item BASE   polygon $points  -fill [parse_color $@bcol] -outline $look(objectframe3)
  	$self item BASE4  polygon $points2 -fill $color4 -outline $look(objectframe3)
! 	$self item NUMBER text [list $xt $yt] -anchor w -text [$self ftoa] \
  		-font $font(str) -fill [parse_color $@fcol]
  	$c delete ${self}CURS
--- 3431,3437 ----
  	$self item BASE   polygon $points  -fill [parse_color $@bcol] -outline $look(objectframe3)
  	$self item BASE4  polygon $points2 -fill $color4 -outline $look(objectframe3)
! 	#$self item NUMBER text [list $xt $yt] -anchor w -text [$self ftoa] \
! 	#	-font $font(str) -fill [parse_color $@fcol]
! 	$self item NUMBER text [list $xt $yt] -anchor w -text $@text \
  		-font $font(str) -fill [parse_color $@fcol]
  	$c delete ${self}CURS
***************
*** 3476,3481 ****
--- 3485,3493 ----
  	mset {ox oy} $@mouse
  	set @val [expr $@val-$@rate*($y-$oy)]
+ 	set @old_val $@val
+ 	set @text $@val
  	set @mouse [list $x $y]
  	pd .$self float $@val;
+ 	pd .$self bang;
  	}
  }
***************
*** 3495,3503 ****
  	$@canvas focus= $self
  	set @clicking 0
  	} { 
  		$@canvas focus= ""
  		.$@canvas.c itemconfigure ${self}BASE4 -fill $look(objectbg)
! 		pd .$self float $@val
! 		pd .$self bang
  	}
  	
--- 3507,3517 ----
  	$@canvas focus= $self
  	set @clicking 0
+ 	set @val ""
+ 	set @key_input 1
  	} { 
  		$@canvas focus= ""
  		.$@canvas.c itemconfigure ${self}BASE4 -fill $look(objectbg)
! 		$self selected?= 0
! 		if {$@key_input} {set @val $@old_val; set @key_input 0; set @text $@val}
  	}
  	
***************
*** 3507,3529 ****
      switch -regexp -- $key {
        ^\[\\d]\$ {
! 	if {[string length $@buf] < $@w} {
  	#set @buf "$@buf$key"
  	set @val "$@val$key"
  	$self changed
  	}
        }
        ^Return\$ {
! 	catch {set @val [expr $@buf]}
  	$@canvas focus= ""
  	pd .$self float $@val
  	pd .$self bang
  	set @buf ""
  	$self changed
        }
!       ^period\$ {if {[string length $@buf] < $@w} {append @val ".";set @text $@val; $self changed} }
        ^minus\$ {append @val "-";set @text $@val; $self changed}
        ^BackSpace|Delete\$ {
          if {[string length $@buf] >= 0} {
  		set @val [string range $@val 0 end-1]
  	}
  	$self changed
--- 3521,3548 ----
      switch -regexp -- $key {
        ^\[\\d]\$ {
! 	if {[string length $@val] < $@w} {
  	#set @buf "$@buf$key"
  	set @val "$@val$key"
+ 	set @text $@val
  	$self changed
  	}
        }
        ^Return\$ {
! 	#catch {set @val [expr $@buf]}
  	$@canvas focus= ""
+ 	set @old_val $val
  	pd .$self float $@val
  	pd .$self bang
  	set @buf ""
+ 	set @text $@val
+ 	set @key_input 0
  	$self changed
        }
!       ^period\$ {if {[string length $@val] < $@w} {append @val ".";set @text $@val; $self changed} }
        ^minus\$ {append @val "-";set @text $@val; $self changed}
        ^BackSpace|Delete\$ {
          if {[string length $@buf] >= 0} {
  		set @val [string range $@val 0 end-1]
+ 		set @text $@val
  	}
  	$self changed





More information about the Pd-cvs mailing list