2 time-signature-engraver.cc -- implement Time_signature_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "time-signature.hh"
10 #include "command-request.hh"
11 #include "engraver.hh"
12 #include "engraver-group-engraver.hh"
15 generate time_signatures.
17 class Time_signature_engraver
: public Engraver
19 Item
* time_signature_
;
20 SCM last_time_fraction_
;
23 virtual void stop_translation_timestep ();
24 virtual void process_music ();
26 TRANSLATOR_DECLARATIONS(Time_signature_engraver
);
30 Time_signature_engraver::Time_signature_engraver ()
33 last_time_fraction_
= SCM_BOOL_F
;
37 Time_signature_engraver::process_music ()
40 not rigorously safe, since the value might get GC'd and
41 reallocated in the same spot */
42 SCM fr
= get_property ("timeSignatureFraction");
43 if (!time_signature_
&& last_time_fraction_
!= fr
)
45 last_time_fraction_
= fr
;
46 time_signature_
= new Item (get_property ("TimeSignature"));
47 time_signature_
->set_grob_property ("fraction",fr
);
50 announce_grob(time_signature_
, SCM_EOL
);
55 Time_signature_engraver::stop_translation_timestep ()
59 typeset_grob (time_signature_
);
65 ENTER_DESCRIPTION(Time_signature_engraver
,
66 /* descr */ "Create a TimeSignature whenever @code{timeSignatureFraction} changes",
67 /* creats*/ "TimeSignature",