lilypond-devel
[Top][All Lists]
Advanced

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

Re: Calculations for spanner before its print function is called


From: Han-Wen Nienhuys
Subject: Re: Calculations for spanner before its print function is called
Date: Wed, 2 Jun 2010 11:26:31 -0300

On Wed, Jun 2, 2010 at 8:28 AM, Mike Solomon <address@hidden> wrote:
>    I am toying around with a new spanner, and before it prints, I need to
> do some calculations on all of its broken_intos_.  I can easily do these
> calculations in the print function by accessing the broken_into_ of
> spanner->original (), but then this calculation is done for each time print
> is called, which is N-1 times too many (where N is the length of
> broken_into_).  The code works just fine, but it is overkill: is there a way
> to perform operations on a spanner and its broken_into_'s once before the
> print function is called?

Use a property with an attached callback to either hold the
computation result. The callback/property infrastructure will make
sure it  happens only once.  What are you trying to calculate?  You
can also have a look at some of the callbacks that attach to
'positioning-done, see for example the vertical alignment spanners.

Since LilyPond is single-threaded, nothing really happens in parallel.

-- 
Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen



reply via email to

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