More about templates

Post Reply
iraway
Site Admin
Posts: 12
Joined: Tue Dec 31, 2019 8:33 pm

More about templates

Post by iraway » Sat Jan 04, 2020 3:15 pm

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:

Image

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:
Image

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.

Post Reply