2 horizontal-bracket.cc -- implement Horizontal_bracket
4 source file of the GNU LilyPond music typesetter
6 (c) 2002--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
9 #include "horizontal-bracket.hh"
12 #include "side-position-interface.hh"
13 #include "pointer-group-interface.hh"
14 #include "directional-element-interface.hh"
15 #include "output-def.hh"
16 #include "staff-symbol-referencer.hh"
17 #include "tuplet-bracket.hh"
18 #include "axis-group-interface.hh"
24 Horizontal_bracket::make_bracket (Grob
*me
,
26 Axis a
, Direction dir
)
28 Drul_array
<Real
> edge_height
= robust_scm2interval (me
->get_property ("edge-height"),
30 Drul_array
<Real
> flare
= robust_scm2interval (me
->get_property ("bracket-flare"),
32 Drul_array
<Real
> shorten
= robust_scm2interval (me
->get_property ("shorten-pair"),
36 // Make sure that it points in the correct direction:
37 scale_drul (&edge_height
, Real (-dir
));
43 Drul_array
<bool> connect_to_other
=
44 robust_scm2booldrul (me
->get_property ("connect-to-neighbor"),
45 Drul_array
<bool> (false, false));
50 if (connect_to_other
[d
])
57 while (flip (&d
) != LEFT
);
60 ugh, Tuplet_bracket should use Horizontal_bracket, not the other way around.
62 return Tuplet_bracket::make_bracket (me
, other_axis (a
), start
,
63 edge_height
, empty
, flare
, shorten
);
68 Horizontal_bracket::make_enclosing_bracket (Grob
*me
, Grob
*refpoint
,
70 Axis a
, Direction dir
)
72 Grob
*common
= common_refpoint_of_array (grobs
, refpoint
, a
);
73 Interval ext
= Axis_group_interface::relative_group_extent (grobs
, common
, a
);
77 me
->programming_error ("Can't enclose empty extents with bracket");
82 Stencil b
= make_bracket (me
, ext
.length (), a
, dir
);
83 b
.translate_axis (ext
[LEFT
] - refpoint
->relative_coordinate (common
, a
), a
);
92 Support texts on the brackets?
94 MAKE_SCHEME_CALLBACK (Horizontal_bracket
, print
, 1);
96 Horizontal_bracket::print (SCM smob
)
98 Spanner
*me
= unsmob_spanner (smob
);
99 extract_grob_set (me
, "columns", gs
);
101 vector
<Grob
*> enclosed
= gs
;
111 Item
*b
= me
->get_bound (d
);
112 if (b
->break_status_dir ())
113 enclosed
.push_back (b
);
115 while (flip (&d
) != LEFT
);
117 Stencil b
= make_enclosing_bracket (me
, me
, enclosed
, X_AXIS
, get_grob_direction (me
));
118 return b
.smobbed_copy ();
121 ADD_INTERFACE (Horizontal_bracket
,
122 "A horizontal bracket encompassing notes.",
129 "connect-to-neighbor "