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