2 rest-engraver.cc -- implement Rest_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
12 #include "duration.hh"
15 #include "rhythmic-head.hh"
16 #include "staff-symbol-referencer.hh"
17 #include "stream-event.hh"
19 #include "translator.icc"
21 class Rest_engraver
: public Engraver
23 Stream_event
*rest_event_
;
27 void start_translation_timestep ();
28 void process_music ();
29 DECLARE_TRANSLATOR_LISTENER (rest
);
31 TRANSLATOR_DECLARATIONS (Rest_engraver
);
35 Should merge with Note_head_engraver
37 Rest_engraver::Rest_engraver ()
45 Rest_engraver::start_translation_timestep ()
53 Rest_engraver::process_music ()
55 if (rest_event_
&& !rest_
)
57 rest_
= make_item ("Rest", rest_event_
->self_scm ());
58 Pitch
*p
= unsmob_pitch (rest_event_
->get_property ("pitch"));
62 int pos
= p
->steps ();
63 SCM c0
= get_property ("middleCPosition");
64 if (scm_is_number (c0
))
65 pos
+= scm_to_int (c0
);
67 rest_
->set_property ("staff-position", scm_from_int (pos
));
72 IMPLEMENT_TRANSLATOR_LISTENER (Rest_engraver
, rest
);
74 Rest_engraver::listen_rest (Stream_event
*ev
)
76 ASSIGN_EVENT_ONCE (rest_event_
, ev
);
79 ADD_TRANSLATOR (Rest_engraver
,