lilypond-user
[Top][All Lists]
Advanced

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

Re: \applyContext, StaffSymbol, and \stopStaff \startStaff


From: Paul Morris
Subject: Re: \applyContext, StaffSymbol, and \stopStaff \startStaff
Date: Mon, 19 Oct 2015 11:32:02 -0400

> On Oct 19, 2015, at 10:59 AM, David Kastrup <address@hidden> wrote:
> 
> Paul Morris <address@hidden> writes:
>> 
>> That did the trick and now it works, thanks!
>> 
>> \version “2.19.22” 
>> 
>> myfunc =
>> #(define-music-function () ()
>>   #{
>>     \context Staff
>>     \applyContext
>>     #(lambda (context)
>>        ;; access context properties and pick a property setting based on 
>> them...
>>        (ly:context-pushpop-property context 'StaffSymbol 'color green))
>>     \stopStaff
>>     \startStaff
>>   #})
> 
> Frankly, anything wrong with
> 
>    \temporary \override Staff.StaffSymbol.color = #green
> 
> here?

That would work except I want to be able to access Staff context properties and 
then, based on their values, decide what to set the StaffSymbol property to.  
In this example, say color it either green or blue.  I just left these details 
out of my tiny example (as I tried to indicate with the comment "access context 
properties and pick a property setting based on them…”, which may not have been 
very clear).

> Assuming you want a temporary override (which is what
> ly:context-pushpop-property does) in order to be able to revert to the
> previous setting afterwards.

I actually don’t think I’ll need to be able to revert.  I was just using 
ly:context-pushpop-property because it was shown in the examples in the 
extending manual.

Thanks again,
-Paul





reply via email to

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