bug-lilypond
[Top][All Lists]
Advanced

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

Re: Custom contexts: \accepts behaves weirdly for grouping contexts


From: Janek Warchoł
Subject: Re: Custom contexts: \accepts behaves weirdly for grouping contexts
Date: Thu, 31 Jul 2014 19:42:44 +0200

PS interestingly, while whatever is \accepted by StaffGroups seems to
be \accepted by ChoirStaffs, PianoStaffs and GrandStaffs won't accept
new contexts unless explicitly told.

2014-07-31 19:35 GMT+02:00 Janek Warchoł <address@hidden>:
> Hi,
>
> i have noticed something strange wrt/ \accepts behaviour.
>
> Let's start with a minimal example: i define new Staff-like context
> Foo that has red noteheads:
>
> \layout {
>   \context {
>     \Staff
>     \name "Foo"
>     \override NoteHead.color = #red
>   }
> }
>
> \new Foo { c'1 }
>
> But this doesn't work (noteheads are black, which means that instead
> of a Foo a Staff is created), because no context accepts Foo.  So i do
>
> \layout {
>   \context {
>     \Score
>     \accepts "Foo"
>   }
>   \context {
>     \Staff
>     \name "Foo"
>     \override NoteHead.color = #red
>   }
> }
>
> \new Foo { c'1 }
>
> This works, but i cannot put several Foos in a ChoirStaff (or a
> StaffGroup, etc.), i.e.
>
> \new ChoirStaff <<
>   \new Foo { c'1 }
>   \new Foo { c' }
>>>
>
> will not get the grouping bracket.  Fine, i change the code to
>
> \layout {
>   \context {
>     \ChoirStaff
>     \accepts "Foo"
>   }
>   \context {
>     \Staff
>     \name "Foo"
>     \override NoteHead.color = #red
>   }
> }
>
> \new ChoirStaff <<
>   \new Foo { c'1 }
>   \new Foo { c' }
>>>
>
> Now here's where the strangeness appears.  With the above definition,
> only \ChoirStaff should accept Foo, shouldn't it?  But if i write
>
> \new StaffGroup <<
>   \new Foo { c'1 }
>   \new Foo { c' }
>>>
>
> it will also work, i.e. i'll get a StaffGroup of Foos.  Moreover,
>
> \new Foo { c'1 }
>
> (i.e. no grouping at all) also works.
> Is this a bug, or a feature i don't understand?
>
> best,
> Janek



reply via email to

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