MODULE WMArabicIME;
IMPORT
Strings, WMInputMethods, Texts, KernelLog;
CONST
imeName* = "Arabic";
TYPE
IME* = OBJECT(WMInputMethods.IME)
PROCEDURE GetName() : Strings.String;
BEGIN
RETURN Strings.NewString(imeName);
END GetName;
PROCEDURE KeyEvent*(ucs : LONGINT; flags : SET; keysym : LONGINT);
VAR multiChar : ARRAY 2 OF LONGINT;
BEGIN
CASE ucs OF
| 60H : InsertChar(00000630H)
| 31H : InsertChar(00000661H)
| 32H : InsertChar(00000662H)
| 33H : InsertChar(00000663H)
| 34H : InsertChar(00000664H)
| 35H : InsertChar(00000665H)
| 36H : InsertChar(00000666H)
| 37H : InsertChar(00000667H)
| 38H : InsertChar(00000668H)
| 39H : InsertChar(00000669H)
| 30H : InsertChar(00000660H)
| 71H : InsertChar(00000636H)
| 77H : InsertChar(00000635H)
| 65H : InsertChar(0000062BH)
| 72H : InsertChar(00000642H)
| 74H : InsertChar(00000641H)
| 79H : InsertChar(0000063AH)
| 75H : InsertChar(00000639H)
| 69H : InsertChar(00000647H)
| 6FH : InsertChar(0000062EH)
| 70H : InsertChar(0000062DH)
| 5BH : InsertChar(0000062CH)
| 5DH : InsertChar(0000062FH)
| 61H : InsertChar(00000634H)
| 73H : InsertChar(00000633H)
| 64H : InsertChar(0000064AH)
| 66H : InsertChar(00000628H)
| 67H : InsertChar(00000644H)
| 68H : InsertChar(00000627H)
| 6AH : InsertChar(0000062AH)
| 6BH : InsertChar(00000646H)
| 6CH : InsertChar(00000645H)
| 3BH : InsertChar(00000643H)
| 27H : InsertChar(00000637H)
| 7AH : InsertChar(00000626H)
| 78H : InsertChar(00000621H)
| 63H : InsertChar(00000624H)
| 76H : InsertChar(00000631H)
| 62H : multiChar[0] := 644H;
multiChar[1] := 627H;
InsertMultiChar(multiChar);
| 6EH : InsertChar(00000649H)
| 6DH : InsertChar(00000629H)
| 2CH : InsertChar(00000648H)
| 2EH : InsertChar(00000632H)
| 2FH : InsertChar(00000638H)
| 7EH : InsertChar(00000651H)
| 51H : InsertChar(0000064EH)
| 57H : InsertChar(0000064BH)
| 45H : InsertChar(0000064FH)
| 52H : InsertChar(0000064CH)
| 54H : multiChar[0] := 644H;
multiChar[1] := 625H;
InsertMultiChar(multiChar);
| 59H : InsertChar(00000625H)
| 55H : InsertChar(00000060H)
| 49H : InsertChar(000000F7H)
| 4FH : InsertChar(000000D7H)
| 50H : InsertChar(0000061BH)
| 7BH : InsertChar(0000003CH)
| 7DH : InsertChar(0000003EH)
| 41H : InsertChar(00000650H)
| 53H : InsertChar(0000064DH)
| 44H : InsertChar(0000005BH)
| 46H : InsertChar(0000005DH)
| 47H : multiChar[0] := 644H;
multiChar[1] := 623H;
InsertMultiChar(multiChar);
| 48H : InsertChar(00000623H)
| 4AH : InsertChar(00000640H)
| 4BH : InsertChar(0000060CH)
| 4CH : InsertChar(0000002FH)
| 5AH : InsertChar(0000007EH)
| 58H : InsertChar(00000652H)
| 43H : InsertChar(0000007BH)
| 56H : InsertChar(0000007DH)
| 42H : multiChar[0] := 644H;
multiChar[1] := 622H;
InsertMultiChar(multiChar);
| 4EH : InsertChar(00000622H)
| 4DH : InsertChar(00000027H)
| 3CH : InsertChar(0000002CH)
| 3EH : InsertChar(0000002EH)
| 3FH : InsertChar(0000061FH)
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 WMArabicIME.Install~
SystemTools.Free WMArabicIME~
WMArabicIME.SelectedCharToUCS ~
WMKeyCode.Open ~