Hi all, I just put together a snippet to make managing shared wind staves more automatic, particularly with triple winds that may be combined in different ways.
\version "2.19.82" #(define remove-if-sibling (lambda (offsets) (lambda (grob) (let* ( ;; The parent of a VerticalAxisGroup is a VerticalAlignment (parent (ly:grob-parent grob 1)) ;; Get the children VerticalAxisGroups of the parent (siblings (ly:grob-object parent 'elements)) (siblings-list (if (ly:grob-array? siblings) (ly:grob-array->list siblings) '())) ;; Find the siblings above or below me by offsets (my-vindex (ly:grob-get-vertical-axis-group-index grob)) (enemy-indices (map (lambda (offset) (+ offset my-vindex)) offsets)) (enemy-vaxis? (lambda (v) (member (ly:grob-get-vertical-axis-group-index v) enemy-indices))) (enemy-vaxes (filter enemy-vaxis? siblings-list)) ) ;; Suicide if an enemy sibling is alive (map (lambda (enemy-vaxis) (ly:pointer-group-interface::add-grob grob 'make-dead-when enemy-vaxis)) enemy-vaxes) ) ) ) ) %% Two Staff Example global = { s1 \break s1 \break s1*2 } I = { c'''1 \context Staff = "1" { \set Staff.keepAliveInterfaces = #'() } c'''1 c'''1 \context Staff = "1" { \unset Staff.keepAliveInterfaces } c'''1 } II = { e''1 e''1 e''1 e''1 } << \new Staff = "1+2" \with { \override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling '(1)) \override VerticalAxisGroup.remove-empty = ##t \override VerticalAxisGroup.remove-first = ##t } << \global \partcombine \I \II >> \new Staff = "1" \with { \override VerticalAxisGroup.remove-empty = ##t \override VerticalAxisGroup.remove-first = ##t } << \global \I >> \new Staff = "2" \with { \override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling '(-2)) \override VerticalAxisGroup.remove-empty = ##t \override VerticalAxisGroup.remove-first = ##t } << \global \II >> >> %% Three Staff Example global = { s1 \break s1 \break s1 \break s1*2 } I = { c'''1 \context Staff = "1" { \set Staff.keepAliveInterfaces = #'() } c'''1 c'''1 c'''1 \context Staff = "1" { \unset Staff.keepAliveInterfaces } c'''1 } II = { e''1 e''1 e''1 e''1 e''1 } III = { a'1 a'1 \context Staff = "3" { \set Staff.keepAliveInterfaces = #'() } a'1 a'1 a'1 } << \new Staff = "1+2+3" \with { \override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling '(2 5)) \override VerticalAxisGroup.remove-empty = ##t \override VerticalAxisGroup.remove-first = ##t } << \global \I \II \III >> \new Staff = "1+2" \with { \override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling '(1 -1)) \override VerticalAxisGroup.remove-empty = ##t \override VerticalAxisGroup.remove-first = ##t } << \global \partcombine \I \II >> \new Staff = "1" \with { \override VerticalAxisGroup.remove-empty = ##t \override VerticalAxisGroup.remove-first = ##t } << \global \I >> \new Staff = "2+3" \with { \override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling '(2 -3)) \override VerticalAxisGroup.remove-empty = ##t \override VerticalAxisGroup.remove-first = ##t } << \global \partcombine \II \III >> \new Staff = "2" \with { \override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling '(-1 -3 -4)) \override VerticalAxisGroup.remove-empty = ##t \override VerticalAxisGroup.remove-first = ##t } << \global \II >> \new Staff = "3" \with { \override VerticalAxisGroup.remove-empty = ##t \override VerticalAxisGroup.remove-first = ##t } << \global \III >> >>
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user