lilypond-user
[Top][All Lists]
Advanced

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

Re: How to reset a SystemStartBracket-override?


From: harm6
Subject: Re: How to reset a SystemStartBracket-override?
Date: Tue, 20 Sep 2011 13:17:46 -0700 (PDT)

Hi David;


David Nalesnik-2 wrote:
> 
> Hi Harm,
> 
> It seems that you have to treat SystemStartBracket as a broken spanner in
> this case..
> Hi, again --
> 
Thanks for the hint, I didn't know that. Following this advice further work
was quite simple.


> Attached is a extension of this which allows you to apply a list of colors
> to the starting brackets.  If there are more lines than colors, we revert
> to
> black.  Just for fun :)
> 

Nice coloring-function! :D

My example with coloring the SystemStartBracket was the most simple example
I could think of to show my problem. 
Here's the code I had really in mind (perhaps it is useful to someone):

\version "2.14.2"

\paper {
        indent = 22
}

#(define ((system-start markup) grob)
  (if (ly:stencil? (ly:system-start-delimiter::print grob))
     (let* ((start-bar (ly:system-start-delimiter::print grob))
            (start-bar-extent (ly:stencil-extent start-bar Y))
            (start-bar-middle (/ (interval-length start-bar-extent) -2)))
     (ly:stencil-combine-at-edge 
       (ly:stencil-translate-axis (ly:system-start-delimiter::print grob) 1
X)
       Y RIGHT (grob-interpret-markup grob markup) start-bar-middle))
       #f))
 
#(define solo-group-markup
   (make-line-markup 
     (list
       (make-with-dimensions-markup '(0 . 0) '(0 . 0) 
         (make-translate-markup (cons -4 0)
           (make-fontsize-markup -1
             (make-italic-markup 
               (make-rotate-markup 90
               "SOLO"))))))))
        
#(define choro-group-markup
   (make-line-markup 
     (list
       (make-with-dimensions-markup '(0 . 0) '(0 . 0) 
         (make-translate-markup (cons -4.95 0)
           (make-fontsize-markup -1
             (make-italic-markup
               (make-rotate-markup 90
               "CHORO"))))))))
                     
#(define ((group-callback markup) grob)
 (let* ((orig (ly:grob-original grob))
        (siblings (if (ly:grob? orig)
                     (ly:spanner-broken-into orig)
                     '())))

  (if (and (>= (length siblings) 2)
           (not (eq? (car (reverse siblings)) grob)))      
  (system-start markup)
  (ly:system-start-delimiter::print grob))))

one = \relative c' {
        a1 \repeat unfold 20 { a }
}

two = \relative c' {
        b \repeat unfold 20 { b }
}

three = \relative c' {
        c \repeat unfold 20 { c }
}

four = \relative c' {
        d \repeat unfold 20 { d }
}

oneAll = \relative c' {
        a \repeat unfold 20 { a }
}

twoAll = \relative c' {
        b \repeat unfold 20 { b }
}

threeAll = \relative c' {
        c \repeat unfold 20 { c }
}

fourAll = \relative c' {
        d \repeat unfold 20 { d }
}
  
\score {
      <<
        \new StaffGroup 
        \with { 
                % write "SOLO" only at the first line
            \override SystemStartBracket #'stencil = #(group-callback
solo-group-markup) 
                % write "SOLO" at all lines
            %\override SystemStartBracket #'stencil = #(system-start
solo-group-markup)
        }
        <<
          \new Staff \with { instrumentName = "Sopran" } \one
          \new Staff \with { instrumentName = "Alt" } \two 
          \new Staff \with { instrumentName = "Tenor" } \three
          \new Staff \with { instrumentName = "Bass" } \four
          >>

          \new StaffGroup 
                \with { 
                        % write "CHORO" only at the first line
                    \override SystemStartBracket #'stencil = #(group-callback
choro-group-markup)
                        % write "CHORO" at all lines
                    %\override SystemStartBracket #'stencil = #(system-start
choro-group-markup)
                }
        <<
          \new Staff \with { instrumentName = "Sopran" } \oneAll 
          \new Staff \with { instrumentName = "Alt" } \twoAll  
          \new Staff \with { instrumentName = "Tenor" } \threeAll 
          \new Staff \with { instrumentName = "Bass" } \fourAll 
          >>
      >>
        \layout {
            \context {
                      \Score
                      \override VerticalAxisGroup #'remove-first = ##t
            }   
            \context {
                      \Staff
                      \RemoveEmptyStaves
            }
        }
}

Is there a better or easier way to get this output?

Cheers,
  Harm

-- 
View this message in context: 
http://old.nabble.com/How-to-reset-a-SystemStartBracket-override--tp32499159p32501284.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.




reply via email to

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