2 span-bar.cc -- implement Span_bar
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "dimensions.hh"
13 #include "paper-def.hh"
14 #include "molecule.hh"
15 #include "align-element.hh"
18 Span_bar::add_bar (Bar*b)
20 spanning_l_arr_.push (b);
25 Span_bar::do_substitute_dependency (Score_element*o, Score_element*n)
27 spanning_l_arr_.unordered_substitute (o, n);
31 Span_bar::set_align (Align_element *a)
37 Span_bar::do_width () const
39 return lookup_l ()->bar (type_str_, 40 PT).dim_.x (); // ugh
43 Span_bar::do_pre_processing ()
45 Bar::do_pre_processing ();
51 Span_bar::do_post_processing ()
53 Bar::do_post_processing ();
57 Span_bar::evaluate_empty ()
59 if (spanning_l_arr_.size () < 1)
61 transparent_b_ = true;
64 if (type_str_.empty_b ())
69 else if (type_str_ == "|:")
73 else if (type_str_ == ":|")
77 else if (type_str_ == ":|:")
84 Span_bar::get_bar_sym (Real dy) const
86 if (dy < paper ()->staffheight_f () / 2)
89 return lookup_l ()->bar (type_str_, dy);
93 Span_bar::do_brew_molecule_p () const
96 for (int i=0; i < spanning_l_arr_.size (); i++)
98 Dimension_cache*common =
99 common_group (spanning_l_arr_[i], Y_AXIS);
101 Real y = spanning_l_arr_[i]->dim_cache_[Y_AXIS].relative_coordinate (common)
102 -dim_cache_[Y_AXIS].relative_coordinate (common);
104 y_int.unite (y + spanning_l_arr_[i]->extent(Y_AXIS));
107 Atom s = get_bar_sym (y_int.length ());
108 Molecule*output = new Molecule (Atom (s));
109 output->translate_axis (y_int.center (), Y_AXIS);
115 Span_bar::Span_bar ()