Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31226
Modified Files: Tag: desiredata desire.tk Log Message: adding arrowkeys and mouse clicks to KeyboardDialog
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.268 retrieving revision 1.1.2.600.2.269 diff -C2 -d -r1.1.2.600.2.268 -r1.1.2.600.2.269 *** desire.tk 2 Aug 2007 20:07:54 -0000 1.1.2.600.2.268 --- desire.tk 2 Aug 2007 20:22:11 -0000 1.1.2.600.2.269 *************** *** 8181,8184 **** --- 8181,8193 ---- }
+ set keyboard_layout2 { + {" " " " 98 " "} + {100 " " 102} + {" " " " 104 " "} + {" "} + {" " 1 2 3} + } + + foreach {k v} { 9 5 *************** *** 8188,8191 **** --- 8197,8201 ---- 50 8 62 8 37 4 115 4 64 4 65 24 113 4 116 4 117 4 109 4 + 1 1 2 1 3 1 } {set keyboard_width_of($k) $v}
*************** *** 8209,8212 **** --- 8219,8230 ---- namekey 116 Sup Menu namekey 109 Ctrl + namekey 98 U + namekey 100 L + namekey 102 R + namekey 104 D + #mouse clicks + namekey 1 1 + namekey 2 2 + namekey 3 3
def KeyboardDialog init {history} { *************** *** 8216,8233 **** wm title .$self "Keyboard View" ;# say set i 0; set j 0 foreach row $::keyboard_layout { ! frame .$self.$i foreach key $row { ! if {$key==" "} {pack [label .$self.$i.shim$j -image icon_empty] -side left; incr j; continue} set ::keyboard_row_of($key) $i #pack [button .$self.$i.key$key -text "$key"] -side left if {[info exists ::keyboard_width_of($key)]} {set width $::keyboard_width_of($key)} {set width 3} if {[info exists ::keyboard_text_of($key)]} {set text $::keyboard_text_of($key)} {set text $key} ! pack [label .$self.$i.key$key -text " $text " -relief raise -border 4 -bg "#dddddd" -width $width] -side left } ! pack .$self.$i -fill x ! if {$i==0} {pack [label .$self.shim -image icon_empty]} incr i } $@history subscribe $self $self fade --- 8234,8272 ---- wm title .$self "Keyboard View" ;# say set i 0; set j 0 + frame .$self.board + frame .$self.board.key + frame .$self.board.misc foreach row $::keyboard_layout { ! frame .$self.board.key.$i foreach key $row { ! if {$key==" "} {pack [label .$self.board.key.$i.shim$j -image icon_empty] -side left; incr j; continue} set ::keyboard_row_of($key) $i #pack [button .$self.$i.key$key -text "$key"] -side left if {[info exists ::keyboard_width_of($key)]} {set width $::keyboard_width_of($key)} {set width 3} if {[info exists ::keyboard_text_of($key)]} {set text $::keyboard_text_of($key)} {set text $key} ! pack [label .$self.board.key.$i.key$key -text " $text " -relief raise -border 4 -bg "#dddddd" -width $width] -side left } ! pack .$self.board.key.$i -fill x ! if {$i==0} {pack [label .$self.board.key.shim -image icon_empty]} incr i } + set @row_division $i + foreach row $::keyboard_layout2 { + frame .$self.board.misc.$i + foreach key $row { + if {$key==" "} {pack [label .$self.board.misc.$i.shim$j -image icon_empty] -side left; incr j; continue} + set ::keyboard_row_of($key) $i + if {[info exists ::keyboard_width_of($key)]} {set width $::keyboard_width_of($key)} {set width 3} + if {[info exists ::keyboard_text_of($key)]} {set text $::keyboard_text_of($key)} {set text $key} + pack [label .$self.board.misc.$i.key$key -text " $text " -relief raise -border 4 -bg "#dddddd" -width $width] -side left + } + pack .$self.board.misc.$i -fill x + + incr i + } + + pack .$self.board.key -side left + pack .$self.board.misc -side right + pack .$self.board $@history subscribe $self $self fade *************** *** 8238,8244 **** if {![info exists ::keyboard_row_of($k)]} {puts "unknown key $k"; 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} } } --- 8277,8287 ---- if {![info exists ::keyboard_row_of($k)]} {puts "unknown key $k"; return} set i $::keyboard_row_of($k) ! if {$i<$@row_division} {set section "key"} else {set section "misc"} ! switch -regexp -- $type { ! ^KeyPress|ButtonPress$ { ! if { [dict exists $@fade $k]} {dict unset @fade $k} ! .$self.board.$section.$i.key$k configure -bg "#ff0000" ! } ! ^KeyRelease|ButtonRelease$ {if {![dict exists $@fade $k]} {dict set @fade $k 255}; puts $@fade} } } *************** *** 8251,8255 **** 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} } --- 8294,8299 ---- set g [expr 221-$v*13/15] set i $::keyboard_row_of($k) ! if {$i<$@row_division} {set section "key"} else {set section "misc"} ! .$self.board.$section.$i.key$k configure -bg [format #%02x%02x%02x $r $g $g] if {$v} {dict set @fade $k $v} {dict unset @fade $k} }