2 staff.cc -- implement Staff
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
8 #include "input-register.hh"
13 #include "staff-column.hh"
14 #include "score-column.hh"
15 #include "voice-element.hh"
17 #include "musical-request.hh"
18 #include "command-request.hh" // todo
23 Staff::add(PointerList<Voice*> const &l)
25 for (iter_top(l,i); i.ok(); i++)
26 voice_list_.bottom().add(i);
32 return score_l_->paper_p_;
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;
45 if (!i->command_column_l_&& !i->musical_column_l_)
53 Staff::get_col(Moment w, PCursor<Staff_column*> *last)
56 if (last && last->ok() && (*last)->when() <= w)
64 } else if (i->when() > w)
69 PCursor<Score_column*> scorecolumns(score_l_->find_col(w, false));
70 Staff_column* staffcolumn_p = new Staff_column;
71 staffcolumn_p->staff_l_ = this;
72 Score_column* comcol_l = scorecolumns++;
73 staffcolumn_p->set_cols(comcol_l, scorecolumns);
76 cols_.bottom().add( staffcolumn_p);
79 i.insert(staffcolumn_p);
87 /** put all stuff grouped vertically in the Staff_cols. Do the
88 preprarations for walking the cols. not virtual */
90 Staff::setup_staffcols()
92 PQueue<Subtle_req *, Moment> subtle_req_pq;
93 PCursor<Staff_column*> last(cols_);
95 for (iter_top(voice_list_,i); i.ok(); i++) {
96 Moment now = i->start;
101 if (subtle_req_pq.size())
102 next = next <? subtle_req_pq.front_idx();
104 Staff_column *s_l= get_col(next, &last);
106 while (subtle_req_pq.size()
107 && subtle_req_pq.front_idx() == s_l->when()) {
108 s_l->setup_one_request(subtle_req_pq.get()); // ugh!
111 s_l->add(j, subtle_req_pq);
119 while (subtle_req_pq.size()) {
120 Moment front =subtle_req_pq.front_idx();
121 Staff_column *s_l = get_col(front, &last);
122 while(subtle_req_pq.size() && subtle_req_pq.front_idx() == front)
123 s_l->setup_one_request(subtle_req_pq.get()); // ugh!
137 for (; i.ok(); j++,i++) {
138 assert(j->when () < i->when() );
149 for (iter_top(voice_list_,i); i.ok(); i++) {
160 for (iter_top(voice_list_,i); i.ok(); i++) {