]> git.donarmstrong.com Git - lilypond.git/blob - src/sccol.cc
release: 0.0.20
[lilypond.git] / src / sccol.cc
1 #include "debug.hh"
2 #include "pcol.hh"
3 #include "sccol.hh"
4
5 int
6 Score_column::compare(Score_column & c1, Score_column &c2)
7 {
8         return sign(c1.when - c2.when);
9 }
10
11 void
12 Score_column::set_breakable() {
13     pcol_->set_breakable();
14 }
15 Score_column::Score_column(Moment w)
16 {
17     when = w;
18     pcol_ = new PCol(0);
19     musical = false;
20 }
21
22 bool
23 Score_column::used() {
24     return pcol_->used();
25 }
26
27 void
28 Score_column::print() const
29 {
30 #ifndef NPRINT
31     mtor << "Score_column { mus "<< musical <<" at " <<  when<<'\n';
32     mtor << "durations: [";
33     for (int i=0; i < durations.sz(); i++)
34         mtor << durations[i] << " ";
35     mtor << "]\n";
36     pcol_->print();
37     mtor << "}\n";
38 #endif
39 }
40
41 int
42 Tdescription_compare(Moment &a , Moment& b)
43 {
44     return sign(a-b);
45 }
46
47 void
48 Score_column::preprocess()
49 {
50     durations.sort(Tdescription_compare);
51 }
52 void
53 Score_column::add_duration(Moment d)
54 {
55     for (int i = 0; i< durations.sz(); i++) {
56         if (d == durations[i])
57             return ;
58     }
59     durations.add(d);
60 }