lilypond-1.3.12
[lilypond.git] / lily / vertical-align-grav.cc
blob8024ab5a50bd75b076b119750170895310efdd24
1 /*
2 vertical-align-grav.cc -- implement Vertical_align_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "p-col.hh"
10 #include "vertical-align-grav.hh"
11 #include "vertical-align-spanner.hh"
12 #include "vertical-group-elem.hh"
14 Vertical_align_engraver::Vertical_align_engraver()
16 valign_p_ =0;
19 void
20 Vertical_align_engraver::do_creation_processing()
22 valign_p_ =new Vertical_align_spanner;
23 valign_p_->set_bounds(LEFT,get_staff_info().command_pcol_l ());
24 announce_element (Score_elem_info (valign_p_ , 0));
27 void
28 Vertical_align_engraver::do_removal_processing()
30 valign_p_->set_bounds(RIGHT,get_staff_info().command_pcol_l ());
31 typeset_element (valign_p_);
32 valign_p_ =0;
35 void
36 Vertical_align_engraver::acknowledge_element (Score_elem_info i)
38 if (i.origin_grav_l_arr_.size() == 2 &&
39 i.elem_l_->is_type_b (Vertical_group_element::static_name()) &&
40 !i.elem_l_->axis_group_l_a_[Y_AXIS])
42 assert (!valign_p_->contains_b (i.elem_l_));
44 valign_p_->add (i.elem_l_);
49 IMPLEMENT_IS_TYPE_B1(Vertical_align_engraver, Engraver);
50 ADD_THIS_TRANSLATOR(Vertical_align_engraver);