]> git.donarmstrong.com Git - lilypond.git/blob - lily/note-column.cc
release: 0.0.77.jcn1
[lilypond.git] / lily / note-column.cc
1 /*
2   note-column.cc -- implement Note_column
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "note-column.hh"
10 #include "script.hh"
11 #include "note-head.hh"
12 #include "stem.hh"
13
14
15 IMPLEMENT_IS_TYPE_B1(Note_column,Head_column);
16
17 void
18 Note_column::set(Stem*s)
19 {
20     stem_l_ = s;
21     add_support(s);
22 }
23
24 Note_column::Note_column()
25 {
26     h_shift_b_ =false;
27 }
28
29 void
30 Note_column::sort()
31 {
32     head_l_arr_.sort( Note_head::compare);
33 }
34     
35 Interval_t<int>
36 Note_column::head_positions_interval()const
37 {
38     ((Note_column*)this)->sort();
39     return Interval_t<int> ( head_l_arr_[0]->position_i_, 
40                              head_l_arr_.top()->position_i_);
41
42 }
43
44
45 void
46 Note_column::do_pre_processing()
47 {
48     if (!dir_i_&& !stem_l_){
49         dir_i_ = (head_positions_interval().center() >=  5) ? -1 : 1;
50     }
51     Head_column::do_pre_processing();
52 }
53
54