]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/snippets/displaying-grob-ancestry.ly
Doc: CSS: A better brown for the usage manual
[lilypond.git] / Documentation / snippets / displaying-grob-ancestry.ly
index 2760ef56634a5fe0fcd0afb473ed4e2a5ab3fe1b..dc55c346f292d241239bf3fd83329cc80767a489 100644 (file)
 %% DO NOT EDIT this file manually; it is automatically
-%% generated from LSR http://lsr.dsi.unimi.it
+%% generated from LSR http://lsr.di.unimi.it
 %% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
 %% and then run scripts/auxiliar/makelsr.py
 %%
 %% This file is in the public domain.
-\version "2.14.2"
+\version "2.18.0"
 
 \header {
-  lsrtags = "devel, tweaks-and-overrides, scheme-language"
-
-%% Translation of GIT committish: b482c3e5b56c3841a88d957e0ca12964bd3e64fa
-
-  texidoces = "
-Al trabajar con los callbacks de un grob, puede ser de mucha ayuda
-entender el @qq{árbol genealógico} de un grob.  La mayor parte de los
-grobs tienen @qq{padres} que influyen en el posicionamiento del grob.
-los padres X e Y influyen en las posiciones horizontal y vertical del
-grob, respectivamente.  Además, cada pade puede tener padres a su vez.
-
-
-Por desgracia, existen varios aspectos de la genealogía de un grob que
-pueden llevar a confusión:
-
-
-@itemize
-
-@item Los tipos de padre que tiene un grob pueden depender del
-contexto.
-
-@item Para ciertos grobs, los padres X e Y son el mismo.
-
-@item Un @qq{ancestro} concreto puede estar relacionado con un grob de
-mas de una manera.
-
-@item El concepto de @qq{generaciones} es engañoso.
-
-@end itemize
-
-
-Por ejemplo, el grob @code{System} puede ser tanto un padre (sobre el
-lado Y) como un abuelo (dos veces en el lado X) de un grob
-@code{VerticalAlignment}.
-
-
-Este macro imprime, en la consola, una representación textual de la
-genealogía de un grob.
-
-
-Cuando se llama de esta forma
-
-@example
-@{
-   \\once \\override NoteHead #'before-line-breaking = #display-ancestry
-   c4
-@}
-@end example
-
-
-Se genera la siguiente salida:
-
-
-@example
-------------------------------------
-
-NoteHead X,Y: NoteColumn
-    X: PaperColumn
-       X,Y: System
-    Y: VerticalAxisGroup
-       X: NonMusicalPaperColumn
-          X,Y: System
-       Y: VerticalAlignment
-          X: NonMusicalPaperColumn
-             X,Y: System
-          Y: System
-@end example
-
-"
-
-  doctitlees = "Imprimir el árbol genealógico de un grob"
-
-%% Translation of GIT committish: 30339cb3706f6399c84607426988b25f79b4998c
-  texidocfr = "
-Lorsque l'on manipule des rappels d'objet (@emph{grob callbacks}), il
-peut être intéressant d'en maîtriser la @qq{ascendants}.  La plupart des
-objets graphiques ont des parents, lesquels auront une influence sur le
-positionnement de l'objet en question.  Ainsi, les X- et Y-parents
-influenceront respectivement la position horizontale et verticale de
-l'objet.  De plus, chacun des parents peut avoir ses propres parents.
-
-Certains aspects de la lignée d'un objet peuvent toutefois porter à
-confusion :
-
--- Les types de parents d'un @emph{grob} peuvent dépendre du contexte.
-
--- Dans le cas de certains @emph{grobs}, les parents X et Y peuvent être
-   le même.
-
--- Un @qq{ascendant} particulier peut dépendre d'un @emph{grob} de
-   différentes manières.
-
--- Le concept de @qq{génération} est trompeur.
-
-Par exemple, l'objet @code{System} peut, vis à vis d'un objet
-@code{VerticalAlignment},  être à la fois parent (par son
-côté Y) et grand parent (par deux fois du côté X).
-
-La macro ci-dessous affiche à l'écran une représentation textuelle de
-l'ascendance d'un @emph{grob}.
-
-
-Elle se lance ainsi :
-
-@example
-@{
-   \\once \\override NoteHead #'before-line-breaking = #display-ancestry
-   c4
-@}
-@end example
-
-et génère la sortie suivante :
-
-@example
-------------------------------------
-
-NoteHead X,Y: NoteColumn
-    X: PaperColumn
-       X,Y: System
-    Y: VerticalAxisGroup
-       X: NonMusicalPaperColumn
-          X,Y: System
-       Y: VerticalAlignment
-          X: NonMusicalPaperColumn
-             X,Y: System
-          Y: System
-@end example
-
-"
-  doctitlefr = "Affichage de la généalogie d'un objet"
+  lsrtags = "devel, scheme-language, tweaks-and-overrides"
 
   texidoc = "
 When working with grob callbacks, it can be helpful to understand a
-grob's @qq{ancestry}. Most grobs have @qq{parents} which influence the
+grob’s ancestry. Most grobs have parents which influence the
 positioning of the grob. X- and Y-parents influence the horizontal and
 vertical positions for the grob, respectively. Additionally, each
 parent may have parents of its own.
 
 
-Unfortunately, there are several aspects of a grob's ancestry that can
+Unfortunately, there are several aspects of a grobs ancestry that can
 lead to confusion:
 
-* The types of parents a grob has may depend on context. * For some
-grobs, the X- and Y-parents are the same. * A particular @qq{ancestor}
-may be related to a grob in multiple ways. * The concept of
-@qq{generations} is misleading.
+
+* The types of parents a grob has may depend on context.
+
+* For some grobs, the X- and Y-parents are the same.
+
+* A particular “ancestor” may be related to a grob in multiple ways.
+
+* The concept of “generations” is misleading.
 
 
 For example, the @code{System} grob can be both parent (on the Y-side)
@@ -160,51 +35,46 @@ and grandparent (twice on the X-side) to a @code{VerticalAlignment}
 grob.
 
 
-This macro prints (to the console) a textual representation of a grob's
+This macro prints (to the console) a textual representation of a grobs
 ancestry.
 
+When called this way:
 
-When called this way
-
-
-@{
- \\once \\override NoteHead #'before-line-breaking = #display-ancestry
- c @}
-
+@code{@{ \\once \\override NoteHead.before-line-breaking =
+#display-ancestry c @}}
 
 The following output is generated:
 
 
-------------------------------------
-
-NoteHead X,Y: NoteColumn
-    X: PaperColumn
-       X,Y: System
-    Y: VerticalAxisGroup
-       X: NonMusicalPaperColumn
-          X,Y: System
-       Y: VerticalAlignment
-          X: NonMusicalPaperColumn
-             X,Y: System
-          Y: System
-
-
+@code{NoteHead X,Y: NoteColumn
+     X: PaperColumn
+        X,Y: System
+     Y: VerticalAxisGroup
+        X: NonMusicalPaperColumn
+           X,Y: System
+        Y: VerticalAlignment
+           X: NonMusicalPaperColumn
+              X,Y: System
+           Y: System}
 
 "
   doctitle = "Displaying grob ancestry"
 } % begin verbatim
 
-#(define (grob-name grob)
-   (if (ly:grob? grob)
-       (assoc-ref (ly:grob-property grob 'meta) 'name)
-       #f))
+%% http://lsr.di.unimi.it/LSR/Item?id=622
+%% see also http://www.lilypond.org/doc/v2.18/Documentation/snippets/tweaks-and-overrides#tweaks-and-overrides-displaying-grob-ancestry
+
+%% Remark:
+%% grob::name is in the source since 2.19.x could be deleted during next LSR-upgrade
+#(define (grob::name grob)
+  (assq-ref (ly:grob-property grob 'meta) 'name))
 
 #(define (get-ancestry grob)
-   (if (not (null? (ly:grob-parent grob X)))
-       (list (grob-name grob)
-             (get-ancestry (ly:grob-parent grob X))
-             (get-ancestry (ly:grob-parent grob Y)))
-       (grob-name grob)))
+  (if (not (null? (ly:grob-parent grob X)))
+      (list (grob::name grob)
+            (get-ancestry (ly:grob-parent grob X))
+            (get-ancestry (ly:grob-parent grob Y)))
+      (grob::name grob)))
 
 #(define (format-ancestry lst padding)
    (string-append
@@ -240,12 +110,14 @@ NoteHead X,Y: NoteColumn
    (format (current-error-port)
       "~3&~a~2%~a~&"
       (make-string 36 #\-)
-      (format-ancestry (get-ancestry grob) 0)))
+      (if (ly:grob? grob)
+          (format-ancestry (get-ancestry grob) 0)
+          (format #f "~a is not a grob" grob))))
 
 \relative c' {
-  \once \override NoteHead #'before-line-breaking = #display-ancestry
+  \once \override NoteHead.before-line-breaking = #display-ancestry
   f4
-  \once \override Accidental #'before-line-breaking = #display-ancestry
-  \once \override Arpeggio #'before-line-breaking = #display-ancestry
+  \once \override Accidental.before-line-breaking = #display-ancestry
+  \once \override Arpeggio.before-line-breaking = #display-ancestry
   <f as c>4\arpeggio
 }