]> git.donarmstrong.com Git - lilypond.git/commitdiff
LSR: Update.
authorNeil Puttock <n.puttock@gmail.com>
Fri, 15 Jan 2010 00:34:04 +0000 (00:34 +0000)
committerNeil Puttock <n.puttock@gmail.com>
Fri, 15 Jan 2010 00:34:04 +0000 (00:34 +0000)
Documentation/snippets/changing-a-single-notes-size-in-a-chord.ly
Documentation/snippets/displaying-grob-ancestry.ly [new file with mode: 0644]
Documentation/snippets/new/numbers-as-easy-note-heads.ly
Documentation/snippets/numbers-as-easy-note-heads.ly
Documentation/snippets/simple-lead-sheet.ly
Documentation/snippets/tweaks-and-overrides.snippet-list
Documentation/snippets/using-ly-grob-object-to-access-grobs-with--tweak.ly [new file with mode: 0644]

index b7e524e5c16f578bd92ff983764955f7d2bb39f8..a3ea65e6fdd7b1737c5348c60e16080b7666e7c1 100644 (file)
@@ -29,7 +29,7 @@ property.
 Inside the chord (within the brackets @code{< >}), before the note to
 be altered, place the @code{\\tweak} command, followed by
 @code{#'font-size} and define the proper size like @code{#-2} (a tiny
-notehead).
+note head).
 
 
 
