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 stop_translation_timestep();
23 virtual void create_grobs ();
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_BOOL_F
;
39 Time_signature_engraver::create_grobs()
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 (!time_signature_p_
&& last_time_fraction_
!= fr
)
47 last_time_fraction_
= fr
;
48 time_signature_p_
= new Item (get_property ("TimeSignature"));
49 time_signature_p_
->set_grob_property ("fraction",fr
);
51 if (time_signature_p_
)
52 announce_grob (time_signature_p_
, 0);
60 Time_signature_engraver::stop_translation_timestep()
62 if (time_signature_p_
)
64 typeset_grob (time_signature_p_
);
70 ADD_THIS_TRANSLATOR(Time_signature_engraver
);