lilypond-1.3.28
[lilypond.git] / lily / rest-collision-engraver.cc
blobb2fd168d0741c161c3e2c9aa802fd5a528927305
1 /*
2 rest-collision-reg.cc -- implement Rest_collision_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include "debug.hh"
10 #include "rest-collision.hh"
11 #include "rest-collision-engraver.hh"
12 #include "collision.hh"
13 #include "note-column.hh"
17 ADD_THIS_TRANSLATOR(Rest_collision_engraver);
19 Rest_collision_engraver::Rest_collision_engraver()
21 rest_collision_p_ =0;
24 void
25 Rest_collision_engraver::process_acknowledged ()
27 if (rest_collision_p_ || note_column_l_arr_.size () < 2)
28 return;
30 rest_collision_p_ = new Rest_collision;
31 announce_element (Score_element_info (rest_collision_p_, 0));
32 for (int i=0; i< note_column_l_arr_.size (); i++)
33 rest_collision_p_->add_column (note_column_l_arr_[i]);
36 void
37 Rest_collision_engraver::acknowledge_element (Score_element_info i)
39 if (dynamic_cast<Note_column *> (i.elem_l_))
40 note_column_l_arr_.push (dynamic_cast<Note_column *> (i.elem_l_));
43 void
44 Rest_collision_engraver::do_pre_move_processing()
46 if (rest_collision_p_)
48 typeset_element (rest_collision_p_);
49 rest_collision_p_ = 0;
51 note_column_l_arr_.clear ();