+#include "engraver.hh"
+#include "pqueue.hh"
+#include "note-spacing.hh"
+#include "staff-spacing.hh"
+#include "group-interface.hh"
+#include "spanner.hh"
+
+struct Rhythmic_tuple
+{
+ Grob_info info_;
+ Moment end_;
+
+ Rhythmic_tuple ()
+ {
+ }
+ Rhythmic_tuple (Grob_info i, Moment m)
+ {
+ info_ = i;
+ end_ = m;
+ }
+ static int time_compare (Rhythmic_tuple const &, Rhythmic_tuple const &);
+};
+
+/**
+ Acknowledge rhythmic elements, for initializing spacing fields in
+ the columns.
+
+ should be the last one of the toplevel context
+*/
+class Spacing_engraver : public Engraver
+{
+ PQueue<Rhythmic_tuple> playing_durations_;
+ Array<Rhythmic_tuple> now_durations_;
+ Array<Rhythmic_tuple> stopped_durations_;
+ Moment now_;
+ Spanner * spacing_;
+
+ TRANSLATOR_DECLARATIONS (Spacing_engraver);
+protected:
+ virtual void acknowledge_grob (Grob_info);
+ virtual void start_translation_timestep ();
+ virtual void stop_translation_timestep ();
+ virtual void process_music ();
+ virtual void finalize ();
+};