2 measure-grouping-spanner.cc -- implement Measure_grouping
4 source file of the GNU LilyPond music typesetter
6 (c) 2002--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "paper-def.hh"
12 #include "measure-grouping-spanner.hh"
15 #include "staff-symbol-referencer.hh"
17 MAKE_SCHEME_CALLBACK (Measure_grouping
, print
, 1);
19 Measure_grouping::print (SCM grob
)
21 Spanner
* me
= dynamic_cast<Spanner
*> (unsmob_grob (grob
));
26 SCM which
= me
->get_property ("style");
27 Real height
= robust_scm2double (me
->get_property ("height"), 1);
29 Real t
= Staff_symbol_referencer::line_thickness (me
) * robust_scm2double (me
->get_property ("thickness"), 1);
30 Grob
*common
= me
->get_bound (LEFT
)->common_refpoint (me
->get_bound (RIGHT
),
33 Interval rext
= me
->get_bound (RIGHT
)->extent (common
, X_AXIS
);
36 Real w
=(rext
.is_empty ()
37 ? me
->get_bound (RIGHT
)->relative_coordinate (common
, X_AXIS
)
39 - me
->get_bound (LEFT
)->relative_coordinate (common
, X_AXIS
);
46 TODO: use line interface
48 if (which
== ly_symbol2scm ("bracket"))
50 m
= Lookup::bracket (X_AXIS
, iv
, t
, -height
, t
);
52 else if (which
== ly_symbol2scm ("triangle"))
54 m
= Lookup::triangle (iv
, t
, height
);
57 m
.align_to (Y_AXIS
, DOWN
);
58 return m
.smobbed_copy ();
61 ADD_INTERFACE (Measure_grouping
,"measure-grouping-interface",
62 "This objectt indicates groups of beats. "
63 "Valid choices for @code{style} are @code{bracket} and @code{triangle}.",
64 "thickness style height");