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 ()
64 Rest_engraver::process_music ()
66 if (rest_req_ && !rest_)
68 rest_ = make_item ("Rest");
70 int durlog = unsmob_duration (rest_req_->get_property ("duration"))-> duration_log ();
72 rest_->set_property ("duration-log",
73 scm_int2num (durlog));
75 int dots =unsmob_duration (rest_req_->get_property ("duration"))->dot_count ();
79 dot_ = make_item ("Dots");
81 Rhythmic_head::set_dots (rest_, dot_);
82 dot_->set_parent (rest_, Y_AXIS);
83 dot_->set_property ("dot-count", scm_int2num (dots));
84 announce_grob (dot_, SCM_EOL);
87 Pitch *p = unsmob_pitch (rest_req_->get_property ("pitch"));
90 This is ridiculous -- rests don't have pitch, but we act as if
96 SCM c0 = get_property ("middleCPosition");
98 pos += ly_scm2int (c0);
100 rest_->set_property ("staff-position", scm_int2num (pos));
103 announce_grob (rest_, rest_req_->self_scm ());
108 Rest_engraver::try_music (Music *m)
110 if (m->is_mus_type ("rest-event"))
118 ENTER_DESCRIPTION (Rest_engraver,
120 /* creats*/ "Rest Dots",
121 /* accepts */ "rest-event",
123 /* reads */ "middleCPosition",