2 note-column.cc -- implement Note_column
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 #include "dot-column.hh"
9 #include "note-column.hh"
11 #include "note-head.hh"
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();
45 if (head_l_arr_.size ())
46 iv = Interval_t<int>(head_l_arr_[0]->position_i_,
47 head_l_arr_.top()->position_i_);
54 Note_column::do_width () const
56 if (head_l_arr_.size ())
57 return head_l_arr_[0]->extent (X_AXIS);
59 return Interval (0,0);
63 Note_column::do_pre_processing()
69 else if (head_l_arr_.size ())
71 assert (false); // looks obsolete?
72 dir_ = sign (head_positions_interval().center ());
75 Script_column::do_pre_processing();
81 Note_column::set_stem (Stem * stem_l)
86 don't add stem to support; mostly invisible for rest-columns (and possibly taken . .)
88 Score_element::add_dependency (stem_l);
89 for (int i=0; i < script_l_arr_.size(); i++)
90 script_l_arr_[i]->set_stem (stem_l);
94 Note_column::add_script (Script *script_l)
96 Script_column::add_script (script_l) ;
98 script_l->set_stem (stem_l_);
102 Note_column::do_substitute_dependency (Score_element*o, Score_element*n)
106 stem_l_ = n ? dynamic_cast<Stem *> (n):0;
108 if (dynamic_cast<Note_head *> (o))
110 head_l_arr_.substitute (dynamic_cast<Note_head *> (o),
111 (n)? dynamic_cast<Note_head *> (n) : 0);
113 Script_column::do_substitute_dependency (o,n);
114 if (dynamic_cast<Rest *> (o))
116 rest_l_arr_.substitute (dynamic_cast<Rest *> (o),
117 (n)? dynamic_cast<Rest *> (n) : 0);
122 Note_column::add_head (Rhythmic_head *h)
124 if (dynamic_cast<Rest *> (h))
126 rest_l_arr_.push ((Rest*)h);
129 if (dynamic_cast<Note_head *> (h))
131 head_l_arr_.push ((Note_head*) h);
137 translate the rest symbols
140 Note_column::translate_rests (int dy_i)
142 invalidate_cache (Y_AXIS);
143 for (int i=0; i < rest_l_arr_.size(); i++)
144 rest_l_arr_[i]->position_i_ += dy_i;
148 Note_column::do_print() const
151 DOUT << "rests: " << rest_l_arr_.size() << ", ";
152 DOUT << "heads: " << head_l_arr_.size();
157 Note_column::set_dotcol (Dot_column *d)