X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=lily%2Fmeasure-grouping-spanner.cc;h=f2cd9894749d8c5e2ef831c6f043c2588c32773e;hb=8a5b4b64ac3bc417ad9b7f7fbe53baa73d620fdc;hp=780e77547b679e9bf759b8befd4fb33f7a9b26b6;hpb=05fabaaf86fd44f9bd903f282bb98d343a991e40;p=lilypond.git diff --git a/lily/measure-grouping-spanner.cc b/lily/measure-grouping-spanner.cc index 780e77547b..f2cd989474 100644 --- a/lily/measure-grouping-spanner.cc +++ b/lily/measure-grouping-spanner.cc @@ -1,65 +1,54 @@ -/* - measure-grouping-spanner.cc -- implement Measure_grouping +/* + measure-grouping-spanner.cc -- implement Measure_grouping - source file of the GNU LilyPond music typesetter + source file of the GNU LilyPond music typesetter - (c) 2002--2004 Han-Wen Nienhuys + (c) 2002--2007 Han-Wen Nienhuys +*/ - */ +#include "measure-grouping-spanner.hh" -#include "paper-def.hh" +#include "output-def.hh" #include "spanner.hh" -#include "measure-grouping-spanner.hh" -#include "lookup.hh" +#include "lookup.hh" #include "item.hh" #include "staff-symbol-referencer.hh" MAKE_SCHEME_CALLBACK (Measure_grouping, print, 1); -SCM +SCM Measure_grouping::print (SCM grob) { - Spanner * me = dynamic_cast (unsmob_grob (grob)); - - /* - TODO: robustify. - */ - SCM which = me->get_grob_property ("style"); - Real height = robust_scm2double (me->get_grob_property ("height"), 1); + Spanner *me = dynamic_cast (unsmob_grob (grob)); - 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), - X_AXIS); + SCM which = me->get_property ("style"); + Real height = robust_scm2double (me->get_property ("height"), 1); - 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); + 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 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 - */ + */ if (which == ly_symbol2scm ("bracket")) - { - m = Lookup::bracket (X_AXIS, iv, t, -height, t); - } + m = Lookup::bracket (X_AXIS, iv, t, -height, t); else if (which == ly_symbol2scm ("triangle")) - { - m = Lookup::triangle (iv, t, height); - } + m = Lookup::triangle (iv, t, height); 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.", +ADD_INTERFACE (Measure_grouping, + "This object indicates groups of beats. " + "Valid choices for @code{style} are @code{bracket} and @code{triangle}.", "thickness style height"); -