]> git.donarmstrong.com Git - lilypond.git/blob - lily/collision-engraver.cc
patch::: 1.3.18.jcn1
[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 ADD_THIS_TRANSLATOR (Collision_engraver);
15
16 void
17 Collision_engraver::process_acknowledged ()
18 {
19    
20   if (col_p_ || note_column_l_arr_.size () < 2)
21       return ;
22   if (!col_p_) 
23     {
24       col_p_ = new Collision;
25       announce_element (Score_element_info (col_p_,0));
26     }
27   for (int i=0; i< note_column_l_arr_.size (); i++)
28     col_p_->add_column (note_column_l_arr_[i]);
29 }
30
31 void
32 Collision_engraver::acknowledge_element (Score_element_info i)
33 {
34   if (Note_column * c = dynamic_cast<Note_column *> (i.elem_l_))
35     {
36       /*should check Y axis? */
37       if (c->rest_b () || c->parent_l(X_AXIS))
38         return ;
39
40       note_column_l_arr_.push (c);
41     }
42 }
43
44 void
45 Collision_engraver::do_pre_move_processing()
46 {
47   if (col_p_) 
48     {
49       typeset_element (col_p_);
50       col_p_ =0;
51     }
52   note_column_l_arr_.clear ();
53 }
54
55 Collision_engraver::Collision_engraver()
56 {
57   col_p_ =0;
58 }