Etoys: Multilingual-bf.22.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Etoys: Multilingual-bf.22.mcz

commits-2
Bert Freudenberg uploaded a new version of Multilingual to project Etoys:
http://source.squeak.org/etoys/Multilingual-bf.22.mcz

==================== Summary ====================

Name: Multilingual-bf.22
Author: bf
Time: 17 February 2012, 6:17:25 pm
UUID: e4c4b0a3-5335-4def-8a03-0a747e8bed14
Ancestors: Multilingual-kfr.21

Generate proper key down / up events for Mac. The keyValuenow it is set to an upper-case character value as if the keyboard had a US-layout. The code refers to the physical key, not its label in a language-specific layout. That means e.g. on a German keyboard, the 'z' key will report $z in a stroke event but $Y in an up or down event. OTOH, e.g. WASD will always refer to the same 4 keys commonly used for navigation, even if using the French AZERTY layout instead of QWERTY.

=============== Diff against Multilingual-kfr.21 ===============

Item was changed:
  KeyboardInputInterpreter subclass: #MacUnicodeInputInterpreter
  instanceVariableNames: 'keyValueIndex'
+ classVariableNames: 'VirtualKeycodes'
- classVariableNames: ''
  poolDictionaries: ''
  category: 'Multilingual-TextConversion'!

Item was added:
+ ----- Method: MacUnicodeInputInterpreter class>>initialize (in category 'class initialization') -----
+ initialize
+ VirtualKeycodes := ByteArray new: 128.
+ #(
+ "A" 16r00 $A
+ "S" 16r01 $S
+ "D" 16r02 $D
+ "F" 16r03 $F
+ "H" 16r04 $H
+ "G" 16r05 $G
+ "Z" 16r06 $Z
+ "X" 16r07 $X
+ "C" 16r08 $C
+ "V" 16r09 $V
+ "ISO_Section" 16r0A nil
+ "B" 16r0B $B
+ "Q" 16r0C $Q
+ "W" 16r0D $W
+ "E" 16r0E $E
+ "R" 16r0F $R
+ "Y" 16r10 $Y
+ "T" 16r11 $T
+ "1" 16r12 $1
+ "2" 16r13 $2
+ "3" 16r14 $3
+ "4" 16r15 $4
+ "6" 16r16 $6
+ "5" 16r17 $5
+ "Equal" 16r18 $=
+ "9" 16r19 $9
+ "7" 16r1A $7
+ "Minus" 16r1B $-
+ "8" 16r1C $8
+ "0" 16r1D $0
+ "RightBracket" 16r1E $]
+ "O" 16r1F $O
+ "U" 16r20 $U
+ "LeftBracket" 16r21 $[
+ "I" 16r22 $I
+ "P" 16r23 $P
+ "L" 16r25 $L
+ "J" 16r26 $J
+ "Quote" 16r27 $'
+ "K" 16r28 $K
+ "Semicolon" 16r29 $;
+ "Backslash" 16r2A $\
+ "Comma" 16r2B $,
+ "Slash" 16r2C $/
+ "N" 16r2D $N
+ "M" 16r2E $M
+ "Period" 16r2F $.
+ "Grave" 16r32 $`
+ "KeypadDecimal" 16r41 $.
+ "KeypadMultiply" 16r43 $*
+ "KeypadPlus" 16r45 $+
+ "KeypadClear" 16r47 nil
+ "KeypadDivide" 16r4B $/
+ "KeypadEnter" 16r4C enter
+ "KeypadMinus" 16r4E $-
+ "KeypadEquals" 16r51 $=
+ "Keypad0" 16r52 $0
+ "Keypad1" 16r53 $1
+ "Keypad2" 16r54 $2
+ "Keypad3" 16r55 $3
+ "Keypad4" 16r56 $4
+ "Keypad5" 16r57 $5
+ "Keypad6" 16r58 $6
+ "Keypad7" 16r59 $7
+ "Keypad8" 16r5B $8
+ "Keypad9" 16r5C $9
+ "Return" 16r24 cr
+ "Tab" 16r30 tab
+ "Space" 16r31 space
+ "Delete" 16r33 backspace
+ "Escape" 16r35 escape
+ "Command" 16r37 nil
+ "Shift" 16r38 nil
+ "CapsLock" 16r39 nil
+ "Option" 16r3A nil
+ "Control" 16r3B nil
+ "RightShift" 16r3C nil
+ "RightOption" 16r3D nil
+ "RightControl" 16r3E nil
+ "Function" 16r3F nil
+ "F17" 16r40 nil
+ "VolumeUp" 16r48 nil
+ "VolumeDown" 16r49 nil
+ "Mute" 16r4A nil
+ "F18" 16r4F nil
+ "F19" 16r50 nil
+ "F20" 16r5A nil
+ "JIS_Yen" 16r5D nil
+ "JIS_Underscore" 16r5E $_
+ "JIS_KeypadComma" 16r5F $,
+ "F5" 16r60 nil
+ "F6" 16r61 nil
+ "F7" 16r62 nil
+ "F3" 16r63 nil
+ "F8" 16r64 nil
+ "F9" 16r65 nil
+ "JIS_Eisu" 16r66 nil
+ "F11" 16r67 nil
+ "JIS_Kana" 16r68 nil
+ "F13" 16r69 nil
+ "F16" 16r6A nil
+ "F14" 16r6B nil
+ "F10" 16r6D nil
+ "F12" 16r6F nil
+ "F15" 16r71 nil
+ "Help" 16r72 nil
+ "Home" 16r73 home
+ "PageUp" 16r74 pageUp
+ "ForwardDelete" 16r75 delete
+ "F4" 16r76 nil
+ "End" 16r77 end
+ "F2" 16r78 nil
+ "PageDown" 16r79 pageDown
+ "F1" 16r7A nil
+ "LeftArrow" 16r7B arrowLeft
+ "RightArrow" 16r7C arrowRight
+ "DownArrow" 16r7D arrowDown
+ "UpArrow" 16r7E arrowUp
+ ) pairsDo: [:code :sel | | char | sel ifNotNil: [
+ char := sel isSymbol ifTrue: [Character perform: sel] ifFalse: [sel].
+ VirtualKeycodes at: code + 1 put: char asInteger]]
+ !

Item was changed:
  ----- Method: MacUnicodeInputInterpreter>>nextCharFrom:firstEvt: (in category 'keyboard') -----
  nextCharFrom: sensor firstEvt: evtBuf
  | keyValue mark |
+ keyValue := evtBuf fourth = EventKeyChar
+ ifTrue: [evtBuf at: self keyValueIndex]
+ ifFalse: [self virtualKeycodeToSqueak: (evtBuf at: 3)].
- keyValue := evtBuf at: self keyValueIndex.
  mark := self japaneseSpecialMark: keyValue.
  mark notNil
  ifTrue: [^ mark].
  keyValue < 256
  ifTrue: [^ (Character value: keyValue) squeakToIso].
  "Smalltalk systemLanguage charsetClass charFromUnicode: keyValue."
  ^ Unicode value: keyValue!

Item was added:
+ ----- Method: MacUnicodeInputInterpreter>>virtualKeycodeToSqueak: (in category 'conversion') -----
+ virtualKeycodeToSqueak: anInteger
+ ^VirtualKeycodes at: anInteger + 1 ifAbsent: [0]
+ !

_______________________________________________
etoys-dev mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/etoys-dev