lilypond-1.5.10
[lilypond.git] / lily / rhythmic-column-grav.cc
blobe6d5b66c04e618e361dc532fb7b44ce3ab216b0f
1 /*
2 rhythmic-column-grav.cc -- implement Rhythmic_column_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "rhythmic-column-grav.hh"
10 #include "note-head.hh"
11 #include "stem.hh"
12 #include "note-column.hh"
13 #include "script.hh"
14 #include "dot-column.hh"
16 Rhythmic_column_engraver::Rhythmic_column_engraver()
18 stem_l_ =0;
19 ncol_p_=0;
20 dotcol_p_ =0;
24 void
25 Rhythmic_column_engraver::acknowledge_element (Score_elem_info i)
27 if (i.elem_l_->is_type_b (Script::static_name ())
28 && i.req_l_ && i.req_l_->musical ())
30 script_l_arr_.push ((Script*)i.elem_l_->item());
32 else if (i.elem_l_->is_type_b (Stem::static_name()))
34 stem_l_ = (Stem*) i.elem_l_->item();
36 else if (i.elem_l_->is_type_b (Rhythmic_head::static_name ()))
38 Rhythmic_head * r = (Rhythmic_head*)i.elem_l_->item ();
39 if (!ncol_p_)
41 ncol_p_ = new Note_column;
42 announce_element (Score_elem_info (ncol_p_, 0));
44 ncol_p_->add (r);
46 if (r->dots_l_)
48 if (!dotcol_p_)
50 dotcol_p_ = new Dot_column;
51 ncol_p_->set (dotcol_p_);
52 announce_element (Score_elem_info (dotcol_p_, 0));
54 dotcol_p_->add (r);
58 if (ncol_p_)
60 if (stem_l_&& !ncol_p_->stem_l_)
61 ncol_p_->set (stem_l_);
63 for (int i=0; i < script_l_arr_.size(); i++)
65 if (ncol_p_)
66 ncol_p_->add (script_l_arr_[i]);
69 script_l_arr_.clear();
73 void
74 Rhythmic_column_engraver::do_pre_move_processing()
76 if (ncol_p_)
78 if (! ncol_p_->h_shift_b_)
79 // egcs
80 ncol_p_->h_shift_b_ = get_property ("hshift").operator bool ();
81 if (! ncol_p_->dir_)
82 ncol_p_->dir_ =(Direction) int(get_property ("ydirection"));
84 typeset_element (ncol_p_);
85 ncol_p_ =0;
87 if (dotcol_p_)
89 typeset_element (dotcol_p_);
90 dotcol_p_ =0;
94 void
95 Rhythmic_column_engraver::do_post_move_processing()
97 script_l_arr_.clear();
98 stem_l_ =0;
104 IMPLEMENT_IS_TYPE_B1(Rhythmic_column_engraver,Engraver);
105 ADD_THIS_TRANSLATOR(Rhythmic_column_engraver);