2 rest-collision-engraver.cc -- implement Rest_collision_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "engraver.hh"
11 #include "rest-collision.hh"
12 #include "note-column.hh"
15 class Rest_collision_engraver : public Engraver
17 Item *rest_collision_;
19 vector<Grob*> note_columns_;
21 DECLARE_ACKNOWLEDGER (note_column);
22 void process_acknowledged ();
23 void stop_translation_timestep ();
25 TRANSLATOR_DECLARATIONS (Rest_collision_engraver);
28 Rest_collision_engraver::Rest_collision_engraver ()
35 Rest_collision_engraver::process_acknowledged ()
38 || note_columns_.empty ()
40 || (note_columns_.size () == rest_count_
44 rest_collision_ = make_item ("RestCollision", SCM_EOL);
46 for (vsize i = 0; i < note_columns_.size (); i++)
47 Rest_collision::add_column (rest_collision_, note_columns_[i]);
51 Rest_collision_engraver::acknowledge_note_column (Grob_info i)
53 note_columns_.push_back (i.grob ());
54 if (Note_column::has_rests (i.grob ()))
59 Rest_collision_engraver::stop_translation_timestep ()
62 note_columns_.clear ();
66 #include "translator.icc"
68 ADD_ACKNOWLEDGER (Rest_collision_engraver, note_column);
69 ADD_TRANSLATOR (Rest_collision_engraver,
71 "Handle collisions of rests.",