2 staff.cc -- implement Staff
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
14 #include "staff-walker.hh"
15 #include "staff-column.hh"
16 #include "score-column.hh"
17 #include "voice-element.hh"
19 #include "musical-request.hh"
20 #include "command-request.hh" // todo
21 #include "midi-stream.hh"
26 Staff::add(PointerList<Voice*> const &l)
28 for (iter_top(l,i); i.ok(); i++)
29 voice_list_.bottom().add(i);
35 return score_l_->paper_p_;
43 if (!i->musical_column_l_->used_b())
44 i->musical_column_l_ = 0;
45 if (!i->command_column_l_->used_b())
46 i->command_column_l_ =0;
48 if (!i->command_column_l_&& !i->musical_column_l_)
56 Staff::get_col(Moment w, PCursor<Staff_column*> *last)
59 if (last && last->ok() && (*last)->when() <= w)
67 } else if (i->when() > w)
72 PCursor<Score_column*> scorecolumns(score_l_->find_col(w, false));
73 Staff_column* staffcolumn_p = new Staff_column;
74 staffcolumn_p->staff_l_ = this;
75 Score_column* comcol_l = scorecolumns++;
76 staffcolumn_p->set_cols(comcol_l, scorecolumns);
79 cols_.bottom().add( staffcolumn_p);
82 i.insert(staffcolumn_p);
90 /** put all stuff grouped vertically in the Staff_cols. Do the
91 preprarations for walking the cols. not virtual */
93 Staff::setup_staffcols()
95 PQueue<Subtle_req *, Moment> subtle_req_pq;
96 PCursor<Staff_column*> last(cols_);
98 for (iter_top(voice_list_,i); i.ok(); i++) {
99 Moment now = i->start;
104 if (subtle_req_pq.size())
105 next = next <? subtle_req_pq.front_idx();
107 Staff_column *s_l= get_col(next, &last);
109 while (subtle_req_pq.size()
110 && subtle_req_pq.front_idx() == s_l->when()) {
111 s_l->setup_one_request(subtle_req_pq.get()); // ugh!
114 s_l->add(j, subtle_req_pq);
122 while (subtle_req_pq.size()) {
123 Moment front =subtle_req_pq.front_idx();
124 Staff_column *s_l = get_col(front, &last);
125 while(subtle_req_pq.size() && subtle_req_pq.front_idx() == front)
126 s_l->setup_one_request(subtle_req_pq.get()); // ugh!
140 for (; i.ok(); j++,i++) {
141 assert(j->when () < i->when() );
152 for (iter_top(voice_list_,i); i.ok(); i++) {
163 for (iter_top(voice_list_,i); i.ok(); i++) {