[PD-cvs] pd/src desire.tk,1.1.2.206,1.1.2.207

chunlee chunlee at users.sourceforge.net
Wed May 17 17:17:37 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
bang bangs, started working on nbx


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.206
retrieving revision 1.1.2.207
diff -C2 -d -r1.1.2.206 -r1.1.2.207
*** desire.tk	17 May 2006 11:06:55 -0000	1.1.2.206
--- desire.tk	17 May 2006 15:17:35 -0000	1.1.2.207
***************
*** 1652,1680 ****
  def* Canvas delete_wire {obj1 outport obj2 inport} {
  	global _
- 	
- 	#set find [lsearch $@wires_pair $x]
- 	#if { $find != -1} {
- 	##remove the selected wire from the @wire_pair...
- 	#set @wires_pair [lreplace $@wires_pair $find $find]
- 	#set @wires_pair [lreplace $@wires_pair [expr $find - 1] [expr $find - 1]]
- 	#}
- 	#	
- 	## removes the wire from the $_($obj1:wires)
- 	#set obj1 $_($x:obj1)
- 	#set find [lsearch $_($obj1:wires) $x]
- 	#if { $find != -1} {
- 	#	set _($obj1:wires) [lreplace $_($obj1:wires) $find $find]
- 	#}
- 	## removes the wire from the $_($obj2:wires)
- 	#set obj2 $_($x:obj2)
- 	#set find [lsearch $_($obj2:wires) $x]
- 	#if { $find != -1} {
- 	#	set _($obj2:wires) [lreplace $_($obj2:wires) $find $find]
- 	#}
- 	#	
- 	## i don't know why wires are taged as 00000000WIRE...
- 	## not sure why $x erase don't work, look later...
- 	#$c delete ${x}WIRE
- 	
  }
  
--- 1652,1655 ----
***************
*** 1720,1723 ****
--- 1695,1702 ----
  	$c coords lnew $l
      }
+     
+     # detects if the focus is not on the canvas itself in run mode, ie. numbox 
+     if {!$@editmode & [$self focus] != $self & [$self focus] != ""} {[$self focus] motion $x $y $mods}
+     
      #puts "action:$@action ........"
      switch $@action {
***************
*** 1739,1747 ****
        }
      }
! #    if {[string length $@focus]} {
! #	if {$@editmode} {set event motionedit} {set event motion}
! #	$@focus $event $self $x $y $mods
! #	return
! #    }
      mset {type id} [$self identify_target $x $y -1 -1 "move "]
  	#puts "id :::: $id"
--- 1718,1722 ----
        }
      }
!     
      mset {type id} [$self identify_target $x $y -1 -1 "move "]
  	#puts "id :::: $id"
***************
*** 2065,2069 ****
  
  def* Canvas unclickrun {x y b} {
! 
  }
  
--- 2040,2044 ----
  
  def* Canvas unclickrun {x y b} {
! 	[$self focus] unclick
  }
  
***************
*** 2426,2435 ****
  		obj {set i 4; set class [lindex $d 4]}
  	}
