2 rest-collision-reg.cc -- implement Rest_collision_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "rest-collision.hh"
11 #include "engraver.hh"
12 #include "note-collision.hh"
13 #include "note-column.hh"
15 class Rest_collision_engraver : public Engraver
17 Item* rest_collision_;
19 Link_array<Grob> note_columns_;
21 virtual void acknowledge_grob (Grob_info);
22 virtual void process_acknowledged_grobs ();
23 virtual void stop_translation_timestep ();
25 TRANSLATOR_DECLARATIONS(Rest_collision_engraver);
30 Rest_collision_engraver::Rest_collision_engraver ()
37 Rest_collision_engraver::process_acknowledged_grobs ()
40 || note_columns_.is_empty ()
44 rest_collision_ = make_item ("RestCollision");
46 announce_grob(rest_collision_, SCM_EOL);
47 for (int i=0; i < note_columns_.size (); i++)
48 Rest_collision::add_column (rest_collision_,note_columns_[i]);
52 Rest_collision_engraver::acknowledge_grob (Grob_info i)
54 if (Note_column::has_interface (i.grob_))
56 note_columns_.push (i.grob_);
57 if (Note_column::has_rests (i.grob_))
63 Rest_collision_engraver::stop_translation_timestep ()
67 typeset_grob (rest_collision_);
70 note_columns_.clear ();
74 ENTER_DESCRIPTION(Rest_collision_engraver,
75 /* descr */ "Handles collisions of rests.",
76 /* creats*/ "RestCollision",
78 /* acks */ "note-column-interface",