lilypond-user
[Top][All Lists]
Advanced

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

Re: Order of callback function calls


From: Joshua Netterfield
Subject: Re: Order of callback function calls
Date: Fri, 15 Mar 2019 15:43:17 +0000 (UTC)

Urs,

First, I’m new to LilyPond internals, so take everything I’m saying here with a grain of salt. Please, someone correct me if I say something wrong.

When properties are set to a procedure instead of a value, we call that procedure a callback. The callback is called whenever code (often C++) tries to get that property. You can make any property a callback.

https://github.com/lilypond/lilypond/blob/master/scm/define-grobs.scm lists default properties. That will get you a lot of the way there.

If you want a complete list of all properties, take a look at the interface list of each type (again, see define-grobs.scm). Each interface has zero or more properties that all grobs with that interface can set. These are documented in the internals reference. For example, the properties you can set for grobs with accidental-interface are documented at http://lilypond.org/doc/v2.19/Documentation/internals/accidental_002dinterface

The order callbacks are called in is complicated. Again, callbacks are called when code tries to get the associated property. There are some gymnastics to ensure that some callbacks are not called too early or cause cyclical dependencies. One notable example is the unpure-pure container: http://lilypond.org/doc/v2.19/Documentation/notation/unpure_002dpure-containers

I hope this helps. Good luck!

Best,
Joshua Netterfield

From: lilypond-user <address@hidden> on behalf of Urs Liska <address@hidden>
Sent: Friday, March 15, 2019 05:14
To: lilypond-user
Subject: Order of callback function calls
 
Hi,

I'm thinking about collecting some (and hopefully a growing corpus) of
the functions that help dealing with grobs in callback functions and
make them accessible in an openLilyLib package. For example for so many
applications it is necessary to find a grob's system, then get all
objects within that and find specific ones within that list. Or find the
NoteColumn's at the two ends of a spanner, etc. I think making such
patterns more accessible with functions is a way for me to become more
comfortable with this type of grob manipulation, and maybe it will be
useful to make this area somewhat more accessible for an (even if only
slightly) wider audience.

I know that some functions can only be called before or after certain
points in the engraving process. For example all information about the
absolute positioning of grobs is only available after-line-breaking,
while some actions (e.g. setting properties like 'X-offset) will only
have an effect before-line-breaking (whereas one can set the 'color
property at any time).

I have two questions about this for now:

1. Is there a list somewhere detailing *all* available callbacks?

2. Is there anything general to say about when callbacks for regular
properties like e.g. 'direction  or 'X-offset. I mean, if I say
\override DynamicText.X-offset = #my-custom-callback, when will that be
called?

Best
Urs


_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user

reply via email to

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