]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/bar-line.cc
* lily/note-column.cc (dir): idem.
[lilypond.git] / lily / bar-line.cc
index cd5729a02eaf5ed0884ecd9e3961cb45f0163a72..f8942db710777bf48c81b8c943134f7f0d7c2ae8 100644 (file)
@@ -1,19 +1,20 @@
 /*
-  bar.cc -- implement Bar
+  bar-line.cc -- implement Bar_line
 
   source file of the GNU LilyPond music typesetter
 
   (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
+#include "bar-line.hh"
+
 #include <math.h>
 
-#include "bar-line.hh"
+#include "all-font-metrics.hh"
+#include "font-interface.hh"
 #include "lookup.hh"
-#include "paper-column.hh"
 #include "output-def.hh"
-#include "font-interface.hh"
-#include "all-font-metrics.hh"
+#include "paper-column.hh"
 #include "staff-symbol-referencer.hh"
 
 MAKE_SCHEME_CALLBACK (Bar_line, print, 1);
@@ -25,7 +26,7 @@ Bar_line::print (SCM smob)
 
   SCM s = me->get_property ("glyph");
   SCM barsiz_proc = me->get_property ("bar-size-procedure");
-  if (scm_is_string (s) && ly_c_procedure_p (barsiz_proc))
+  if (scm_is_string (s) && ly_is_procedure (barsiz_proc))
     {
       String str = ly_scm2string (s);
       SCM siz = scm_call_1 (barsiz_proc, me->self_scm ());
@@ -33,13 +34,14 @@ Bar_line::print (SCM smob)
       if (sz <= 0)
        return SCM_EOL;
 
-      return compound_barline (me, str, sz).smobbed_copy ();
+      return compound_barline (me, str, sz, false).smobbed_copy ();
     }
   return SCM_EOL;
 }
 
 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);
   Real thinkern = robust_scm2double (me->get_property ("thin-kern"), 1);
@@ -54,8 +56,8 @@ Bar_line::compound_barline (Grob *me, String str, Real h)
   hair *= staffline;
   fatline *= staffline;
 
-  Stencil thin = simple_barline (me, hair, h);
-  Stencil thick = simple_barline (me, fatline, h);
+  Stencil thin = simple_barline (me, hair, h, rounded);
+  Stencil thick = simple_barline (me, fatline, h, rounded);
   Stencil dot = Font_interface::get_default_font (me)->find_by_name ("dots.dot");
 
   int lines = Staff_symbol_referencer::line_count (me);
@@ -132,7 +134,7 @@ Bar_line::compound_barline (Grob *me, String str, Real h)
          Real y = (- (c - 1.0) / 2 + 0.5 + i * staff_space);
          Stencil d (dot);
 
-         d. translate_axis (y, Y_AXIS);
+         d.translate_axis (y, Y_AXIS);
          m.add_stencil (d);
        }
     }
@@ -142,11 +144,16 @@ Bar_line::compound_barline (Grob *me, String str, Real h)
 Stencil
 Bar_line::simple_barline (Grob *me,
                          Real w,
-                         Real h)
+                         Real h,
+                         bool rounded)
 {
-  Real blot = me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
+  Real blot
+    = rounded
+    ? me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter"))
+    : 0.0;
 
-  return Lookup::round_filled_box (Box (Interval (0, w), Interval (-h / 2, h / 2)), blot);
+  return Lookup::round_filled_box (Box (Interval (0, w),
+                                       Interval (-h / 2, h / 2)), blot);
 }
 
 MAKE_SCHEME_CALLBACK (Bar_line, before_line_breaking, 1);
@@ -173,13 +180,12 @@ Bar_line::before_line_breaking (SCM smob)
       // leave y_extent for spanbar? 
     }
 
-  if (! ly_c_equal_p (g, orig))
+  if (! ly_is_equal (g, orig))
     me->set_property ("glyph", g);
 
   return SCM_UNSPECIFIED;
 }
 
-
 MAKE_SCHEME_CALLBACK (Bar_line, get_staff_bar_size, 1);
 SCM
 Bar_line::get_staff_bar_size (SCM smob)
@@ -188,7 +194,7 @@ Bar_line::get_staff_bar_size (SCM smob)
   Real ss = Staff_symbol_referencer::staff_space (me);
   SCM size = me->get_property ("bar-size");
   if (scm_is_number (size))
-    return scm_make_real (scm_to_double (size)*ss);
+    return scm_make_real (scm_to_double (size) * ss);
   else if (Staff_symbol_referencer::get_staff_symbol (me))
     {
       /*
@@ -200,8 +206,7 @@ Bar_line::get_staff_bar_size (SCM smob)
       ysize = ysize * ss + Staff_symbol_referencer::line_thickness (me);
       return scm_make_real (ysize);
     }
-  else
-    return scm_int2num (0);
+  return scm_int2num (0);
 }
 
 ADD_INTERFACE (Bar_line, "bar-line-interface",