lilypond-1.3.7
[lilypond.git] / lily / span-bar-grav.cc
blobbacdcb36240054fd46f4ce38b6d08d81b75a78fa
1 /*
2 span-bar-grav.cc -- implement Span_bar_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "span-bar.hh"
10 #include "span-bar-grav.hh"
11 #include "vertical-align-spanner.hh"
13 Span_bar_engraver::Span_bar_engraver()
15 spanbar_p_ =0;
16 valign_l_ =0;
19 Span_bar*
20 Span_bar_engraver::get_span_bar_p() const
22 return new Span_bar;
26 void
27 Span_bar_engraver::do_creation_processing ()
31 void
32 Span_bar_engraver::do_removal_processing ()
36 void
37 Span_bar_engraver::acknowledge_element (Score_elem_info i)
39 int depth = i.origin_grav_l_arr_.size();
40 if (depth > 1
41 && i.elem_l_->is_type_b (Bar::static_name()))
43 bar_l_arr_.push ((Bar*)i.elem_l_->item());
45 if (bar_l_arr_.size() >= 2 && !spanbar_p_)
47 spanbar_p_ = get_span_bar_p();
48 announce_element (Score_elem_info (spanbar_p_,0));
49 spanbar_p_-> type_str_ = bar_l_arr_[0]->type_str_;
52 else if (i.elem_l_->is_type_b (Vertical_align_spanner::static_name())
53 && i.origin_grav_l_arr_.size() <= 2)
55 valign_l_ = (Vertical_align_spanner*)i.elem_l_->spanner();
59 void
60 Span_bar_engraver::do_pre_move_processing()
62 if (spanbar_p_)
64 for (int i=0; i < bar_l_arr_.size() ; i++)
65 spanbar_p_->add (bar_l_arr_[i]);
66 spanbar_p_->set (valign_l_);
67 typeset_element (spanbar_p_);
68 spanbar_p_ =0;
70 bar_l_arr_.set_size (0);
74 IMPLEMENT_IS_TYPE_B1(Span_bar_engraver,Engraver);
75 ADD_THIS_TRANSLATOR(Span_bar_engraver);