Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(developer): Support loading XML LDML keyboards in TIKE 🦕 #9963

Merged
merged 7 commits into from
Nov 15, 2023

Conversation

mcdurdin
Copy link
Member

@mcdurdin mcdurdin commented Nov 8, 2023

Relates to #9948.

This PR may be more easily reviewed commit-by-commit.

  • removed obsolete project code: Removes old state load/save from each project file type, and the unused WarnAsError property, in preparation for xmlLdmlProjectFile.

  • ldmlKeyboard3.dtd

  • Add basic LDML XML keyboard file support to TIKE projects

  • Split dmActionsDebugger out of dmActionsKeyboardEditor:

    • Because the debugger actions are used only with the kmn keyboard editor, it makes sense to keep them as a separate module, in preparation for supporting XmlLdmlKeyboards.
  • add xmlLdml types and form, rename ActiveEditor:

    • Adds XmlLdml keyboard editor form based on the plain text Editor for now.
    • ActiveEditor is a name used for multiple purposes. Rename to ActiveKmnKeyboardEditor and introduce ActiveLdmlKeyboardEditor alongside.
  • Actions to support LdmlKeyboardEditor:

    • Adds actions to support LdmlKeyboardEditor, and refactors and reorganizes the existing actions along the way to make them clearer.
    • Compile, Install, and Uninstall supported at this time

@keymanapp-test-bot skip

A full user test of the new XML keyboard functionality will be included in a subsequent PR; there are a number of incomplete features at present which make test difficult.

Removes old state load/save from each project file type, and the
unused WarnAsError property, in preparation for xmlLdmlProjectFile.
Adds XmlLdml keyboard editor form based on the plain text Editor for
now.

ActiveEditor is a name used for multiple purposes. Rename to
ActiveKmnKeyboardEditor and introduce ActiveLdmlKeyboardEditor
alongside.
Because the debugger actions are used only with the kmn keyboard editor,
it makes sense to keep them as a separate module, in preparation for
supporting XmlLdmlKeyboards.
Adds actions to support LdmlKeyboardEditor, and refactors and
reorganizes the existing actions along the way to make them clearer.

Compile, Install, and Uninstall supported at this time
@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Nov 8, 2023

User Test Results

Test specification and instructions

User tests are not required

@ermshiperete
Copy link
Contributor

GHA packaging builds are failing because the branch is missing the latest changes from master. However, GHA packaging fails on setting the status, so the failure is not visible here.

@mcdurdin mcdurdin changed the title feat(developer): Support loading XML LDML keyboards in TIKE feat(developer): Support loading XML LDML keyboards in TIKE 🦕 Nov 12, 2023
@mcdurdin mcdurdin modified the milestones: A17S25, A17S26 Nov 13, 2023
// This appears to be a Delphi compiler bug (RSP-20457)
// Workaround is to make a copy of the parameter locally
// which fixes the reference counting.
FTempFileVersion := FileVersion;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still around? Issue 631 was closed in 2018.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RSP-20457 is still not fixed.

CleanFile(OutputFileName);

if Targets * KMXKeymanTargets <> [] then
CleanFile(ExtractFilePath(FileName) + ExtractFileName(ChangeFileExt(KVKFileName, '.kvk')), True);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is KVKFileName used to establish the file name for CleanFile?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is removing a build output, the .kvk file, if it exists.


function TxmlLdmlProjectFileUI.TestKeymanWeb(FSilent: Boolean): Boolean; // I4409
(*var
FCompiledName: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one of them multi-line comments of dead-code we usually remove?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Granted, I see this is the part where we'd test an LDML keyboard in Web, which isn't going to be supported for this version. But... surely just saying "Hey, just CTRL-F this function from this other class / file when the time comes" should work well enough? Or do we expect significant differences in how it'd work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is on my list to address now in #9948.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Oh yes, there will be significant differences in the kmn debugger and ldml debugger -- they will be completely divergent implementations, I expect)

if not modActionsMain.actFileSave.Execute then Exit;
end
else
Exit;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So when ProjecFile is modified and silent is true, this just exists as NOOP?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. It exits with a false return value so the caller knows that things didn't work out.

Copy link
Contributor

@jahorton jahorton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For anything "actions", all I can give is an RSLGTM. I'm not familiar with that abstraction from Core whatsoever, so I can't really give much feedback there.

For the rest of it, a plain ol' LGTM.

procedure Load(node: IXMLNode); override; // I4698
procedure Save(node: IXMLNode); override; // I4698
procedure LoadState(node: IXMLNode); override; // I4698
procedure SaveState(node: IXMLNode); override; // I4698
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I'm not quite following the inheritance and/or polymorphism patterns used here and in ProjectFile.pas (as noticed via commit 1), I can see a pretty strong correlation between the methods.

I'm mostly confused why these procedures are override here but virtual there; I don't see the inheritance path between the two, and personally would've expected them to be sibling derived classes of a common base. But those might be small nits and partly due to my inexperience with Delphi in particular.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation in ProjectFile.pas is the base class, hence it is virtual. The other classes are the overrides and extend the base functionality.


function TxmlLdmlProjectFileUI.TestKeymanWeb(FSilent: Boolean): Boolean; // I4409
(*var
FCompiledName: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Granted, I see this is the part where we'd test an LDML keyboard in Web, which isn't going to be supported for this version. But... surely just saying "Hey, just CTRL-F this function from this other class / file when the time comes" should work well enough? Or do we expect significant differences in how it'd work?

dlgFont: TFontDialog;
actDebugViewState: TAction;
actDebugSwitchToDebuggerWindow: TAction;
procedure actionsKeyboardEditorUpdate(Action: TBasicAction;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As best as I can tell, the method above is new, but all that follow in this list have been migrated from dmActionsKeyboardEditor within this commit.

Base automatically changed from chore/developer/9948-hide-remove-project to master November 15, 2023 02:46
@mcdurdin mcdurdin merged commit 37edb4f into master Nov 15, 2023
2 checks passed
@mcdurdin mcdurdin deleted the feat/developer/9948-load-xml-ldml-files branch November 15, 2023 02:47
@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 17.0.211-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants