spiegel-keyman/windows/src/engine/keyman/kmint.pas
Marc Durdin b65b982584 Keyman Desktop and Keyman Developer open source 10.0 alpha seed (#121)
* Keyman for Windows 10.0 Open Source

* Squashed 'windows/src/ext/jedi/jedi/' content from commit f444ad2

git-subtree-dir: windows/src/ext/jedi/jedi
git-subtree-split: f444ad2da4693851e523f1ea6bd541f701904c24

* Squashed 'windows/src/ext/jedi/jcl/' content from commit d63d3c9fd

git-subtree-dir: windows/src/ext/jedi/jcl
git-subtree-split: d63d3c9fd9ff84efdd8159084ec6a60313644243

* Squashed 'windows/src/ext/jedi/jvcl/' content from commit bee19f3b4

git-subtree-dir: windows/src/ext/jedi/jvcl
git-subtree-split: bee19f3b46909fde2fa92c06cd2706f41d99f6c3

* Add required .res files

* Add required .res files

* Add docbook files (forced)

* Add required libxslt

* Add required jedi files

* Add installation files

* Tweak .gitignore for open

* CI

* Remove KMW from Developer source (#122)

* Remove KMW from Developer source (copies during build)

* Remove KMW from Developer source (copies during build)

* Remove KMW from Developer source (copies during build)

* Fixup release build and copy license, readme from kmw during build

* Remove obsolete build help documentation

* Keyman Engine 10 on Windows regression for shift states (#129)

* Improve #128 -- cleaner debug messages

* Fixes #127, shift state now resets correctly; and more work for #128

* Fixes #130 (#131)
2017-07-25 10:53:06 +07:00

92 lines
2.3 KiB
ObjectPascal

(*
Name: kmint
Copyright: Copyright (C) SIL International.
Documentation:
Description:
Create Date: 20 Jun 2006
Modified Date: 14 Sep 2006
Authors: mcdurdin
Related Files:
Dependencies:
Bugs:
Todo:
Notes:
History: 20 Jun 2006 - mcdurdin - Initial version
14 Sep 2006 - mcdurdin - Remove Refresh-Keyman function
*)
unit kmint;
interface
uses
custinterfaces,
KeymanEngineControl,
keymanapi_TLB;
var
kmcom: IKeyman = nil;
FProductFileName: string = '';
FRunFolder: string = '';
function EncodingsAsString(encodings: KeymanKeyboardEncodings): WideString;
function HotkeyAsString(hotkey: IKeymanHotkey): WideString;
function KeymanCustomisation: IKeymanCustomisation;
function KeymanEngineControl: IKeymanEngineControl;
const
KEYMAN_LAYOUT_CUSTOM = $000005FE;
implementation
uses
Winapi.Windows,
KeyNames,
MessageIdentifierConsts,
MessageIdentifiers;
const
KR_REQUEST_REFRESH = 0; // Send this to any window, which will make Keyman post a KR_REFRESH to all top-level windows
KR_REFRESH = 2; // Finally this message get sent to all the other top-level windows in the system.
function KeymanCustomisation: IKeymanCustomisation;
begin
Result := (kmcom.Control as IKeymanCustomisationAccess).KeymanCustomisation;
end;
function KeymanEngineControl: IKeymanEngineControl;
begin
Result := kmcom.Control as IKeymanEngineControl;
end;
function EncodingsAsString(encodings: KeymanKeyboardEncodings): WideString;
begin
Result := '';
if (encodings and keANSI) = keANSI then Result := MsgFromId(skANSIEncoding);
if (encodings and keUnicode) = keUnicode then
begin
if Result <> '' then Result := Result + ', ';
Result := Result + MsgFromId(skUnicodeEncoding);
end;
end;
function HotkeyAsString(hotkey: IKeymanHotkey): WideString;
var
s: string;
begin
s := '';
if LoByte(hotkey.VirtualKey) <> 0 then
begin
if (hotkey.Modifiers and HK_SHIFT) = HK_SHIFT then s := s + 'Shift + ';
if (hotkey.Modifiers and HK_CTRL) = HK_CTRL then s := s + 'Ctrl + ';
if (hotkey.Modifiers and HK_ALT) = HK_ALT then s := s + 'Alt + ';
s := s + SKeyNames[LoByte(hotkey.VirtualKey)];
end;
Result := s;
end;
end.