]> git.donarmstrong.com Git - lilypond.git/blob - lily/collision-grav.cc
6a6dcef13c57449468cfdbf9c4589f8d2e250606
[lilypond.git] / lily / collision-grav.cc
1 /*
2   collision-reg.cc -- implement Collision_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "note-column.hh"
10 #include "collision-grav.hh"
11 #include "collision.hh"
12
13 void
14 Collision_engraver::acknowledge_element (Score_elem_info i)
15 {
16   if (i.elem_l_->is_type_b (Note_column::static_name ()))
17     {
18       Note_column * c = (Note_column*) i.elem_l_->item ();
19       if (c->rest_b ())
20         return ;
21       if (!col_p_) 
22         {
23           col_p_ = new Collision;
24           announce_element (Score_elem_info (col_p_,0));
25         }
26       col_p_->add (c);
27     }
28 }
29 void
30 Collision_engraver::do_pre_move_processing()
31 {
32   if (col_p_) 
33     {
34       typeset_element (col_p_);
35       col_p_ =0;
36     }
37 }
38 Collision_engraver::Collision_engraver()
39 {
40   col_p_ =0;
41 }
42
43
44 IMPLEMENT_IS_TYPE_B1(Collision_engraver,Engraver);
45 ADD_THIS_TRANSLATOR(Collision_engraver);