]> git.donarmstrong.com Git - lilypond.git/blobdiff - input/regression/molecule-hacking.ly
(conv): add 2.2.0 rule.
[lilypond.git] / input / regression / molecule-hacking.ly
index 9ff04511611060712ee90a446e6631e35b0c3e06..862020a7bdb700885629b67ee54f258f9e1cf6d1 100644 (file)
@@ -1,9 +1,9 @@
-#(ly:set-option 'old-relative)
-\version "1.9.1"
 
-\header { texidoc=" You can write molecule callbacks in Scheme, thus
+\version "2.1.36"
+
+\header { texidoc=" You can write stencil callbacks in Scheme, thus
 providing custom glyphs for notation elements.  A simple example is
-adding parentheses to existing molecule callbacks.
+adding parentheses to existing stencil callbacks.
 
 The parenthesized beam is less successful due to implementation of the
 Beam. The note head is also rather naive, since the extent of the
@@ -16,16 +16,16 @@ parens are also not seen by accidentals.
    "Construct a function that will do CALLBACK and add parentheses.
 Example usage:
 
-  \property Voice.NoteHead \\override #'molecule-callback
-                     =
-                     #(parenthesize-callback Note_head::brew_molecule)
+  \\property NoteHead \\override #'print-function
+                  =
+                     #(parenthesize-callback Note_head::print)
                    
 "
 
    
-   (define (parenthesize-molecule grob)
+   (define (parenthesize-stencil grob)
      "This function adds parentheses to the original callback for
-GROB.  The dimensions of the molecule is not affected.
+GROB.  The dimensions of the stencil is not affected.
 "
      
      (let* (
@@ -35,23 +35,23 @@ GROB.  The dimensions of the molecule is not affected.
            (subject (callback grob))
 
            ; remember old size
-           (subject-dim-x (ly:molecule-get-extent subject 0))
-           (subject-dim-y (ly:molecule-get-extent subject 1))
+           (subject-dim-x (ly:stencil-extent subject 0))
+           (subject-dim-y (ly:stencil-extent subject 1))
        )
 
         ; add parens
         (set! subject
-            (ly:molecule-combine-at-edge 
-             (ly:molecule-combine-at-edge subject 0 1 pclose 0.2)
+            (ly:stencil-combine-at-edge 
+             (ly:stencil-combine-at-edge subject 0 1 pclose 0.2)
              0 -1 popen  0.2))
 
        ; revert old size.
-       (ly:molecule-set-extent! subject 0 subject-dim-x)
-       (ly:molecule-set-extent! subject 1 subject-dim-y)
+       (ly:stencil-set-extent! subject 0 subject-dim-x)
+       (ly:stencil-set-extent! subject 1 subject-dim-y)
        subject
     )
      )
-   parenthesize-molecule
+   parenthesize-stencil
    )
     
 
@@ -59,14 +59,14 @@ GROB.  The dimensions of the molecule is not affected.
 \score {
        \notes \relative c' { c4 e
 
-                   \property Voice.NoteHead \override #'molecule-callback
-                     =
-                     #(parenthesize-callback Note_head::brew_molecule)
+                   \override NoteHead  #'print-function
+                  =
+                     #(parenthesize-callback Note_head::print)
                    g bes
-                   \property Voice.NoteHead \revert #'molecule-callback
-                   \property Voice.Beam \override #'molecule-callback
-                     =
-                     #(parenthesize-callback Beam::brew_molecule)
+                   \revert NoteHead #'print-function
+                   \override Beam  #'print-function
+                  =
+                     #(parenthesize-callback Beam::print)
 
                    a8 gis8 a2.