[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 10:52:47 -0400 |
> On Oct 19, 2015, at 1:56 AM, David Kastrup <address@hidden> wrote:
>
> I think your main problem is that you are using \applyContext here at
> Voice level where it does not really do anything worthwhile.
Ah, I see.
> Try \context Staff \applyContext …
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
#})
{
c'
% now it works!
\context Staff
\applyContext
#(lambda (context)
;; access context properties and pick a property setting based on them...
(ly:context-pushpop-property context 'StaffSymbol 'color red))
\stopStaff \startStaff
c'
% and you can put it in a music function
\myfunc
c'
}
> Though frankly I have no idea what \myFunc is trying to do. You are
> keeping state in a global variable which is not going to work when using
> \myFunc in several contexts in parallel.
Um, never mind that, it was just my clumsy attempt to try to use \override
Staff.StaffSymbol... to set the grob property when I couldn’t get
ly:context-pushpop-property to work.
Thanks again, I really appreciate your help. No telling how long or if I would
have ever figured that out on my own.
-Paul
- \applyContext, StaffSymbol, and \stopStaff \startStaff, Paul Morris, 2015/10/17
- Re: \applyContext, StaffSymbol, and \stopStaff \startStaff, Paul Morris, 2015/10/18
- Re: \applyContext, StaffSymbol, and \stopStaff \startStaff, David Kastrup, 2015/10/19
- Re: \applyContext, StaffSymbol, and \stopStaff \startStaff,
Paul Morris <=
- Re: \applyContext, StaffSymbol, and \stopStaff \startStaff, David Kastrup, 2015/10/19
- Re: \applyContext, StaffSymbol, and \stopStaff \startStaff, Paul Morris, 2015/10/19
- Re: \applyContext, StaffSymbol, and \stopStaff \startStaff, David Kastrup, 2015/10/19