2
horizontal-bracket.cc -- implement Horizontal_bracket
2
horizontal-bracket.cc -- implement Horizontal_bracket
4
4
source file of the GNU LilyPond music typesetter
6
(c) 2002--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
6
(c) 2002--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
9
#include "horizontal-bracket.hh"
10
12
#include "side-position-interface.hh"
12
#include "group-interface.hh"
13
#include "pointer-group-interface.hh"
13
14
#include "directional-element-interface.hh"
14
#include "paper-def.hh"
15
#include "output-def.hh"
15
16
#include "staff-symbol-referencer.hh"
17
struct Horizontal_bracket
19
DECLARE_SCHEME_CALLBACK (print, (SCM));
20
static bool has_interface (Grob*);
17
#include "tuplet-bracket.hh"
18
#include "axis-group-interface.hh"
22
Horizontal_bracket::make_bracket (Grob *me,
24
Axis a, Direction dir)
26
Drul_array<Real> edge_height = robust_scm2interval (me->get_property ("edge-height"),
28
Drul_array<Real> flare = robust_scm2interval (me->get_property ("bracket-flare"),
30
Drul_array<Real> shorten = robust_scm2interval (me->get_property ("shorten-pair"),
33
// Make sure that it points in the correct direction:
34
scale_drul (&edge_height, Real (-dir));
41
ugh, Tuplet_bracket should use Horizontal_bracket, not the other way around.
43
return Tuplet_bracket::make_bracket (me, other_axis (a), start,
44
edge_height, empty, flare, shorten);
49
Horizontal_bracket::make_enclosing_bracket (Grob *me, Grob *refpoint,
51
Axis a, Direction dir)
53
Grob *common = common_refpoint_of_array (grobs, refpoint, a);
54
Interval ext = Axis_group_interface::relative_group_extent (grobs, common, a);
56
Stencil b = make_bracket (me, ext.length(), a, dir);
57
b.translate_axis (ext[LEFT] - refpoint->relative_coordinate (common, a), a);
27
This doesn't look very elegant: should support winged edges.
29
66
Support texts on the brackets?
31
69
MAKE_SCHEME_CALLBACK (Horizontal_bracket, print, 1);
34
71
Horizontal_bracket::print (SCM smob)
36
Grob * me = unsmob_grob (smob);
37
Spanner *sp = dynamic_cast<Spanner*> (me);
38
Link_array<Grob> gs = Pointer_group_interface__extract_grobs (me,(Grob*)0, "columns");
73
Grob *me = unsmob_grob (smob);
74
extract_grob_set (me, "columns", gs);
45
Grob * cx = common_refpoint_of_array (gs, me, X_AXIS);
46
cx = cx->common_refpoint (sp->get_bound (LEFT), X_AXIS);
47
cx = cx->common_refpoint (sp->get_bound (RIGHT),X_AXIS);
49
Interval ext = gs.top ()->extent (cx, X_AXIS);
50
ext.unite (gs[0]->extent (cx, X_AXIS));
52
Direction d = get_grob_direction (me);
54
Real thickness = Staff_symbol_referencer::line_thickness (me);
55
thickness *= robust_scm2double (me->get_property ("thickness"), 1.0);
57
Stencil b = Lookup::bracket (X_AXIS, ext, thickness, - d* 1.0, thickness/2);
59
b.translate_axis ( - sp->get_bound (LEFT)->relative_coordinate (cx, X_AXIS), X_AXIS);
61
return b.smobbed_copy ();
81
Stencil b = make_enclosing_bracket (me, me, gs, X_AXIS, get_grob_direction (me));
82
return b.smobbed_copy ();
64
ADD_INTERFACE (Horizontal_bracket,"horizontal-bracket-interface",
65
"A horizontal bracket encompassing notes.",
66
"thickness columns direction");
85
ADD_INTERFACE (Horizontal_bracket,
87
"horizontal-bracket-interface",
88
"A horizontal bracket encompassing notes.",