source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "span-bar.hh"
#include "lookup.hh"
#include "dimensions.hh"
-#include "atom.hh"
#include "paper-def.hh"
#include "molecule.hh"
#include "align-element.hh"
+#include "warn.hh"
void
-Span_bar::add_bar (Bar*b)
+Span_bar::add_bar (Score_element*b)
{
spanning_l_arr_.push (b);
add_dependency (b);
}
void
-Span_bar::do_substitute_dependency (Score_element*o, Score_element*n)
+Span_bar::do_substitute_element_pointer (Score_element*o, Score_element*n)
{
spanning_l_arr_.unordered_substitute (o, n);
}
Bar::do_pre_processing ();
evaluate_empty ();
+ translate_axis (extra_x_off_, X_AXIS);
+
+ dim_cache_[Y_AXIS].set_empty (false); // a hack to make mark scripts work.
}
void
}
}
-Molecule
-Span_bar::get_bar_sym (Real dy) const
-{
- if (dy < paper ()->staffheight_f () / 2)
- return Atom ();
-
- return lookup_l ()->bar (type_str_, dy);
-}
-
-Molecule*
-Span_bar::do_brew_molecule_p () const
+Interval
+Span_bar::get_spanned_interval () const
{
Interval y_int;
for (int i=0; i < spanning_l_arr_.size (); i++)
y_int.unite (y + spanning_l_arr_[i]->extent(Y_AXIS));
}
+ return y_int;
+}
+
+Interval
+Span_bar::do_height () const
+{
+ return get_spanned_interval ();
+}
- Molecule*output = new Molecule (get_bar_sym (y_int.length ()));
- output->translate_axis (y_int.center (), Y_AXIS);
+Molecule*
+Span_bar::do_brew_molecule_p () const
+{
+ Interval iv (get_spanned_interval ());
+ Molecule*output = new Molecule;
+ if (!iv.empty_b())
+ {
+ output->add_molecule (lookup_l ()->bar (type_str_, iv.length ()));
+ output->translate_axis (iv.center (), Y_AXIS);
+ }
+ else
+ {
+ warning("Huh? My children deflated (FIXME)");
+ }
return output;
}
Span_bar::Span_bar ()
{
type_str_ = "";
+ extra_x_off_ = 0.0;
}