lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New openLilyLib feature: properties


From: Urs Liska
Subject: New openLilyLib feature: properties
Date: Sun, 28 Jun 2020 23:03:00 +0200
User-agent: Evolution 3.36.3-1

Hi all,

triggered by a new analysis.highlighters module that Klaus Blum shared
with me last week I had a few feature/functionality wishes that I
implemented, especially a kind of stylesheet support and selective
activation of elements. I quickly realized that this should be
generalized and factored out, and today I've implemented a new tool for
the oll-core package (i.e. available for any documents using
openLilyLib): properties.

Properties are related to OLL's existing option handling, but probably
superior in every aspect, so I might one day deprecate the whole
options feature (although that might be hard on existing code, so I'm
not sure about that yet).

The main features of the new properties are:

 * properties are type-checked
 * grouping in property sets may allow better organization and
   encapsulation
 * nice support for cascading behaviour
 * support for selective activation

If you are interested you can check out the "properties" branch in the
oll-core repo and play around with the attached file (also available in
the usage-examples folder in oll-core).

A "property set" is a group of properties with names, type check
predicates, and values.
When defining a property set, "design time defaults" are specified,
which can be retrieved or changed at any point throughout a document.

A property set might group openLilyLib package options, project
options, or the available properties for a music/scheme/void-function.

A macro "with-propset" allows the definition of functions that rely on
a property set, that is:

 * When called without options the properties of the propset are
   available with their current values
 * It is possible to define "presets", which are (type-checked) subsets
   of a property set. When used its values override the current
   property values.
 * When called with a \with {} block individual properties can be
   overridden, whether from the original properties or from a preset
 * Presets can have parents (I have not transferred the implementation
   to that new code base, but I had it in place in the original code).
   This allows cascading stylesheets, for example a default preset
   specifying a line thickness for a given function, and several child
   presets with different colors.
 * Also not transferred yet is support for a logic to use/ignore items
   based on presets. This makes it possible to easily control which
   items are shown or not, for example when doing presentations or
   teaching.

As a first step I'll make use of this in the Frames, Arrows and
Highlighters modules of anaLYsis. Second I will use it in new anaLYsis
modules which I have wanted to realize for a very long time: support
for harmonic analysis symbols in analysis.harmony.functional,
analysis.harmony.roman, and analysis.harmony.scale-degrees.

This is both sort-of an announcement and a request for comments before
I start building heavily on the new code base.

Best
Urs

Attachment: properties.ly
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]