]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/slur.cc
($(outdir)/%.pdf): add DVIPS_FLAGS. This will
[lilypond.git] / lily / slur.cc
index 5a42fcb7da3aa590e44cb0224dd4a28387516f4b..9868d30b9c5cdf2d05a1df6422735124c00cf052 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1996--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1996--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
     Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
@@ -29,7 +29,7 @@
 #include "note-column.hh"
 #include "stem.hh"
 #include "paper-column.hh"
-#include "molecule.hh"
+#include "stencil.hh"
 #include "warn.hh"
 #include "slur-bezier-bow.hh"
 #include "main.hh"
@@ -348,9 +348,7 @@ Slur::get_attachment (Grob *me, Direction dir,
              /*
                Default position is on stem X, at stem end Y
               */
-             Real stem_thickness =
-               gh_scm2double (stem->get_grob_property ("thickness"))
-               * stem->get_paper ()->get_realvar (ly_symbol2scm ("linethickness"));
+             Real stem_thickness = Stem::thickness (stem);
              o += Offset (0.5 *
                           x_extent * (1 + Stem::get_direction (stem))
                           - ((dir + 1)/2) * stem_thickness
@@ -438,7 +436,7 @@ Slur::encompass_offset (Grob*me,
   o[X_AXIS] -= 0.5 * stem_dir * x_extent;
 
   if ((stem_dir == dir)
-      && !stem->extent (stem, Y_AXIS).empty_b ())
+      && !stem->extent (stem, Y_AXIS).is_empty ())
     {
       o[Y_AXIS] = stem->extent (common[Y_AXIS], Y_AXIS)[dir];
     }
@@ -450,7 +448,7 @@ Slur::encompass_offset (Grob*me,
   /*
    leave a gap: slur mustn't touch head/stem
    */
-  o[Y_AXIS] += dir * gh_scm2double (me->get_grob_property ("y-free")) *
+  o[Y_AXIS] += dir * robust_scm2double (me->get_grob_property ("y-free"), 0) *
     1.0;
   return o;
 }
@@ -530,16 +528,19 @@ Slur::height (SCM smob, SCM ax)
   Grob * me = unsmob_grob (smob);
   assert (a == Y_AXIS);
 
-  SCM mol = me->get_uncached_molecule ();
-  return ly_interval2scm (unsmob_molecule (mol)->extent (a));
+  SCM mol = me->get_uncached_stencil ();
+  Interval ext;
+  if (Stencil * m = unsmob_stencil (mol))
+    ext = m->extent (a);
+  return ly_interval2scm (ext);
 }
 
 /*
   Ugh should have dash-length + dash-period
  */
-MAKE_SCHEME_CALLBACK (Slur, brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Slur, print,1);
 SCM
-Slur::brew_molecule (SCM smob)
+Slur::print (SCM smob)
 {
   Grob * me = unsmob_grob (smob);
   if (!scm_ilength (me->get_grob_property ("note-columns")))
@@ -548,20 +549,23 @@ Slur::brew_molecule (SCM smob)
       return SCM_EOL;
     }
 
-  Real thick = me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")) *
-    gh_scm2double (me->get_grob_property ("thickness"));
+  Real base_thick = robust_scm2double (me->get_grob_property ("thickness"), 1);
+  Real thick = base_thick * Staff_symbol_referencer::line_thickness (me);
+
+  Real ss = Staff_symbol_referencer::staff_space (me);
   Bezier one = get_curve (me);
 
   // get_curve may suicide
   if (!scm_ilength (me->get_grob_property ("note-columns")))
     return SCM_EOL;
 
-  Molecule a;
+  Stencil a;
   SCM d =  me->get_grob_property ("dashed");
   if (gh_number_p (d))
-    a = Lookup::dashed_slur (one, thick, thick * gh_scm2double (d));
+    a = Lookup::dashed_slur (one, thick, thick * robust_scm2double (d, 0));
   else
-    a = Lookup::slur (one, get_grob_direction (me) * thick, thick);
+    a = Lookup::slur (one, get_grob_direction (me) * base_thick * ss / 10.0,
+                     thick);
 
   return a.smobbed_copy ();
 }
@@ -575,7 +579,7 @@ Slur::set_control_points (Grob*me)
   SCM h_inf_scm = me->get_grob_property ("height-limit");
   SCM r_0_scm = me->get_grob_property ("ratio");
 
-  Real r_0 = gh_scm2double (r_0_scm);
+  Real r_0 = robust_scm2double (r_0_scm, 1);
   Real h_inf = staff_space * gh_scm2double (h_inf_scm);
   
   Slur_bezier_bow bb (get_encompass_offsets (me),