]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/rest-collision-engraver.cc
Run `make grand-replace'.
[lilypond.git] / lily / rest-collision-engraver.cc
index 2d718092f0d26dbabc42fc6ffcdb6b4e3bb0e4c7..df1c486924e296d59aa5f2bb54fbba632fce2c12 100644 (file)
@@ -3,23 +3,24 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1997--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include "warn.hh"
 #include "engraver.hh"
 #include "rest-collision.hh"
 #include "note-column.hh"
+#include "item.hh"
 
 class Rest_collision_engraver : public Engraver
 {
   Item *rest_collision_;
-  int rest_count_;
-  Link_array<Grob> note_columns_;
+  vsize rest_count_;
+  vector<Grob*> note_columns_;
 protected:
-  virtual void acknowledge_grob (Grob_info);
-  virtual void process_acknowledged_grobs ();
-  virtual void stop_translation_timestep ();
+  DECLARE_ACKNOWLEDGER (note_column);
+  void process_acknowledged ();
+  void stop_translation_timestep ();
 public:
   TRANSLATOR_DECLARATIONS (Rest_collision_engraver);
 };
@@ -31,10 +32,10 @@ Rest_collision_engraver::Rest_collision_engraver ()
 }
 
 void
-Rest_collision_engraver::process_acknowledged_grobs ()
+Rest_collision_engraver::process_acknowledged ()
 {
   if (rest_collision_
-      || note_columns_.is_empty ()
+      || note_columns_.empty ()
       || !rest_count_
       || (note_columns_.size () == rest_count_
          && rest_count_ < 2))
@@ -42,19 +43,16 @@ Rest_collision_engraver::process_acknowledged_grobs ()
 
   rest_collision_ = make_item ("RestCollision", SCM_EOL);
 
-  for (int i = 0; i < note_columns_.size (); i++)
+  for (vsize i = 0; i < note_columns_.size (); i++)
     Rest_collision::add_column (rest_collision_, note_columns_[i]);
 }
 
 void
-Rest_collision_engraver::acknowledge_grob (Grob_info i)
+Rest_collision_engraver::acknowledge_note_column (Grob_info i)
 {
-  if (Note_column::has_interface (i.grob ()))
-    {
-      note_columns_.push (i.grob ());
-      if (Note_column::has_rests (i.grob ()))
-       rest_count_++;
-    }
+  note_columns_.push_back (i.grob ());
+  if (Note_column::has_rests (i.grob ()))
+    rest_count_++;
 }
 
 void
@@ -65,10 +63,19 @@ Rest_collision_engraver::stop_translation_timestep ()
   rest_count_ = 0;
 }
 
+#include "translator.icc"
+
+ADD_ACKNOWLEDGER (Rest_collision_engraver, note_column);
 ADD_TRANSLATOR (Rest_collision_engraver,
-               /* descr */ "Handles collisions of rests.",
-               /* creats*/ "RestCollision",
-               /* accepts */ "",
-               /* acks  */ "note-column-interface",
-               /* reads */ "",
-               /* write */ "");
+               /* doc */
+               "Handle collisions of rests.",
+
+               /* create */
+               "RestCollision ",
+
+               /* read */
+               "",
+
+               /* write */
+               ""
+               );