lilypond-user
[Top][All Lists]
Advanced

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

Re: Accessing Context Properties


From: David Kastrup
Subject: Re: Accessing Context Properties
Date: Thu, 25 Feb 2016 17:55:15 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

tisimst <address@hidden> writes:

> David,
>
> On Thu, Feb 25, 2016 at 9:28 AM, David Kastrup [via Lilypond] <
> address@hidden> wrote:
>
>> Abraham Lee <[hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=187720&i=0>> writes:
>>
>> > All,
>> >
>> > In the docs are numerous sections that discuss how to modify context
>> > properties. This is not complicated. However, a handful of recent
>> threads
>> > on the user list have got me wondering about the correct way(s) of
>> > _accessing_ these properties within, for example, a music function. The
>> > music function may or may not modify the same or another context
>> property.
>> > If music functions are NOT the way to go, then what is preferred?
>> >
>> > Thanks, in advance, for all insights and instruction.
>>
>> I have no idea what you want.  Music functions are called when parsing
>> LilyPond source code.  At that time, there are no contexts and no
>> context properties.  Consequently, music functions have no way
>> whatsoever to read or modify context properties.  All they can do is
>> create music expressions (typically overrides or applyContext calls,
>> possibly as context modifications) that contain callbacks of some form
>> that, when ultimately called during iteration of the music expression,
>> will be able to access actual properties.
>>
>> So for your actual question, there is little insight and instruction to
>> be had.
>
>
> Thanks for your response. That helps knowing that music functions cannot
> read or modify context properties.
>
> Let me give some examples of what I might want to do:
>
> 1. Determine the currentBarNumber in order to print a custom stencil
> 2. Access the System or Staff's vertical position on the page in order to
> change it
> 3. Determine which page I'm on so I can print a particular stencil on that
> page only
> 4. Determine the current time signature so I can create a MMR of the exact
> size needed to fill a measure
> etc.

All of that cannot be done from within a music function.  I repeat: All
they can do is create music expressions (typically overrides or
applyContext calls, possibly as context modifications) that contain
callbacks of some form that, when ultimately called during iteration of
the music expression, will be able to access actual properties.

That has nothing to do with music functions at all but rather with the
kind of music expressions you'd want the music function to create.

> These are just examples and I'm not even asking for specifics on how
> to do these (as they've partially been discussed in other
> threads). What approach would I want to follow in order to access the
> properties so I could make a change elsewhere?

Have you read what I wrote?  Music functions are not able to access
properties.  Various music expressions (possibly created by music
functions) may contain callbacks that might be used for such purposes.

-- 
David Kastrup



reply via email to

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