2 span-bar.cc -- implement Span_bar
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "dimensions.hh"
12 #include "paper-def.hh"
13 #include "molecule.hh"
14 #include "align-element.hh"
18 Span_bar::add_bar (Score_element*b)
20 spanning_l_arr_.push (b);
25 Span_bar::do_substitute_element_pointer (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
41 return Interval (0,0);
44 Molecule m = lookup_l ()->bar (type_str_, 40 PT);
46 return m.extent (X_AXIS);
50 Span_bar::do_pre_processing ()
52 Bar::do_pre_processing ();
55 translate_axis (extra_x_off_, X_AXIS);
57 dim_cache_[Y_AXIS].set_empty (false); // a hack to make mark scripts work.
61 Span_bar::do_post_processing ()
63 Bar::do_post_processing ();
67 Span_bar::evaluate_empty ()
69 if (spanning_l_arr_.size () < 1)
71 transparent_b_ = true;
74 if (type_str_.empty_b ())
79 else if (type_str_ == "|:")
83 else if (type_str_ == ":|")
87 else if (type_str_ == ":|:")
94 Span_bar::get_spanned_interval () const
97 for (int i=0; i < spanning_l_arr_.size (); i++)
99 Dimension_cache*common =
100 common_group (spanning_l_arr_[i], Y_AXIS);
102 Real y = spanning_l_arr_[i]->dim_cache_[Y_AXIS].relative_coordinate (common)
103 -dim_cache_[Y_AXIS].relative_coordinate (common);
105 y_int.unite (y + spanning_l_arr_[i]->extent(Y_AXIS));
111 Span_bar::do_height () const
113 return get_spanned_interval ();
117 Span_bar::do_brew_molecule_p () const
119 Interval iv (get_spanned_interval ());
120 Molecule*output = new Molecule;
123 output->add_molecule (lookup_l ()->bar (type_str_, iv.length ()));
124 output->translate_axis (iv.center (), Y_AXIS);
128 warning("Huh? My children deflated (FIXME)");
135 Span_bar::Span_bar ()