lilypond-0.1.37
[lilypond.git] / lily / bar-column-grav.cc
blobe4219fdb38f6b3768d9789839bc926767fef434c
1 /*
2 bar-column-grav.cc -- implement Bar_column_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
10 #include "bar-column-grav.hh"
11 #include "bar-column.hh"
12 #include "request.hh"
13 #include "script.hh"
14 #include "bar.hh"
16 Bar_column_engraver::Bar_column_engraver()
18 bar_l_ =0;
19 barcol_p_ =0;
23 void
24 Bar_column_engraver::acknowledge_element (Score_elem_info info)
26 if (info.elem_l_->is_type_b (Script::static_name())
27 && info.req_l_->command()
28 && info.origin_grav_l_arr_.size() == 1)
30 script_l_arr_.push ((Script*)info.elem_l_->item());
32 else if (info.origin_grav_l_arr_.size() == 1
33 && info.elem_l_->is_type_b (Bar::static_name()))
34 bar_l_ = (Bar*)info.elem_l_->item();
36 if (bar_l_ && !barcol_p_)
38 barcol_p_ = new Bar_column;
39 barcol_p_->breakable_b_ =true;
40 barcol_p_->break_priority_i_ = bar_l_ -> break_priority_i_;
41 barcol_p_->set_bar (bar_l_);
43 announce_element (Score_elem_info (barcol_p_, 0));
46 if (barcol_p_)
48 for (int i=0; i < script_l_arr_.size(); i++)
50 script_l_arr_[i]->breakable_b_ = true;
51 script_l_arr_[i]->break_priority_i_ = barcol_p_-> break_priority_i_;
52 barcol_p_->add (script_l_arr_[i]);
54 script_l_arr_.clear();
58 void
59 Bar_column_engraver::do_pre_move_processing()
61 if (barcol_p_)
63 typeset_element (barcol_p_);
64 barcol_p_ =0;
68 void
69 Bar_column_engraver::do_post_move_processing()
71 script_l_arr_.clear();
72 bar_l_ =0;
75 IMPLEMENT_IS_TYPE_B1(Bar_column_engraver, Engraver);
76 ADD_THIS_TRANSLATOR(Bar_column_engraver);