1 % Do not edit this file; it is automatically
2 % generated from Documentation/snippets/new
3 % This file is in the public domain.
4 %% Note: this file works from version 2.13.36
8 %% Translation of GIT committish: fa19277d20f8ab0397c560eb0e7b814bd804ecec
11 Al trabajar con los callbacks de un grob, puede ser de mucha ayuda
12 entender el @qq{árbol genealógico} de un grob. La mayor parte de los
13 grobs tienen @qq{padres} que influyen en el posicionamiento del grob.
14 los padres X e Y influyen en las posiciones horizontal y vertical del
15 grob, respectivamente. Además, cada pade puede tener padres a su vez.
18 Por desgracia, existen varios aspectos de la genealogía de un grob que
19 pueden llevar a confusión:
24 @item Los tipos de padre que tiene un grob pueden depender del
27 @item Para ciertos grobs, los padres X e Y son el mismo.
29 @item Un @qq{ancestro} concreto puede estar relacionado con un grob de
32 @item El concepto de @qq{generaciones} es engañoso.
37 Por ejemplo, el grob @code{System} puede ser tanto un padre (sobre el
38 lado Y) como un abuelo (dos veces en el lado X) de un grob
39 @code{VerticalAlignment}.
42 Este macro imprime, en la consola, una representación textual de la
43 genealogía de un grob.
46 Cuando se llama de esta forma
50 \\once \\override NoteHead #'before-line-breaking = #display-ancestry
56 Se genera la siguiente salida:
60 ------------------------------------
62 NoteHead X,Y: NoteColumn
66 X: NonMusicalPaperColumn
69 X: NonMusicalPaperColumn
76 doctitlees = "Imprimir el árbol genealógico de un grob"
78 lsrtags = "tweaks-and-overrides"
81 When working with grob callbacks, it can be helpful to understand a
82 grob's @qq{ancestry}. Most grobs have @qq{parents} which influence the
83 positioning of the grob. X- and Y-parents influence the horizontal and
84 vertical positions for the grob, respectively. Additionally, each
85 parent may have parents of its own.
88 Unfortunately, there are several aspects of a grob's ancestry that can
95 The types of parents a grob has may depend on context.
98 For some grobs, the X- and Y-parents are the same.
101 A particular @qq{ancestor} may be related to a grob in multiple ways.
104 The concept of @qq{generations} is misleading.
109 For example, the @code{System} grob can be both parent (on the Y-side)
110 and grandparent (twice on the X-side) to a @code{VerticalAlignment}
114 This macro prints (to the console) a textual representation of a grob's
122 \\once \\override NoteHead #'before-line-breaking = #display-ancestry
128 The following output is generated:
132 ------------------------------------
134 NoteHead X,Y: NoteColumn
138 X: NonMusicalPaperColumn
141 X: NonMusicalPaperColumn
148 doctitle = "Displaying grob ancestry"
152 #(define (grob-name grob)
154 (assoc-ref (ly:grob-property grob 'meta) 'name)
157 #(define (get-ancestry grob)
158 (if (not (null? (ly:grob-parent grob X)))
159 (list (grob-name grob)
160 (get-ancestry (ly:grob-parent grob X))
161 (get-ancestry (ly:grob-parent grob Y)))
164 #(define (format-ancestry lst padding)
166 (symbol->string (car lst))
169 (if (list? (cadr lst))
170 (format-ancestry (cadr lst) (+ padding 3))
171 (symbol->string (cadr lst))))
173 (if (list? (caddr lst))
174 (format-ancestry (caddr lst) (+ padding 3))
175 (symbol->string (caddr lst)))))
176 (if (equal? X-ancestry Y-ancestry)
179 (make-string padding #\space)
181 (if (list? (cadr lst))
182 (format-ancestry (cadr lst) (+ padding 5))
183 (symbol->string (cadr lst))))
186 (make-string padding #\space)
189 (make-string padding #\space)
194 #(define (display-ancestry grob)
197 (format #f "~3&~a~2%" (make-string 36 #\-))
198 (format-ancestry (get-ancestry grob) 0)
202 \once \override NoteHead #'before-line-breaking = #display-ancestry
204 \once \override Accidental #'before-line-breaking = #display-ancestry
205 \once \override Arpeggio #'before-line-breaking = #display-ancestry