]> git.donarmstrong.com Git - lilypond.git/blob - lily/score-column.cc
release: 0.1.52
[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   forced_break_b_ = false;
16   when_ = w;
17   musical_b_ = false;
18 }
19
20 void
21 Score_column::do_print() const
22 {
23 #ifndef NPRINT
24   DOUT << "mus "<< musical_b_ <<" at " <<  when_<< '\n';
25   if (forced_break_b_)
26     DOUT << "Break forced";
27       
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
34 }
35
36 int
37 Moment_compare (Moment const &m1, Moment const &m2)
38 {
39   return sign (m1-m2);
40 }
41
42 void
43 Score_column::preprocess()
44 {
45   Paper_column ::preprocess ();
46   durations.sort (Moment_compare);
47 }
48
49 void
50 Score_column::add_duration (Moment d)
51 {
52   if (!d)
53     {
54       warning (_("Ignoring zero duration added to column at ")
55                + when_.str ());
56       return;
57     }
58   
59   for (int i = 0; i< durations.size(); i++) 
60     {
61       if (d == durations[i])
62         return ;
63     }
64   durations.push (d);
65 }
66
67 IMPLEMENT_IS_TYPE_B1(Score_column, Paper_column);