2 rest-grav.cc -- implement Rest_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "staff-symbol-referencer.hh"
10 #include "musical-request.hh"
12 #include "rhythmic-head.hh"
13 #include "engraver.hh"
16 class Rest_engraver : public Engraver
18 Rest_req *rest_req_l_;
22 virtual bool try_music (Music *);
23 virtual void stop_translation_timestep ();
24 virtual void start_translation_timestep ();
25 virtual void create_grobs ();
29 TRANSLATOR_DECLARATIONS(Rest_engraver);
34 Should merge with Note_head_engraver
36 Rest_engraver::Rest_engraver ()
44 Rest_engraver::start_translation_timestep ()
50 Rest_engraver::stop_translation_timestep ()
54 typeset_grob (rest_p_);
59 typeset_grob (dot_p_);
65 Rest_engraver::create_grobs ()
67 if (rest_req_l_ && !rest_p_)
69 rest_p_ = new Item (get_property ("Rest"));
70 Rhythmic_head::set_interface (rest_p_);
71 Staff_symbol_referencer::set_interface (rest_p_);
73 int durlog = unsmob_duration (rest_req_l_->get_mus_property ("duration"))-> duration_log ();
75 rest_p_->set_grob_property ("duration-log",
78 int dots =unsmob_duration (rest_req_l_->get_mus_property ("duration"))->dot_count ();
82 dot_p_ = new Item (get_property ("Dots"));
84 Rhythmic_head::set_dots (rest_p_, dot_p_);
85 dot_p_->set_parent (rest_p_, Y_AXIS);
86 dot_p_->set_grob_property ("dot-count", gh_int2scm (dots));
87 announce_grob (dot_p_,0);
90 announce_grob (rest_p_, rest_req_l_);
95 Rest_engraver::try_music (Music *m)
97 if (Rest_req *r = dynamic_cast <Rest_req *> (m))
107 ENTER_DESCRIPTION(Rest_engraver,
109 /* creats*/ "Rest Dots",