2 note-column-reg.cc -- implement Note_column_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
9 #include "note-column-grav.hh"
10 #include "note-head.hh"
12 #include "note-column.hh"
14 #include "rest-column.hh"
17 Note_column_engraver::acceptable_elem_b(Score_elem const*elem_C)const
19 char const*nC = elem_C->name();
20 return (nC == Script::static_name() || nC == Note_head::static_name()
21 || nC == Stem::static_name());
24 Note_column_engraver::note_col_l()
27 ncol_p_ = new Note_column;
28 announce_element(Score_elem_info(ncol_p_, 0));
34 Note_column_engraver::rest_col_l()
37 restcol_p_ = new Rest_column;
38 announce_element(Score_elem_info(restcol_p_,0));
44 Note_column_engraver::acknowledge_element(Score_elem_info i)
46 if (!acceptable_elem_b(i.elem_l_))
50 char const*nC = i.elem_l_->name();
52 if (nC == Script::static_name() && i.req_l_ && i.req_l_->musical()) {
53 script_l_arr_.push((Script*)i.elem_l_->item());
54 } else if (nC == Note_head::static_name()) {
55 Note_head * h_l = (Note_head*)i.elem_l_->item();
57 rest_col_l()->add(h_l);
59 note_col_l()->add(h_l);
61 } else if (nC == Stem::static_name()){
62 stem_l_ = (Stem*)i.elem_l_->item();
65 if ( ncol_p_ || restcol_p_ ) {
67 if (restcol_p_&& !restcol_p_->stem_l_)
68 restcol_p_->set (stem_l_ );
69 if (ncol_p_ && !ncol_p_->stem_l_)
70 ncol_p_->set(stem_l_);
74 for (int i=0; i < script_l_arr_.size(); i++) {
76 restcol_p_->add(script_l_arr_[i]);
78 ncol_p_->add(script_l_arr_[i]);
81 script_l_arr_.clear();
87 Note_column_engraver::do_pre_move_processing()
90 if (! ncol_p_->h_shift_b_)
91 ncol_p_->h_shift_b_ = h_shift_b_;
92 if (! ncol_p_->dir_i_ )
93 ncol_p_->dir_i_ = dir_i_;
95 typeset_element(ncol_p_);
99 if (! restcol_p_->dir_i_ )
100 restcol_p_->dir_i_ = dir_i_;
102 typeset_element(restcol_p_);
108 Note_column_engraver::do_post_move_processing()
110 script_l_arr_.clear();
115 Note_column_engraver::set_feature(Feature i)
117 if (i.type_ == "vdir")
119 if (i.type_ == "hshift")
120 h_shift_b_ = (bool)(int)i.value_;
123 Note_column_engraver::Note_column_engraver()
130 do_post_move_processing();
134 IMPLEMENT_IS_TYPE_B1(Note_column_engraver,Engraver);
135 ADD_THIS_ENGRAVER(Note_column_engraver);