]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/measure-grouping-spanner.cc
(overdone_heads): typos.
[lilypond.git] / lily / measure-grouping-spanner.cc
index 780e77547b679e9bf759b8befd4fb33f7a9b26b6..f6a751c7b895200039f63d79a42f8c5c7d2fda62 100644 (file)
@@ -7,9 +7,10 @@
 
  */
 
-#include "paper-def.hh"
-#include "spanner.hh"
 #include "measure-grouping-spanner.hh"
+
+#include "output-def.hh"
+#include "spanner.hh"
 #include "lookup.hh" 
 #include "item.hh"
 #include "staff-symbol-referencer.hh"
@@ -20,28 +21,22 @@ Measure_grouping::print (SCM grob)
 {
   Spanner * me = dynamic_cast<Spanner*> (unsmob_grob (grob));
 
-  /*
-    TODO: robustify.
-   */
-  SCM which = me->get_grob_property ("style");
-  Real height = robust_scm2double (me->get_grob_property ("height"), 1);
+  SCM which = me->get_property ("style");
+  Real height = robust_scm2double (me->get_property ("height"), 1);
 
-  Real t = Staff_symbol_referencer::line_thickness (me) * robust_scm2double (me->get_grob_property ("thickness"), 1);
-  Grob *common = me->get_bound(LEFT)->common_refpoint (me->get_bound (RIGHT),
+  Real t = Staff_symbol_referencer::line_thickness (me) * robust_scm2double (me->get_property ("thickness"), 1);
+  Grob *common = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT),
                                                       X_AXIS);
 
-  Interval rext = me->get_bound (RIGHT)->extent (common, X_AXIS);
-  
-  
-  Real w =(rext.is_empty ()
-          ? me->get_bound (RIGHT)->relative_coordinate (common, X_AXIS)
-          : rext[RIGHT])
-    - me->get_bound (LEFT)->relative_coordinate (common, X_AXIS);
-
-  Interval iv (0,w);
+  Real right_point = robust_relative_extent (me->get_bound (RIGHT),
+                                            common, X_AXIS).linear_combination (CENTER);
+  Real left_point = me->get_bound (LEFT)->relative_coordinate (common, X_AXIS);
 
-  Molecule m;
 
+  
+  Interval iv (left_point, right_point);
+  Stencil m;
+  
   /*
     TODO: use line interface
    */
@@ -55,11 +50,13 @@ Measure_grouping::print (SCM grob)
     }
 
   m.align_to (Y_AXIS, DOWN);
-  return m.smobbed_copy();
+  m.translate_axis (- me->relative_coordinate (common, X_AXIS), X_AXIS);
+  return m.smobbed_copy ();
 }
 
 ADD_INTERFACE (Measure_grouping,"measure-grouping-interface",
-              "indicate groups of beats. Valid choices for 'type are 'bracket and 'triangle.",
+              "This object indicates groups of beats. "
+              "Valid choices for @code{style} are @code{bracket} and @code{triangle}.",
               "thickness style height");