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 Molecule m = lookup_l ()->bar (type_str_, 40 PT);
41 return m.extent (X_AXIS);
45 Span_bar::do_pre_processing ()
47 Bar::do_pre_processing ();
53 Span_bar::do_post_processing ()
55 Bar::do_post_processing ();
59 Span_bar::evaluate_empty ()
61 if (spanning_l_arr_.size () < 1)
63 transparent_b_ = true;
66 if (type_str_.empty_b ())
71 else if (type_str_ == "|:")
75 else if (type_str_ == ":|")
79 else if (type_str_ == ":|:")
86 Span_bar::get_bar_sym (Real dy) const
88 if (dy < paper ()->staffheight_f () / 2)
91 return lookup_l ()->bar (type_str_, dy);
95 Span_bar::do_brew_molecule_p () const
98 for (int i=0; i < spanning_l_arr_.size (); i++)
100 Dimension_cache*common =
101 common_group (spanning_l_arr_[i], Y_AXIS);
103 Real y = spanning_l_arr_[i]->dim_cache_[Y_AXIS].relative_coordinate (common)
104 -dim_cache_[Y_AXIS].relative_coordinate (common);
106 y_int.unite (y + spanning_l_arr_[i]->extent(Y_AXIS));
109 Molecule*output = new Molecule (get_bar_sym (y_int.length ()));
110 output->translate_axis (y_int.center (), Y_AXIS);
116 Span_bar::Span_bar ()