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()
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::do_pre_processing()
56 else if (head_l_arr_.size ())
58 // assert (false); // looks obsolete?
59 dir_ = sign (head_positions_interval().center ());
62 Script_column::do_pre_processing();
68 Note_column::set_stem (Stem * stem_l)
73 don't add stem to support; mostly invisible for rest-columns (and possibly taken . .)
75 Score_element::add_dependency (stem_l);
76 for (int i=0; i < script_l_arr_.size(); i++)
77 script_l_arr_[i]->set_stem (stem_l);
81 Note_column::add_script (Script *script_l)
83 Script_column::add_script (script_l) ;
85 script_l->set_stem (stem_l_);
89 Note_column::do_substitute_element_pointer (Score_element*o, Score_element*n)
93 stem_l_ = n ? dynamic_cast<Stem *> (n):0;
95 if (dynamic_cast<Note_head *> (o))
97 head_l_arr_.substitute (dynamic_cast<Note_head *> (o),
98 (n)? dynamic_cast<Note_head *> (n) : 0);
100 Script_column::do_substitute_element_pointer (o,n);
101 if (dynamic_cast<Rest *> (o))
103 rest_l_arr_.substitute (dynamic_cast<Rest *> (o),
104 (n)? dynamic_cast<Rest *> (n) : 0);
109 Note_column::add_head (Rhythmic_head *h)
111 if (Rest*r=dynamic_cast<Rest *> (h))
113 rest_l_arr_.push (r);
116 if (Note_head *nh=dynamic_cast<Note_head *> (h))
118 head_l_arr_.push (nh);
124 translate the rest symbols
127 Note_column::translate_rests (int dy_i)
129 invalidate_cache (Y_AXIS);
130 for (int i=0; i < rest_l_arr_.size(); i++)
131 rest_l_arr_[i]->position_i_ += dy_i;
135 Note_column::do_print() const
138 DOUT << "rests: " << rest_l_arr_.size() << ", ";
139 DOUT << "heads: " << head_l_arr_.size();
144 Note_column::set_dotcol (Dot_column *d)