lilypond-1.3.130
[lilypond.git] / lily / head-engraver.cc
blob4b0a3b06fd5fa912505e8286d192044d8b02c38e
1 /*
2 head-grav.cc -- part of GNU LilyPond
4 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
5 */
7 #include "note-head.hh"
8 #include "head-engraver.hh"
9 #include "paper-def.hh"
10 #include "musical-request.hh"
11 #include "dots.hh"
13 Note_head_engraver::Note_head_engraver()
15 dot_p_=0;
16 note_p_ = 0;
17 note_req_l_ =0;
20 bool
21 Note_head_engraver::do_try_request (Request *req_l)
23 if (note_req_l_)
24 return false;
26 if (Note_req * nr = dynamic_cast <Note_req *> (req_l))
28 note_req_l_= nr;
29 return true;
31 return false;
34 void
35 Note_head_engraver::do_process_requests()
37 if (!note_req_l_ || note_p_)
38 return;
40 note_p_ = new Note_head;
41 note_p_->balltype_i_ = note_req_l_->duration_.durlog_i_;
42 note_p_->dots_i_ = note_req_l_->duration_.dots_i_;
43 if (note_p_->dots_i_)
45 dot_p_ = new Dots;
46 note_p_->dots_l_ = dot_p_;
47 announce_element (Score_element_info (dot_p_,0));
50 note_p_->position_i_ = dynamic_cast <Note_req *> (note_req_l_)->pitch_.steps ();
53 Score_element_info itinf (note_p_,note_req_l_);
54 announce_element (itinf);
57 void
58 Note_head_engraver::do_pre_move_processing()
60 if (note_p_)
62 typeset_element (note_p_);
63 note_p_ = 0;
65 if (dot_p_)
67 typeset_element (dot_p_);
68 dot_p_ =0;
71 void
72 Note_head_engraver::do_post_move_processing()
74 note_req_l_ = 0;
78 IMPLEMENT_IS_TYPE_B1(Note_head_engraver,Engraver);
79 ADD_THIS_TRANSLATOR(Note_head_engraver);