2 staff.cc -- implement Staff
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
17 #include "staff-walker.hh"
18 #include "staff-column.hh"
19 #include "score-column.hh"
20 #include "voice-element.hh"
22 #include "musical-request.hh"
23 #include "command-request.hh" // todo
24 #include "midi-stream.hh"
27 Staff::add(PointerList<Voice*> const &l)
29 for (iter_top(l,i); i.ok(); i++)
30 voice_list_.bottom().add(i);
36 return score_l_->paper_p_;
44 if (!i->musical_column_l_->used_b())
45 i->musical_column_l_ = 0;
46 if (!i->command_column_l_->used_b())
47 i->command_column_l_ =0;
49 if (!i->command_column_l_&& !i->musical_column_l_)
57 Staff::get_col(Moment w, PCursor<Staff_column*> *last)
60 if (last && last->ok() && (*last)->when() <= w)
68 } else if (i->when() > w)
73 PCursor<Score_column*> scorecolumns(score_l_->find_col(w, false));
74 Staff_column* staffcolumn_p = new Staff_column;
75 staffcolumn_p->staff_l_ = this;
76 Score_column* comcol_l = scorecolumns++;
77 staffcolumn_p->set_cols(comcol_l, scorecolumns);
80 cols_.bottom().add( staffcolumn_p);
83 i.insert(staffcolumn_p);
91 /** put all stuff grouped vertically in the Staff_cols. Do the
92 preprarations for walking the cols. not virtual */
94 Staff::setup_staffcols()
96 PQueue<Subtle_req *, Moment> subtle_req_pq;
98 for (iter_top(voice_list_,i); i.ok(); i++) {
99 PCursor<Staff_column*> last(cols_);
100 Moment now = i->start;
105 if (subtle_req_pq.size())
106 next = next <? subtle_req_pq.front_idx();
108 Staff_column *s_l= get_col(next, &last);
110 while (subtle_req_pq.size()
111 && subtle_req_pq.front_idx() == s_l->when()) {
112 s_l->setup_one_request(subtle_req_pq.get()); // ugh!
115 s_l->add(j, subtle_req_pq);
122 PCursor<Staff_column*> last(cols_);
124 while (subtle_req_pq.size()) {
125 Moment front =subtle_req_pq.front_idx();
126 Staff_column *s_l = get_col(front, &last);
127 while(subtle_req_pq.size() && subtle_req_pq.front_idx() == front)
128 s_l->setup_one_request(subtle_req_pq.get()); // ugh!
143 for (; i.ok(); j++,i++) {
144 assert(j->when () < i->when() );
155 for (iter_top(voice_list_,i); i.ok(); i++) {
166 for (iter_top(voice_list_,i); i.ok(); i++) {