1 /*
2 This file is part of LilyPond, the GNU music typesetter.
3
4 Copyright (C) 2002--2020 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "horizontal-bracket.hh"
21
22 #include "bracket.hh"
23 #include "stencil.hh"
24 #include "pointer-group-interface.hh"
25 #include "directional-element-interface.hh"
26 #include "spanner.hh"
27 #include "item.hh"
28
29 using std::vector;
30
31 MAKE_SCHEME_CALLBACK (Horizontal_bracket, print, 1);
32 SCM
print(SCM smob)33 Horizontal_bracket::print (SCM smob)
34 {
35 Spanner *me = unsmob<Spanner> (smob);
36 extract_grob_set (me, "columns", gs);
37
38 vector<Grob *> enclosed = gs;
39 if (!gs.size ())
40 {
41 me->suicide ();
42 return SCM_EOL;
43 }
44
45 for (LEFT_and_RIGHT (d))
46 {
47 Item *b = me->get_bound (d);
48 if (b->break_status_dir ())
49 enclosed.push_back (b);
50 }
51
52 Stencil b = Bracket::make_enclosing_bracket (me, me, enclosed, X_AXIS,
53 get_grob_direction (me));
54 return b.smobbed_copy ();
55 }
56
57 ADD_INTERFACE (Horizontal_bracket,
58 "A horizontal bracket encompassing notes.",
59
60 /* properties */
61 "bracket-flare "
62 "bracket-text "
63 "columns "
64 "dashed-edge "
65 "edge-height "
66 "shorten-pair "
67 "connect-to-neighbor "
68 );
69
70