From 823c7db4e8374fb01985a0669642b03d5915726d Mon Sep 17 00:00:00 2001 From: Jean-Marc Levecque Date: Wed, 6 Mar 2013 14:11:29 +0100 Subject: Add common procedures in fpg_base for deadkeys --- src/corelib/fpg_base.pas | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index 3eae947a..5158540e 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -744,6 +744,8 @@ type { Keyboard } function KeycodeToText(AKey: Word; AShiftState: TShiftState): string; function CheckClipboardKey(AKey: Word; AShiftstate: TShiftState): TClipboardKeyType; +function UseDeadKey(AChar: TfpgChar; AKey: word): TfpgChar; +function ReadDeadKey(AKey: word): integer; { Color } function fpgColorToRGBTriple(const AColor: TfpgColor): TRGBTriple; @@ -965,6 +967,68 @@ begin end { if/else } end; +function UseDeadKey(AChar: TfpgChar; AKey: word): TfpgChar; +begin + case AKey of + keyDeadCircumflex: + case AChar of + 'a': + Result:= 'â'; + 'e': + Result:= 'ê'; + 'i': + Result:= 'î'; + 'o': + Result:= 'ô'; + 'u': + Result:= 'û'; + 'A': + Result:= 'Â'; + 'E': + Result:= 'Ê'; + 'I': + Result:= 'Î'; + 'O': + Result:= 'Ô'; + 'U': + Result:= 'Û'; + end; + keyDeadDiaeresis: + case AChar of + 'a': + Result:= 'ä'; + 'e': + Result:= 'ë'; + 'i': + Result:= 'ï'; + 'o': + Result:= 'ö'; + 'u': + Result:= 'ü'; + 'A': + Result:= 'Ä'; + 'E': + Result:= 'Ë'; + 'I': + Result:= 'Ï'; + 'O': + Result:= 'Ö'; + 'U': + Result:= 'Ü'; + end; + end; +end; + +function ReadDeadKey(AKey: word): integer; +begin + case AKey of + keyDeadCircumflex, keyDeadDiaeresis: + Result := AKey; + else + Result := -1; + end; +end; + function fpgColorToRGBTriple(const AColor: TfpgColor): TRGBTriple; begin with Result do -- cgit v1.2.3-70-g09d2