]> git.donarmstrong.com Git - lilypond.git/blob - lily/rest-collision-grav.cc
release: 0.0.76
[lilypond.git] / lily / rest-collision-grav.cc
1 /*
2   rest-collision-reg.cc -- implement Rest_collision_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "debug.hh"
10 #include "rest-collision.hh"
11 #include "rest-collision-grav.hh"
12 #include "collision.hh"
13 #include "rest-column.hh"
14 #include "note-column.hh"
15
16 IMPLEMENT_STATIC_NAME(Rest_collision_engraver);
17 IMPLEMENT_IS_TYPE_B1(Rest_collision_engraver, Engraver);
18 ADD_THIS_ENGRAVER(Rest_collision_engraver);
19
20 Rest_collision_engraver::Rest_collision_engraver()
21 {
22     rest_collision_p_ =0;
23 }
24
25 void
26 Rest_collision_engraver::acknowledge_element(Score_elem_info i)
27 {
28     char const * nC = i.elem_l_->name();
29     if (nC == Collision::static_name()) {
30         collision_l_arr_.push((Collision*)i.elem_l_->item());
31     } 
32     else if (nC == Note_column::static_name()) {
33         // what should i do, what should _engraver do?
34         if (!rest_collision_p_)
35             rest_collision_p_ = new Rest_collision;
36         rest_collision_p_->add((Note_column*)i.elem_l_->item());
37     }
38     else if (nC == Rest_column::static_name()) {
39         if (!rest_collision_p_)
40             rest_collision_p_ = new Rest_collision;
41         rest_collision_p_->add((Rest_column*)i.elem_l_->item());
42     }
43 }
44
45 void
46 Rest_collision_engraver::do_pre_move_processing()
47 {
48     if (rest_collision_p_) {
49         typeset_element(rest_collision_p_);
50         rest_collision_p_ = 0;
51     }
52 }
53
54 void
55 Rest_collision_engraver::do_print() const
56 {
57 #ifndef NPRINT
58     if ( rest_collision_p_ )
59         rest_collision_p_->print();
60 #endif
61 }