[PD-cvs] pd/src desire.tk,1.1.2.258,1.1.2.259

chunlee chunlee at users.sourceforge.net
Wed Jun 21 11:30:50 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
floatatom worx/fixed at the client side


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.258
retrieving revision 1.1.2.259
diff -C2 -d -r1.1.2.258 -r1.1.2.259
*** desire.tk	21 Jun 2006 06:41:22 -0000	1.1.2.258
--- desire.tk	21 Jun 2006 09:30:47 -0000	1.1.2.259
***************
*** 609,612 ****
--- 609,614 ----
  }
  
+ proc pdtk_text_set {x y z} {}
+ 
  proc pdtk_watchdog {} {pd pd ping; after 2000 {pdtk_watchdog}}
  
***************
*** 1443,1447 ****
  def Canvas obj_in_edit= {v} {set @obj_in_edit $v}
  
! def TextBox edit {} {
  	global look font
  	if {$@edit} {return}
--- 1445,1449 ----
  def Canvas obj_in_edit= {v} {set @obj_in_edit $v}
  
! def* TextBox edit {} {
  	global look font
  	if {$@edit} {return}
***************
*** 1773,1776 ****
--- 1775,1783 ----
  	mset {u v} [$self xy]
  	.$@canvas.c move $self [expr $u-$x] [expr $v-$y]
+ 	$self draw_wires
+ }
+ 
+ def View draw_wires {} {
+     foreach wire $@wires {$wire draw}
  }
  
***************
*** 2365,2368 ****
--- 2372,2376 ----
  
  def* Canvas key {x y key iso shift} {
+ 
      set c .$self.c
      set x [$c canvasx $x]
***************
*** 2371,2374 ****
--- 2379,2383 ----
      set c .$self.c
      $self hide_tooltip
+     puts "focus ::::::::::: [$self focus]"
      if {[$self focus] != ""} {
  	[$self focus] key $key $shift
***************
*** 2439,2446 ****
  }
  
! def Box draw_wires {} {
!     #puts "wires:$@wires"
!     foreach wire $@wires {$wire draw}
! }
  
  def* Box delete_wire {wire} {
--- 2448,2455 ----
  }
  
! #def Box draw_wires {} {
! #    #puts "wires:$@wires"
! #    foreach wire $@wires {$wire draw}
! #}
  
  def* Box delete_wire {wire} {
***************
*** 2451,2455 ****
  def Box move {dx dy} {
    super $dx $dy
!   $self draw_wires
    #foreach wire $@wires {
     # set _($wire:select_by) $_($@canvas:select_by)
--- 2460,2464 ----
  def Box move {dx dy} {
    super $dx $dy
!   #$self draw_wires
    #foreach wire $@wires {
     # set _($wire:select_by) $_($@canvas:select_by)
***************
*** 3239,3245 ****
  	set @buf 0
  	set @valid 0
  	set @text 0
  	set @edit 0
! 	set @isnew 1
  	
  }
--- 3248,3256 ----
  	set @buf 0
  	set @valid 0
+ 	set @clickpos {}
+ 	set @key_input 0
  	set @text 0
  	set @edit 0
! 	#set @isnew 1
  	
  }
***************
*** 3247,3250 ****
--- 3258,3262 ----
  
  def* FloatAtom draw {} {
+ 	$self update_size
  	global font look
  	super
***************
*** 3252,3272 ****
  	set xs [expr 4+10*$@w]
  	set ys $font(height)
! 	set xt [expr $x1+$ys/2+2]
! 	set yt [expr $y1+$ys/2+1+$xs/34]
! 	$self item TEXT text [list $xt $yt] -anchor w -text $@buf \
! 		-font $font(str) -fill #000000
! 	set t .$@canvas.c.${self}TEXT
! 	if {$@isnew} {
! 	bind $t <Key> "$self key %W %x %y %K %A 0"
! 	set @isnew 0
! 	#focus .$@canvas.c.${self}TEXT
  	}
- 	
  }
  
! def* FloatAtom key {x y key iso shift} {
! 
  }
  
  def* FloatAtom ftoa {} {
  	set f $@val
--- 3264,3307 ----
  	set xs [expr 4+10*$@w]
  	set ys $font(height)
! 	set @xt [expr $x1+$ys/2-2]
! 	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} {
! 	$self item TEXT text [list $@xt $@yt] -anchor w -text $@text \
! 		-font $font(str) -fill $fcol
  	}
  }
  
! def* FloatAtom key {key shift} {
! 	global font look
! 	set @clicking 0
! 	switch $key {
! 		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}
! 		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} 
! 		 
! 		}
! 	}
  }
  
+ 
  def* FloatAtom ftoa {} {
  	set f $@val
***************
*** 3292,3296 ****
  def FloatAtom update_size {} {
  	global font look
! 	set @textwidth [expr $font(padx)+$font(width)*[string length $@buf]]
  	set @topwidth [expr ($@ninlets + ($@ninlets - 1)) * $look(iowidth)]
  	set @bottomwidth [expr ($@noutlets + ($@noutlets - 1)) * $look(iowidth)]
--- 3327,3333 ----
  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]
  	set @topwidth [expr ($@ninlets + ($@ninlets - 1)) * $look(iowidth)]
  	set @bottomwidth [expr ($@noutlets + ($@noutlets - 1)) * $look(iowidth)]
***************
*** 3300,3324 ****
  }
  
! def* FloatAtom click {args} {
! 	#$self edit
  	set t .$@canvas.c.${self}text
! 	puts ".$@canvas.c itemconfigure $t -state disabled"
! 	.$@canvas.c itemconfigure $t -state disabled
  	$@canvas focus= $self
! 	.$@canvas.c itemconfigure ${self}BASE4 -fill #00ff00
! 	#set @mouse [list $x $y]
! 	#set @oval $@val
! 	#set @clicking 1
! 	#set @rate [expr $f&1 ? 0.01 : 1.00]
  }
  
! def* FloatAtom unclick {args} {
  	global look
  	set @clicking 0
! 	$@canvas focus= $@canvas
! 	.$@canvas.c itemconfigure ${self}BASE4 -fill $look(objectbg)
  }
  
! def* FloatAtom motion {args} {}
  
  class_new NumBox {Labeled Box}
--- 3337,3384 ----
  }
  
! def* FloatAtom click {x y b f} {
! 	set c .$@canvas.c
! 	set @clickpos [list $x $y]
! 	set @mouse [list $x $y]
  	set t .$@canvas.c.${self}text
! 	#.$@canvas.c itemconfigure $t -state disabled
  	$@canvas focus= $self
! 	set @rate [expr $f&1 ? 0.01 : 1.00]
! 	set @clicking 1
! 	$self selected?= 1
  }
  
! def* FloatAtom unclick {x y b} {
  	global look
  	set @clicking 0
! 	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
! 	}
  }
  
! def* FloatAtom motion {x y mod} {
! 	set focused [$self == [$@canvas focus]]
! 	if {!$focused} {return}
! 	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
! 	}
! 	
! 	$self changed
! 
! }
  
  class_new NumBox {Labeled Box}
***************
*** 3671,3675 ****
--- 3731,3737 ----
  }
  
+ 
  def Bang unclick {x y b} {$@canvas focus= ""}
+ 
  def Bang click {x y b f} {
  	$@canvas focus= $self





More information about the Pd-cvs mailing list