2 horizontal-bracket.cc -- implement Horizontal_bracket
4 source file of the GNU LilyPond music typesetter
6 (c) 2002--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "side-position-interface.hh"
11 #include "pointer-group-interface.hh"
12 #include "directional-element-interface.hh"
13 #include "output-def.hh"
14 #include "staff-symbol-referencer.hh"
15 #include "tuplet-bracket.hh" // ugh.
16 #include "horizontal-bracket.hh" // ugh.
21 This doesn't look very elegant: should support winged edges.
23 Support texts on the brackets?
27 Horizontal_bracket::make_bracket (Grob *me, Grob *common,
28 Link_array<Grob> grobs, Axis a, Direction dir)
30 Axis other = other_axis (a);
32 Grob *cx = common_refpoint_of_array (grobs, common, a);
34 Interval ext = grobs.top ()->extent (cx, a);
35 ext.unite (grobs[0]->extent (cx, a));
37 Drul_array<Real> edge_height = robust_scm2interval (me->get_property ("edge-height"),
39 Drul_array<Real> flare = robust_scm2interval (me->get_property ("bracket-flare"),
41 Drul_array<Real> shorten = robust_scm2interval (me->get_property ("shorten-pair"),
44 // Make sure that it points in the correct direction:
45 scale_drul (&edge_height, Real (-dir));
49 start[a] = ext.length ();
51 = Tuplet_bracket::make_bracket (me, other, start,
52 edge_height, empty, flare, shorten);
54 b.translate_axis (ext[LEFT], a);
59 MAKE_SCHEME_CALLBACK (Horizontal_bracket, print, 1);
61 Horizontal_bracket::print (SCM smob)
63 Grob *me = unsmob_grob (smob);
64 Spanner *sp = dynamic_cast<Spanner *> (me);
66 extract_grob_set (me, "columns", gs);
73 Grob *cx = me->common_refpoint (sp->get_bound (LEFT), X_AXIS);
74 cx = cx->common_refpoint (sp->get_bound (RIGHT), X_AXIS);
76 Stencil b = make_bracket (me, cx, gs, X_AXIS, get_grob_direction (me));
78 b.translate_axis (- sp->get_bound (LEFT)->relative_coordinate (cx, X_AXIS), X_AXIS);
80 return b.smobbed_copy ();
83 ADD_INTERFACE (Horizontal_bracket, "horizontal-bracket-interface",
84 "A horizontal bracket encompassing notes.",