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)
34 Score_element * e = dynamic_cast<Score_element*>(a);
35 Item * i = dynamic_cast<Item*> (e);
36 e = dynamic_cast<Score_element*> (a);
37 i = dynamic_cast<Item*>(e);
41 Span_bar::do_width () const
43 Molecule m = lookup_l ()->bar (type_str_, 40 PT);
45 return m.extent (X_AXIS);
49 Span_bar::do_pre_processing ()
51 Bar::do_pre_processing ();
54 translate_axis (extra_x_off_, X_AXIS);
56 dim_cache_[Y_AXIS].set_empty (false); // a hack to make mark scripts work.
60 Span_bar::do_post_processing ()
62 Bar::do_post_processing ();
66 Span_bar::evaluate_empty ()
68 if (spanning_l_arr_.size () < 1)
70 set_elt_property (transparent_scm_sym, SCM_BOOL_T);
73 if (type_str_.empty_b ())
75 set_elt_property (transparent_scm_sym, SCM_BOOL_T);
78 else if (type_str_ == "|:")
82 else if (type_str_ == ":|")
86 else if (type_str_ == ":|:")
93 Span_bar::get_spanned_interval () 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));
110 Span_bar::do_height () const
112 return get_spanned_interval ();
116 Span_bar::do_brew_molecule_p () const
118 Interval iv (get_spanned_interval ());
119 Molecule*output = new Molecule;
122 output->add_molecule (lookup_l ()->bar (type_str_, iv.length ()));
123 output->translate_axis (iv.center (), Y_AXIS);
127 warning("Huh? My children deflated (FIXME)");
134 Span_bar::Span_bar ()