On 23 mai 2012, at 19:19, Thomas Morley wrote:

> 2012/5/23 Urs Liska <li...@ursliska.de>:
>> but shouldn't a standard barline have the desired length by default?
> 
> Of course, but the new BreathingSign-stencil is only to visualize that
> I've got the correct value.
> And a BarLine lives in Staff-context but I want the "StaffGroup-size".
> 
> Trying:
> 
>                \override Score.BarLine #'stencil =
>                  #(lambda (grob)
>                    (let* ((stil (ly:bar-line::print grob))
>                           (stil-ext-y (interval-length
> (ly:stencil-extent stil Y))))
>                           (newline)(display stil-ext-y)
>                           stil))
> 
> returns every time the same value, in this case: 3.9975
> 
> As expected.
> 

Try the buddy engraver!

buddyEngraver =
    #(let ((match-list '())
           (name-list '()))
       (list
         (cons 'acknowledgers
               (list
                 (cons 'grob-interface
                       (lambda (engraver grob source-engraver)
                               (let ((name (ly:grob-property grob 'my-name))
                                     (searching (ly:grob-property grob 
'searching)))
                                    (set! name-list (cons (cons name grob) 
name-list))
                                    (set! match-list (append (map (lambda (x) 
(cons name x)) searching) match-list)))))))
         (cons 'finalize
              (lambda (trans)
                (for-each
                  (lambda (x) ;(format #t "MATCHING ~a\n" x)
                    (let ((grob1 (assoc-get (car x) name-list))
                          (grob2 (assoc-get (cdr x) name-list)))
                    (ly:grob-set-property! grob2 'buddies (cons (cons (car x) 
grob1) (ly:grob-property grob2 'buddies)))
                    (ly:grob-set-property! grob1 'buddies (cons (cons (cdr x) 
grob2) (ly:grob-property grob1 'buddies)))))
                  match-list)))))

Then, \layout \context { \Staff \consists \buddyEngraver }

If you do something like \override Staff.BarLine #'my-name = #'foo in one staff 
and \override Staff.BarLine #'my-name = #'bar in another and then \override 
BreathingSign #'searching = #'(foo bar) then BreathingSign will have a property 
'buddies set with two buddies (the two barlines). You can then find their 
positions via the normal grob-relative-position-finding functions.

Cheers,
MS


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to