+#include "rest.hh"
+#include "drul-array.hh"
+#include "item.hh"
+#include "spanner.hh"
+#include "context.hh"
+
+class Beam_engraver : public Engraver
+{
+protected:
+ Music *start_ev_;
+
+ Spanner *finished_beam_;
+ Spanner *beam_;
+ Music *prev_start_ev_;
+
+ Music *now_stop_ev_;
+
+ Beaming_info_list *beam_info_;
+ Beaming_info_list *finished_beam_info_;
+
+ /// location within measure where beam started.
+ Moment beam_start_location_;
+
+ /// moment (global time) where beam started.
+ Moment beam_start_mom_;
+
+ bool subdivide_beams_;
+ Moment beat_length_;
+
+ void typeset_beam ();
+ void set_melisma (bool);
+
+ Moment last_stem_added_at_;
+ virtual void stop_translation_timestep ();
+ virtual void start_translation_timestep ();
+ virtual void finalize ();
+
+ virtual void acknowledge_grob (Grob_info);
+ virtual bool try_music (Music *);
+ virtual void process_music ();
+
+ virtual bool valid_start_point ();
+ virtual bool valid_end_point ();
+
+public:
+ TRANSLATOR_DECLARATIONS (Beam_engraver);
+};
+
+/*
+ Hmm. this isn't necessary, since grace beams and normal beams are
+ always nested.
+*/
+bool
+Beam_engraver::valid_start_point ()
+{
+ Moment n = now_mom ();
+
+ return n.grace_part_ == Rational (0);
+}
+
+bool
+Beam_engraver::valid_end_point ()
+{
+ return valid_start_point ();
+}