]> git.donarmstrong.com Git - lilypond.git/commitdiff
* input/regression/balloon.ly: new file.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 17 Jan 2004 13:52:39 +0000 (13:52 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 17 Jan 2004 13:52:39 +0000 (13:52 +0000)
* lily/balloon.cc (brew_molecule): new file: draw boxes around
objects, and make help texts.

input/regression/balloon.ly
lily/balloon.cc
lily/paper-outputter.cc
scm/define-grob-properties.scm
scm/music-functions.scm

index cf06c5ab86717b4d7cb77e0b772f8a18fcf81ab2..a3222a92b504aa9537fc9d25526f9f3c134ae044 100644 (file)
@@ -10,14 +10,21 @@ with lines and explanatory text added."
      
    \relative c'  {
 
+       %% by hand:
        \once\property Voice.Stem \set #'molecule-callback = #Balloon_interface::brew_molecule
-       \once\property Voice.Stem \set #'original-callback = #Stem::brew_molecule
+       \once\property Voice.Stem \set #'balloon-original-callback = #Stem::brew_molecule
        \once\property Voice.Stem \set #'balloon-text = #"I'm a stem"
        \once\property Voice.Stem \set #'balloon-text-offset = #'(3 . 4)
        \once\property Voice.Stem \set #'balloon-text-props
          = #'((font-family .  roman))
 
-       
+
+       %% use predefd function. 
+       \context Voice \applyoutput #(add-balloon-text
+                                    'NoteHead "heads, or tails?"
+                                    '(0 . -3))
+
+      
        c8
        }
   }
index 0604a81234b74f91f155dd04d60782605a762a73..dfb4d86f2ee84773b0a7c8cc46ce4f44b6671762 100644 (file)
@@ -25,7 +25,7 @@ Balloon_interface::brew_molecule (SCM smob)
 {
   Grob *me= unsmob_grob (smob);
 
-  SCM cb = me->get_grob_property ("original-callback");
+  SCM cb = me->get_grob_property ("balloon-original-callback");
   SCM scm_mol  =  SCM_EOL;
 
   if (gh_procedure_p (cb))
index a040ceecfb8fd9f7640e5a9a7cb341b1c01b55d0..7689afa901a79075d2735078e8e44d0ed52bdbeb 100644 (file)
@@ -119,7 +119,7 @@ Paper_outputter::output_scope (SCM mod, String prefix)
        {
          output_String_def (prefix + s, ly_scm2string (v));
        }
-      else if (scm_number_p (v) == SCM_BOOL_T && scm_exact_p (v) == SCM_BOOL_T)
+      else if (scm_integer_p (v) == SCM_BOOL_T && scm_exact_p (v) == SCM_BOOL_T)
        {
          output_int_def (prefix + s, gh_scm2int (v));    
        }
index 3a5452eb13a74e5b3d04eb39964b3384f2d6e127..d5809adf658c9bf342fc2535b0ebe05717c95024 100644 (file)
@@ -98,7 +98,7 @@ for balloon text.")
 (grob-property-description 'balloon-text-offset number-pair?
                           "Where to put text relative to balloon.")
 (grob-property-description 'balloon-padding ly:dimension? "Text to add to help balloon")
-(grob-property-description 'original-callback procedure? "The
+(grob-property-description 'balloon-original-callback procedure? "The
 original molecule drawer to draw the balloon around.")
 
 
index 071a5dc05d446a15590ed67f3d5e141b5c84fb9d..5159d13b7a4cc8e0dbc0d25ac25df0ce8671e3ff 100644 (file)
@@ -750,3 +750,23 @@ Rest can contain a list of beat groupings
   (music-map apply-duration lyric-music))
 
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+
+
+(define-public ((add-balloon-text object-name text off) grob orig-context cur-context)
+   "Usage: see input/regression/balloon.ly "
+  (let*
+   ((meta (ly:get-grob-property grob 'meta))
+    (nm (if (pair? meta) (cdr (assoc 'name meta)) "nonexistant"))
+    (cb (ly:get-grob-property grob 'molecule-callback)))
+    
+   (if (equal? nm object-name)
+    (begin
+     (ly:set-grob-property! grob 'molecule-callback Balloon_interface::brew_molecule)
+     (ly:set-grob-property! grob 'balloon-original-callback cb)
+     (ly:set-grob-property! grob 'balloon-text text)
+     (ly:set-grob-property! grob 'balloon-text-offset off)
+     (ly:set-grob-property! grob 'balloon-text-props '((font-family . roman)))
+
+     ))))