2 measure-grouping-spanner.cc -- implement Measure_grouping
4 source file of the GNU LilyPond music typesetter
6 (c) 2002--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "paper-def.hh"
11 #include "measure-grouping-spanner.hh"
15 MAKE_SCHEME_CALLBACK (Measure_grouping
, brew_molecule
, 1);
17 Measure_grouping::brew_molecule (SCM grob
)
19 Spanner
* me
= dynamic_cast<Spanner
*> (unsmob_grob (grob
));
24 SCM which
= me
->get_grob_property ("style");
25 SCM thick
= me
->get_grob_property ("thickness");
26 SCM height
= me
->get_grob_property ("height");
28 Real t
= me
->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")) * gh_scm2double (thick
);
29 Grob
*common
= me
->get_bound(LEFT
)->common_refpoint (me
->get_bound (RIGHT
),
32 Interval rext
= me
->get_bound (RIGHT
)->extent (common
, X_AXIS
);
35 Real w
=(rext
.empty_b()
36 ? me
->get_bound (RIGHT
)->relative_coordinate (common
, X_AXIS
)
38 - me
->get_bound (LEFT
)->relative_coordinate (common
, X_AXIS
);
43 if (which
== ly_symbol2scm ("bracket"))
45 m
= Lookup::bracket (X_AXIS
, iv
, t
,-gh_scm2double (height
));
47 else if (which
== ly_symbol2scm ("triangle"))
49 m
= Lookup::triangle (iv
, t
, gh_scm2double (height
));
52 m
.align_to (Y_AXIS
, DOWN
);
53 return m
.smobbed_copy();
56 ADD_INTERFACE (Measure_grouping
,"measure-grouping-interface",
57 "indicate groups of beats. Valid choices for 'type are 'bracket and 'triangle.",
58 "thickness style height");