2 note-column-reg.cc -- implement Note_column_register
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
9 #include "note-column-reg.hh"
10 #include "notehead.hh"
12 #include "note-column.hh"
14 #include "rest-column.hh"
17 Note_column_register::acceptable_elem_b(Score_elem const*elem_C)const
19 char const*nC = elem_C->name();
20 return (nC == Script::static_name() || nC == Notehead::static_name()
21 || nC == Stem::static_name());
24 Note_column_register::note_col_l()
27 ncol_p_ = new Note_column;
28 announce_element(Score_elem_info(ncol_p_, 0));
34 Note_column_register::rest_col_l()
37 restcol_p_ = new Rest_column;
38 announce_element(Score_elem_info(restcol_p_,0));
44 Note_column_register::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()) {
53 script_l_arr_.push((Script*)i.elem_l_->item());
54 } else if (nC == Notehead::static_name()) {
55 Notehead * h_l = (Notehead*)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();
67 Note_column_register::pre_move_processing()
69 Script_column *col_l = ( ncol_p_ ) ? ncol_p_ : restcol_p_;
73 for (int i=0; i < script_l_arr_.size(); i++)
74 col_l->add(script_l_arr_[i]);
77 ncol_p_->add(stem_l_);
79 if (! restcol_p_ -> dir_i_)
80 restcol_p_->dir_i_ = dir_i_;
81 typeset_element(restcol_p_);
85 if (! ncol_p_->dir_i_ )
86 ncol_p_->dir_i_ = dir_i_;
87 if (! ncol_p_->h_shift_b_)
88 ncol_p_->h_shift_b_ = h_shift_b_;
89 typeset_element(ncol_p_);
95 Note_column_register::post_move_processing()
97 script_l_arr_.set_size(0);
102 Note_column_register::set_feature(Feature i)
104 if (i.type_ == "vdir")
106 if (i.type_ == "hshift")
107 h_shift_b_ = i.value_;
110 Note_column_register::Note_column_register()
117 post_move_processing();
119 IMPLEMENT_STATIC_NAME(Note_column_register);
120 ADD_THIS_REGISTER(Note_column_register);