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.
17 struct Horizontal_bracket
19 DECLARE_SCHEME_CALLBACK (print
, (SCM
));
20 static bool has_interface (Grob
*);
26 This doesn't look very elegant: should support winged edges.
28 Support texts on the brackets?
30 MAKE_SCHEME_CALLBACK (Horizontal_bracket
, print
, 1);
33 Horizontal_bracket::print (SCM smob
)
35 Grob
*me
= unsmob_grob (smob
);
36 Spanner
*sp
= dynamic_cast<Spanner
*> (me
);
38 extract_grob_set (me
, "columns", gs
);
44 Grob
*cx
= common_refpoint_of_array (gs
, me
, X_AXIS
);
45 cx
= cx
->common_refpoint (sp
->get_bound (LEFT
), X_AXIS
);
46 cx
= cx
->common_refpoint (sp
->get_bound (RIGHT
), X_AXIS
);
48 Interval ext
= gs
.top ()->extent (cx
, X_AXIS
);
49 ext
.unite (gs
[0]->extent (cx
, X_AXIS
));
51 Drul_array
<Real
> edge_height
= robust_scm2interval (me
->get_property ("edge-height"),
54 Drul_array
<Real
> flare
= robust_scm2interval (me
->get_property ("bracket-flare"),
57 Drul_array
<Real
> shorten
= robust_scm2interval (me
->get_property ("shorten-pair"),
60 // Make sure that it points in the correct direction:
61 Real dir
= get_grob_direction (me
);
62 scale_drul (&edge_height
, -dir
);
66 = Tuplet_bracket::make_bracket (me
, Y_AXIS
, Offset (ext
.length (), 0),
67 edge_height
, empty
, flare
, shorten
);
69 b
.translate_axis (ext
[LEFT
] - sp
->get_bound (LEFT
)->relative_coordinate (cx
, X_AXIS
), X_AXIS
);
71 return b
.smobbed_copy ();
74 ADD_INTERFACE (Horizontal_bracket
, "horizontal-bracket-interface",
75 "A horizontal bracket encompassing notes.",
76 "columns bracket-flare shorten-pair edge-height");