X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fmeasure-grouping-spanner.cc;h=62c7c287ab0d3148a40310aca28feab2dcd621f9;hb=feb0b96b015c19f2c215326689924acabce0c9a5;hp=fb9da592c95416982ccad332b99cb4400e435ba8;hpb=4f7187ac9efe404e0c5653fde88ebe972340e9c6;p=lilypond.git diff --git a/lily/measure-grouping-spanner.cc b/lily/measure-grouping-spanner.cc index fb9da592c9..62c7c287ab 100644 --- a/lily/measure-grouping-spanner.cc +++ b/lily/measure-grouping-spanner.cc @@ -1,60 +1,66 @@ /* -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--2003 Han-Wen Nienhuys + (c) 2002--2004 Han-Wen Nienhuys */ + #include "paper-def.hh" #include "spanner.hh" #include "measure-grouping-spanner.hh" #include "lookup.hh" #include "item.hh" +#include "staff-symbol-referencer.hh" -MAKE_SCHEME_CALLBACK (Measure_grouping, brew_molecule, 1); +MAKE_SCHEME_CALLBACK (Measure_grouping, print, 1); SCM -Measure_grouping::brew_molecule (SCM grob) +Measure_grouping::print (SCM grob) { Spanner * me = dynamic_cast (unsmob_grob (grob)); /* TODO: robustify. */ - SCM which = me->get_grob_property ("style"); - SCM thick = me->get_grob_property ("thickness"); - SCM height = me->get_grob_property ("height"); + SCM which = me->get_property ("style"); + Real height = robust_scm2double (me->get_property ("height"), 1); - Real t = me->get_paper ()->get_var ("linethickness") * gh_scm2double (thick); - 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.empty_b() + 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); - Molecule m; + Stencil m; + + /* + TODO: use line interface + */ if (which == ly_symbol2scm ("bracket")) { - m = Lookup::bracket (X_AXIS, iv, t,-gh_scm2double (height)); + m = Lookup::bracket (X_AXIS, iv, t, -height, t); } else if (which == ly_symbol2scm ("triangle")) { - m = Lookup::triangle (iv, t, gh_scm2double (height)); + m = Lookup::triangle (iv, t, height); } m.align_to (Y_AXIS, DOWN); - return m.smobbed_copy(); + return m.smobbed_copy (); } ADD_INTERFACE (Measure_grouping,"measure-grouping-interface", - "indicate groups of beats. Valid choices for 'type are 'bracket and 'triangle.", + "This objectt indicates groups of beats. " + "Valid choices for @code{style} are @code{bracket} and @code{triangle}.", "thickness style height");