Page 1 of 1

More about templates

Posted: Sat Jan 04, 2020 3:15 pm
by iraway
One of the new features of StoneNotes is a more reliable and less fiddly way to create custom forms. Since the Windows and Linux versions are written using the excellent IUP cross-platform GUI toolkit, the natural choice is to use their own LED language for templates.

Templates files consist of a simple INI file format that looks like this currently:


The last half of this under [tmpl] is actually pure LED code, though it's also valid INI code, which makes it a bit easier to load with our INI parse.

The reason it's formatted a bit weirdly is that we must have a unique key for each element of the LED file so that the resources use by them can be cleaned up automatically. This shouldn't be too bad since the labels, hboxes and vboxes all can just have any numeric ID associated to them (they do not need to be in order or anything really), while all fields will naturally need to have names anyway so that we can serialize the data to the note object that uses the template.

Anyway the template above looks like this once rendered in StoneNotes:

I've also written an LED parser from scratch while will be used in the mobile versions eventually, but more immediately will be used to parse the template LED code in order to generate drawing instructions for the graph sidebar automatically. This should allow me to create nicely formatted previews / thumbnails of any notes that use templates. Didn't quite get this working yet, though the parser is finally working correctly, so no screenshot yet.