[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get Staff context-id from a grob?
From: |
David Kastrup |
Subject: |
Re: How to get Staff context-id from a grob? |
Date: |
Sat, 09 Nov 2013 22:33:04 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Jan Rosseel <address@hidden> writes:
> Urs Liska <ul <at> openlilylib.org> writes:
>
>>
>>
>> Am 11.10.2013 10:22, schrieb Jan
>> Rosseel:
>>
>>
>> I don't know, but how do you want your solution to behave when you
>> use << some music>> in more than one staff?
>> Urs
>
> Quite simply: I didn't care about that situation because I never have that
> happening in the way I build a score.
>
> But to answer the question: if the music gets instantiated in multiple Staff
> contexts, I will have multiple grobs and having the context ID would allow
> me to figure out in what context the music was used, and would thus allow me
> to direct my annotation to the right place.
>
> Thinking of it: the case you mentioned kind of destroys my alternative
> solution I had in mind. So I really should find a way to attach that bit of
> information to a grob during the engraving process.
Ok, here is another approach: the grob itself does not carry the
required information, but the grob_info data structure used for
acknowledging grobs carries the information about the engraver which
created the grob, and of course an engraver has a related context.
So if you do
\layout {
\context {
\Score
\consists
#(make-engraver
(acknowledgers
((grob-interface engraver grob source-engraver)
...)))
}
}
then ... is called when any grob is created, and
(ly:translator-context source-engraver) should give the context where
the grob has been created. You can then record this relation in the
grob, or you can record it in a key-weak hashtable mapping grobs to
originating contexts.
Sorry, this feedback is a bit late...
--
David Kastrup
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: How to get Staff context-id from a grob?,
David Kastrup <=