lilypond-devel
[Top][All Lists]
Advanced

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

Re: change clef inside a grob-callback?


From: Mark Polesky
Subject: Re: change clef inside a grob-callback?
Date: Thu, 16 Jul 2009 23:06:56 -0700 (PDT)

Joe Neeman wrote:
> > Is there a way to change the clef from within a grob callback?
> 
> Not really. You can change the clef's glyph, but you can't really change
> the clef's influence on the following notes. 

I presume you mean I can change the clef stencil, or do you mean that
it's possible to change the clefGlyph context property? If that were
the case, then couldn't I change clefPosition and middleCPosition and
do it that way?

> ...Reason being, the NoteHead
> grobs are created around the same time as the Clef grob and their
> positions are fixed at that time, so unless you want to somehow iterate
> over and modify all the NoteHeads, it isn't really going to work.
> 
> I'd suggest a music function rather than a grob override.

How? I was using a music function before, but I couldn't find a way to
get NoteHead staff-positions without a callback. And I get stuck with a 
music-function because I don't know how to test if I'm in a \relative
block or not. 

I guess the algorithmic idea would be:

*Before* staff-positions are concretely determined...
1. what would the staff-positions be if we stayed in this clef?
2. if they're within this clef's "staff-range", do nothing.
3. if another clef is better (according to user), change the clef.
4. determine actual staff-positions with the updated clef info.

I just don't know how to catch the process before the staff-positions
are determined, if all I have is a context and a EventChord. I thought
that if I could at least know whether I'm in a \relative block, I could
then look at the current clef, and figure it out the long way (not that
I'd want to). But I imagine there must be an easier way in. And I can't
test for \relative-ness as far as I can tell anyway.

Do you have any other (slightly more specific) suggestions? (:

Thanks for taking a look at this.
- Mark



      




reply via email to

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