lilypond-0.0.62
[lilypond.git] / lily / note-column.cc
blobf0c518a5b78fee195de4bcd86296352d3ff77a08
1 /*
2 note-column.cc -- implement Note_column
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "note-column.hh"
10 #include "debug.hh"
11 #include "script.hh"
12 #include "notehead.hh"
13 #include "stem.hh"
15 IMPLEMENT_STATIC_NAME(Note_column);
17 void
18 Note_column::add(Stem*stem_l)
20 stem_l_ = stem_l;
21 add_support(stem_l);
24 void
25 Note_column::add(Notehead* n_l)
27 assert(!n_l->rest_b_);
28 head_l_arr_.push(n_l);
29 add_support(n_l);
32 Note_column::Note_column()
34 stem_l_ = 0;
35 h_shift_b_ =false;
36 dir_i_ =0;
39 void
40 Note_column::sort()
42 head_l_arr_.sort( Notehead::compare);
45 Interval_t<int>
46 Note_column::head_positions_interval()const
48 ( (Note_column*)this)->sort();
49 return Interval_t<int> ( head_l_arr_[0]->position_i_,
50 head_l_arr_.top()->position_i_);
55 void
56 Note_column::do_pre_processing()
58 if (!dir_i_){
59 if (stem_l_)
60 dir_i_ = stem_l_->dir_i_;
61 else
62 dir_i_ = (head_positions_interval().center() >= 5) ? -1 : 1;