lilypond-0.1.57
[lilypond.git] / lily / score-column.cc
blob0da2f640cbd0b024cc89f4b0b9156424ccf1d750
1 /*
2 score-column.cc -- implement Score_column
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "debug.hh"
10 #include "p-col.hh"
11 #include "score-column.hh"
13 Score_column::Score_column (Moment w)
15 forced_break_b_ = false;
16 when_ = w;
17 musical_b_ = false;
20 void
21 Score_column::do_print() const
23 #ifndef NPRINT
24 DOUT << "mus "<< musical_b_ <<" at " << when_<< '\n';
25 if (forced_break_b_)
26 DOUT << "Break forced";
28 DOUT << "durations: [";
29 for (int i=0; i < durations.size(); i++)
30 DOUT << durations[i] << " ";
31 DOUT << "]\n";
32 Paper_column::do_print();
33 #endif
36 int
37 Moment_compare (Moment const &m1, Moment const &m2)
39 return sign (m1-m2);
42 void
43 Score_column::preprocess()
45 Paper_column ::preprocess ();
46 durations.sort (Moment_compare);
49 void
50 Score_column::add_duration (Moment d)
52 if (!d)
54 warning (_("Ignoring zero duration added to column at ")
55 + when_.str ());
56 return;
59 for (int i = 0; i< durations.size(); i++)
61 if (d == durations[i])
62 return ;
64 durations.push (d);
67 IMPLEMENT_IS_TYPE_B1(Score_column, Paper_column);