System NonMusicalPaperColumn NonMusicalPaperColumn PaperColumn PaperColumn PaperColumn VerticalAlignment VerticalAxisGroup grobs, zB StemStub NoteSpacing NoteColumn grobs grobs VerticalAxisGroup grobs, zB NoteColumn BarLine StaffSpacing PhrasingSlur grobs grobs VerticalAxisGroup grobs, zB LyricText LyricSpace grobs grobs VerticalAxisGroup grobs grobs grobs
Wäre es richtig, zu sagen, dass Lilyponds Notensatz eine große Tabelle ist, jedes Element also eine Zelle ist? Und manche Elemente auch aus der Zelle hinausragen oder andere Elemente überlappen dürfen?
Der Y-Parent von VerticalAxisGroups ist VerticalAlignment
Der X-Parent von VerticalAxisGroups und VerticalAlignment ist jeweils eine NonMusicalPaperColumn
Meine Frage ist: Ist die NonMusicalPaperColumn für beide die selbe? Oder wie muss ich mir das vorstellen?
\new Staff \with {
\override VerticalAxisGroup.after-line-breaking =
#(lambda (grob)
(let* ((x-par (ly:grob-parent grob X)) ;; -> NonMusicalPaperColumn
(y-par (ly:grob-parent grob Y)) ;; -> VerticalAlignment
(x-par-y-par (ly:grob-parent y-par X))) ;; -> NonMusicalPaperColumn
(format
#t
"\nIs the X-parent of VerticalAxisGroup a NonMusicalPaperColumn?: ~a"
(eq? (grob::name x-par) 'NonMusicalPaperColumn))
(format
#t
"\nIs the X-parent of the Y-parent of VerticalAxisGroup a NonMusicalPaperColumn?: ~a"
(eq? (grob::name x-par-y-par) 'NonMusicalPaperColumn))
(format #t "\nAre the found NonMusicalPaperColumns equal?: ~a"
(equal? x-par x-par-y-par))))
}
{ c'1 }
Also: ja.Tool aus der Snippet Repository, um sich die Hierarchie von Grobs anzeigen zu lassen:
http://lsr.di.unimi.it/LSR/Item?id=622 (http://lsr.di.unimi.it/LSR/Item?id=622)
#(define (look-up-for-parent name-symbol axis grob)
"Return the parent of @var{grob}, specified by it's @var{name-symbol} in
axis @var{axis} or @var{grob}, if equal to the grob named @var{name-symbol}
already.
If not found, look up for the next parent."
(let* ((parent (ly:grob-parent grob axis)))
(cond
((not (ly:grob? parent))
(ly:error
(_"Perhaps typing error for \"~a\" or \"~a\" is not in the parent-tree.")
name-symbol name-symbol))
((equal? name-symbol (grob::name grob)) grob)
((not (equal? name-symbol (grob::name parent)))
(look-up-for-parent name-symbol axis parent))
(else parent))))
{
\override NoteHead.after-line-breaking =
#(lambda (grob)
(write (look-up-for-parent 'VerticalAxisGroup Y grob)))
c'1
}
#(define (grob-interface::info iface)
(hashq-get-handle (ly:all-grob-interfaces) iface))
#(define (grob-interface::properties iface-info)
(if iface-info (cadddr iface-info) '()))
#(define (grob-interface::pointers grob iface)
(let* ((info (grob-interface::info iface))
(props (grob-interface::properties info))
(pointers
(and (pair? props)
(filter
(lambda (prop)
(let ((type (object-property prop 'backend-type?)))
(or (eq? type ly:grob?)
(eq? type ly:grob-array?))))
props))))
(if pointers
(map
(lambda (p) (list p (ly:grob-object grob p)))
pointers))))
#(define (grob::all-pointers grob)
(let ((ifaces (ly:grob-interfaces grob)))
(define (entry iface)
(let ((pointers (grob-interface::pointers grob iface)))
(if (pair? pointers)
(list (list iface pointers))
'())))
(let loop ((ifaces ifaces) (result '()))
(if (null? ifaces)
result
(loop (cdr ifaces)
(append result (entry (car ifaces))))))))
#(define (display-pointers grob)
(format #t "~%~y ~y~%"
(grob::name grob)
(grob::all-pointers grob)))
{
\override NoteHead.after-line-breaking =
#(lambda (grob)
(display-pointers grob))
c'1
}
\version "2.18.2"
#(define (grob-name grob)
(cdr (assoc 'name (ly:grob-property grob 'meta))))
#(define resume-search #t)
#(define (get-parent-in-hierarchie grob searchword)
;; goes up in hierarchie until it finds
;; a grob named searchword
(define result #f)
(define (get-par grob)
(define compare
(lambda (x)
(and (ly:grob? x)
(equal? searchword (grob-name x)))))
(let* (
(parx (ly:grob-parent grob X))
(pary (ly:grob-parent grob Y))
)
;(disp (list parx (compare parx) pary (compare pary)))
(cond
((not(equal? result #f))
result )
((compare parx)
(set! result parx)
result)
((compare pary)
(set! result pary)
result)
(else
(if (ly:grob? parx)
(get-par parx))
(if(ly:grob? pary)
(get-par pary))
)
)
)
)
;; the inner function gets called from here
(let* (
(result (get-par grob))
)
;; check if we found something
(if (ly:grob? result)
result
#f
)
)
)
{
\override NoteHead.after-line-breaking =
#(lambda (grob)
(write (get-parent-in-hierarchie grob 'VerticalAxisGroup)))
c'1
}