Hi all,

Working with Andrew’s "spacer" situation, I see now that my staff layout 
functions can be simplified significantly: since every break "must" be 
accompanied by a bar (even if it’s an invisible one!), one can simply use that 
interface (and no others!) to force visibility.

In the snippet below, you can see the effects of forcing visibility 
(\showStaff), forcing invisibility (\hideStaff), and reverting to normal 
(\resetStaff). Note that these functions can also be used with \once, if 
desired (though I haven’t in this snippet).

Hope this helps!
Kieren.

%%%  SNIPPET BEGINS  %%%
\version "2.19.80"

showStaff = \set Staff.keepAliveInterfaces = #'(bar-line-interface)
hideStaff = \set Staff.keepAliveInterfaces = #'()
resetStaff = \unset Staff.keepAliveInterfaces

violinOne = {
  \override Staff.VerticalAxisGroup.remove-first = ##t
  c''1 \break
  \showStaff
  c''1 \break
  s2 \bar "" \break s2 \break
  c''1 \break
  \resetStaff
  R1 \break
  c''1 \break
  \showStaff
  R1 \break
  c''1
}

violinTwo = {
  \repeat unfold 8 { c'4 }
  \break
  \hideStaff
  \repeat unfold 8 { c'4 }
  \break
  \repeat unfold 8 { c'4 }
  \break
  \resetStaff
  \repeat unfold 8 { c'4 }
}

\score {
  <<
    \new Staff \with { \override StaffSymbol.color = #red } {
      \violinOne
    }
    \new Staff \with { \override StaffSymbol.color = #blue } {
      \violinTwo
    }
  >>
  \layout {
    \context {
      \Staff
      \RemoveEmptyStaves
    }
  }
}

%%%  SNIPPET ENDS  %%%

________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to