lilypond-user
[Top][All Lists]
Advanced

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

Re: GrandStaff vertical distance


From: Lukas-Fabian Moser
Subject: Re: GrandStaff vertical distance
Date: Fri, 12 Oct 2018 18:12:52 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Hi,

The StartDelimiterHierarchy gives the possibility to change the first
bracket by anything you want, for instance:
[...]
It would be interesting if your function can manage also that!
I guess this is what happens when you start coding before agreeing on a desirable user interface ;-).

Here we go:

\version "2.19.82"

\layout {
  indent = 35
}

#(define (make-n-copies x n)
   (if (> n 0)
       (cons x (make-n-copies x (- n 1)))
       '()))

#(define (symbol-or-list? x) (or (list? x) (symbol? x)))

#(define easy-delimiter-alist '((brace . SystemStartBrace)
                                (bracket . SystemStartBracket)
                                (square . SystemStartSquare)
                                (barlineOnly . SystemStartBar)
                                (barline . SystemStartBar)
                                ))

#(define (make-delimiter-hierarchy magic-list)
   ; expects
   ; - either a symbol (brace, bracket, square, barline[Only])
   ; - or a list,
   ;   the first entry of which is such a symbol (may be missing, then taken to be 'bracket)
   ;     defining the delimiter for the whole staffGroup,
   ;   followed by
   ;   - pairs of the form (symbol . number of staves), and/or
   ;   - placeholder symbols [which should never be an easy-delimiter magic word, so preferably 'staff or 'void)
   ;     designating single skipped staves.

   (if (list? magic-list)
       (let* ((total-delimiter (assq-ref easy-delimiter-alist (car magic-list)))               (actual-total-delimiter (if (eq? total-delimiter #f) 'SystemStartBracket total-delimiter))               (sub-delimiter-magic-list (if (eq? total-delimiter #f) magic-list (cdr magic-list))))
         (cons actual-total-delimiter
           (apply append (map (lambda (entry)
                                (if (pair? entry)
                                    (let ((delim (assq-ref easy-delimiter-alist (car entry))))
                                      (if (eq? delim #f)
                                          (make-n-copies 'some-staff (cdr entry))                                           (list (cons delim (make-n-copies 'void (cdr entry))))))
                                    '(void)))
                           sub-delimiter-magic-list))))
       (list (assq-ref easy-delimiter-alist magic-list))))


setDelimiters =
#(define-music-function (magic-list) (symbol-or-list?)
   #{
     \set StaffGroup.systemStartDelimiterHierarchy = #(make-delimiter-hierarchy magic-list)
   #})

\new StaffGroup \with {
  \setDelimiters #'barlineOnly
  % ALSO TRY THE FOLLOWING:
  % \setDelimiters #'(barlineOnly)
  % \setDelimiters #'(barlineOnly skip (brace . 2))
  % \setDelimiters #'(skip (brace . 2))
  % \setDelimiters #'(bracket skip (brace . 2))
  % \setDelimiters #'(skip (brace . 2) (skip . 2) (brace . 2))

  % Single-staff braces/brackets are not supported at the moment.

} <<
  \new Staff = "Staff_violinI" \with { instrumentName = #"Violin I" } { a }
  \new Staff = "Staff_violinII" \with { instrumentName = #"Violin II" } { a }
  \new Staff = "Staff_viola" \with { instrumentName = #"Viola" } { a }
  \new Staff = "Staff_cello" \with { instrumentName = #"Cello" } { a }
  \new Staff = "Staff_bassd" \with { instrumentName = #"Double Bass" } { a }   \new Staff = "Staff_basst" \with { instrumentName = #"Triple Bass" } { a }   \new Staff = "Staff_bassq" \with { instrumentName = #"Quadruple Bass" } { a }
>>


Best
Lukas



reply via email to

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