[PD-cvs] pd/src desire.tk,1.1.2.600.2.219,1.1.2.600.2.220

Mathieu Bouchard matju at users.sourceforge.net
Wed Jul 11 23:40:03 CEST 2007


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

Modified Files:
      Tag: desiredata
	desire.tk 
Log Message:
event history supports multiple modifiers; keyboard dialog shows fadeout


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.600.2.219
retrieving revision 1.1.2.600.2.220
diff -C2 -d -r1.1.2.600.2.219 -r1.1.2.600.2.220
*** desire.tk	11 Jul 2007 20:58:58 -0000	1.1.2.600.2.219
--- desire.tk	11 Jul 2007 21:39:58 -0000	1.1.2.600.2.220
***************
*** 490,494 ****
  	bind Text <Control-t> {}
  	bind Text <Control-s> {}
! 	set mods {{} 0 Shift- 1 Control- 4 Alt- 8}
  	foreach type {KeyPress KeyRelease} {
  	    foreach {subtype mod} $mods {
--- 490,494 ----
  	bind Text <Control-t> {}
  	bind Text <Control-s> {}
! 	set mods {{} 0 Shift- 1 Control- 4 Shift-Control- 5 Alt- 8 Shift-Alt- 9 Control-Alt- 12 Shift-Control-Alt- 13}
  	foreach type {KeyPress KeyRelease} {
  	    foreach {subtype mod} $mods {
***************
*** 7929,7936 ****
--- 7929,7943 ----
  	Super_L Win Super_R Win Escape Esc
  } {set keyboard_text_of($k) $v}
+ foreach {k v} {
+ 	! 1 @ 2 # 3 $ 4 % 5 ^ 6 & 7 * 8 ( 9 ) 0 _ - + =
+ 	Q q W w E e R r T t Y y U u I i O o P p \{ [ \} ] | \\
+ 	A a S s D d F f G g H h J j K k L l ; '
+ 	Z z X x C c V v B b N n M m < , > . ? /
+ } {set keyboard_aliases($k) $v}
  
  def KeyboardDialog init {history} {
  	super close
  	set @history $history
+ 	set @fade [dict create]
  	wm title .$self "Keyboard View" ;# say
  	set i 0; set j 0
***************
*** 7950,7965 ****
  	}
  	$@history subscribe $self
  }
  
  def KeyboardDialog notice {origin add event} {
! 	mset {type k x y w} $event
  	if {![info exists ::keyboard_row_of($k)]} {puts "unknown event $event"; return}
! 	set row $::keyboard_row_of($k)
  	switch -- $type {
! 		KeyPress   {.$self.$row.key$k configure -bg "#ff0000"}
! 		KeyRelease {.$self.$row.key$k configure -bg "#dddddd"}
  	}
  }
  
  def KeyboardDialog delete {} {
    $@history unsubscribe $self
--- 7957,7986 ----
  	}
  	$@history subscribe $self
+ 	$self fade
  }
  
  def KeyboardDialog notice {origin add event} {
! 	mset {type k x y m w} $event
  	if {![info exists ::keyboard_row_of($k)]} {puts "unknown event $event"; return}
! 	set i $::keyboard_row_of($k)
  	switch -- $type {
! 		KeyPress   {if { [dict exists $@fade $k]} {dict unset @fade $k}; .$self.$i.key$k configure -bg "#ff0000"}
! 		KeyRelease {if {![dict exists $@fade $k]} {dict set @fade $k 255}; puts $@fade}
  	}
  }
  
+ def KeyboardDialog fade {} {
+ 	foreach {k v} $@fade {
+ 		incr v -85
+ 		if {$v<0} {set v 0}
+ 		set r [expr 221+$v*2/15]
+ 		set g [expr 221-$v*13/15]
+ 		set i $::keyboard_row_of($k)
+ 		.$self.$i.key$k configure -bg [format #%02x%02x%02x $r $g $g]
+ 		if {$v} {dict set @fade $k $v} {dict unset @fade $k}
+ 	}
+ 	after 100 "$self fade"
+ }
+ 
  def KeyboardDialog delete {} {
    $@history unsubscribe $self





More information about the Pd-cvs mailing list