2 rest-grav.cc -- implement Rest_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 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_;
20 Score_element* rest_p_;
22 virtual bool do_try_music (Music *);
23 virtual void do_pre_move_processing ();
24 virtual void do_post_move_processing ();
25 virtual void do_process_music ();
28 VIRTUAL_COPY_CONS(Translator);
34 Should merge with Note_head_engraver
36 Rest_engraver::Rest_engraver ()
44 Rest_engraver::do_post_move_processing ()
50 Rest_engraver::do_pre_move_processing ()
54 typeset_element (rest_p_);
59 typeset_element (dot_p_);
65 Rest_engraver::do_process_music ()
67 if (rest_req_l_ && !rest_p_)
69 rest_p_ = new Item (get_property ("basicRestProperties"));
70 Rhythmic_head::set_interface (rest_p_);
71 Staff_symbol_referencer::set_interface (rest_p_);
74 rest_p_->set_elt_property ("duration-log",
75 gh_int2scm (rest_req_l_->duration_.durlog_i_));
77 if (rest_req_l_->duration_.dots_i_)
79 dot_p_ = new Item (get_property ("basicDotsProperties"));
81 Staff_symbol_referencer::set_interface (dot_p_);
82 Rhythmic_head::set_dots (rest_p_, dot_p_);
83 dot_p_->set_parent (rest_p_, Y_AXIS);
84 dot_p_->add_offset_callback (Dots::quantised_position_callback, Y_AXIS);
85 dot_p_->set_elt_property ("dot-count",
86 gh_int2scm (rest_req_l_->duration_.dots_i_));
87 announce_element (Score_element_info (dot_p_,0));
90 announce_element (Score_element_info (rest_p_, rest_req_l_));
95 Rest_engraver::do_try_music (Music *req)
97 if (Rest_req *r = dynamic_cast <Rest_req *> (req))
106 ADD_THIS_TRANSLATOR(Rest_engraver);