lilypond-1.3.7
[lilypond.git] / lily / meter-grav.cc
blobf14d00a4edbbe8ff7d7e19345b21cc0d11dd9c63
1 /*
2 meter-reg.cc -- implement Meter_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "meter-grav.hh"
10 #include "meter.hh"
11 #include "command-request.hh"
12 #include "timing-grav.hh"
13 #include "engraver-group.hh"
15 Meter_engraver::Meter_engraver()
17 meter_p_ =0;
20 void
21 Meter_engraver::do_process_requests()
23 Translator * result =
24 daddy_grav_l()->get_simple_translator (Timing_engraver::static_name());
26 if (!result)
28 warning ("Lost in time: can't find Timing_translator");
29 return ;
32 Timing_engraver * timing_grav_l= (Timing_engraver*) result->engraver_l ();
34 Meter_change_req *req = timing_grav_l->meter_req_l();
35 if (req)
37 Array<Scalar> args;
38 args.push (req->beats_i_);
39 args.push (req->one_beat_i_);
41 meter_p_ = new Meter (args);
42 meter_p_->break_priority_i_ = 1; // ugh
45 if (meter_p_)
46 announce_element (Score_elem_info (meter_p_, req));
49 void
50 Meter_engraver::do_pre_move_processing()
52 if (meter_p_)
54 typeset_element (meter_p_);
55 meter_p_ =0;
60 ADD_THIS_TRANSLATOR(Meter_engraver);
61 IMPLEMENT_IS_TYPE_B1(Meter_engraver,Engraver);