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 "musicalrequest.hh"
12 #include "staff-walker.hh"
13 #include "staff-column.hh"
14 #include "score-column.hh"
16 #include "time-description.hh"
17 #include "commandrequest.hh"
18 #include "grouping.hh"
19 #include "score-walker.hh"
21 Staff_walker::~Staff_walker()
26 Staff_walker::Staff_walker(Staff_walker
const &s
)
27 :PCursor
<Staff_column
*> (s
)
32 Staff_walker::Staff_walker(Staff
* s
, PScore
*ps
)
33 : PCursor
<Staff_column
*> (s
->cols_
)
38 // should be in tdes. TODO
39 default_grouping
= new Rhythmic_grouping(MInterval(0, 1), 4);
44 Staff_walker::when() const
51 Staff_walker::process_timing_reqs()
53 for (int i
=0; i
< ptr()->timing_req_l_arr_
.size(); i
++) {
54 Timing_req
* tr_l
= ptr()->timing_req_l_arr_
[i
];
55 if (tr_l
->meterchange()) {
56 int b_i
=tr_l
->meterchange()->beats_i_
;
57 int o_i
= tr_l
->meterchange()->one_beat_i_
;
58 time_
.set_meter(b_i
, o_i
);
60 *default_grouping
= Rhythmic_grouping(
61 MInterval(0,Moment(b_i
, o_i
)), b_i
);
65 for (int i
=0; i
< ptr()->timing_req_l_arr_
.size(); i
++) {
66 Timing_req
* tr_l
= ptr()->timing_req_l_arr_
[i
];
67 if (tr_l
->partial()) {
68 time_
.setpartial(tr_l
->partial()->duration_
);
69 } else if (tr_l
->barcheck() && time_
.whole_in_measure_
) {
70 warning( "Barcheck failed", tr_l
->defined_ch_c_l_
);
71 } else if (tr_l
->cadenza()) {
72 time_
.set_cadenza(tr_l
->cadenza()->on_b_
);
73 } else if (tr_l
->measuregrouping()) {
74 *default_grouping
= parse_grouping(
75 tr_l
->measuregrouping()->beat_i_arr_
,
76 tr_l
->measuregrouping()->elt_length_arr_
);
83 Staff_walker::operator++(int i
)
88 PCursor
<Staff_column
*>::operator++(i
);
90 Moment delta_t
= when() - last
;
98 Staff_walker::process()
100 process_timing_reqs();
105 Staff_walker::allow_break()
107 score_walk_l_
->allow_break(this);