! 	puts "class is $class ---------------"
! 	#puts "canvas -------- $canvas(current)"
  	if {![info exists _($x:_class)]} {
  		# new object
  		if {[info exists classinfo($class)]} {
- 			puts "and here ------------------------"
  			set _($x:_class) [lindex $classinfo($class) 0]
  		} {
--- 2401,2408 ----
  		obj {set i 4; set class [lindex $d 4]}
  	}
! 	puts "class -------- $class"
  	if {![info exists _($x:_class)]} {
  		# new object
  		if {[info exists classinfo($class)]} {
  			set _($x:_class) [lindex $classinfo($class) 0]
  		} {
***************
*** 2595,2603 ****
  	set @clicking 0
  	set @buf ""
  }
  
  def* NumBox draw {} {
  	$self update_size
! 	global look
  	mset {x1 y1} [$self xy]
  	set xs [expr 4+10*$@w]
--- 2568,2577 ----
  	set @clicking 0
  	set @buf ""
+ 	set @valid 0
  }
  
  def* NumBox draw {} {
  	$self update_size
! 	global look font
  	mset {x1 y1} [$self xy]
  	set xs [expr 4+10*$@w]
***************
*** 2608,2612 ****
  	set outs [expr [string compare $@snd empty]==0]
  	set points [list $x1 $y1 [expr $x2-4] $y1 $x2 [expr $y1+4] $x2 $y2 $x1 $y2]
! 	set font courier
  	set xt [expr $x1+$ys/2+2]
  	set yt [expr $y1+$ys/2+1+$xs/34]
--- 2582,2586 ----
  	set outs [expr [string compare $@snd empty]==0]
  	set points [list $x1 $y1 [expr $x2-4] $y1 $x2 [expr $y1+4] $x2 $y2 $x1 $y2]
! 	#set font $font(str)
  	set xt [expr $x1+$ys/2+2]
  	set yt [expr $y1+$ys/2+1+$xs/34]
***************
*** 2616,2621 ****
  	$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 [list $font $@fs bold] -fill [parse_color $@fcol]
  	.$@canvas.c delete ${self}CURS
  	if {[string length $@buf]>0} {
--- 2590,2597 ----
  	$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 [list $font $@fs bold] -fill [parse_color $@fcol]
  	$self item NUMBER text [list $xt $yt] -anchor w -text [$self ftoa] \
! 		-font $font(str) -fill [parse_color $@fcol]
  	.$@canvas.c delete ${self}CURS
  	if {[string length $@buf]>0} {
***************
*** 2661,2667 ****
  }
  
! def NumBox click {x y b f} {
! 	$@canvas focus $self
! 	$@canvas itemconfigure ${self}BASE4 -fill #00ff00
  	set @mouse [list $x $y]
  	set @oval $@val
--- 2637,2643 ----
  }
  
! def* NumBox click {x y b f} {
! 	$@canvas focus= $self
! 	.$@canvas.c itemconfigure ${self}BASE4 -fill #00ff00
  	set @mouse [list $x $y]
  	set @oval $@val
***************
*** 2670,2674 ****
  }
  
! def NumBox motion {x y mod} {
  	set focused [$self == [$@canvas focus]]
  	if {!$focused} {return}
--- 2646,2650 ----
  }
  
! def* NumBox motion {x y mod} {
  	set focused [$self == [$@canvas focus]]
  	if {!$focused} {return}
***************
*** 2676,2690 ****
  	set @val [expr $@val-$@rate*($y-$oy)]
  	set @mouse [list $x $y]
! 	if {$@clicking} {pd x$self float $@val}
! 	$self changed
  }
  
! def NumBox unfocus {} {set @buf ""; $self changed}
  
! def NumBox unclick {x y} {
  	set @clicking 0
  	if {$@oval!=$@val} {
! 		$@canvas unfocus
! 		pd x$self float $@val
  	}
  }
--- 2652,2668 ----
  	set @val [expr $@val-$@rate*($y-$oy)]
  	set @mouse [list $x $y]
! 	if {$@clicking} {pd .$self float $@val;}
! 	#$self changed
  }
  
! def* NumBox unfocus {} {set @buf ""; $self changed}
  
! def* NumBox unclick {} {
! 	global look
  	set @clicking 0
  	if {$@oval!=$@val} {
! 		$@canvas focus= $@canvas
! 		.$@canvas.c itemconfigure ${self}BASE4 -fill $look(objectbg)
! 		pd .$self float $@val
  	}
  }
***************
*** 2887,2890 ****
--- 2865,2870 ----
  	set @valid 0
  	set @w 15
+ 	set @flash 0
+ 	set @count 0
  }
  
***************
*** 2897,2911 ****
  	super
  	mset {x1 y1 x2 y2} [$self bbox]
  	set colour [parse_color $@bcol]
  	$self item BUT oval \
  		[list [expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2]] \
  		-fill [bluify $colour] -tags "${self}BUT $self"
  }
  
! def Bang click {x y b f} {pd .$self bang; $self bang}
  
! def Bang bang {} {
! 	.$@canvas.c itemconfigure ${self}BUT -fill [bluify [parse_color $@fcol]]
! 	after 100 [list .$@canvas.c itemconfigure ${self}BUT -fill [bluify [parse_color $@bcol]]]
  }
  
--- 2877,2902 ----
  	super
  	mset {x1 y1 x2 y2} [$self bbox]
+ 	if {$@flash} {
+ 	.$@canvas.c itemconfigure ${self}BUT -fill [bluify [parse_color $@fcol]]
+ 	after 100 [list .$@canvas.c itemconfigure ${self}BUT -fill [bluify [parse_color $@bcol]]]
+ 	set $flash 0
+ 	} else {
  	set colour [parse_color $@bcol]
  	$self item BUT oval \
  		[list [expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2]] \
  		-fill [bluify $colour] -tags "${self}BUT $self"
+ 	}
  }
  
! def Bang click {x y b f} {
! 	pd .$self bang 
! 	#$self bang
! }
  
! def Bang bang {count} {
! 	set @count $count
! 	set @flash 1
! 	#.$@canvas.c itemconfigure ${self}BUT -fill [bluify [parse_color $@fcol]]
! 	#after 100 [list .$@canvas.c itemconfigure ${self}BUT -fill [bluify [parse_color $@bcol]]]
  }
  





More information about the Pd-cvs mailing list