lilypond-1.3.28
[lilypond.git] / lily / staff.cc
blob76e6d995cab21a8a75c907c739bcadd1b3b400b1
1 /*
2 staff.cc -- implement Staff
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "proto.hh"
10 #include "plist.hh"
11 #include "input-register.hh"
12 #include "staff.hh"
13 #include "score.hh"
14 #include "voice.hh"
15 #include "staff-column.hh"
16 #include "score-column.hh"
17 #include "voice-element.hh"
18 #include "debug.hh"
19 #include "musical-request.hh"
20 #include "command-request.hh" // todo
21 #include "staffline.hh"
22 #include "complex-walker.hh"
23 #include "super-elem.hh"
24 #include "p-score.hh"
25 #include "scoreline.hh"
27 void
28 Staff::add(Link_list<Voice*> const &l)
30 for (iter_top(l,i); i.ok(); i++)
31 voice_list_.bottom().add(i);
34 Paper_def *
35 Staff::paper() const
37 return score_l_->paper_p_;
40 void
41 Staff::clean_cols()
43 #if 0 // TODO
44 iter_top(cols_,i);
45 for(; i.ok(); ){
46 if (!i->musical_column_l_->used_b())
47 i->musical_column_l_ = 0;
48 if (!i->command_column_l_->used_b())
49 i->command_column_l_ =0;
51 if (!i->command_column_l_&& !i->musical_column_l_)
52 delete i.remove_p();
53 else
54 i++;
56 #endif
60 void
61 Staff::OK() const
63 #ifndef NDEBUG
64 cols_.OK();
65 voice_list_.OK();
66 assert(score_l_);
67 #endif
71 Moment
72 Staff::last() const
74 Moment l = 0;
75 for (iter_top(voice_list_,i); i.ok(); i++) {
76 l = l >? i->last();
78 return l;
81 void
82 Staff::print() const
84 #ifndef NPRINT
85 mtor << "Staff {\n";
86 for (iter_top(voice_list_,i); i.ok(); i++) {
87 i->print();
89 ireg_p_->print();
90 mtor <<"}\n";
91 #endif
94 Staff::~Staff()
96 delete ireg_p_;
99 Staff::Staff()
101 ireg_p_ =0;
102 score_l_ =0;
103 pscore_l_ =0;
106 void
107 Staff::add_col(Staff_column*c_l)
109 cols_.bottom().add(c_l);
110 c_l->staff_l_ = this;
113 void
114 Staff::set_output(PScore* pscore_l )
116 pscore_l_ = pscore_l;
117 staff_line_l_ = new Line_of_staff;
118 pscore_l_->typeset_unbroken_spanner(staff_line_l_);
119 pscore_l_->super_elem_l_->line_of_score_l_->add_line(staff_line_l_);
123 Staff_walker *
124 Staff::get_walker_p()
126 return new Complex_walker(this);