2 rest-grav.cc -- implement Rest_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "staff-symbol-referencer.hh"
12 #include "rhythmic-head.hh"
13 #include "engraver.hh"
16 class Rest_engraver
: public Engraver
22 virtual bool try_music (Music
*);
23 virtual void stop_translation_timestep ();
24 virtual void start_translation_timestep ();
25 virtual void process_music ();
28 TRANSLATOR_DECLARATIONS (Rest_engraver
);
33 Should merge with Note_head_engraver
35 Rest_engraver::Rest_engraver ()
43 Rest_engraver::start_translation_timestep ()
49 Rest_engraver::stop_translation_timestep ()
56 Rest_engraver::process_music ()
58 if (rest_req_
&& !rest_
)
60 rest_
= make_item ("Rest", rest_req_
->self_scm ());
62 int durlog
= unsmob_duration (rest_req_
->get_property ("duration"))-> duration_log ();
64 rest_
->set_property ("duration-log",
65 scm_int2num (durlog
));
67 int dots
=unsmob_duration (rest_req_
->get_property ("duration"))->dot_count ();
71 dot_
= make_item ("Dots", SCM_EOL
);
73 Rhythmic_head::set_dots (rest_
, dot_
);
74 dot_
->set_parent (rest_
, Y_AXIS
);
75 dot_
->set_property ("dot-count", scm_int2num (dots
));
79 Pitch
*p
= unsmob_pitch (rest_req_
->get_property ("pitch"));
82 This is ridiculous -- rests don't have pitch, but we act as if
88 SCM c0
= get_property ("middleCPosition");
89 if (ly_c_number_p (c0
))
90 pos
+= ly_scm2int (c0
);
92 rest_
->set_property ("staff-position", scm_int2num (pos
));
99 Rest_engraver::try_music (Music
*m
)
101 if (m
->is_mus_type ("rest-event"))
109 ENTER_DESCRIPTION (Rest_engraver
,
111 /* creats*/ "Rest Dots",
112 /* accepts */ "rest-event",
114 /* reads */ "middleCPosition",