2 note-column-reg.cc -- implement Note_column_register
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
9 #include "note-column-reg.hh"
10 #include "note-head.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 == Note_head::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 == 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();
67 Note_column_register::do_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]);
78 ncol_p_->add(stem_l_);
80 restcol_p_->add(stem_l_);
83 if (! restcol_p_ -> dir_i_)
84 restcol_p_->dir_i_ = dir_i_;
85 typeset_element(restcol_p_);
89 if (! ncol_p_->dir_i_ )
90 ncol_p_->dir_i_ = dir_i_;
91 if (! ncol_p_->h_shift_b_)
92 ncol_p_->h_shift_b_ = h_shift_b_;
93 typeset_element(ncol_p_);
99 Note_column_register::do_post_move_processing()
101 script_l_arr_.set_size(0);
106 Note_column_register::set_feature(Feature i)
108 if (i.type_ == "vdir")
110 if (i.type_ == "hshift")
111 h_shift_b_ = (bool)(int)i.value_;
114 Note_column_register::Note_column_register()
121 do_post_move_processing();
123 IMPLEMENT_STATIC_NAME(Note_column_register);
124 IMPLEMENT_IS_TYPE_B1(Note_column_register,Request_register);
125 ADD_THIS_REGISTER(Note_column_register);