]> git.donarmstrong.com Git - lilypond.git/blob - lily/collision-engraver.cc
d7c6a102abbe2a4f79a9965c9f7747b57f1a051b
[lilypond.git] / lily / collision-engraver.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@cs.uu.nl>
7 */
8
9 #include "note-column.hh"
10 #include "collision-engraver.hh"
11 #include "collision.hh"
12
13 void
14 Collision_engraver::process_acknowledged ()
15 {
16    
17   if (col_p_ || note_column_l_arr_.size () < 2)
18       return ;
19   if (!col_p_) 
20     {
21       col_p_ = new Collision;
22       announce_element (Score_element_info (col_p_,0));
23     }
24   for (int i=0; i< note_column_l_arr_.size (); i++)
25     col_p_->add_column (note_column_l_arr_[i]);
26 }
27
28 void
29 Collision_engraver::acknowledge_element (Score_element_info i)
30 {
31   if (i.elem_l_->is_type_b (Note_column::static_name ()))
32     {
33       Note_column * c = (Note_column*) dynamic_cast <Item *> (i.elem_l_);
34       if (c->rest_b ())
35         return ;
36
37       note_column_l_arr_.push (c);
38     }
39 }
40
41 void
42 Collision_engraver::do_pre_move_processing()
43 {
44   if (col_p_) 
45     {
46       typeset_element (col_p_);
47       col_p_ =0;
48     }
49   note_column_l_arr_.clear ();
50 }
51
52 Collision_engraver::Collision_engraver()
53 {
54   col_p_ =0;
55 }
56
57
58 IMPLEMENT_IS_TYPE_B1(Collision_engraver,Engraver);
59 ADD_THIS_TRANSLATOR(Collision_engraver);