2 note-column.cc -- implement Note_column
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 #include "dot-column.hh"
9 #include "note-column.hh"
11 #include "note-head.hh"
17 Note_column::rest_b () const
19 return rest_l_arr_.size ();
22 Note_column::Note_column()
24 set_axes (X_AXIS,X_AXIS);
31 head_l_arr_.sort (Note_head::compare);
35 Note_column::head_positions_interval() const
37 ((Note_column*)this)->sort();
42 if (head_l_arr_.size ())
43 iv = Interval_t<int>(head_l_arr_[0]->position_i_,
44 head_l_arr_.top()->position_i_);
50 Note_column::dir () const
54 else if (head_l_arr_.size ())
55 return sign (head_positions_interval().center ());
63 Note_column::set_stem (Stem * stem_l)
66 add_dependency (stem_l);
72 Note_column::do_substitute_element_pointer (Score_element*o, Score_element*n)
76 stem_l_ = n ? dynamic_cast<Stem *> (n):0;
78 if (dynamic_cast<Note_head *> (o))
80 head_l_arr_.substitute (dynamic_cast<Note_head *> (o),
81 (n)? dynamic_cast<Note_head *> (n) : 0);
84 if (dynamic_cast<Rest *> (o))
86 rest_l_arr_.substitute (dynamic_cast<Rest *> (o),
87 (n)? dynamic_cast<Rest *> (n) : 0);
92 Note_column::add_head (Rhythmic_head *h)
94 if (Rest*r=dynamic_cast<Rest *> (h))
98 if (Note_head *nh=dynamic_cast<Note_head *> (h))
100 head_l_arr_.push (nh);
106 translate the rest symbols
109 Note_column::translate_rests (int dy_i)
111 invalidate_cache (Y_AXIS);
112 for (int i=0; i < rest_l_arr_.size(); i++)
113 rest_l_arr_[i]->position_i_ += dy_i;
117 Note_column::do_print() const
120 DOUT << "rests: " << rest_l_arr_.size() << ", ";
121 DOUT << "heads: " << head_l_arr_.size();
126 Note_column::set_dotcol (Dot_column *d)