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
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 ();
50 translate_axis (extra_x_off_, X_AXIS);
52 dim_cache_[Y_AXIS].set_empty (false); // a hack to make mark scripts work.
56 Span_bar::do_post_processing ()
58 Bar::do_post_processing ();
62 Span_bar::evaluate_empty ()
64 if (spanning_l_arr_.size () < 1)
66 transparent_b_ = true;
69 if (type_str_.empty_b ())
74 else if (type_str_ == "|:")
78 else if (type_str_ == ":|")
82 else if (type_str_ == ":|:")
89 Span_bar::get_spanned_interval () const
92 for (int i=0; i < spanning_l_arr_.size (); i++)
94 Dimension_cache*common =
95 common_group (spanning_l_arr_[i], Y_AXIS);
97 Real y = spanning_l_arr_[i]->dim_cache_[Y_AXIS].relative_coordinate (common)
98 -dim_cache_[Y_AXIS].relative_coordinate (common);
100 y_int.unite (y + spanning_l_arr_[i]->extent(Y_AXIS));
106 Span_bar::do_height () const
108 return get_spanned_interval ();
112 Span_bar::do_brew_molecule_p () const
114 Interval iv (get_spanned_interval ());
115 Molecule*output = new Molecule;
118 output->add_molecule (lookup_l ()->bar (type_str_, iv.length ()));
119 output->translate_axis (iv.center (), Y_AXIS);
123 warning("Huh? My children deflated (FIXME)");
130 Span_bar::Span_bar ()