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 %% Translation of GIT committish: d5307870fe0ad47904daba73792c7e17b813737f
12 Certains objets graphiques ne sont accessibles que par le biais d'un
13 @emph{callback} à partir d'un autre @code{grob}. Ils sont normalement
14 listés dans les « @emph{layout objects} » au sein de la section
15 « Propriétés internes » d'une @emph{grob-interface}. La fonction
16 @code{ly:grob-object} permet d'accéder à ces objets.
18 Voici plusieurs moyens d'accéder aux objets par un @emph{callback} sur
19 @code{NoteHead}. D'autres biais sont naturellement possible ;
20 @code{NoteHead} a cependant l'avantage incontestable d'être utilisé
21 implicitement par la commande @code{\\tweak}.
23 La fonction @code{display-grobs} définie ci-dessous n'est probablement
24 pas très utile. Elle indique toutefois qu'il est tout à fait possible
27 Voici par exemple ce qui sera émis dans la console :
37 doctitlefr = "Utilisation de ly:grob-object pour accéder aux grobs avec \\tweak"
39 lsrtags = "devel, tweaks-and-overrides, scheme-language"
42 %% Translation of GIT committish: b482c3e5b56c3841a88d957e0ca12964bd3e64fa
46 Se puede acceder @qq{lateralmente} a algunos grobs desde dentro de la
47 función de callback de otro grob. Éstos se encuentran relacionados
48 normalmente como @qq{layout objects} (objetos de presentación) en la
49 sección @qq{Internal properties} (propiedades internas) de un
50 interface de grob. Se usa la función @code{ly:grob-object} para
51 acceder a estos grobs.
54 Se presentan más abajo como ejemplo algunas formas de addecer a grobs
55 desde dentro de una función de callback de NoteHead, pero la técnica
56 no se limita a las cabezas de nota. Sin embargo, la función de
57 callback de NoteHead es especialmente importante, porque es la función
58 de callback implícita que utiliza la instrucción @code{\\tweak}.
61 La función de ejemplo que se define abajo (\"display-grobs\") no es
62 probablemente tan útil, pero muestra que se está accediendo
63 efectivamente a los grobs.
66 Salida de ejemplo de la consola:
79 doctitlees = "Utilizar ly:grob-object para acceder a los grobs con \\tweak"
83 Some grobs can be accessed @qq{laterally} from within another grob's
84 callback. These are usually listed as @qq{layout objects} in the
85 @qq{Internal properties} section of a grob-interface. The function
86 @code{ly:grob-object} is used to access these grobs.
89 Demonstrated below are some ways of accessing grobs from within a
90 NoteHead callback, but the technique is not limited to NoteHeads.
91 However, the NoteHead callback is particularly important, since it is
92 the implicit callback used by the @code{\\tweak} command.
95 The example function defined below (\"display-grobs\") is probably not
96 that useful, but it demonstrates that the grobs are indeed being
100 Example console output:
103 -------------------- #-Grob Accidental - #-Grob Arpeggio - #-Grob Stem -
108 doctitle = "Using ly:grob-object to access grobs with \\tweak"
111 #(define (notehead-get-accidental notehead)
113 (ly:grob-object notehead 'accidental-grob))
115 #(define (notehead-get-arpeggio notehead)
117 (let ((notecolumn (notehead-get-notecolumn notehead)))
118 (ly:grob-object notecolumn 'arpeggio)))
120 #(define (notehead-get-notecolumn notehead)
122 (ly:grob-parent notehead X))
124 #(define (notehead-get-stem notehead)
126 (let ((notecolumn (notehead-get-notecolumn notehead)))
127 (ly:grob-object notecolumn 'stem)))
129 #(define (display-grobs notehead)
131 (let ((accidental (notehead-get-accidental notehead))
132 (arpeggio (notehead-get-arpeggio notehead))
133 (stem (notehead-get-stem notehead)))
134 (format (current-error-port) "~2&~a\n" (make-string 20 #\-))
136 (lambda (x) (format (current-error-port) "~a\n" x))
137 (list accidental arpeggio stem))))
140 %% display grobs for each note head:
141 %\override NoteHead #'before-line-breaking = #display-grobs
144 \tweak #'before-line-breaking #display-grobs