]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.124
authorfred <fred>
Wed, 27 Mar 2002 00:48:18 +0000 (00:48 +0000)
committerfred <fred>
Wed, 27 Mar 2002 00:48:18 +0000 (00:48 +0000)
Documentation/user/features.itely
VERSION
input/test/molecule-hacking.ly [new file with mode: 0644]
lily/beam.cc

index fa5034eb54d9ed9c31b2308dd3a605363fcd060e..cb60274f366989fa095d75e97ed8c592a7b54e0a 100644 (file)
@@ -578,18 +578,7 @@ music = \notes { c'4 d'4( e'4 f'4 }
 }
 @end lilypond
 
-
-LilyPond is more flexible than some users realise.  Han-Wen could be
-very rich.
-
-Just too funny not to include.
-
 @example
-@quotation
-    I've just entered a request on cosource.com :
-@quotation
-        http://www.cosource.com/cgi-bin/cos.pl/wish/info/387
-@end quotation
     Here's a copy of my feature request :
 @quotation
         Your task, if you accept it is to implement a \smarttranspose
@@ -597,13 +586,8 @@ Just too funny not to include.
         notations. Double accidentals should be removed, as well as #E
         (-> F), bC (-> B), bF (-> E), #B (-> C).
 @end quotation
-@end quotation
-You mean like this. (Sorry 'bout the nuked indentation.)
 
-Add IMPLEMENT_TYPE_P(Music, "music?"); to music.cc, and presto, done.
-
-That's an easy $ 100; if I'd make $ 200/hour for every hour I worked
-on Lily, I'd be very rich :)
+You mean like this. (Sorry 'bout the nuked indentation.)
 @end example
 
 
diff --git a/VERSION b/VERSION
index 6509481f50e5f57b83fe04c0a03a4f5619eaf91a..db4dcb4dea1cf9d80f0370e6ec482c2cb1fb61fe 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,7 +1,7 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
-PATCH_LEVEL=123
+PATCH_LEVEL=124
 MY_PATCH_LEVEL=
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
diff --git a/input/test/molecule-hacking.ly b/input/test/molecule-hacking.ly
new file mode 100644 (file)
index 0000000..1c9cf4e
--- /dev/null
@@ -0,0 +1,72 @@
+
+\header { texidoc=" You can write molecule callbacks in Scheme, thus
+providing custom glyphs for notation elements.  A simple example is
+adding parentheses to existing molecule callbacks.
+
+The parenthesized beam is less successful due to implementation of the
+Beam.
+";
+       
+        }
+
+#(define (parenthesize-callback callback)
+   "Construct a function that will do CALLBACK and add parentheses.
+Example usage:
+
+  \property Voice.NoteHead \\override #'molecule-callback
+                     =
+                     #(parenthesize-callback Note_head::brew_molecule)
+                   
+"
+
+   
+   (define (parenthesize-molecule grob)
+     "This function adds parentheses to the original callback for
+GROB.  The dimensions of the molecule is not affected.
+"
+     
+     (let* (
+           (fn (ly-get-default-font grob))
+           (pclose (ly-find-glyph-by-name fn "accidentals-)"))
+           (popen (ly-find-glyph-by-name fn "accidentals-("))
+           (subject (callback grob))
+
+           ;; remember old size
+           (subject-dims (ly-get-molecule-extent subject 0))
+           )
+
+       ;; add parens
+        (set! subject
+            (ly-combine-molecule-at-edge 
+             (ly-combine-molecule-at-edge subject 0 1 pclose 0.2)
+             0 -1 popen  0.2))
+
+       ;; revert old size.
+       (ly-set-molecule-extent! subject 0 subject-dims)
+       subject
+    )
+     )
+   parenthesize-molecule
+   )
+    
+
+
+\score {
+       \notes \relative c' { c4 e
+
+                   \property Voice.NoteHead \override #'molecule-callback
+                     =
+                     #(parenthesize-callback Note_head::brew_molecule)
+                   g bes
+                   \property Voice.NoteHead \revert #'molecule-callback
+                   \property Voice.Beam \override #'molecule-callback
+                     =
+                     #(parenthesize-callback Beam::brew_molecule)
+
+                   a8 gis8 a2.
+                   
+                   }
+
+       \paper { linewidth = -1.; }
+       }
+
index db50deee2735e7c7a12a73e9ceef25ce0a93bbcd..7421de6f1ccac129cd83c6b5c2e8cbc6c46cb7ed 100644 (file)
@@ -769,6 +769,10 @@ Beam::stem_beams (Grob*me,Item *here, Item *next, Item *prev)
   return leftbeams;
 }
 
+/*
+  TODO: it would be nice to introduce y-position via callbacks.
+ */
+
 MAKE_SCHEME_CALLBACK(Beam,brew_molecule,1);
 SCM
 Beam::brew_molecule (SCM smob)