diff --git a/Documentation/snippets/displaying-grob-ancestry.ly b/Documentation/snippets/displaying-grob-ancestry.ly
new file mode 100644 (file)
index 0000000..d26184f
--- /dev/null
@@ -0,0 +1,121 @@
+%% Do not edit this file; it is automatically
+%% generated from LSR http://lsr.dsi.unimi.it
+%% This file is in the public domain.
+\version "2.13.10"
+
+\header {
+  lsrtags = "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
+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 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.
+
+
+For example, the @code{System} grob can be both parent (on the Y-side)
+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
+ancestry.
+
+
+When called this way
+
+
+@{
+ \\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
+
+
+
+"
+  doctitle = "Displaying grob ancestry"
+} % begin verbatim
+
+#(define (grob-name grob)
+   (if (ly:grob? grob)
+       (assoc-ref (ly:grob-property grob 'meta) 'name)
+       #f))
+
+#(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)))
+
+#(define (format-ancestry lst padding)
+   (string-append
+    (symbol->string (car lst))
+    "\n"
+    (let ((X-ancestry
+           (if (list? (cadr lst))
+               (format-ancestry (cadr lst) (+ padding 3))
+               (symbol->string (cadr lst))))
+          (Y-ancestry
+           (if (list? (caddr lst))
+               (format-ancestry (caddr lst) (+ padding 3))
+               (symbol->string (caddr lst)))))
+      (if (equal? X-ancestry Y-ancestry)
+          (string-append
+           (format #f "~&")
+           (make-string padding #\space)
+           "X,Y: "
+           (if (list? (cadr lst))
+               (format-ancestry (cadr lst) (+ padding 5))
+               (symbol->string (cadr lst))))
+          (string-append
+           (format #f "~&")
+           (make-string padding #\space)
+           "X: " X-ancestry
+           "\n"
+           (make-string padding #\space)
+           "Y: " Y-ancestry
+           (format #f "~&"))))
+    (format #f "~&")))
+
+#(define (display-ancestry grob)
+   (display
+    (string-append
+     (format #f "~3&~a~2%" (make-string 36 #\-))
+     (format-ancestry (get-ancestry grob) 0)
+     (format #f "~2&"))))
+
+\relative c' {
+  \once \override NoteHead #'before-line-breaking = #display-ancestry
+  f
+  \once \override Accidental #'before-line-breaking = #display-ancestry
+  \once \override Arpeggio #'before-line-breaking = #display-ancestry
+  <f as c>\arpeggio
+}
+
index 2df46c56b32eb758ce0810d6375cf08ce2aae626..16b6002d33afa7d4e75b8589471af3eb9a10b67f 100644 (file)
@@ -29,7 +29,10 @@ object it sees.
            (note-names (make-vector 7 (number->string (+ 1 delta)))))
         (ly:grob-set-property! grob 'note-names note-names))))))))
 
+#(set-global-staff-size 26)
+
 \layout {
+  ragged-right = ##t
   \context {
     \Voice
     \consists \Ez_numbers_engraver
index 9ccb26181af1a843ee67dcf6262607c05503def8..7cd88fa11baabba886afe62b358ce847c124e5a5 100644 (file)
@@ -34,7 +34,10 @@ object it sees.
            (note-names (make-vector 7 (number->string (+ 1 delta)))))
         (ly:grob-set-property! grob 'note-names note-names))))))))
 
+#(set-global-staff-size 26)
+
 \layout {
+  ragged-right = ##t
   \context {
     \Voice
     \consists \Ez_numbers_engraver
index 21cf367d5013225a0b55c095ee220453e1484bf3..db6808885a6a7f873bb2aced443b6ba0a54471f6 100644 (file)
@@ -4,14 +4,6 @@
 \version "2.13.10"
 
 \header {
-%% Translation of GIT committish: b7ec64504da87595509ae6e88ae546d6a0ce633d
-  texidocfr = "
-Pour obtenir la partition d'un chanson, il suffit d'assembler
-des noms d'accords, une mélodie et des paroles :
-
-"
-  doctitlefr = "Chanson simple"
-
   lsrtags = "chords"
 
 %% Translation of GIT committish: b2d4318d6c53df8469dfa4da09b27c15a374d0ca
@@ -28,6 +20,13 @@ Ein Liedblatt besteht aus Akkordbezeichnungen, einer Melodie und dem Liedtext:
 
 "
   doctitlede = "Ein einfaches Liedblatt"
+%% Translation of GIT committish: b7ec64504da87595509ae6e88ae546d6a0ce633d
+  texidocfr = "
+Pour obtenir la partition d'un chanson, il suffit d'assembler
+des noms d'accords, une mélodie et des paroles :
+
+"
+  doctitlefr = "Chanson simple"
 
   texidoc = "
 When put together, chord names, a melody, and lyrics form a lead sheet:
index 67efdd20a1366f9c98ec824fa5c9804a26469681..d5fd97c3123137856b19b80741c0bffab92e8cb2 100644 (file)
@@ -17,6 +17,7 @@ custodes.ly
 customizing-fretboard-fret-diagrams.ly
 customizing-markup-fret-diagrams.ly
 display-bracket-with-only-one-staff-in-a-system.ly
+displaying-grob-ancestry.ly
 dotted-harmonics.ly
 drawing-boxes-around-grobs.ly
 drawing-circles-around-various-objects.ly
@@ -53,6 +54,7 @@ time-signature-printing-only-the-numerator-as-a-number-instead-of-the-fraction.l
 transcription-of-ancient-music-with-incipit.ly
 tweaking-clef-properties.ly
 tweaking-grace-layout-within-music.ly
+using-ly-grob-object-to-access-grobs-with--tweak.ly
 using-postscript-to-generate-special-note-head-shapes.ly
 using-the--tweak-command-to-tweak-individual-grobs.ly
 vertically-aligned-dynamics-and-textscripts.ly
diff --git a/Documentation/snippets/using-ly-grob-object-to-access-grobs-with--tweak.ly b/Documentation/snippets/using-ly-grob-object-to-access-grobs-with--tweak.ly
new file mode 100644 (file)
index 0000000..5e38377
--- /dev/null
@@ -0,0 +1,75 @@
+%% Do not edit this file; it is automatically
+%% generated from LSR http://lsr.dsi.unimi.it
+%% This file is in the public domain.
+\version "2.13.10"
+
+\header {
+  lsrtags = "tweaks-and-overrides"
+
+  texidoc = "
+Some grobs can be accessed @qq{laterally} from within another grob's
+callback. These are usually listed as @qq{layout objects} in the
+@qq{Internal properties} section of a grob-interface. The function
+@code{ly:grob-object} is used to access these grobs.
+
+
+Demonstrated below are some ways of accessing grobs from within a
+NoteHead callback, but the technique is not limited to NoteHeads.
+However, the NoteHead callback is particularly important, since it is
+the implicit callback used by the @code{\\tweak} command.
+
+
+The example function defined below (\"display-grobs\") is probably not
+that useful, but it demonstrates that the grobs are indeed being
+accessed.
+
+
+Example console output:
+
+
+-------------------- #-Grob Accidental - #-Grob Arpeggio - #-Grob Stem -
+
+
+
+"
+  doctitle = "Using ly:grob-object to access grobs with \\tweak"
+} % begin verbatim
+
+#(define (notehead-get-accidental notehead)
+   ;; notehead is grob
+   (ly:grob-object notehead 'accidental-grob))
+
+#(define (notehead-get-arpeggio notehead)
+   ;; notehead is grob
+   (let ((notecolumn (notehead-get-notecolumn notehead)))
+     (ly:grob-object notecolumn 'arpeggio)))
+
+#(define (notehead-get-notecolumn notehead)
+   ;; notehead is grob
+   (ly:grob-parent notehead X))
+
+#(define (notehead-get-stem notehead)
+   ;; notehead is grob
+   (let ((notecolumn (notehead-get-notecolumn notehead)))
+     (ly:grob-object notecolumn 'stem)))
+
+#(define (display-grobs notehead)
+   ;; notehead is grob
+   (let ((accidental (notehead-get-accidental notehead))
+         (arpeggio (notehead-get-arpeggio notehead))
+         (stem (notehead-get-stem notehead)))
+     (format #t "~2&~a\n" (make-string 20 #\-))
+     (for-each
+      (lambda (x) (format #t "~a\n" x))
+      (list accidental arpeggio stem))))
+
+\relative c' {
+  %% display grobs for each note head:
+  %\override NoteHead #'before-line-breaking = #display-grobs
+  <c
+  %% or just for one:
+  \tweak #'before-line-breaking #display-grobs
+  es
+  g>1\arpeggio
+}
+