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.10
8 %% Translation of GIT committish: 0b55335aeca1de539bf1125b717e0c21bb6fa31b
12 Se puede acceder @qq{lateralmente} a algunos grobs desde dentro de la
13 función de callback de otro grob. Éstos se encuentran relacionados
14 normalmente como @qq{layout objects} (objetos de presentación) en la
15 sección @qq{Internal properties} (propiedades internas) de un
16 interface de grob. Se usa la función @code{ly:grob-object} para
17 acceder a estos grobs.
20 Se presentan más abajo como ejemplo algunas formas de addecer a grobs
21 desde dentro de una función de callback de NoteHead, pero la técnica
22 no se limita a las cabezas de nota. Sin embargo, la función de
23 callback de NoteHead es especialmente importante, porque es la función
24 de callback implícita que utiliza la instrucción @code{\\tweak}.
27 La función de ejemplo que se define abajo (\"display-grobs\") no es
28 probablemente tan útil, pero muestra que se está accediendo
29 efectivamente a los grobs.
32 Salida de ejemplo de la consola:
45 doctitlees = "Utilizar ly:grob-object para acceder a los grobs con \\tweak"
48 lsrtags = "tweaks-and-overrides"
51 Some grobs can be accessed @qq{laterally} from within another grob's
52 callback. These are usually listed as @qq{layout objects} in the
53 @qq{Internal properties} section of a grob-interface. The function
54 @code{ly:grob-object} is used to access these grobs.
57 Demonstrated below are some ways of accessing grobs from within a
58 NoteHead callback, but the technique is not limited to NoteHeads.
59 However, the NoteHead callback is particularly important, since it is
60 the implicit callback used by the @code{\\tweak} command.
63 The example function defined below (\"display-grobs\") is probably not
64 that useful, but it demonstrates that the grobs are indeed being
68 Example console output:
80 doctitle = "Using ly:grob-object to access grobs with \\tweak"
84 #(define (notehead-get-accidental notehead)
86 (ly:grob-object notehead 'accidental-grob))
88 #(define (notehead-get-arpeggio notehead)
90 (let ((notecolumn (notehead-get-notecolumn notehead)))
91 (ly:grob-object notecolumn 'arpeggio)))
93 #(define (notehead-get-notecolumn notehead)
95 (ly:grob-parent notehead X))
97 #(define (notehead-get-stem notehead)
99 (let ((notecolumn (notehead-get-notecolumn notehead)))
100 (ly:grob-object notecolumn 'stem)))
102 #(define (display-grobs notehead)
104 (let ((accidental (notehead-get-accidental notehead))
105 (arpeggio (notehead-get-arpeggio notehead))
106 (stem (notehead-get-stem notehead)))
107 (format #t "~2&~a\n" (make-string 20 #\-))
109 (lambda (x) (format #t "~a\n" x))
110 (list accidental arpeggio stem))))
113 %% display grobs for each note head:
114 %\override NoteHead #'before-line-breaking = #display-grobs
117 \tweak #'before-line-breaking #display-grobs