[Vm-dev] Unicode VM keyboard shortcut...
chrispetsos at sch.gr
Tue Jun 5 10:39:43 UTC 2007
This is my work around for keyboard shortcuts with the Unicode VM...
The UnicodeInputInterpreter has this method
nextCharFrom: sensor firstEvt: evtBuf
| keyValue |
" Unicode charCode expected as the sixth data member ! "
"If Alt or Ctrl is pressed and we have a unicode char code... delegate shortcut conversion to the locale specific class..."
(((evtBuf fifth = 2 or: [evtBuf fifth = 8])) and: [evtBuf sixth > 255])
keyValue := evtBuf sixth.
^ Character value:(((Locale currentPlatform) languageEnvironment) unicodeToLatinCharMap:keyValue).]
ifFalse: [keyValue := evtBuf sixth.].
^ keyValue asCharacter.
(OK, it needs some refactoring but you get the clue...)
Now the specific locale class (for me is the GreekEnvironment class) must have an instance method called
that will convert the unicode char codes to MacRoman codes that work for the shortcuts.
I know the the all-around conversion back to MacRoman seems redundant, but at least we avoided the pollution of the unicode environment classes with locale specific code...
The trick was that we can get an instance of the current LanguageEnvironment, without referring to it, with
(Locale currentPlatform) languageEnvironment
I don't know though for how long we are going to get away with it this way...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev