lilypond-user
[Top][All Lists]
Advanced

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

How to catch the current height of a StaffGroup?


From: Thomas Morley
Subject: How to catch the current height of a StaffGroup?
Date: Wed, 23 May 2012 18:57:40 +0200

Hi,

I'm trying to read out the current height of a StaffGroup, i.e. from
the bottom-line of the bottom-staff up to the top-line of the
top-staff.

As a test I created a new BreathingSign-stencil drawing a line from
top-line to bottom-line. The value for draw-line is figured out
manually for now. Of course I want to automate this.

\version "2.15.38"

#(define ((staff-group-height number) grob)
     (let* ((stil (ly:text-interface::print grob))
            (par1 (ly:grob-parent grob Y))      ;; #<Grob VerticalAxisGroup >
            (par2 (ly:grob-parent par1 Y))      ;; #<Grob VerticalAlignment >
            (par3 (ly:grob-parent par2 Y))      ;; #<Grob System >
            )

     ;(newline)(display "par1 ")(display par1)

     (ly:grob-set-property! grob 'stencil
       (grob-interpret-markup grob
           (make-line-markup
             (list
                 (make-with-dimensions-markup '(0 . 0) '(0 . 0)
                   (make-with-color-markup blue
                     (make-draw-line-markup (cons 0 number))))))))))

%--------- Test

one = {
        \relative c' {
                a2 b
                \override Score.BreathingSign #'after-line-breaking =
                        #(staff-group-height -13)
                c\breathe d \break
                a,, b''
                \override Score.BreathingSign #'after-line-breaking =
                        #(staff-group-height -22.5)
                c\breathe d
        }
}

two = {
        \relative c {
                \clef bass
                a2 b c d a'' b,, c d
        }
}

\score {
        \new StaffGroup <<
           \new Staff \one
           \new Staff \two
           >>
}

I don't know which grob/item/stencil I should adress to catch the
needed value and how.

Any hint would be appreciated.

Thanks,
  Harm



reply via email to

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