X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fmeasure-grouping-spanner.cc;h=052aae12ac6071a5799de95728f7bf0e33efa4b2;hb=97a0169312a260933246ab224e4f8b0969871dd5;hp=20c8cd34942ca5ecd71baf50c73ffa9966219864;hpb=b1323f33e9aa4b9eea05eefb8755c907d4d762d4;p=lilypond.git diff --git a/lily/measure-grouping-spanner.cc b/lily/measure-grouping-spanner.cc index 20c8cd3494..052aae12ac 100644 --- a/lily/measure-grouping-spanner.cc +++ b/lily/measure-grouping-spanner.cc @@ -1,66 +1,70 @@ -/* - measure-grouping-spanner.cc -- implement Measure_grouping +/* + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 2002--2015 Han-Wen Nienhuys - (c) 2002--2004 Han-Wen Nienhuys + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - */ + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . +*/ -#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, print, 1); -SCM +SCM Measure_grouping::print (SCM grob) { - Spanner * me = dynamic_cast (unsmob_grob (grob)); + Spanner *me = unsmob (grob); - /* - TODO: robustify. - */ 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_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); + 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); + 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); - } - else if (which == ly_symbol2scm ("triangle")) - { - m = Lookup::triangle (iv, t, height); - } + */ + if (scm_is_eq (which, ly_symbol2scm ("bracket"))) + m = Lookup::bracket (X_AXIS, iv, t, -height, t); + else if (scm_is_eq (which, ly_symbol2scm ("triangle"))) + 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", - "This objectt indicates groups of beats. " - "Valid choices for @code{style} are @code{bracket} and @code{triangle}.", - "thickness style 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 " + ); -