The MENU Designer's code
The MENU Designer is EUOMenuDesigner.lpi, with its sources in tools/EUOMenuDesigner/. Its
plan and rules are in docs/menu-designer.md in the repository.
How it is built
Section titled “How it is built”It reuses the interpreter’s own MENU code instead of a copy of its rules:
- The canvas, the Preview and the importer all run a real
TMenu16(parser/EuoMenu16.pas, the 1.6 MENU logic). The canvas runs each form’s generated sub and hosts the form’s surface in its tab; the importer runs a loaded script’smenulines in a hiddenTMenu16and reads every control back withgetprop. - Lines are read with the interpreter’s code:
parser/EuoScriptWords.pas(the+continuation, the./,glue,IsVar), whichTEuoInterpreter.ParseLinecalls too, andEuoMenuSelect.SplitScriptLine. - The model, the generator, the importer and the files (
mdmodel,mdgenerate,mdimport,mdfile) have no window of their own, so the test suite runs them (tests/MenuDesigner*Tests.pas). - The control types are a table,
MdTypeRowsinmdtypes.pas: the palette, the inspector, the generator and the importer go by it, and the properties of each type come fromTMenu16’s own table.
Adding a control type
Section titled “Adding a control type”When the 1.6 MENU logic gets a new control type (an MT_* constant in EuoMenu16.pas), the designer gets it
in the same change. tests/tools/CheckDocsCoverage.ps1, which run_tests.ps1 and CI run, fails until it
does:
- A row in
MdTypeRows(mdtypes.pas): its name, itsMT_*kind, its creating line, how its sizes reach the script, its default size and its quirk flags. A new value inTMdTypenames it. - The generator (
mdgenerate.pas): anything its creating line cannot say, inAfterCreate. - The importer (
mdimport.pas): its creating line inReadLine, and what the windows cannot tell afterwards (as for shapes and drawings) noted beside the replay. - The inspector (
mdinspector.pas) and the model (mdmodel.pas), if it has values no other type has. - Tests: its lines in
MenuDesignerGenerateTests, its reading inMenuDesignerImportTests; the parity and round-trip tests cover it once it is in the rich document ofMenuDesignerRoundTripTests. - Its section
## <name>on designer/components.
A new property of TMenu16’s table gets a row in MdProps, and a new sub-command goes in one of
MdSubsWritten, MdSubsRead or MdSubsRuntime. Whatever is left out on purpose goes in MdExcluded, with
the reason as a comment. The 1.5 MENU logic does not count: the designer is for 1.6 only.