2 head-grav.cc -- part of GNU LilyPond
4 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 #include "note-head.hh"
8 #include "note-heads-engraver.hh"
9 #include "paper-def.hh"
10 #include "musical-request.hh"
12 #include "dot-column.hh"
14 Note_heads_engraver::Note_heads_engraver()
19 Note_heads_engraver::do_try_music (Music *m)
21 if (Note_req * n =dynamic_cast <Note_req *> (m))
23 note_req_l_arr_.push (n);
24 notes_end_pq_.insert (now_mom () + m->length_mom ());
28 else if (Tonic_req* t = dynamic_cast<Tonic_req*> (m))
32 else if (Inversion_req* i = dynamic_cast<Inversion_req*> (m))
36 else if (Bass_req* b = dynamic_cast<Bass_req*> (m))
40 else if (Busy_playing_req * p = dynamic_cast<Busy_playing_req*> (m))
42 return notes_end_pq_.size ();
44 else if (Pitch_interrogate_req *p = dynamic_cast<Pitch_interrogate_req*> (m))
46 for (int i= note_req_l_arr_.size (); i--;)
47 p->pitch_arr_.push (note_req_l_arr_[i]->pitch_); // GUH UGH UGHUGH.
55 Note_heads_engraver::do_process_requests()
57 if (note_p_arr_.size ())
60 SCM noteheadstyle = get_property ("noteHeadStyle", 0);
61 for (int i=0; i < note_req_l_arr_.size (); i++)
63 Note_head *note_p = new Note_head;
64 Note_req * note_req_l = note_req_l_arr_[i];
65 note_p->balltype_i_ = note_req_l->duration_.durlog_i_;
67 if (note_req_l->duration_.dots_i_)
71 d->dots_i_ = note_req_l->duration_.dots_i_;
73 SCM dir = get_property ("verticalDirection",0);
76 d->resolve_dir_ = to_dir (dir);
79 announce_element (Score_element_info (d,0));
82 note_p->set_position(note_req_l->pitch_.steps ());
85 TODO: transparent note heads.
88 if (gh_string_p (noteheadstyle))
90 note_p->set_elt_property ("style", noteheadstyle);
93 Score_element_info itinf (note_p,note_req_l);
94 announce_element (itinf);
95 note_p_arr_.push (note_p);
100 Note_heads_engraver::do_pre_move_processing()
102 for (int i=0; i < note_p_arr_.size (); i++)
104 typeset_element (note_p_arr_[i]);
106 note_p_arr_.clear ();
107 for (int i=0; i < dot_p_arr_.size (); i++)
109 typeset_element (dot_p_arr_[i]);
113 note_req_l_arr_.clear ();
117 Note_heads_engraver::do_post_move_processing()
119 Moment n (now_mom ());
120 while (notes_end_pq_.size () && notes_end_pq_.front () <=n)
121 notes_end_pq_.get ();
126 ADD_THIS_TRANSLATOR(Note_heads_engraver);