]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/bar-line.cc
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / lily / bar-line.cc
index ad03166ff16512015c15f278a457dca14c80455c..4922a84d37b29921d1e5a79d29c4ccd1508f1f0d 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include "bar-line.hh"
@@ -26,7 +26,7 @@ Bar_line::print (SCM smob)
   
   if (scm_is_string (s) && scm_is_number (barsize))
     {
-      String str = ly_scm2string (s);
+      string str = ly_scm2string (s);
       Real sz = robust_scm2double (barsize, 0);
       if (sz <= 0)
        return SCM_EOL;
@@ -37,7 +37,7 @@ Bar_line::print (SCM smob)
 }
 
 Stencil
-Bar_line::compound_barline (Grob *me, String str, Real h,
+Bar_line::compound_barline (Grob *me, string str, Real h,
                            bool rounded)
 {
   Real kern = robust_scm2double (me->get_property ("kern"), 1);
@@ -45,7 +45,7 @@ Bar_line::compound_barline (Grob *me, String str, Real h,
   Real hair = robust_scm2double (me->get_property ("hair-thickness"), 1);
   Real fatline = robust_scm2double (me->get_property ("thick-thickness"), 1);
 
-  Real staffline = me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+  Real staffline = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
   Real staff_space = Staff_symbol_referencer::staff_space (me);
 
   kern *= staffline;
@@ -146,7 +146,7 @@ Bar_line::simple_barline (Grob *me,
 {
   Real blot
     = rounded
-    ? me->layout ()->get_dimension (ly_symbol2scm ("blotdiameter"))
+    ? me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"))
     : 0.0;
 
   return Lookup::round_filled_box (Box (Interval (0, w),
@@ -158,18 +158,10 @@ SCM
 Bar_line::calc_bar_size (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
-  Real ss = Staff_symbol_referencer::staff_space (me);
-
-  if (Staff_symbol_referencer::get_staff_symbol (me))
+  if (Grob *staff = Staff_symbol_referencer::get_staff_symbol (me))
     {
-      /*
-       If there is no staff-symbol, we get -1 from the next
-       calculation. That's a nonsense value, which would collapse the
-       barline so we return 0.0 in the next alternative.
-      */
-      Real ysize = (Staff_symbol_referencer::line_count (me) -1);
-      ysize = ysize * ss + Staff_symbol_referencer::line_thickness (me);
-      return scm_from_double (ysize);
+      Interval staff_y = staff->extent (staff, Y_AXIS);
+      return scm_from_double (staff_y.is_empty () ? 0.0 : staff_y.length ());
     }
   return scm_from_int (0);
 }