X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fmeasure-grouping-spanner.cc;h=48d00ded04f503feb57bfe52377e2d199c2b851f;hb=5b4b0d6e9a197e8f9eb085b7c2ad78b8be3e5cfc;hp=55c76ae277296ef44bf0bc1143eb9779e04cf971;hpb=367ed56704b509885a4928003b5aadcd5fa7820a;p=lilypond.git diff --git a/lily/measure-grouping-spanner.cc b/lily/measure-grouping-spanner.cc index 55c76ae277..48d00ded04 100644 --- a/lily/measure-grouping-spanner.cc +++ b/lily/measure-grouping-spanner.cc @@ -1,53 +1,59 @@ -/* -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 Han-Wen Nienhuys + (c) 2002--2008 Han-Wen Nienhuys +*/ - */ -#include "paper-def.hh" -#include "spanner.hh" #include "measure-grouping-spanner.hh" -#include "lookup.hh" + +#include "output-def.hh" +#include "spanner.hh" +#include "lookup.hh" #include "item.hh" +#include "staff-symbol-referencer.hh" -MAKE_SCHEME_CALLBACK (Measure_grouping, brew_molecule, 1); -SCM -Measure_grouping::brew_molecule (SCM grob) +MAKE_SCHEME_CALLBACK (Measure_grouping, print, 1); +SCM +Measure_grouping::print (SCM grob) { - Spanner * me = dynamic_cast (unsmob_grob (grob)); + Spanner *me = dynamic_cast (unsmob_grob (grob)); - /* - TODO: robustify. - */ - SCM which = me->get_grob_property ("type"); - 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), - X_AXIS); - Real w = me->get_bound (LEFT)->relative_coordinate (common, X_AXIS) - - me->get_bound (RIGHT)->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, 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); - return m.smobbed_copy(); + m.align_to (Y_AXIS, DOWN); + 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.", - "thickness height"); +ADD_INTERFACE (Measure_grouping, + "This object indicates groups of beats. Valid choices for" + " @code{style} are @code{bracket} and @code{triangle}.", + + /* properties */ + "thickness " + "style " + "height " + ); -