2 staff-walker.cc -- implement Staff_walker
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
11 #include "grouping.hh"
13 #include "musical-request.hh"
14 #include "staff-walker.hh"
15 #include "staff-column.hh"
16 #include "score-column.hh"
18 #include "time-description.hh"
19 #include "command-request.hh"
20 #include "grouping.hh"
21 #include "score-walker.hh"
23 Staff_walker::~Staff_walker()
28 Staff_walker::Staff_walker(Staff_walker const &s)
29 :PCursor<Staff_column*> (s)
34 Staff_walker::Staff_walker(Staff * s, PScore*ps )
35 : PCursor<Staff_column*> (s->cols_)
40 // should be in tdes. TODO
41 default_grouping = new Rhythmic_grouping(MInterval(0, 1), 4);
46 Staff_walker::when() const
53 Staff_walker::process_timing_reqs()
55 for (int i=0; i < ptr()->timing_req_l_arr_.size(); i++) {
56 Timing_req * tr_l = ptr()->timing_req_l_arr_[i];
57 if (tr_l->meterchange()) {
58 int b_i=tr_l->meterchange()->beats_i_;
59 int o_i = tr_l->meterchange()->one_beat_i_;
60 if (! time_.allow_meter_change_b() )
62 tr_l->warning("Meterchange should be at start of measure");
64 time_.set_meter(b_i, o_i);
66 *default_grouping = Rhythmic_grouping(
67 MInterval(0,Moment(b_i, o_i)), b_i);
71 for (int i=0; i < ptr()->timing_req_l_arr_.size(); i++) {
72 Timing_req * tr_l = ptr()->timing_req_l_arr_[i];
73 if (tr_l->partial()) {
74 Moment m = tr_l->partial()->duration_;
75 String error = time_.try_set_partial_str(m);
80 } else if (tr_l->barcheck() && time_.whole_in_measure_) {
81 tr_l ->warning( "Barcheck failed");
82 } else if (tr_l->cadenza()) {
83 time_.set_cadenza(tr_l->cadenza()->on_b_);
84 } else if (tr_l->measuregrouping()) {
85 *default_grouping = parse_grouping(
86 tr_l->measuregrouping()->beat_i_arr_,
87 tr_l->measuregrouping()->elt_length_arr_);
94 Staff_walker::operator++(int i)
99 PCursor<Staff_column*>::operator++(i);
101 Moment delta_t = when() - last;
102 assert(delta_t >Moment(0));
103 time_.add( delta_t );
109 Staff_walker::process()
111 process_timing_reqs();
116 Staff_walker::allow_break()
118 score_walk_l_->allow_break(this);