]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/balloon.cc
($(outdir)/%.pdf): add DVIPS_FLAGS. This will
[lilypond.git] / lily / balloon.cc
index dfb4d86f2ee84773b0a7c8cc46ce4f44b6671762..6c29895f4b56a12b08039a6e7d37aaaf3da556db 100644 (file)
@@ -4,9 +4,10 @@
 
 #include "text-item.hh"
 #include "grob.hh"
+#include "line-interface.hh"
 #include "lookup.hh"
 #include "font-interface.hh"
-#include "molecule.hh"
+#include "stencil.hh"
 #include "lily-guile.hh"
 #include "paper-def.hh"
 #include "misc.hh"
@@ -15,13 +16,13 @@ struct Balloon_interface
 {
   
 public:
-  DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
+  DECLARE_SCHEME_CALLBACK (print, (SCM));
   static bool has_interface (Grob*);
 };
 
-MAKE_SCHEME_CALLBACK (Balloon_interface, brew_molecule, 1);
+MAKE_SCHEME_CALLBACK (Balloon_interface, print, 1);
 SCM
-Balloon_interface::brew_molecule (SCM smob) 
+Balloon_interface::print (SCM smob) 
 {
   Grob *me= unsmob_grob (smob);
 
@@ -33,7 +34,7 @@ Balloon_interface::brew_molecule (SCM smob)
       scm_mol = scm_call_1 (cb, smob);
     }
 
-  if (!unsmob_molecule (scm_mol))
+  if (!unsmob_stencil (scm_mol))
     return scm_mol;
 
   SCM scm_off = me->get_grob_property ("balloon-text-offset");
@@ -42,23 +43,18 @@ Balloon_interface::brew_molecule (SCM smob)
     return scm_mol;
 
   Offset off = ly_scm2offset (scm_off);
-  Molecule * m = unsmob_molecule (scm_mol);
+  Stencil * m = unsmob_stencil (scm_mol);
   Box orig_extent = m->extent_box ();
   Box box_extent = orig_extent;
 
-  SCM widen = me->get_grob_property ("balloon-padding");
-  Real w = .1;
-  if (gh_number_p (widen))
-    {
-      w = gh_scm2double (widen);
-    }
+  Real w = robust_scm2double (me->get_grob_property ("balloon-padding"),  .1);
   box_extent.widen (w, w);
   
   
-  Molecule fr = Lookup::frame (box_extent, 0.1, 0.05);
+  Stencil fr = Lookup::frame (box_extent, 0.1, 0.05);
 
   
-  fr.add_molecule (*m);
+  fr.add_stencil (*m);
 
 
 
@@ -70,7 +66,7 @@ Balloon_interface::brew_molecule (SCM smob)
   SCM text = Text_item::interpret_markup (me->get_paper ()->self_scm (), chain, bt);
 
   
-  Molecule *text_mol = unsmob_molecule (text);
+  Stencil *text_mol = unsmob_stencil (text);
   
   Offset z1;
 
@@ -83,12 +79,12 @@ Balloon_interface::brew_molecule (SCM smob)
 
   Offset z2 = z1 + off;
   
-  fr.add_molecule (Lookup::line (0.1, z1, z2));
+  fr.add_stencil (Line_interface::line (me, z1, z2));
 
   text_mol->translate (z2);
-  fr.add_molecule (*text_mol);
+  fr.add_stencil (*text_mol);
   
-  fr = Molecule (orig_extent, fr.get_expr ());
+  fr = Stencil (orig_extent, fr.get_expr ());
   return fr.smobbed_copy ();
 }