lilypond-0.0.39
[lilypond.git] / src / meter-reg.cc
bloba27737c076b8c37e251b45d7f6f0405306c4d562
1 /*
2 meter-reg.cc -- implement Meter_register
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "meter-reg.hh"
10 #include "meter.hh"
11 #include "commandrequest.hh"
13 Meter_register::Meter_register()
16 post_move_processing();
19 bool
20 Meter_register::try_request(Request*r_l)
22 Command_req* creq_l= r_l->command();
23 if (!creq_l || !creq_l->meterchange())
24 return false;
26 assert(!meter_req_l_);
27 meter_req_l_ = r_l->command()->meterchange();
29 return true;
32 void
33 Meter_register::process_requests()
35 if (meter_req_l_ ) {
36 Array<Scalar> args;
37 args.push(meter_req_l_->beats_i_);
38 args.push(meter_req_l_->one_beat_i_);
40 meter_p_ = new Meter(args);
43 if (meter_p_)
44 announce_element(Staff_elem_info(meter_p_, meter_req_l_) );
47 void
48 Meter_register::pre_move_processing()
50 if (meter_p_) {
51 Meter * post_p =new Meter(*meter_p_);
52 Meter * pre_p =new Meter(*meter_p_);
54 typeset_breakable_item(pre_p, meter_p_, post_p);
55 meter_p_ =0;
59 void
60 Meter_register::post_move_processing()
62 meter_req_l_ = 0;
63 meter_p_ =0;