]> git.donarmstrong.com Git - lilypond.git/blob - lily/staff.cc
1226fce46a76e085aee96241973c9483ce8902e1
[lilypond.git] / lily / staff.cc
1 /*
2   staff.cc -- implement Staff
3
4   source file of the LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8 #include "input-register.hh"
9 #include "proto.hh"
10 #include "staff.hh"
11 #include "score.hh"
12 #include "voice.hh"
13 #include "staff-column.hh"
14 #include "score-column.hh"
15 #include "voice-element.hh"
16 #include "debug.hh"
17 #include "musical-request.hh"
18 #include "command-request.hh" // todo
19
20
21 void
22 Staff::add(PointerList<Voice*> const &l)
23 {
24     for (iter_top(l,i); i.ok(); i++)
25         voice_list_.bottom().add(i);
26 }
27
28 Paper_def *
29 Staff::paper() const
30 {
31     return score_l_->paper_p_;
32 }
33
34 void
35 Staff::clean_cols()
36 {
37 #if 0 // TODO
38     iter_top(cols_,i);
39     for(; i.ok(); ){
40         if (!i->musical_column_l_->used_b())
41             i->musical_column_l_ = 0;
42         if (!i->command_column_l_->used_b())
43             i->command_column_l_ =0;
44         
45         if (!i->command_column_l_&& !i->musical_column_l_)
46             delete i.remove_p();
47         else
48             i++;
49     }
50 #endif
51 }
52
53
54 void
55 Staff::OK() const
56 {
57 #ifndef NDEBUG
58     cols_.OK();
59     voice_list_.OK();
60     iter_top(cols_, i);
61     iter_top(cols_, j);
62     i++;
63     assert(score_l_);
64 #endif    
65 }
66
67
68 Moment
69 Staff::last() const
70 {
71     Moment l = 0;
72     for (iter_top(voice_list_,i); i.ok(); i++) {
73         l = l >? i->last();
74     }
75     return l;
76 }
77
78 void
79 Staff::print() const
80 {
81 #ifndef NPRINT
82     mtor << "Staff {\n";
83     for (iter_top(voice_list_,i); i.ok(); i++) {
84         i->print();     
85     }
86     ireg_p_->print();
87     mtor <<"}\n";
88 #endif
89 }
90
91 Staff::Staff()
92 {    
93     ireg_p_ =0;
94     score_l_ =0;
95     pscore_l_ =0;
96     pstaff_l_ =0;
97 }
98
99 void
100 Staff::add_col(Staff_column*c_l)
101 {
102     cols_.bottom().add(c_l);
103     c_l->staff_l_ = this;
104 }