]> git.donarmstrong.com Git - lilypond.git/blob - lily/heads-engraver.cc
release: 1.1.29
[lilypond.git] / lily / heads-engraver.cc
1 /*
2   head-grav.cc -- part of GNU LilyPond
3
4   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
5 */
6
7 #include "note-head.hh"
8 #include "heads-engraver.hh"
9 #include "paper-def.hh"
10 #include "musical-request.hh"
11 #include "dots.hh"
12 #include "dot-column.hh"
13
14 Note_heads_engraver::Note_heads_engraver()
15 {
16 }
17
18 bool
19 Note_heads_engraver::do_try_music (Music *m) 
20 {
21   if (Note_req * n =dynamic_cast <Note_req *> (m))
22     {
23       note_req_l_arr_.push (n);
24       return true;
25     }
26   if (Tonic_req* t = dynamic_cast<Tonic_req*> (m))
27     {
28       return true;
29     }
30   return false;
31 }
32
33 void
34 Note_heads_engraver::do_process_requests()
35 {
36   if (note_p_arr_.size ())
37     return ;
38   
39   for (int i=0; i < note_req_l_arr_.size (); i++)
40     {
41       Note_head *note_p  = new Note_head;
42       Note_req * note_req_l = note_req_l_arr_[i];
43       note_p->balltype_i_ = note_req_l->duration_.durlog_i_;
44       note_p->dots_i_ = note_req_l->duration_.dots_i_;
45       if (note_p->dots_i_)
46         {
47           Dots * d = new Dots;
48           note_p->dots_l_ = d;
49           announce_element (Score_element_info (d,0));
50           dot_p_arr_.push (d);
51         }
52
53       note_p->steps_i_ = note_req_l->pitch_.steps ();
54       //      note_p->position_i_ = note_req_l->pitch_.steps ();
55
56       String noteheadstyle = get_property ("noteheadStyle", 0);
57       if (noteheadstyle.length_i ())
58         note_p->note_head_type_str_ = noteheadstyle;
59   
60       Score_element_info itinf (note_p,note_req_l);
61       announce_element (itinf);
62       note_p_arr_.push (note_p);
63     }
64 }
65  
66 void
67 Note_heads_engraver::do_pre_move_processing()
68 {
69   for (int i=0; i < note_p_arr_.size (); i++)
70     {
71       typeset_element (note_p_arr_[i]);
72     }
73   note_p_arr_.clear ();
74   for (int i=0; i < dot_p_arr_.size (); i++)
75     {
76       typeset_element (dot_p_arr_[i]);
77     }
78   dot_p_arr_.clear ();
79   
80   note_req_l_arr_.clear ();
81 }
82
83 void
84 Note_heads_engraver::do_post_move_processing()
85 {
86
87 }
88
89
90
91 ADD_THIS_TRANSLATOR(Note_heads_engraver);