2 span-bar.cc -- implement Span_bar
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
10 #include "span-bar.hh"
13 #include "paper-def.hh"
14 #include "molecule.hh"
15 #include "vertical-align-elem.hh"
20 spanning_l_arr_
.push (b
);
27 Span_bar::do_substitute_dependency (Score_elem
*o
, Score_elem
*n
)
29 spanning_l_arr_
.unordered_substitute (o
, n
);
34 Span_bar::set (Vertical_align_element
*a
)
41 Span_bar::do_width() const
43 return paper()->lookup_l ()->bar (type_str_
, 40 PT
).dim_
.x (); // ugh
47 Span_bar::do_pre_processing()
49 Bar::do_pre_processing ();
51 if (spanning_l_arr_
.size() < 1)
53 transparent_b_
= true;
56 if (type_str_
.empty_b ())
61 else if (type_str_
== "|:")
65 else if (type_str_
== ":|")
72 Span_bar::get_bar_sym (Real dy
) const
74 return paper()->lookup_l ()->bar (type_str_
, dy
);
79 Span_bar::brew_molecule_p() const
82 for (int i
=0; i
< spanning_l_arr_
.size(); i
++)
84 Axis_group_element
*common
=
85 common_group (spanning_l_arr_
[i
], Y_AXIS
);
87 Real y
= spanning_l_arr_
[i
]->relative_coordinate (common
, Y_AXIS
)
88 -relative_coordinate (common
,Y_AXIS
);
90 y_int
.unite (y
+ spanning_l_arr_
[i
]->height());
93 Atom s
= get_bar_sym (y_int
.length());
94 Molecule
*output
= new Molecule (Atom (s
));
95 output
->translate_axis (y_int
.center(), Y_AXIS
);
100 IMPLEMENT_IS_TYPE_B1(Span_bar
,Bar
);