MODULE WMRussianIME;
IMPORT
Strings, WMInputMethods, Texts, KernelLog;
CONST
imeName* = "Russian";
TYPE
IME* = OBJECT(WMInputMethods.IME)
PROCEDURE GetName() : Strings.String;
BEGIN
RETURN Strings.NewString(imeName);
END GetName;
PROCEDURE KeyEvent*(ucs : LONGINT; flags : SET; keysym : LONGINT);
BEGIN
CASE ucs OF
| 60H : InsertChar(00000451H)
| 71H : InsertChar(00000439H)
| 77H : InsertChar(00000446H)
| 65H : InsertChar(00000443H)
| 72H : InsertChar(0000043AH)
| 74H : InsertChar(00000435H)
| 79H : InsertChar(0000043DH)
| 75H : InsertChar(00000433H)
| 69H : InsertChar(00000448H)
| 6FH : InsertChar(00000449H)
| 70H : InsertChar(00000437H)
| 5BH : InsertChar(00000445H)
| 5DH : InsertChar(0000044AH)
| 61H : InsertChar(00000444H)
| 73H : InsertChar(0000044BH)
| 64H : InsertChar(00000432H)
| 66H : InsertChar(00000430H)
| 67H : InsertChar(0000043FH)
| 68H : InsertChar(00000440H)
| 6AH : InsertChar(0000043EH)
| 6BH : InsertChar(0000043BH)
| 6CH : InsertChar(00000434H)
| 3BH : InsertChar(00000436H)
| 27H : InsertChar(0000044DH)
| 7AH : InsertChar(0000044FH)
| 78H : InsertChar(00000447H)
| 63H : InsertChar(00000441H)
| 76H : InsertChar(0000043CH)
| 62H : InsertChar(00000438H)
| 6EH : InsertChar(00000442H)
| 6DH : InsertChar(0000044CH)
| 2CH : InsertChar(00000431H)
| 2EH : InsertChar(0000044EH)
| 2FH : InsertChar(0000002EH)
| 7EH : InsertChar(00000401H)
| 40H : InsertChar(00000022H)
| 23H : InsertChar(00002116H)
| 24H : InsertChar(0000003BH)
| 5EH : InsertChar(0000003AH)
| 26H : InsertChar(0000003FH)
| 51H : InsertChar(00000419H)
| 57H : InsertChar(00000426H)
| 45H : InsertChar(00000423H)
| 52H : InsertChar(0000041AH)
| 54H : InsertChar(00000415H)
| 59H : InsertChar(0000041DH)
| 55H : InsertChar(00000413H)
| 49H : InsertChar(00000428H)
| 4FH : InsertChar(00000429H)
| 50H : InsertChar(00000417H)
| 7BH : InsertChar(00000425H)
| 7DH : InsertChar(0000042AH)
| 41H : InsertChar(00000424H)
| 53H : InsertChar(0000042BH)
| 44H : InsertChar(00000412H)
| 46H : InsertChar(00000410H)
| 47H : InsertChar(0000041FH)
| 48H : InsertChar(00000420H)
| 4AH : InsertChar(0000041EH)
| 4BH : InsertChar(0000041BH)
| 4CH : InsertChar(00000414H)
| 3AH : InsertChar(00000416H)
| 22H : InsertChar(0000042DH)
| 7CH : InsertChar(0000002FH)
| 5AH : InsertChar(0000042FH)
| 58H : InsertChar(00000427H)
| 43H : InsertChar(00000421H)
| 56H : InsertChar(0000041CH)
| 42H : InsertChar(00000418H)
| 4EH : InsertChar(00000422H)
| 4DH : InsertChar(0000042CH)
| 3CH : InsertChar(00000411H)
| 3EH : InsertChar(0000042EH)
| 3FH : InsertChar(0000002CH)
ELSE
InsertChar(ucs)
END
END KeyEvent;
END IME;
PROCEDURE Install*;
VAR ime : IME;
BEGIN
NEW(ime);
WMInputMethods.InstallIME(ime);
END Install;
PROCEDURE SelectedCharToUCS*;
VAR r : Texts.TextReader;
selectionText: Texts.Text;
ucs : LONGINT;
from, to : Texts.TextPosition;
BEGIN
IF Texts.GetLastSelection(selectionText, from, to) THEN
selectionText.AcquireRead;
NEW(r, selectionText);
r.SetPosition(Strings.Min(from.GetPosition(), to.GetPosition()));
r.ReadCh(ucs);
selectionText.ReleaseRead;
KernelLog.String("InsertChar("); KernelLog.Hex(ucs, 0); KernelLog.String("H) (**)"); KernelLog.Ln;
END;
END SelectedCharToUCS;
END WMRussianIME.Install~
SystemTools.Free WMRussianIME~
WMRussianIME.SelectedCharToUCS ~
WMKeyCode.Open ~