Revised autobeam settings patch and ran makelsr.py
[lilypond/mpolesky.git] / Documentation / snippets / using-ly-grob-object-to-access-grobs-with--tweak.ly
blob4ec260377f4da490616c7e619b89d5481cb7972b
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
5 \version "2.13.29"
7 \header {
8 %% Translation of GIT committish: 0b55335aeca1de539bf1125b717e0c21bb6fa31b
10 texidoces = "
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:
35 @example
36 --------------------
37 #-Grob Accidental -
38 #-Grob Arpeggio -
39 #-Grob Stem -
40 @end example
45 doctitlees = "Utilizar ly:grob-object para acceder a los grobs con \\tweak"
48 lsrtags = "tweaks-and-overrides"
50 texidoc = "
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
65 accessed.
68 Example console output:
71 @example
72 --------------------
73 #-Grob Accidental -
74 #-Grob Arpeggio -
75 #-Grob Stem -
76 @end example
80 doctitle = "Using ly:grob-object to access grobs with \\tweak"
81 } % begin verbatim
84 #(define (notehead-get-accidental notehead)
85 ;; notehead is grob
86 (ly:grob-object notehead 'accidental-grob))
88 #(define (notehead-get-arpeggio notehead)
89 ;; notehead is grob
90 (let ((notecolumn (notehead-get-notecolumn notehead)))
91 (ly:grob-object notecolumn 'arpeggio)))
93 #(define (notehead-get-notecolumn notehead)
94 ;; notehead is grob
95 (ly:grob-parent notehead X))
97 #(define (notehead-get-stem notehead)
98 ;; notehead is grob
99 (let ((notecolumn (notehead-get-notecolumn notehead)))
100 (ly:grob-object notecolumn 'stem)))
102 #(define (display-grobs notehead)
103 ;; notehead is grob
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 #\-))
108 (for-each
109 (lambda (x) (format #t "~a\n" x))
110 (list accidental arpeggio stem))))
112 \relative c' {
113 %% display grobs for each note head:
114 %\override NoteHead #'before-line-breaking = #display-grobs
116 %% or just for one:
117 \tweak #'before-line-breaking #display-grobs
119 g>1\arpeggio