lilypond-0.1.14
[lilypond.git] / src / meterreg.cc
blob3aab0fb29149c00a1c8190e007f3ddd03cfbc37b
1 /*
2 meterreg.cc -- implement Meter_register
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "meterreg.hh"
10 #include "meter.hh"
11 #include "commandrequest.hh"
13 Meter_register::Meter_register(Complex_walker*w)
14 : Request_register(w)
16 do_post_move_process();
19 bool
20 Meter_register::try_request(Request*r_l)
22 if (!r_l->command()->meterchange())
23 return false;
25 assert(!meter_req_l_);
26 meter_req_l_ = r_l->command()->meterchange();
28 return true;
31 void
32 Meter_register::process_request()
34 if (meter_req_l_ ) {
35 Array<Scalar> args;
36 args.push(meter_req_l_->beats_i_);
37 args.push(meter_req_l_->one_beat_i_);
39 meter_p_ = new Meter(args);
42 if (meter_p_)
43 announce_element(Staff_elem_info(meter_p_, meter_req_l_, this) );
46 void
47 Meter_register::do_pre_move_process()
49 if (meter_p_) {
50 Meter * post_p =new Meter(*meter_p_);
51 Meter * pre_p =new Meter(*meter_p_);
53 typeset_breakable_item(pre_p, meter_p_, post_p);
54 meter_p_ =0;
58 void
59 Meter_register::do_post_move_process()
61 meter_req_l_ = 0;
62 meter_p_ =0;