1 %% DO NOT EDIT this file manually; it is automatically
2 %% generated from LSR http://lsr.dsi.unimi.it
3 %% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
4 %% and then run scripts/auxiliar/makelsr.py
6 %% This file is in the public domain.
10 lsrtags = "devel, tweaks-and-overrides, scheme-language"
12 %% Translation of GIT committish: b482c3e5b56c3841a88d957e0ca12964bd3e64fa
15 Al trabajar con los callbacks de un grob, puede ser de mucha ayuda
16 entender el @qq{árbol genealógico} de un grob. La mayor parte de los
17 grobs tienen @qq{padres} que influyen en el posicionamiento del grob.
18 los padres X e Y influyen en las posiciones horizontal y vertical del
19 grob, respectivamente. Además, cada pade puede tener padres a su vez.
22 Por desgracia, existen varios aspectos de la genealogía de un grob que
23 pueden llevar a confusión:
28 @item Los tipos de padre que tiene un grob pueden depender del
31 @item Para ciertos grobs, los padres X e Y son el mismo.
33 @item Un @qq{ancestro} concreto puede estar relacionado con un grob de
36 @item El concepto de @qq{generaciones} es engañoso.
41 Por ejemplo, el grob @code{System} puede ser tanto un padre (sobre el
42 lado Y) como un abuelo (dos veces en el lado X) de un grob
43 @code{VerticalAlignment}.
46 Este macro imprime, en la consola, una representación textual de la
47 genealogía de un grob.
50 Cuando se llama de esta forma
54 \\once \\override NoteHead #'before-line-breaking = #display-ancestry
60 Se genera la siguiente salida:
64 ------------------------------------
66 NoteHead X,Y: NoteColumn
70 X: NonMusicalPaperColumn
73 X: NonMusicalPaperColumn
80 doctitlees = "Imprimir el árbol genealógico de un grob"
83 When working with grob callbacks, it can be helpful to understand a
84 grob's @qq{ancestry}. Most grobs have @qq{parents} which influence the
85 positioning of the grob. X- and Y-parents influence the horizontal and
86 vertical positions for the grob, respectively. Additionally, each
87 parent may have parents of its own.
90 Unfortunately, there are several aspects of a grob's ancestry that can
93 * The types of parents a grob has may depend on context. * For some
94 grobs, the X- and Y-parents are the same. * A particular @qq{ancestor}
95 may be related to a grob in multiple ways. * The concept of
96 @qq{generations} is misleading.
99 For example, the @code{System} grob can be both parent (on the Y-side)
100 and grandparent (twice on the X-side) to a @code{VerticalAlignment}
104 This macro prints (to the console) a textual representation of a grob's
112 \\once \\override NoteHead #'before-line-breaking = #display-ancestry
116 The following output is generated:
119 ------------------------------------
121 NoteHead X,Y: NoteColumn
125 X: NonMusicalPaperColumn
128 X: NonMusicalPaperColumn
135 doctitle = "Displaying grob ancestry"
138 #(define (grob-name grob)
140 (assoc-ref (ly:grob-property grob 'meta) 'name)
143 #(define (get-ancestry grob)
144 (if (not (null? (ly:grob-parent grob X)))
145 (list (grob-name grob)
146 (get-ancestry (ly:grob-parent grob X))
147 (get-ancestry (ly:grob-parent grob Y)))
150 #(define (format-ancestry lst padding)
152 (symbol->string (car lst))
155 (if (list? (cadr lst))
156 (format-ancestry (cadr lst) (+ padding 3))
157 (symbol->string (cadr lst))))
159 (if (list? (caddr lst))
160 (format-ancestry (caddr lst) (+ padding 3))
161 (symbol->string (caddr lst)))))
162 (if (equal? X-ancestry Y-ancestry)
165 (make-string padding #\space)
167 (if (list? (cadr lst))
168 (format-ancestry (cadr lst) (+ padding 5))
169 (symbol->string (cadr lst))))
172 (make-string padding #\space)
175 (make-string padding #\space)
180 #(define (display-ancestry grob)
181 (format (current-error-port)
184 (format-ancestry (get-ancestry grob) 0)))
187 \once \override NoteHead #'before-line-breaking = #display-ancestry
189 \once \override Accidental #'before-line-breaking = #display-ancestry
190 \once \override Arpeggio #'before-line-breaking = #display-ancestry