2 note-column.cc -- implement Note_column
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
8 #include "dot-column.hh"
9 #include "note-column.hh"
11 #include "note-head.hh"
16 IMPLEMENT_IS_TYPE_B1(Note_column,Script_column);
19 Note_column::rest_b () const
21 return rest_l_arr_.size ();
24 Note_column::Note_column()
34 head_l_arr_.sort (Note_head::compare);
38 Note_column::head_positions_interval() const
40 ((Note_column*)this)->sort();
41 return Interval_t<int> (head_l_arr_[0]->position_i_,
42 head_l_arr_.top()->position_i_);
47 Note_column::do_pre_processing()
54 else if (head_l_arr_.size ())
56 dir_ = (head_positions_interval().center () >= 5) ? DOWN:UP;
59 Script_column::do_pre_processing();
65 Note_column::set (Stem * stem_l)
70 don't add stem to support; mostly invisible for rest-columns (and possibly taken . .)
72 Score_elem::add_dependency (stem_l);
73 for (int i=0; i < script_l_arr_.size(); i++)
74 script_l_arr_[i]->set_stem (stem_l);
78 Note_column::add (Script *script_l)
80 Script_column::add (script_l) ;
82 script_l->set_stem (stem_l_);
86 Note_column::do_substitute_dependency (Score_elem*o, Score_elem*n)
90 stem_l_ = n ? (Stem*)n->item():0;
92 if (o->is_type_b (Note_head::static_name ()))
94 head_l_arr_.substitute ((Note_head*)o->item(),
95 (n)? (Note_head*)n->item() : 0);
97 Script_column::do_substitute_dependency (o,n);
98 if (o->is_type_b (Rest::static_name ()))
100 rest_l_arr_.substitute ((Rest*)o->item(),
101 (n)? (Rest*)n->item() : 0);
106 Note_column::add (Rhythmic_head *h)
108 if (h->is_type_b (Rest::static_name ()))
110 rest_l_arr_.push ((Rest*)h);
113 if (h->is_type_b (Note_head::static_name ()))
115 head_l_arr_.push ((Note_head*) h);
121 translate the rest symbols
124 Note_column::translate_rests (int dy_i)
126 invalidate_cache (Y_AXIS);
127 for (int i=0; i < rest_l_arr_.size(); i++)
128 rest_l_arr_[i]->position_i_ += dy_i;
132 Note_column::do_print() const
135 DOUT << "rests: " << rest_l_arr_.size() << ", ";
136 DOUT << "heads: " << head_l_arr_.size();
141 Note_column::set (Dot_column *d)