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"
21 spanning_l_arr_.push (b);
28 Span_bar::do_substitute_dependency (Score_elem*o, Score_elem*n)
31 if (o->is_type_b (Bar::static_name()))
32 bold = (Bar*)o->item();
38 if (n && n->is_type_b (Bar::static_name()))
44 spanning_l_arr_.substitute (bold , b);
49 Span_bar::set (Vertical_align_element *a)
56 Span_bar::do_width() const
58 return paper()->lookup_l ()->bar (type_str_, 40 PT).dim.x (); // ugh
61 Span_bar::do_pre_processing()
63 if (spanning_l_arr_.size() < 1)
65 transparent_b_ = true;
71 type_str_ = spanning_l_arr_[0]->type_str_;
77 else if (type_str_ == "|:")
81 else if (type_str_ == ":|")
89 Span_bar::get_bar_sym (Real dy) const
91 return paper()->lookup_l ()->bar (type_str_, dy);
96 Span_bar::brew_molecule_p() const
99 for (int i=0; i < spanning_l_arr_.size(); i++)
101 Axis_group_element *common =
102 common_group (spanning_l_arr_[i], Y_AXIS);
104 Real y = spanning_l_arr_[i]->relative_coordinate (common, Y_AXIS)
105 -relative_coordinate (common,Y_AXIS);
107 y_int.unite (y + spanning_l_arr_[i]->height());
110 Symbol s = get_bar_sym (y_int.length());
111 Molecule*output = new Molecule (Atom (s));
112 output->translate (y_int[-1], Y_AXIS);
117 IMPLEMENT_IS_TYPE_B1(Span_bar,Bar);