2 time_signature-reg.cc -- implement Time_signature_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "time-signature.hh"
10 #include "command-request.hh"
11 #include "engraver.hh"
14 #include "engraver-group-engraver.hh"
18 generate time_signatures.
20 class Time_signature_engraver : public Engraver {
22 virtual void do_process_music();
23 virtual void do_pre_move_processing();
25 VIRTUAL_COPY_CONS(Translator);
26 Item * time_signature_p_;
27 SCM last_time_fraction_;
28 Time_signature_engraver();
32 Time_signature_engraver::Time_signature_engraver()
35 last_time_fraction_ = SCM_EOL;
39 Time_signature_engraver::do_process_music()
42 not rigorously safe, since the value might get GC'd and
43 reallocated in the same spot */
44 SCM fr= get_property ("timeSignatureFraction");
45 if (last_time_fraction_ != fr)
47 last_time_fraction_ = fr;
48 time_signature_p_ = new Item (get_property ("basicTimeSignatureProperties"));
49 time_signature_p_->set_elt_property ("fraction",fr);
52 if (time_signature_p_)
53 announce_element (time_signature_p_, 0);
57 Time_signature_engraver::do_pre_move_processing()
59 if (time_signature_p_)
61 typeset_element (time_signature_p_);
67 ADD_THIS_TRANSLATOR(Time_signature_engraver);