From 5f0308b75b76a098d8114df3372fc73d9d3ef68e Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Sun, 26 Jan 2020 16:12:37 +1100 Subject: [PATCH 1/6] fix(developer): F7 was not working in editors This was happening because F7 was assigned to two actions, so they would conflict with each other. --- .../Keyman.Developer.UI.dmActionsModelEditor.pas | 11 ++++++++++- .../TIKE/actions/dmActionsKeyboardEditor.pas | 8 ++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/windows/src/developer/TIKE/actions/Keyman.Developer.UI.dmActionsModelEditor.pas b/windows/src/developer/TIKE/actions/Keyman.Developer.UI.dmActionsModelEditor.pas index 594e25cde3..a91db0d371 100644 --- a/windows/src/developer/TIKE/actions/Keyman.Developer.UI.dmActionsModelEditor.pas +++ b/windows/src/developer/TIKE/actions/Keyman.Developer.UI.dmActionsModelEditor.pas @@ -3,7 +3,10 @@ unit Keyman.Developer.UI.dmActionsModelEditor; interface uses - System.SysUtils, System.Classes, System.Actions, Vcl.ActnList; + System.SysUtils, + System.Classes, + System.Actions, + Vcl.ActnList; type TmodActionsModelEditor = class(TDataModule) @@ -30,6 +33,9 @@ implementation {%CLASSGROUP 'Vcl.Controls.TControl'} uses + Vcl.Menus, + Winapi.Windows, + UfrmMain, UfrmMessages, Keyman.Developer.System.Project.ProjectFile, @@ -64,6 +70,9 @@ end; procedure TmodActionsModelEditor.actModelCompileUpdate(Sender: TObject); begin actModelCompile.Enabled := ActiveModelEditor <> nil; + if actModelCompile.Enabled + then actModelCompile.ShortCut := Vcl.Menus.Shortcut(VK_F7, []) + else actModelCompile.ShortCut := scNone; frmKeymanDeveloper.mnuModel.Visible := actModelCompile.Enabled; end; diff --git a/windows/src/developer/TIKE/actions/dmActionsKeyboardEditor.pas b/windows/src/developer/TIKE/actions/dmActionsKeyboardEditor.pas index 5f61ee1a87..3c41349153 100644 --- a/windows/src/developer/TIKE/actions/dmActionsKeyboardEditor.pas +++ b/windows/src/developer/TIKE/actions/dmActionsKeyboardEditor.pas @@ -139,6 +139,9 @@ implementation uses ComObj, Forms, + Vcl.Menus, + Winapi.Windows, + KMDActions, KMDActionInterfaces, Keyman.Developer.System.Project.kmnProjectFile, @@ -454,6 +457,11 @@ begin (ActiveEditor <> nil) or (ActivePackageEditor <> nil) or (frmKeymanDeveloper.ActiveChild is TfrmProject); + + if actKeyboardCompile.Enabled + then actKeyboardCompile.ShortCut := Vcl.Menus.Shortcut(VK_F7, []) + else actKeyboardCompile.ShortCut := scNone; + frmKeymanDeveloper.mnuKeyboard.Visible := actKeyboardCompile.Enabled; frmKeymanDeveloper.mnuDebug.Visible := ActiveEditor <> nil; end; From 43757fd10e91def59f5d9ffe82a3da872099d47e Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Sun, 26 Jan 2020 16:13:56 +1100 Subject: [PATCH 2/6] fix(developer): new format hotkeys not parsing The keyboard editor did not recognise the new format hotkeys (unquoted) as valid. --- .../developer/TIKE/main/KeyboardParser.pas | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/windows/src/developer/TIKE/main/KeyboardParser.pas b/windows/src/developer/TIKE/main/KeyboardParser.pas index 3bc47670b9..67bb339e23 100644 --- a/windows/src/developer/TIKE/main/KeyboardParser.pas +++ b/windows/src/developer/TIKE/main/KeyboardParser.pas @@ -100,6 +100,8 @@ type FValue: WideString; procedure SetValue(Value: WideString); class function IsSystemStoreName(Value: WideString): Boolean; + class function ParseKeyOrXStr(ALine: WideString; + var Output: WideString): Boolean; static; protected procedure InitLine(ALine: WideString); override; public @@ -803,7 +805,7 @@ begin FSystemStoreType := SystemStoreFromName(GetTag(ALine)); Assert(FSystemStoreType <> ssNone); Assert(WideSameText(GetTag(ALine), ')')); - Assert(GetXStr(ALine, FValue)); + Assert(ParseKeyOrXStr(ALine, FValue)); end else begin @@ -887,6 +889,27 @@ begin Result := SystemStoreFromName(Value) <> ssNone; end; +class function TKeyboardParser_SystemStore.ParseKeyOrXStr(ALine: WideString; var Output: WideString): Boolean; +var + t, ALine2: WideString; + FShift: TExtShiftState; + FVKey: Integer; +begin + ALine2 := ALine; + t := GetTag(ALine); + if t = '[' then + begin + Result := ParseKey(ALine2, FVKey, FShift); + if Result then + begin + // We'll wrap the hotkey in quotes and treat it like a + Output := '['+ExtShiftStateToString(FShift)+VKeyNames[FVKey]+']'; + end; + end + else + Result := GetXStr(ALine2, Output); // it should be an xstring +end; + class function TKeyboardParser_SystemStore.IsType(ALine: WideString): Boolean; var t, s: WideString; @@ -898,7 +921,7 @@ begin WideSameText(GetTag(ALine), '(') and IsSystemStoreName(GetTag(ALine)) and WideSameText(GetTag(ALine), ')') and - GetXStr(ALine, s); + ParseKeyOrXStr(ALine, s); if not Result then begin From e470e3fa58912a2833839903e6abf70bc6931cc1 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Sun, 26 Jan 2020 16:14:35 +1100 Subject: [PATCH 3/6] fix(developer): char drop onto OSK was wrong On Screen Keyboard character map drop was still dropping codes instead of chars. --- .../src/developer/TIKE/main/UframeOnScreenKeyboardEditor.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/src/developer/TIKE/main/UframeOnScreenKeyboardEditor.pas b/windows/src/developer/TIKE/main/UframeOnScreenKeyboardEditor.pas index dcae3de2b3..3acb3f4511 100644 --- a/windows/src/developer/TIKE/main/UframeOnScreenKeyboardEditor.pas +++ b/windows/src/developer/TIKE/main/UframeOnScreenKeyboardEditor.pas @@ -858,7 +858,7 @@ begin FKey.Bitmap := nil; with Source as TCharacterDragObject do - s := Text[cmimText]; + s := Text[cmimCharacter]; if GetAsyncKeyState(VK_CONTROL) < 0 then FKey.Text := FKey.Text + s From 5c6530662f8e1a0d0443759777955a9391cab018 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Sun, 26 Jan 2020 16:15:11 +1100 Subject: [PATCH 4/6] fix(developer): Project MRU showed garbage text The project MRU showed additional characters after the end of the filename after ellipsis treatment. --- windows/src/developer/TIKE/main/mrulist.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/windows/src/developer/TIKE/main/mrulist.pas b/windows/src/developer/TIKE/main/mrulist.pas index 57b6cbafb2..a72f3d5ec6 100644 --- a/windows/src/developer/TIKE/main/mrulist.pas +++ b/windows/src/developer/TIKE/main/mrulist.pas @@ -172,7 +172,9 @@ function TMRUList.EllipsisFile(Index: Integer): WideString; begin Result := Files[Index]; - if not PathCompactPath(0, PWideChar(Result), GetSystemMetrics(SM_CXSCREEN) div 3) then // I4697 + if PathCompactPath(0, PWideChar(Result), GetSystemMetrics(SM_CXSCREEN) div 3) then // I4697 + Result := string(PChar(Result)) // This removes the terminating nul + else Result := ExtractFileName(Files[Index]); end; From 77ffd17d8825a6e39459364dc5ee68763918eb2c Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Sun, 26 Jan 2020 16:16:05 +1100 Subject: [PATCH 5/6] fix(developer): model kpj template included tsv The model template .kpj file still included the wordlist.tsv file directly instead of it being referenced via the .model.ts only --- .../kmconvert/Keyman.Developer.System.ModelProjectTemplate.pas | 1 - 1 file changed, 1 deletion(-) diff --git a/windows/src/developer/kmconvert/Keyman.Developer.System.ModelProjectTemplate.pas b/windows/src/developer/kmconvert/Keyman.Developer.System.ModelProjectTemplate.pas index 4b29380d63..abef88ff8d 100644 --- a/windows/src/developer/kmconvert/Keyman.Developer.System.ModelProjectTemplate.pas +++ b/windows/src/developer/kmconvert/Keyman.Developer.System.ModelProjectTemplate.pas @@ -134,7 +134,6 @@ begin // Add model and package to project kpj.Files.Add(TmodelTsProjectFile.Create(kpj, GetModelFilename, nil)); - kpj.Files.Add(TwordlistTsvProjectFile.Create(kpj, GetWordlistFilename, nil)); kpj.Files.Add(TkpsProjectFile.Create(kpj, GetPackageFilename, nil)); // Add metadata files to project From 105a1b3af007173d5a5ec911e56366f8ba167f22 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Sun, 26 Jan 2020 16:16:36 +1100 Subject: [PATCH 6/6] fix(developer): model editor requires wordBreaker The model editor would not recognise a source file if it did not include a wordBreaker reference. --- .../kmconvert/data/wordlist-lexical-model/source/model.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/windows/src/developer/kmconvert/data/wordlist-lexical-model/source/model.ts b/windows/src/developer/kmconvert/data/wordlist-lexical-model/source/model.ts index b333964042..38affb7826 100644 --- a/windows/src/developer/kmconvert/data/wordlist-lexical-model/source/model.ts +++ b/windows/src/developer/kmconvert/data/wordlist-lexical-model/source/model.ts @@ -8,6 +8,7 @@ const source: LexicalModelSource = { format: 'trie-1.0', + wordBreaker: 'default', sources: ['wordlist.tsv'], }; export default source; \ No newline at end of file