gnu-music-discuss
[Top][All Lists]
Advanced

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

Re: thiscontext


From: Mats Bengtsson
Subject: Re: thiscontext
Date: Tue, 06 Mar 2001 11:04:58 +0100

> address@hidden writes:
> > Well, it's a general problem that macros operate on specific context.
> > For instance \clef F; is a shorthand for
> > 
> >          \property  Staff.clefGlyph = "clefs-F"
> >          \property  Staff.clefPosition = 2
> >          \property  Staff.clefOctavation = 0
> > 
> > Okay. But what if I have defined my own staff-context and named it
> > FancyStaff...? To get an F-clef I would then need
> > 
> >          \property  FancyStaff.clefGlyph = "clefs-F"
> >          \property  FancyStaff.clefPosition = 2
> >          \property  FancyStaff.clefOctavation = 0
> > 
> > which I cannot do in a shortform; - I have to enter all three lines as
> > above.
> > 
> > The solution, ofcourse, would be to redefine \clef F to some sort of
> > 
> >          \property  \thiscontext.clefGlyph = "clefs-F"
> >          \property  \thiscontext.clefPosition = 2
> >          \property  \thiscontext.clefOctavation = 0
> > 
> 
> Interesting. You're second person who asked (the first one was Jan),
> and I'd rather solve this differently, eg. by adding alias fields to
> contexts, so you can do
> 
>         \translator { \StaffContext
>                 \name "FancyStaff";
>                 \alias "Staff";
>           }
> 
> I could make it so that \property Staff.X also finds the FancyStaff
> (once it exists).  Does that sound good to you?

That's definitely a better solution since \thiscontext is not
uniquely defined. If you are in a Voice context, you are also in a
Staff, possibly a StaffGroup or GrandStaff and a Score context.
For clef changes, you want to affect the context on the Staff
level in the hierarchy, for some settings you want to refer to
a context on the Score level.
Han-Wen's solution handles this problem very elegantly.

    /Mats





reply via email to

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