lilypond-user
[Top][All Lists]
Advanced

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

Re: reinstating hidden stave


From: Lukas-Fabian Moser
Subject: Re: reinstating hidden stave
Date: Fri, 29 Mar 2019 07:38:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

Hi Andrew,

This came up as one of my queries a short while ago. It appears to be a surprisingly tricky topic. Have a look back through the archives for the full discussion. Here's the code I came up with. Hope this helps.

Andrew

%======
\version "2.19.82"

% manual staff hiding and showing .
% must be used with \RemoveEmptyStaves on.

hideStaffWithOnlyRests =
\set Staff.keepAliveInterfaces = #'()

This would tend to kill a staff no matter what its contents are. (Try

\layout {
  \context {
    \Staff
    \RemoveAllEmptyStaves
  }
}

\new Staff {
  \repeat unfold 200 a4
  \hideStaffWithOnlyRests
  \repeat unfold 200 a4
}

to see the effect.)

That is actually useful in some situations... but not what the original question asked for, I think.

Also, the logical is actually not that tricky: the keepAliveInterfaces list determines what elements in a staff will force the staff to be displayed. So if you want to see a staff where it contains only rests, it suffices to add rest-interface to that list. This leads to your definition of showStaffWithOnlyRests, but hideStaffWithOnlyRests should restore the default list (as defined in ly/engraver-init.ly):

hideStaffWithOnlyRests =
\set Staff.keepAliveInterfaces = #'(
                                     bass-figure-interface
                                     chord-name-interface
                                     cluster-beacon-interface
                                     fret-diagram-interface
                                     lyric-syllable-interface
                                     note-head-interface
                                     tab-note-head-interface
                                     lyric-interface
                                     percent-repeat-item-interface
                                     percent-repeat-interface

                                     ;; need this, as stanza numbers are items, and appear only once.
                                     stanza-number-interface
                                     )

(It would probably be better to turn these into functions that really only add the rest-interface to the list resp. remove it, using some seme construct.)

Lukas





reply via email to

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