[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to catch the current height of a StaffGroup?
From: |
Thomas Morley |
Subject: |
Re: How to catch the current height of a StaffGroup? |
Date: |
Wed, 23 May 2012 22:43:26 +0200 |
Next try to tackle the main problem, without engraver, but same idea:
Mark some grobs and read out their position.
After defining a 'marker-property and applying it with 'foo and 'bar
to some BarLines, I tried to color them from inside the
BreathingSign-after-line-breaking-override.
Works!
But every time I try to catch their coordinates in Y-axis-direction,
it results in a totally messed up output (but no problem with X-axis)
Regardless if I try:
ly:grob-relative-coordinate
ly:grob-robust-relative-extent
ly:grob-extent
%%%%%%%%%%%%%%%%%
\version "2.15.38"
#(define (define-grob-property symbol type? description)
(if (not (equal? (object-property symbol 'backend-doc) #f))
(ly:error (_ "symbol ~S redefined") symbol))
(set-object-property! symbol 'backend-type? type?)
(set-object-property! symbol 'backend-doc description)
symbol)
#(for-each
(lambda (x)
(apply define-grob-property x))
`(
(marker ,symbol? "Marker(s) in grob for function-call")
))
#(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 >
(sys (ly:grob-parent par2 Y)) ;; #<Grob System >
(elements-lst (ly:grob-array->list (ly:grob-object sys
'all-elements)))
(grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta) 'name)))
(lst-1 (filter
(lambda (x) (and (eq? 'BarLine (grob-name x))
(equal? (ly:grob-property x 'marker) 'foo)))
elements-lst))
(lst-2 (filter
(lambda (x) (and (eq? 'BarLine (grob-name x))
(equal? (ly:grob-property x 'marker) 'bar)))
elements-lst))
(top (ly:grob-relative-coordinate (car lst-1) sys Y))
;(top (ly:grob-extent (car lst-1) sys Y))
;(top (ly:grob-robust-relative-extent (car lst-1) sys Y))
;(bottom (ly:grob-relative-coordinate (car lst-2) sys Y))
;(bottom (ly:grob-robust-relative-extent (car lst-2) sys Y))
;(height (interval-length (cons (car bottom) (cdr top))))
)
;(newline)(display "top ")(display top)
;(newline)(display "bottom ")(display bottom )
(ly:grob-set-property! (car lst-1) 'color green)
(ly:grob-set-property! (car lst-2) 'color red)
(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 Staff.BarLine #'marker = #'foo
\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 \override Staff.BarLine #'marker = #'bar
c d a'' b,, c d
}
}
\score {
\new StaffGroup <<
\new Staff \one
\new Staff \one
\new Staff \one
\new Staff \two
>>
}
%%%%%%%%%%%%%%%%%%%%%%%
What am I missing?
-Harm
- How to catch the current height of a StaffGroup?, Thomas Morley, 2012/05/23
- Re: How to catch the current height of a StaffGroup?, Urs Liska, 2012/05/23
- Re: How to catch the current height of a StaffGroup?, Thomas Morley, 2012/05/23
- Re: How to catch the current height of a StaffGroup?, address@hidden, 2012/05/23
- Re: How to catch the current height of a StaffGroup?, Thomas Morley, 2012/05/23
- Re: How to catch the current height of a StaffGroup?, David Kastrup, 2012/05/23
- Re: How to catch the current height of a StaffGroup?, Thomas Morley, 2012/05/23
- Re: How to catch the current height of a StaffGroup?, David Kastrup, 2012/05/23
- Re: How to catch the current height of a StaffGroup?, Thomas Morley, 2012/05/23
- Re: How to catch the current height of a StaffGroup?,
Thomas Morley <=