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()
32 head_l_arr_.sort (Note_head::compare);
36 Note_column::head_positions_interval() const
38 ((Note_column*)this)->sort();
43 if (head_l_arr_.size ())
44 iv = Interval_t<int>(head_l_arr_[0]->position_i_,
45 head_l_arr_.top()->position_i_);
51 Note_column::do_pre_processing()
57 else if (head_l_arr_.size ())
59 // assert (false); // looks obsolete?
60 dir_ = sign (head_positions_interval().center ());
63 Script_column::do_pre_processing();
69 Note_column::set_stem (Stem * stem_l)
74 don't add stem to support; mostly invisible for rest-columns (and possibly taken . .)
76 Score_element::add_dependency (stem_l);
77 for (int i=0; i < script_l_arr_.size(); i++)
78 script_l_arr_[i]->set_stem (stem_l);
82 Note_column::add_script (Script *script_l)
84 Script_column::add_script (script_l) ;
86 script_l->set_stem (stem_l_);
90 Note_column::do_substitute_element_pointer (Score_element*o, Score_element*n)
94 stem_l_ = n ? dynamic_cast<Stem *> (n):0;
96 if (dynamic_cast<Note_head *> (o))
98 head_l_arr_.substitute (dynamic_cast<Note_head *> (o),
99 (n)? dynamic_cast<Note_head *> (n) : 0);
101 Script_column::do_substitute_element_pointer (o,n);
102 if (dynamic_cast<Rest *> (o))
104 rest_l_arr_.substitute (dynamic_cast<Rest *> (o),
105 (n)? dynamic_cast<Rest *> (n) : 0);
110 Note_column::add_head (Rhythmic_head *h)
112 if (Rest*r=dynamic_cast<Rest *> (h))
114 rest_l_arr_.push (r);
117 if (Note_head *nh=dynamic_cast<Note_head *> (h))
119 head_l_arr_.push (nh);
125 translate the rest symbols
128 Note_column::translate_rests (int dy_i)
130 invalidate_cache (Y_AXIS);
131 for (int i=0; i < rest_l_arr_.size(); i++)
132 rest_l_arr_[i]->position_i_ += dy_i;
136 Note_column::do_print() const
139 DOUT << "rests: " << rest_l_arr_.size() << ", ";
140 DOUT << "heads: " << head_l_arr_.size();
145 Note_column::set_dotcol (Dot_column *d)