]> git.donarmstrong.com Git - lilypond.git/blob - lily/score-column.cc
release: 0.1.11
[lilypond.git] / lily / score-column.cc
1 /*
2   score-column.cc -- implement Score_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 "debug.hh"
10 #include "p-col.hh"
11 #include "score-column.hh"
12
13 Score_column::Score_column (Moment w)
14 {
15   when_ = w;
16   musical_b_ = false;
17 }
18
19 void
20 Score_column::do_print() const
21 {
22 #ifndef NPRINT
23   DOUT << "mus "<< musical_b_ <<" at " <<  when_<<'\n';
24   DOUT << "durations: [";
25   for (int i=0; i < durations.size(); i++)
26     DOUT << durations[i] << " ";
27   DOUT << "]\n";
28   Paper_column::do_print();
29 #endif
30 }
31
32 int
33 Moment_compare (Moment const &m1, Moment const &m2)
34 {
35   return sign (m1-m2);
36 }
37
38 void
39 Score_column::preprocess()
40 {
41   durations.sort (Moment_compare);
42 }
43
44 void
45 Score_column::add_duration (Moment d)
46 {
47   assert (d);
48   for (int i = 0; i< durations.size(); i++) 
49     {
50       if (d == durations[i])
51         return ;
52     }
53   durations.push (d);
54 }
55
56 IMPLEMENT_IS_TYPE_B1(Score_column, Paper_column);