Merge pull request #2535 from keymanapp/fix/developer/pre-beta-checklist

fix(developer): Address pre-beta checklist issues
This commit is contained in:
Marc Durdin 2020-01-27 14:15:20 +11:00 • committed by GitHub
commit 644adbbdd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 48 additions and 6 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -8,6 +8,7 @@
const source: LexicalModelSource = {
format: 'trie-1.0',
wordBreaker: 'default',
sources: ['wordlist.tsv'],
};
export default source;