lilypond-1.3.12
[lilypond.git] / lily / rest-engraver.cc
blob368f6fdae2f066e6aa023df5417a365b66afee51
1 /*
2 rest-grav.cc -- implement Rest_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8 #include "staff-symbol-referencer.hh"
9 #include "rest-engraver.hh"
10 #include "musical-request.hh"
11 #include "dots.hh"
12 #include "rest.hh"
14 Should merge with Note_head_engraver
16 Rest_engraver::Rest_engraver ()
18 rest_req_l_ =0;
19 rest_p_ =0;
20 dot_p_ =0;
23 void
24 Rest_engraver::do_post_move_processing ()
26 rest_req_l_ =0;
29 void
30 Rest_engraver::do_pre_move_processing ()
32 if (rest_p_)
34 typeset_element (rest_p_);
35 rest_p_ =0;
37 if (dot_p_)
39 typeset_element (dot_p_);
40 dot_p_ =0;
44 void
45 Rest_engraver::do_process_requests ()
47 if (rest_req_l_ && !rest_p_)
49 rest_p_ = new Rest;
50 Staff_symbol_referencer_interface si (rest_p_);
51 si.set_interface ();
53 rest_p_->set_elt_property ("duration-log",
54 gh_int2scm (rest_req_l_->duration_.durlog_i_));
56 if (rest_req_l_->duration_.dots_i_)
58 dot_p_ = new Dots;
60 Staff_symbol_referencer_interface si (dot_p_);
61 si.set_interface ();
63 rest_p_->add_dots (dot_p_);
64 dot_p_->dots_i_ = rest_req_l_->duration_.dots_i_;
65 announce_element (Score_element_info (dot_p_,0));
68 announce_element (Score_element_info (rest_p_, rest_req_l_));
72 bool
73 Rest_engraver::do_try_music (Music *req)
75 if (Rest_req *r = dynamic_cast <Rest_req *> (req))
77 rest_req_l_ = r;
78 return true;
80 return false;
84 ADD_THIS_TRANSLATOR(Rest_engraver);