]> git.donarmstrong.com Git - lilypond.git/blob - lily/heads-engraver.cc
patch::: 1.1.23.ms2
[lilypond.git] / lily / heads-engraver.cc
1 /*
2   head-grav.cc -- part of GNU LilyPond
3
4   (c)  1997--1998 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 *req_l) 
20 {
21   if (Note_req * n =dynamic_cast <Note_req *> (req_l))
22     {
23       note_req_l_arr_.push (n);
24       return true;
25     }
26   return false;
27 }
28
29 void
30 Note_heads_engraver::do_process_requests()
31 {
32   if (note_p_arr_.size ())
33     return ;
34   
35   for (int i=0; i < note_req_l_arr_.size (); i++)
36     {
37       Note_head *note_p  = new Note_head;
38       Note_req * note_req_l = note_req_l_arr_[i];
39       note_p->balltype_i_ = note_req_l->duration_.durlog_i_;
40       note_p->dots_i_ = note_req_l->duration_.dots_i_;
41       if (note_p->dots_i_)
42         {
43           Dots * d = new Dots;
44           note_p->dots_l_ = d;
45           announce_element (Score_element_info (d,0));
46           dot_p_arr_.push (d);
47         }
48
49       note_p->steps_i_ = note_req_l->pitch_.steps ();
50       //      note_p->position_i_ = note_req_l->pitch_.steps ();
51
52       String noteheadstyle = get_property ("noteheadStyle", 0);
53       if (noteheadstyle.length_i ())
54         note_p->note_head_type_str_ = noteheadstyle;
55   
56       Score_element_info itinf (note_p,note_req_l);
57       announce_element (itinf);
58       note_p_arr_.push (note_p);
59     }
60 }
61  
62 void
63 Note_heads_engraver::do_pre_move_processing()
64 {
65   for (int i=0; i < note_p_arr_.size (); i++)
66     {
67       typeset_element (note_p_arr_[i]);
68     }
69   note_p_arr_.clear ();
70   for (int i=0; i < dot_p_arr_.size (); i++)
71     {
72       typeset_element (dot_p_arr_[i]);
73     }
74   dot_p_arr_.clear ();
75   
76   note_req_l_arr_.clear ();
77 }
78
79 void
80 Note_heads_engraver::do_post_move_processing()
81 {
82
83 }
84
85
86
87 ADD_THIS_TRANSLATOR(Note_heads_engraver);