\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
}
}
{
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))
{
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));
}
(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.")
(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)))
+
+ ))))