lilypond-1.1.13
[lilypond.git] / src / sccol.cc
blob43d549b1756d8bdc43c66281bd7af78348e161d5
1 /*
2 sccol.cc -- implement Score_column
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "debug.hh"
10 #include "pcol.hh"
11 #include "sccol.hh"
13 int
14 Score_column::compare(Score_column & c1, Score_column &c2)
16 return sign(c1.when_ - c2.when_);
19 void
20 Score_column::set_breakable()
22 pcol_l_->set_breakable();
25 Score_column::Score_column(Moment w)
27 when_ = w;
28 pcol_l_ = new PCol(0);
29 musical_b_ = false;
32 bool
33 Score_column::used_b() {
34 return pcol_l_->used_b();
37 void
38 Score_column::print() const
40 #ifndef NPRINT
41 mtor << "Score_column { mus "<< musical_b_ <<" at " << when_<<'\n';
42 mtor << "durations: [";
43 for (int i=0; i < durations.size(); i++)
44 mtor << durations[i] << " ";
45 mtor << "]\n";
46 pcol_l_->print();
47 mtor << "}\n";
48 #endif
51 int
52 Moment_compare(Moment &a , Moment& b)
54 return sign(a-b);
57 void
58 Score_column::preprocess()
60 durations.sort(Moment_compare);
62 void
63 Score_column::add_duration(Moment d)
65 assert(d);
66 for (int i = 0; i< durations.size(); i++) {
67 if (d == durations[i])
68 return ;
70 durations.push(d);
73 bool
74 Score_column::breakable_b()
76 return pcol_l_->breakable_b();