Hi,

The attached patch converts a bunch of engravers. It relies on my previous 
patch.

-- 
Erik
Index: lily/arpeggio-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/arpeggio-engraver.cc,v
retrieving revision 1.43
diff -u -r1.43 arpeggio-engraver.cc
--- lily/arpeggio-engraver.cc	14 Jul 2006 06:58:29 -0000	1.43
+++ lily/arpeggio-engraver.cc	18 Jul 2006 22:04:36 -0000
@@ -45,7 +45,6 @@
 void Arpeggio_engraver::listen_arpeggio (Stream_event *ev)
 {
   arpeggio_event_ = ev;
-  ev->protect ();
 }
 
 void
@@ -86,7 +85,6 @@
   if (arpeggio_event_)
     {
       arpeggio_ = make_item ("Arpeggio", arpeggio_event_->self_scm ());
-      arpeggio_event_->unprotect ();
     }
 }
 
Index: lily/auto-beam-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/auto-beam-engraver.cc,v
retrieving revision 1.166
diff -u -r1.166 auto-beam-engraver.cc
--- lily/auto-beam-engraver.cc	22 May 2006 17:45:40 -0000	1.166
+++ lily/auto-beam-engraver.cc	18 Jul 2006 22:04:36 -0000
@@ -6,17 +6,18 @@
   (c) 1999--2006 Jan Nieuwenhuizen <[EMAIL PROTECTED]>
 */
 
-#include "engraver.hh"
+#include "bar-line.hh"
 #include "beaming-pattern.hh"
 #include "beam.hh"
-#include "stem.hh"
-#include "warn.hh"
-#include "bar-line.hh"
-#include "rest.hh"
-#include "item.hh"
-#include "spanner.hh"
 #include "context.hh"
 #include "duration.hh"
+#include "engraver.hh"
+#include "item.hh"
+#include "rest.hh"
+#include "spanner.hh"
+#include "stream-event.hh"
+#include "stem.hh"
+#include "warn.hh"
 
 #include "translator.icc"
 
@@ -28,7 +29,6 @@
   void stop_translation_timestep ();
   void start_translation_timestep ();
   void process_music ();
-  virtual bool try_music (Music *);
   virtual void finalize ();
   virtual void derived_mark () const;
 
@@ -36,6 +36,7 @@
   DECLARE_ACKNOWLEDGER (beam);
   DECLARE_ACKNOWLEDGER (bar_line);
   DECLARE_ACKNOWLEDGER (stem);
+  DECLARE_TRANSLATOR_LISTENER (beam_forbid);
 
   void process_acknowledged ();
 
@@ -50,7 +51,7 @@
   bool is_same_grace_state (Grob *e);
   void typeset_beam ();
 
-  Music *forbid_;
+  Stream_event *forbid_;
   /*
     shortest_mom is the shortest note in the beam.
   */
@@ -128,16 +129,11 @@
   beam_settings_ = SCM_EOL;
 }
 
-bool
-Auto_beam_engraver::try_music (Music *m)
+IMPLEMENT_TRANSLATOR_LISTENER (Auto_beam_engraver, beam_forbid);
+void
+Auto_beam_engraver::listen_beam_forbid (Stream_event *ev)
 {
-  if (m->is_mus_type ("beam-forbid-event"))
-    {
-      forbid_ = m;
-      return true;
-    }
-
-  return false;
+  forbid_ = ev;
 }
 
 bool
@@ -335,8 +331,8 @@
 {
   check_bar_property ();
   Item *stem = dynamic_cast<Item *> (info.grob ());
-  Music *m = info.ultimate_music_cause ();
-  if (!m->is_mus_type ("rhythmic-event"))
+  Stream_event *ev = info.ultimate_event_cause ();
+  if (!ev->in_event_class ("rhythmic-event"))
     {
       programming_error ("stem must have rhythmic structure");
       return;
@@ -359,7 +355,7 @@
       return;
     }
 
-  int durlog = unsmob_duration (m->get_property ("duration"))->duration_log ();
+  int durlog = unsmob_duration (ev->get_property ("duration"))->duration_log ();
 
   if (durlog <= 2)
     {
@@ -375,7 +371,7 @@
   if (bool (beam_start_location_.grace_part_) != bool (now.grace_part_))
     return;
 
-  Moment dur = unsmob_duration (m->get_property ("duration"))->get_length ();
+  Moment dur = unsmob_duration (ev->get_property ("duration"))->get_length ();
 
   consider_end (dur);
   consider_begin (dur);
@@ -390,7 +386,7 @@
 		       durlog - 2);
   stems_->push_back (stem);
   last_add_mom_ = now;
-  extend_mom_ = max (extend_mom_, now) + m->get_length ();
+  extend_mom_ = max (extend_mom_, now) + get_event_length (ev);
 }
 
 void
Index: lily/beam-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/beam-engraver.cc,v
retrieving revision 1.140
diff -u -r1.140 beam-engraver.cc
--- lily/beam-engraver.cc	11 Jul 2006 05:58:00 -0000	1.140
+++ lily/beam-engraver.cc	18 Jul 2006 22:04:37 -0000
@@ -16,6 +16,7 @@
 #include "item.hh"
 #include "rest.hh"
 #include "spanner.hh"
+#include "stream-event.hh"
 #include "stem.hh"
 #include "warn.hh"
 
@@ -27,13 +28,13 @@
   DECLARE_ACKNOWLEDGER (stem);
   DECLARE_ACKNOWLEDGER (rest);
 protected:
-  Music *start_ev_;
+  Stream_event *start_ev_;
 
   Spanner *finished_beam_;
   Spanner *beam_;
-  Music *prev_start_ev_;
+  Stream_event *prev_start_ev_;
 
-  Music *now_stop_ev_;
+  Stream_event *now_stop_ev_;
 
   Beaming_pattern *beam_info_;
   Beaming_pattern *finished_beam_info_;
@@ -55,12 +56,12 @@
   void start_translation_timestep ();
   virtual void finalize ();
 
-  virtual bool try_music (Music *);
   void process_music ();
 
   virtual bool valid_start_point ();
   virtual bool valid_end_point ();
 
+  DECLARE_TRANSLATOR_LISTENER (beam);
 public:
   TRANSLATOR_DECLARATIONS (Beam_engraver);
 };
@@ -94,24 +95,16 @@
   prev_start_ev_ = 0;
 }
 
-bool
-Beam_engraver::try_music (Music *m)
+IMPLEMENT_TRANSLATOR_LISTENER (Beam_engraver, beam);
+void
+Beam_engraver::listen_beam (Stream_event *ev)
 {
-  if (m->is_mus_type ("beam-event"))
-    {
-      Direction d = to_dir (m->get_property ("span-direction"));
-      if (d == START && !valid_start_point ())
-	return false;
-      if (d == STOP && !valid_end_point ())
-	return false;
-
-      if (d == START)
-	start_ev_ = m;
-      else if (d == STOP)
-	now_stop_ev_ = m;
-      return true;
-    }
-  return false;
+  Direction d = to_dir (ev->get_property ("span-direction"));
+
+  if (d == START && valid_start_point ())
+    start_ev_ = ev;
+  else if (d == STOP && valid_end_point ())
+    now_stop_ev_ = ev;
 }
 
 void
@@ -238,23 +231,18 @@
 
   
   
-  Music *m = info.ultimate_music_cause ();
-  if (!m->is_mus_type ("rhythmic-event"))
+  Stream_event *ev = info.ultimate_event_cause ();
+  if (!ev->in_event_class ("rhythmic-event"))
     {
-      string s = _ ("stem must have Rhythmic structure");
-      if (info.music_cause ())
-	info.music_cause ()->origin ()->warning (s);
-      else
-	::warning (s);
-
+      info.grob ()->warning (_ ("stem must have Rhythmic structure"));
       return;
     }
 
   last_stem_added_at_ = now;
-  int durlog = unsmob_duration (m->get_property ("duration"))->duration_log ();
+  int durlog = unsmob_duration (ev->get_property ("duration"))->duration_log ();
   if (durlog <= 2)
     {
-      m->origin ()->warning (_ ("stem doesn't fit in beam"));
+      ev->origin ()->warning (_ ("stem doesn't fit in beam"));
       prev_start_ev_->origin ()->warning (_ ("beam was started here"));
       /*
 	don't return, since
Index: lily/breathing-sign-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/breathing-sign-engraver.cc,v
retrieving revision 1.43
diff -u -r1.43 breathing-sign-engraver.cc
--- lily/breathing-sign-engraver.cc	6 Jan 2006 09:13:27 -0000	1.43
+++ lily/breathing-sign-engraver.cc	18 Jul 2006 22:04:37 -0000
@@ -16,6 +16,9 @@
 #include "breathing-sign.hh"
 #include "engraver-group.hh"
 #include "item.hh"
+#include "stream-event.hh"
+
+#include "translator.icc"
 
 class Breathing_sign_engraver : public Engraver
 {
@@ -23,12 +26,12 @@
   TRANSLATOR_DECLARATIONS (Breathing_sign_engraver);
 
 protected:
-  virtual bool try_music (Music *event);
   void process_acknowledged ();
   void stop_translation_timestep ();
 
+  DECLARE_TRANSLATOR_LISTENER (breathing);
 private:
-  Music *breathing_sign_event_;
+  Stream_event *breathing_sign_event_;
   Grob *breathing_sign_;
 };
 
@@ -38,11 +41,11 @@
   breathing_sign_event_ = 0;
 }
 
-bool
-Breathing_sign_engraver::try_music (Music *r)
+IMPLEMENT_TRANSLATOR_LISTENER (Breathing_sign_engraver, breathing);
+void
+Breathing_sign_engraver::listen_breathing (Stream_event *r)
 {
   breathing_sign_event_ = r;
-  return true;
 }
 
 void
@@ -62,8 +65,6 @@
   breathing_sign_event_ = 0;
 }
 
-#include "translator.icc"
-
 ADD_TRANSLATOR (Breathing_sign_engraver,
 		/* doc */ "",
 		/* create */ "BreathingSign",
Index: lily/chord-name-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/chord-name-engraver.cc,v
retrieving revision 1.98
diff -u -r1.98 chord-name-engraver.cc
--- lily/chord-name-engraver.cc	11 Feb 2006 11:35:18 -0000	1.98
+++ lily/chord-name-engraver.cc	18 Jul 2006 22:04:37 -0000
@@ -6,17 +6,19 @@
   (c) 1998--2006 Jan Nieuwenhuizen <[EMAIL PROTECTED]>
 */
 
-#include "engraver.hh"
 #include "chord-name.hh"
-#include "output-def.hh"
-#include "font-interface.hh"
-#include "output-def.hh"
+#include "context.hh"
 #include "dimensions.hh"
+#include "engraver.hh"
+#include "font-interface.hh"
 #include "item.hh"
+#include "output-def.hh"
+#include "pitch.hh"
 #include "protected-scm.hh"
-#include "context.hh"
+#include "stream-event.hh"
 #include "warn.hh"
-#include "pitch.hh"
+
+#include "translator.icc"
 
 class Chord_name_engraver : public Engraver
 {
@@ -24,14 +26,12 @@
 protected:
   void stop_translation_timestep ();
   void process_music ();
-  virtual bool try_music (Music *);
   virtual void finalize ();
   virtual void derived_mark () const;
+  DECLARE_TRANSLATOR_LISTENER (note);
 private:
-  void add_note (Music *);
-
   Item *chord_name_;
-  vector<Music*> notes_;
+  vector<Stream_event*> notes_;
 
   SCM last_chord_;
 };
@@ -54,12 +54,6 @@
 }
 
 void
-Chord_name_engraver::add_note (Music *n)
-{
-  notes_.push_back (n);
-}
-
-void
 Chord_name_engraver::process_music ()
 {
   if (!notes_.size ())
@@ -69,10 +63,10 @@
   SCM inversion = SCM_EOL;
   SCM pitches = SCM_EOL;
 
-  Music *inversion_event = 0;
+  Stream_event *inversion_event = 0;
   for (vsize i = 0; i < notes_.size (); i++)
     {
-      Music *n = notes_[i];
+      Stream_event *n = notes_[i];
       SCM p = n->get_property ("pitch");
       if (!unsmob_pitch (p))
 	continue;
@@ -125,18 +119,11 @@
   last_chord_ = chord_as_scm;
 }
 
-bool
-Chord_name_engraver::try_music (Music *m)
+IMPLEMENT_TRANSLATOR_LISTENER (Chord_name_engraver, note);
+void
+Chord_name_engraver::listen_note (Stream_event *ev)
 {
-  /*
-    hmm. Should check?
-  */
-  if (m->is_mus_type ("note-event"))
-    {
-      add_note (m);
-      return true;
-    }
-  return false;
+  notes_.push_back (ev);
 }
 
 void
@@ -150,8 +137,6 @@
   The READs description is not strictly accurate:
   which properties are read depend on the chord naming function active.
 */
-#include "translator.icc"
-
 ADD_TRANSLATOR (Chord_name_engraver,
 		/* doc */ "Catch note-events "
 		"and generate the appropriate chordname.",
Index: lily/chord-tremolo-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/chord-tremolo-engraver.cc,v
retrieving revision 1.100
diff -u -r1.100 chord-tremolo-engraver.cc
--- lily/chord-tremolo-engraver.cc	24 May 2006 07:00:41 -0000	1.100
+++ lily/chord-tremolo-engraver.cc	18 Jul 2006 22:04:37 -0000
@@ -7,18 +7,18 @@
   		 Erik Sandberg <[EMAIL PROTECTED]>
 */
 
-#include "math.h" // ceil
-
 #include "beam.hh"
 #include "engraver-group.hh"
 #include "international.hh"
 #include "item.hh"
+#include "math.h" // ceil
 #include "misc.hh"
 #include "repeated-music.hh"
 #include "rhythmic-head.hh"
 #include "spanner.hh"
 #include "stem-tremolo.hh"
 #include "stem.hh"
+#include "stream-event.hh"
 #include "warn.hh"
 
 #include "translator.icc"
@@ -41,7 +41,7 @@
 {
   TRANSLATOR_DECLARATIONS (Chord_tremolo_engraver);
 protected:
-  Music *repeat_;
+  Stream_event *repeat_;
 
   int flags_;
   // number of beams for short tremolos
@@ -52,8 +52,8 @@
   Spanner *beam_;
 protected:
   virtual void finalize ();
-  virtual bool try_music (Music *);
   void process_music ();
+  DECLARE_TRANSLATOR_LISTENER (tremolo_span);
   DECLARE_ACKNOWLEDGER (stem);
 };
 
@@ -66,31 +66,27 @@
   beam_dir_ = CENTER;
 }
 
-bool
-Chord_tremolo_engraver::try_music (Music *m)
+IMPLEMENT_TRANSLATOR_LISTENER (Chord_tremolo_engraver, tremolo_span);
+void
+Chord_tremolo_engraver::listen_tremolo_span (Stream_event *ev)
 {
-  if (m->is_mus_type ("tremolo-span-event"))
+  Direction span_dir = to_dir (ev->get_property ("span-direction"));
+  if (span_dir == START)
     {
-      Direction span_dir = to_dir (m->get_property ("span-direction"));
-      if (span_dir == START)
-	{
-	  repeat_ = m;
-	  int type = scm_to_int (m->get_property ("tremolo-type"));
-	  /* e.g. 1 for type 8, 2 for type 16 */
-	  flags_ = intlog2 (type) - 2;
-	  expected_beam_count_ = scm_to_int (m->get_property ("expected-beam-count"));
-	  beam_dir_ = RIGHT;
-	}
-      if (span_dir == STOP)
-	{
-	  repeat_ = 0;
-          beam_ = 0;
-          expected_beam_count_ = 0;
-          beam_dir_ = CENTER;
-	}
-      return true;
+      repeat_ = ev;
+      int type = scm_to_int (ev->get_property ("tremolo-type"));
+      /* e.g. 1 for type 8, 2 for type 16 */
+      flags_ = intlog2 (type) - 2;
+      expected_beam_count_ = scm_to_int (ev->get_property ("expected-beam-count"));
+      beam_dir_ = RIGHT;
+    }
+  else if (span_dir == STOP)
+    {
+      repeat_ = 0;
+      beam_ = 0;
+      expected_beam_count_ = 0;
+      beam_dir_ = CENTER;
     }
-  return false;
 }
 
 void
Index: lily/cluster-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/cluster-engraver.cc,v
retrieving revision 1.45
diff -u -r1.45 cluster-engraver.cc
--- lily/cluster-engraver.cc	11 Feb 2006 11:35:18 -0000	1.45
+++ lily/cluster-engraver.cc	18 Jul 2006 22:04:37 -0000
@@ -12,19 +12,22 @@
 #include "note-column.hh"
 #include "pointer-group-interface.hh"
 #include "pitch.hh"
+#include "stream-event.hh"
+
+#include "translator.icc"
 
 class Cluster_spanner_engraver : public Engraver
 {
 
 protected:
   TRANSLATOR_DECLARATIONS (Cluster_spanner_engraver);
-  virtual bool try_music (Music *);
-  void process_music ();
+  DECLARE_TRANSLATOR_LISTENER (cluser_note);
   DECLARE_ACKNOWLEDGER (note_column);
   void stop_translation_timestep ();
+  virtual void process_music ();
   virtual void finalize ();
 private:
-  vector<Music*> cluster_notes_;
+  vector<Stream_event*> cluster_notes_;
   Item *beacon_;
 
   void typeset_grobs ();
@@ -55,18 +58,11 @@
   beacon_ = 0;
 }
 
-bool
-Cluster_spanner_engraver::try_music (Music *m)
+IMPLEMENT_TRANSLATOR_LISTENER (Cluster_spanner_engraver, cluser_note);
+void
+Cluster_spanner_engraver::listen_cluser_note (Stream_event *ev)
 {
-  if (m->is_mus_type ("cluster-note-event"))
-    {
-      cluster_notes_.push_back (m);
-      return true;
-    }
-  else if (m->is_mus_type ("busy-playing-event"))
-    return cluster_notes_.size ();
-
-  return false;
+  cluster_notes_.push_back (ev);
 }
 
 void
@@ -123,13 +119,11 @@
     }
 }
 
-#include "translator.icc"
-
 ADD_ACKNOWLEDGER (Cluster_spanner_engraver, note_column);
 ADD_TRANSLATOR (Cluster_spanner_engraver,
 		/* doc */ 	"Engraves a cluster using Spanner notation ",
 		/* create */ 	"ClusterSpanner ClusterSpannerBeacon",
-		/* accept */ 	"cluster-note-event busy-playing-event",
+		/* accept */ 	"cluster-note-event",
 		/* read */ 	"",
 		/* write */	"");
 
Index: lily/completion-note-heads-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/completion-note-heads-engraver.cc,v
retrieving revision 1.66
diff -u -r1.66 completion-note-heads-engraver.cc
--- lily/completion-note-heads-engraver.cc	11 Feb 2006 11:35:18 -0000	1.66
+++ lily/completion-note-heads-engraver.cc	18 Jul 2006 22:04:39 -0000
@@ -7,20 +7,23 @@
 #include <cctype>
 using namespace std;
 
-#include "rhythmic-head.hh"
-#include "output-def.hh"
-#include "music.hh"
-#include "dots.hh"
 #include "dot-column.hh"
-#include "staff-symbol-referencer.hh"
+#include "dots.hh"
+#include "duration.hh"
+#include "global-context.hh"
 #include "item.hh"
+#include "music.hh"
+#include "output-def.hh"
+#include "pitch.hh"
+#include "rhythmic-head.hh"
 #include "score-engraver.hh"
-#include "warn.hh"
 #include "spanner.hh"
+#include "staff-symbol-referencer.hh"
+#include "stream-event.hh"
 #include "tie.hh"
-#include "global-context.hh"
-#include "duration.hh"
-#include "pitch.hh"
+#include "warn.hh"
+
+#include "translator.icc"
 
 /*
   TODO: make matching rest engraver.
@@ -48,8 +51,8 @@
   vector<Grob*> ties_;
 
   vector<Item*> dots_;
-  vector<Music*> note_events_;
-  vector<Music*> scratch_note_events_;
+  vector<Stream_event*> note_events_;
+  vector<Stream_event*> scratch_note_events_;
 
   Moment note_end_mom_;
   bool is_first_;
@@ -65,9 +68,9 @@
 protected:
   virtual void initialize ();
   void start_translation_timestep ();
-  virtual bool try_music (Music *event);
   void process_music ();
   void stop_translation_timestep ();
+  DECLARE_TRANSLATOR_LISTENER (note);
 };
 
 void
@@ -76,31 +79,23 @@
   is_first_ = false;
 }
 
-bool
-Completion_heads_engraver::try_music (Music *m)
+IMPLEMENT_TRANSLATOR_LISTENER (Completion_heads_engraver, note);
+void
+Completion_heads_engraver::listen_note (Stream_event *ev)
 {
-  if (m->is_mus_type ("note-event"))
-    {
-      note_events_.push_back (m);
-
-      is_first_ = true;
-      Moment musiclen = m->get_length ();
-      Moment now = now_mom ();
-
-      if (now_mom ().grace_part_)
-	{
-	  musiclen.grace_part_ = musiclen.main_part_;
-	  musiclen.main_part_ = Rational (0, 1);
-	}
-      note_end_mom_ = max (note_end_mom_, (now + musiclen));
-      do_nothing_until_ = Rational (0, 0);
+  note_events_.push_back (ev);
+  
+  is_first_ = true;
+  Moment musiclen = get_event_length (ev);
+  Moment now = now_mom ();
 
-      return true;
+  if (now_mom ().grace_part_)
+    {
+      musiclen.grace_part_ = musiclen.main_part_;
+      musiclen.main_part_ = Rational (0, 1);
     }
-  else if (m->is_mus_type ("busy-playing-event"))
-    return note_events_.size () && is_first_;
-
-  return false;
+  note_end_mom_ = max (note_end_mom_, (now + musiclen));
+  do_nothing_until_ = Rational (0, 0);
 }
 
 /*
@@ -194,14 +189,14 @@
       if (!scratch_note_events_.size ())
 	for (vsize i = 0; i < note_events_.size (); i++)
 	  {
-	    Music *m = note_events_[i]->clone ();
+	    Stream_event *m = note_events_[i]->clone ();
 	    scratch_note_events_.push_back (m);
 	  }
     }
 
   for (vsize i = 0; left_to_do_ && i < note_events_.size (); i++)
     {
-      Music *event = note_events_[i];
+      Stream_event *event = note_events_[i];
       if (scratch_note_events_.size ())
 	{
 	  event = scratch_note_events_[i];
@@ -296,13 +291,11 @@
 {
 }
 
-#include "translator.icc"
-
 ADD_TRANSLATOR (Completion_heads_engraver,
 		/* doc */ "This engraver replaces "
 		"@code{Note_heads_engraver}. It plays some trickery to "
 		"break long notes and automatically tie them into the next measure.",
 		/* create */ "NoteHead Dots Tie",
-		/* accept */ "busy-playing-event note-event",
+		/* accept */ "note-event",
 		/* read */ "middleCPosition measurePosition measureLength",
 		/* write */ "");
Index: lily/drum-note-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/drum-note-engraver.cc,v
retrieving revision 1.48
diff -u -r1.48 drum-note-engraver.cc
--- lily/drum-note-engraver.cc	11 Feb 2006 11:35:18 -0000	1.48
+++ lily/drum-note-engraver.cc	18 Jul 2006 22:04:39 -0000
@@ -7,30 +7,33 @@
 #include <cctype>
 using namespace std;
 
-#include "rhythmic-head.hh"
+#include "duration.hh"
 #include "engraver.hh"
-#include "warn.hh"
+#include "note-column.hh"
+#include "rhythmic-head.hh"
 #include "side-position-interface.hh"
 #include "script-interface.hh"
 #include "stem.hh"
-#include "note-column.hh"
-#include "duration.hh"
+#include "stream-event.hh"
+#include "warn.hh"
+
+#include "translator.icc"
 
 class Drum_notes_engraver : public Engraver
 {
   vector<Item*> notes_;
   vector<Item*> dots_;
   vector<Item*> scripts_;
-  vector<Music*> events_;
+  vector<Stream_event*> events_;
 
 public:
   TRANSLATOR_DECLARATIONS (Drum_notes_engraver);
 
 protected:
-  virtual bool try_music (Music *ev);
   void process_music ();
   DECLARE_ACKNOWLEDGER (stem);
   DECLARE_ACKNOWLEDGER (note_column);
+  DECLARE_TRANSLATOR_LISTENER (note);
   void stop_translation_timestep ();
 };
 
@@ -38,18 +41,11 @@
 {
 }
 
-bool
-Drum_notes_engraver::try_music (Music *m)
+IMPLEMENT_TRANSLATOR_LISTENER (Drum_notes_engraver, note);
+void
+Drum_notes_engraver::listen_note (Stream_event *ev)
 {
-  if (m->is_mus_type ("note-event"))
-    {
-      events_.push_back (m);
-      return true;
-    }
-  else if (m->is_mus_type ("busy-playing-event"))
-    return events_.size ();
-
-  return false;
+  events_.push_back (ev);
 }
 
 void
@@ -61,7 +57,7 @@
       if (!tab)
 	tab = get_property ("drumStyleTable");
 
-      Music *ev = events_[i];
+      Stream_event *ev = events_[i];
       Item *note = make_item ("NoteHead", ev->self_scm ());
 
       Duration dur = *unsmob_duration (ev->get_property ("duration"));
@@ -153,14 +149,12 @@
   events_.clear ();
 }
 
-#include "translator.icc"
-
 ADD_ACKNOWLEDGER (Drum_notes_engraver, stem);
 ADD_ACKNOWLEDGER (Drum_notes_engraver, note_column);
 ADD_TRANSLATOR (Drum_notes_engraver,
 		/* doc */ "Generate noteheads.",
 		/* create */ "NoteHead Dots Script",
-		/* accept */ "note-event busy-playing-event",
+		/* accept */ "note-event",
 		/* read */ "drumStyleTable",
 		/* write */ "");
 
Index: lily/dynamic-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/dynamic-engraver.cc,v
retrieving revision 1.196
diff -u -r1.196 dynamic-engraver.cc
--- lily/dynamic-engraver.cc	31 May 2006 01:47:31 -0000	1.196
+++ lily/dynamic-engraver.cc	18 Jul 2006 22:04:39 -0000
@@ -21,6 +21,7 @@
 #include "self-alignment-interface.hh"
 #include "side-position-interface.hh"
 #include "staff-symbol-referencer.hh"
+#include "stream-event.hh"
 #include "warn.hh"
 
 #include "translator.icc"
@@ -50,10 +51,10 @@
   Spanner *finished_line_spanner_;
   Spanner *finished_cresc_;
 
-  Music *script_ev_;
-  Music *current_cresc_ev_;
+  Stream_event *script_ev_;
+  Stream_event *current_cresc_ev_;
 
-  Drul_array<Music *> accepted_spanevents_drul_;
+  Drul_array<Stream_event *> accepted_spanevents_drul_;
 
   vector<Note_column*> pending_columns_;
   vector<Grob*> pending_elements_;
@@ -66,10 +67,11 @@
   DECLARE_ACKNOWLEDGER (stem_tremolo);
   DECLARE_ACKNOWLEDGER (note_column);
   DECLARE_ACKNOWLEDGER (slur);
+  DECLARE_TRANSLATOR_LISTENER (absolute_dynamic);
+  DECLARE_TRANSLATOR_LISTENER (span_dynamic);
 
 protected:
   virtual void finalize ();
-  virtual bool try_music (Music *event);
   void stop_translation_timestep ();
   void process_music ();
 };
@@ -88,28 +90,25 @@
   accepted_spanevents_drul_[STOP] = 0;
 }
 
-bool
-Dynamic_engraver::try_music (Music *m)
+IMPLEMENT_TRANSLATOR_LISTENER (Dynamic_engraver, absolute_dynamic);
+void
+Dynamic_engraver::listen_absolute_dynamic (Stream_event *ev)
 {
-  if (m->is_mus_type ("absolute-dynamic-event"))
-    {
-      /*
-	TODO: probably broken.
-      */
-      script_ev_ = m;
-      return true;
-    }
-  else if (m->is_mus_type ("decrescendo-event")
-	   || m->is_mus_type ("crescendo-event"))
-    {
-      Direction d = to_dir (m->get_property ("span-direction"));
+  /*
+    TODO: probably broken.
+  */
+  script_ev_ = ev;
+}
 
-      accepted_spanevents_drul_[d] = m;
-      if (current_cresc_ev_ && d == START)
-	accepted_spanevents_drul_[STOP] = m;
-      return true;
-    }
-  return false;
+IMPLEMENT_TRANSLATOR_LISTENER (Dynamic_engraver, span_dynamic);
+void
+Dynamic_engraver::listen_span_dynamic (Stream_event *ev)
+{
+  Direction d = to_dir (ev->get_property ("span-direction"));
+
+  accepted_spanevents_drul_[d] = ev;
+  if (current_cresc_ev_ && d == START)
+    accepted_spanevents_drul_[STOP] = ev;
 }
 
 void
@@ -119,7 +118,7 @@
     {
       if (!line_spanner_)
 	{
-	  Music *rq = accepted_spanevents_drul_[START];
+	  Stream_event *rq = accepted_spanevents_drul_[START];
 	  line_spanner_ = make_spanner ("DynamicLineSpanner", rq ? rq->self_scm () : SCM_EOL);
 	  if (script_ev_)
 	    rq = script_ev_;
@@ -153,7 +152,7 @@
       Axis_group_interface::add_element (line_spanner_, script_);
     }
 
-  Music *stop_ev = accepted_spanevents_drul_ [STOP]
+  Stream_event *stop_ev = accepted_spanevents_drul_ [STOP]
     ? accepted_spanevents_drul_[STOP] : script_ev_;
 
   if (accepted_spanevents_drul_[STOP] || script_ev_)
@@ -189,7 +188,7 @@
       if (current_cresc_ev_)
 	{
 	  string msg = _ ("already have a decrescendo");
-	  if (current_cresc_ev_->is_mus_type ("decrescendo-event"))
+	  if (current_cresc_ev_->in_event_class ("crescendo-event"))
 	    msg = _ ("already have a crescendo");
 
 	  accepted_spanevents_drul_[START]->origin ()->warning (msg);
@@ -205,16 +204,19 @@
 	  /*
 	    TODO: Use symbols.
 	  */
-
-	  string start_type
-	    = ly_symbol2string (current_cresc_ev_->get_property ("name"));
 	  
-	  if (start_type == "DecrescendoEvent")
+	  SCM start_sym = current_cresc_ev_->get_property ("class");
+	  string start_type;
+	  
+	  if (start_sym == ly_symbol2scm ("decrescendo-event"))
 	    start_type = "decrescendo";
-	  else if (start_type == "CrescendoEvent")
+	  else if (start_sym == ly_symbol2scm ("crescendo-event"))
 	    start_type = "crescendo";
-	  
-				       
+	  else
+	    {
+	      programming_error ("unknown dynamic spanner type");
+	      return;
+	    }
 
 	  /*
 	    UGH. TODO: should read from original event, so appearance
Index: lily/extender-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/extender-engraver.cc,v
retrieving revision 1.76
diff -u -r1.76 extender-engraver.cc
--- lily/extender-engraver.cc	31 Jan 2006 00:30:43 -0000	1.76
+++ lily/extender-engraver.cc	18 Jul 2006 22:04:40 -0000
@@ -15,13 +15,16 @@
 #include "lyric-extender.hh"
 #include "note-head.hh"
 #include "pointer-group-interface.hh"
+#include "stream-event.hh"
 #include "warn.hh"
 
+#include "translator.icc"
+
 void completize_extender (Spanner *sp);
 
 class Extender_engraver : public Engraver
 {
-  Music *ev_;
+  Stream_event *ev_;
   Spanner *extender_;
   Spanner *pending_extender_;
 
@@ -29,9 +32,9 @@
   TRANSLATOR_DECLARATIONS (Extender_engraver);
 
 protected:
+  DECLARE_TRANSLATOR_LISTENER (extender);
   DECLARE_ACKNOWLEDGER (lyric_syllable);
   virtual void finalize ();
-  virtual bool try_music (Music *);
   void stop_translation_timestep ();
   void process_music ();
 };
@@ -43,15 +46,11 @@
   ev_ = 0;
 }
 
-bool
-Extender_engraver::try_music (Music *r)
+IMPLEMENT_TRANSLATOR_LISTENER (Extender_engraver, extender);
+void
+Extender_engraver::listen_extender (Stream_event *ev)
 {
-  if (!ev_)
-    {
-      ev_ = r;
-      return true;
-    }
-  return false;
+  ev_ = ev;
 }
 
 void
@@ -142,8 +141,6 @@
     }
 }
 
-#include "translator.icc"
-
 ADD_ACKNOWLEDGER (Extender_engraver, lyric_syllable);
 ADD_TRANSLATOR (Extender_engraver,
 		/* doc */ "Create lyric extenders",
Index: lily/tab-note-heads-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/tab-note-heads-engraver.cc,v
retrieving revision 1.59
diff -u -r1.59 tab-note-heads-engraver.cc
--- lily/tab-note-heads-engraver.cc	15 Feb 2006 01:38:10 -0000	1.59
+++ lily/tab-note-heads-engraver.cc	18 Jul 2006 22:04:40 -0000
@@ -10,16 +10,19 @@
 #include <cstdio>
 using namespace std;
 
-#include "rhythmic-head.hh"
-#include "output-def.hh"
-#include "music.hh"
-#include "dots.hh"
 #include "dot-column.hh"
-#include "staff-symbol-referencer.hh"
+#include "dots.hh"
+#include "duration.hh"
 #include "item.hh"
+#include "music.hh"
+#include "output-def.hh"
+#include "rhythmic-head.hh"
 #include "score-engraver.hh"
+#include "staff-symbol-referencer.hh"
+#include "stream-event.hh"
 #include "warn.hh"
-#include "duration.hh"
+
+#include "translator.icc"
 
 /**
    make (guitar-like) tablature note
@@ -29,13 +32,14 @@
   vector<Item*> notes_;
 
   vector<Item*> dots_;
-  vector<Music*> note_events_;
-  vector<Music*> tabstring_events_;
+  vector<Stream_event*> note_events_;
+  vector<Stream_event*> tabstring_events_;
 public:
   TRANSLATOR_DECLARATIONS (Tab_note_heads_engraver);
 
 protected:
-  virtual bool try_music (Music *event);
+  DECLARE_TRANSLATOR_LISTENER (note);
+  DECLARE_TRANSLATOR_LISTENER (string_number);
   void process_music ();
 
   void stop_translation_timestep ();
@@ -45,23 +49,18 @@
 {
 }
 
-bool
-Tab_note_heads_engraver::try_music (Music *m)
+IMPLEMENT_TRANSLATOR_LISTENER (Tab_note_heads_engraver, note);
+void
+Tab_note_heads_engraver::listen_note (Stream_event *ev)
 {
-  if (m->is_mus_type ("note-event"))
-    {
-      note_events_.push_back (m);
-      return true;
-    }
-  else if (m->is_mus_type ("string-number-event"))
-    {
-      tabstring_events_.push_back (m);
-      return true;
-    }
-  else if (m->is_mus_type ("busy-playing-event"))
-    return note_events_.size ();
+  note_events_.push_back (ev);
+}
 
-  return false;
+IMPLEMENT_TRANSLATOR_LISTENER (Tab_note_heads_engraver, string_number);
+void
+Tab_note_heads_engraver::listen_string_number (Stream_event *ev)
+{
+  tabstring_events_.push_back (ev);
 }
 
 void
@@ -74,10 +73,10 @@
       int number_of_strings = ((int) ly_length (stringTunings));
       bool high_string_one = to_boolean (get_property ("highStringOne"));
 
-      Music *event = note_events_[i];
+      Stream_event *event = note_events_[i];
       Item *note = make_item ("TabNoteHead", event->self_scm ());
 
-      Music *tabstring_event = 0;
+      Stream_event *tabstring_event = 0;
 
       for (SCM s = event->get_property ("articulations");
 	   !tabstring_event && scm_is_pair (s); s = scm_cdr (s))
@@ -85,7 +84,7 @@
 	  Music *art = unsmob_music (scm_car (s));
 
 	  if (art->is_mus_type ("string-number-event"))
-	    tabstring_event = art;
+	    tabstring_event = art->to_event ();
 	}
 
       if (!tabstring_event && j < tabstring_events_.size ())
@@ -163,12 +162,10 @@
   tabstring_events_.clear ();
 }
 
-#include "translator.icc"
-
 ADD_TRANSLATOR (Tab_note_heads_engraver,
 		/* doc */ "Generate one or more tablature noteheads from Music of type NoteEvent.",
 		/* create */ "TabNoteHead Dots",
-		/* accept */ "note-event string-number-event busy-playing-event",
+		/* accept */ "note-event string-number-event",
 		/* read */ "middleCPosition stringTunings minimumFret tablatureFormat highStringOne stringOneTopmost",
 		/* write */ "");
 
Index: lily/text-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/text-engraver.cc,v
retrieving revision 1.108
diff -u -r1.108 text-engraver.cc
--- lily/text-engraver.cc	11 Feb 2006 11:35:17 -0000	1.108
+++ lily/text-engraver.cc	18 Jul 2006 22:04:40 -0000
@@ -8,39 +8,38 @@
 
 #include "directional-element-interface.hh"
 #include "engraver.hh"
+#include "rhythmic-head.hh"
 #include "side-position-interface.hh"
 #include "stem.hh"
-#include "rhythmic-head.hh"
+#include "stream-event.hh"
 #include "text-interface.hh"
 
+#include "translator.icc"
+
 /**
    typeset directions that are  plain text.
 */
 class Text_engraver : public Engraver
 {
-  vector<Music*> evs_;
+  vector<Stream_event *> evs_;
   vector<Item*> texts_;
 public:
   TRANSLATOR_DECLARATIONS (Text_engraver);
 protected:
-  virtual bool try_music (Music *m);
   void stop_translation_timestep ();
   void process_acknowledged ();
 
+  DECLARE_TRANSLATOR_LISTENER (text_script);
   DECLARE_ACKNOWLEDGER (stem_tremolo);
   DECLARE_ACKNOWLEDGER (stem);
   DECLARE_ACKNOWLEDGER (rhythmic_head);
 };
 
-bool
-Text_engraver::try_music (Music *m)
+IMPLEMENT_TRANSLATOR_LISTENER (Text_engraver, text_script);
+void
+Text_engraver::listen_text_script (Stream_event *ev)
 {
-  if (m->is_mus_type ("text-script-event"))
-    {
-      evs_.push_back (m);
-      return true;
-    }
-  return false;
+  evs_.push_back (ev);
 }
 
 void
@@ -84,7 +83,7 @@
     return;
   for (vsize i = 0; i < evs_.size (); i++)
     {
-      Music *r = evs_[i];
+      Stream_event *r = evs_[i];
 
       // URG: Text vs TextScript
       Item *text = make_item ("TextScript", r->self_scm ());
@@ -125,8 +124,6 @@
 {
 }
 
-#include "translator.icc"
-
 ADD_ACKNOWLEDGER (Text_engraver, stem);
 ADD_ACKNOWLEDGER (Text_engraver, stem_tremolo);
 ADD_ACKNOWLEDGER (Text_engraver, rhythmic_head);
Index: lily/text-spanner-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/text-spanner-engraver.cc,v
retrieving revision 1.50
diff -u -r1.50 text-spanner-engraver.cc
--- lily/text-spanner-engraver.cc	26 Jan 2006 11:16:41 -0000	1.50
+++ lily/text-spanner-engraver.cc	18 Jul 2006 22:04:40 -0000
@@ -11,6 +11,9 @@
 #include "international.hh"
 #include "note-column.hh"
 #include "side-position-interface.hh"
+#include "stream-event.hh"
+
+#include "translator.icc"
 
 class Text_spanner_engraver : public Engraver
 {
@@ -19,15 +22,15 @@
 protected:
   virtual void finalize ();
   DECLARE_ACKNOWLEDGER (note_column);
-  virtual bool try_music (Music *);
+  DECLARE_TRANSLATOR_LISTENER (text_span);
   void stop_translation_timestep ();
   void process_music ();
 
 private:
   Spanner *span_;
   Spanner *finished_;
-  Music *current_event_;
-  Drul_array<Music *> event_drul_;
+  Stream_event *current_event_;
+  Drul_array<Stream_event *> event_drul_;
   void typeset_all ();
 };
 
@@ -40,17 +43,12 @@
   event_drul_[STOP] = 0;
 }
 
-bool
-Text_spanner_engraver::try_music (Music *m)
+IMPLEMENT_TRANSLATOR_LISTENER (Text_spanner_engraver, text_span);
+void
+Text_spanner_engraver::listen_text_span (Stream_event *ev)
 {
-  if (m->is_mus_type ("text-span-event"))
-    {
-      Direction d = to_dir (m->get_property ("span-direction"));
-      event_drul_[d] = m;
-      return true;
-    }
-
-  return false;
+  Direction d = to_dir (ev->get_property ("span-direction"));
+  event_drul_[d] = ev;
 }
 
 void
@@ -137,7 +135,6 @@
     }
 }
 
-#include "translator.icc"
 ADD_ACKNOWLEDGER (Text_spanner_engraver, note_column);
 ADD_TRANSLATOR (Text_spanner_engraver,
 		/* doc */ "Create text spanner from a Music.",
Index: lily/tie-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/tie-engraver.cc,v
retrieving revision 1.122
diff -u -r1.122 tie-engraver.cc
--- lily/tie-engraver.cc	8 Jun 2006 15:14:16 -0000	1.122
+++ lily/tie-engraver.cc	18 Jul 2006 22:04:40 -0000
@@ -16,10 +16,13 @@
 #include "protected-scm.hh"
 #include "spanner.hh"
 #include "staff-symbol-referencer.hh"
+#include "stream-event.hh"
 #include "tie-column.hh"
 #include "tie.hh"
 #include "warn.hh"
 
+#include "translator.icc"
+
 /**
    Manufacture ties.  Acknowledge noteheads, and put them into a
    priority queue. If we have a TieEvent, connect the notes that finish
@@ -34,7 +37,7 @@
   Grob *head_;
   Moment end_moment_;
   SCM tie_definition_;
-  Music *event_;
+  Stream_event *event_;
   
   Head_event_tuple ()
   {
@@ -46,7 +49,7 @@
 
 class Tie_engraver : public Engraver
 {
-  Music *event_;
+  Stream_event *event_;
   vector<Grob*> now_heads_;
   vector<Head_event_tuple> heads_to_tie_;
   vector<Grob*> ties_;
@@ -58,7 +61,7 @@
   virtual void derived_mark () const;
   void start_translation_timestep ();
   DECLARE_ACKNOWLEDGER (note_head);
-  virtual bool try_music (Music *);
+  DECLARE_TRANSLATOR_LISTENER (tie);
   void process_music ();
   void typeset_tie (Grob *);
 public:
@@ -79,13 +82,11 @@
   tie_column_ = 0;
 }
 
-bool
-Tie_engraver::try_music (Music *mus)
+IMPLEMENT_TRANSLATOR_LISTENER (Tie_engraver, tie);
+void
+Tie_engraver::listen_tie (Stream_event *ev)
 {
-  if (mus->is_mus_type ("tie-event"))
-    event_ = mus;
-
-  return true;
+  event_ = ev;
 }
 
 void
@@ -103,15 +104,15 @@
   for (vsize i = heads_to_tie_.size (); i--;)
     {
       Grob *th = heads_to_tie_[i].head_;
-      Music *right_mus = unsmob_music (h->get_property ("cause"));
-      Music *left_mus = unsmob_music (th->get_property ("cause"));
+      Stream_event *right_ev = unsmob_stream_event (h->get_property ("cause"));
+      Stream_event *left_ev = unsmob_stream_event (th->get_property ("cause"));
 
       /*
 	maybe should check positions too.
       */
-      if (right_mus && left_mus
-	  && ly_is_equal (right_mus->get_property ("pitch"),
-			  left_mus->get_property ("pitch")))
+      if (right_ev && left_ev
+	  && ly_is_equal (right_ev->get_property ("pitch"),
+			  left_ev->get_property ("pitch")))
 	{
 	  Grob *p = new Spanner (heads_to_tie_[i].tie_definition_,
 				 context ()->get_grob_key ("Tie"));
@@ -176,8 +177,8 @@
       for (vsize i = 0; i < now_heads_.size (); i++)
 	{
 	  Grob *head = now_heads_[i];
-	  Music *left_mus = unsmob_music (head->get_property ("cause"));
-	  if (left_mus)
+	  Stream_event *left_ev = unsmob_stream_event (head->get_property ("cause"));
+	  if (left_ev)
 	    {
 	      Head_event_tuple event_tup;
 
@@ -188,11 +189,11 @@
 	      Moment end = now_mom ();
 	      if (end.grace_part_)
 		{
-		  end.grace_part_ += left_mus->get_length ().main_part_;
+		  end.grace_part_ += get_event_length (left_ev).main_part_;
 		}
 	      else
 		{
-		  end += left_mus->get_length (); 
+		  end += get_event_length (left_ev);
 		}
 	      event_tup.end_moment_ = end;
 
@@ -227,8 +228,6 @@
   sp->set_bound (RIGHT, new_head_drul[RIGHT]);
 }
 
-#include "translator.icc"
-
 ADD_ACKNOWLEDGER (Tie_engraver, note_head);
 ADD_TRANSLATOR (Tie_engraver,
 		/* doc */ "Generate ties between noteheads of equal pitch.",
Index: lily/trill-spanner-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/trill-spanner-engraver.cc,v
retrieving revision 1.19
diff -u -r1.19 trill-spanner-engraver.cc
--- lily/trill-spanner-engraver.cc	8 Feb 2006 12:42:11 -0000	1.19
+++ lily/trill-spanner-engraver.cc	18 Jul 2006 22:04:40 -0000
@@ -18,6 +18,7 @@
 #include "international.hh"
 #include "note-column.hh"
 #include "side-position-interface.hh"
+#include "stream-event.hh"
 
 #include "translator.icc"
 
@@ -28,15 +29,15 @@
 protected:
   virtual void finalize ();
   DECLARE_ACKNOWLEDGER (note_column);
-  virtual bool try_music (Music *);
+  DECLARE_TRANSLATOR_LISTENER (trill_span);
   void stop_translation_timestep ();
   void process_music ();
 
 private:
   Spanner *span_;
   Spanner *finished_;
-  Music *current_event_;
-  Drul_array<Music *> event_drul_;
+  Stream_event *current_event_;
+  Drul_array<Stream_event *> event_drul_;
   void typeset_all ();
 };
 
@@ -49,17 +50,12 @@
   event_drul_[STOP] = 0;
 }
 
-bool
-Trill_spanner_engraver::try_music (Music *m)
+IMPLEMENT_TRANSLATOR_LISTENER (Trill_spanner_engraver, trill_span);
+void
+Trill_spanner_engraver::listen_trill_span (Stream_event *ev)
 {
-  if (m->is_mus_type ("trill-span-event"))
-    {
-      Direction d = to_dir (m->get_property ("span-direction"));
-      event_drul_[d] = m;
-      return true;
-    }
-
-  return false;
+  Direction d = to_dir (ev->get_property ("span-direction"));
+  event_drul_[d] = ev;
 }
 
 void
Index: lily/tuplet-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/tuplet-engraver.cc,v
retrieving revision 1.98
diff -u -r1.98 tuplet-engraver.cc
--- lily/tuplet-engraver.cc	11 Jul 2006 10:44:48 -0000	1.98
+++ lily/tuplet-engraver.cc	18 Jul 2006 22:04:40 -0000
@@ -11,17 +11,18 @@
 #include "beam.hh"
 #include "engraver.hh"
 #include "spanner.hh"
+#include "stream-event.hh"
 
 #include "translator.icc"
 
 struct Tuplet_description
 {
-  Music *music_;
+  Stream_event *event_;
   Spanner *bracket_;
   Spanner *number_;
   Tuplet_description ()
   {
-    music_ = 0;
+    event_ = 0;
     bracket_ = 0;
     number_ = 0;
   }
@@ -37,32 +38,28 @@
   vector<Tuplet_description> stopped_tuplets_;
   vector<Spanner*> last_tuplets_;
   DECLARE_ACKNOWLEDGER (note_column);
-  virtual bool try_music (Music *r);
+  DECLARE_TRANSLATOR_LISTENER (tuplet_spanner);
   virtual void finalize ();
   void start_translation_timestep ();
   void process_music ();
 };
 
-bool
-Tuplet_engraver::try_music (Music *music)
+IMPLEMENT_TRANSLATOR_LISTENER (Tuplet_engraver, tuplet_spanner);
+void
+Tuplet_engraver::listen_tuplet_spanner (Stream_event *ev)
 {
-  if (music->is_mus_type ("tuplet-spanner-event"))
+  Direction dir = to_dir (ev->get_property ("span-direction"));
+  if (dir == START)
     {
-      Direction dir = to_dir (music->get_property ("span-direction"));
-      if (dir == START)
-	{
-	  Tuplet_description d;
-	  d.music_ = music;
-	  tuplets_.push_back (d);
-	}
-      if (dir == STOP)
-	{
-	  stopped_tuplets_.push_back (tuplets_.back ());
-	  tuplets_.pop_back ();
-	}
-      return true;
+      Tuplet_description d;
+      d.event_ = ev;
+      tuplets_.push_back (d);
+    }
+  if (dir == STOP)
+    {
+      stopped_tuplets_.push_back (tuplets_.back ());
+      tuplets_.pop_back ();
     }
-  return false;
 }
 
 void
@@ -104,9 +101,9 @@
 	continue;
 
       tuplets_[i].bracket_ = make_spanner ("TupletBracket",
-					   tuplets_[i].music_->self_scm ());
+					   tuplets_[i].event_->self_scm ());
       tuplets_[i].number_ = make_spanner ("TupletNumber",
-					  tuplets_[i].music_->self_scm ());
+					  tuplets_[i].event_->self_scm ());
       tuplets_[i].number_->set_object ("bracket", tuplets_[i].bracket_->self_scm ());
       tuplets_[i].bracket_->set_object ("tuplet-number", tuplets_[i].number_->self_scm ());
       
Index: scm/define-event-classes.scm
===================================================================
RCS file: /sources/lilypond/lilypond/scm/define-event-classes.scm,v
retrieving revision 1.4
diff -u -r1.4 define-event-classes.scm
--- scm/define-event-classes.scm	14 Jul 2006 06:58:29 -0000	1.4
+++ scm/define-event-classes.scm	18 Jul 2006 22:04:40 -0000
@@ -7,20 +7,34 @@
 
 (use-modules (srfi srfi-1))
 
-;; Event class hierarchy. Each line is on the form ((List of children) . Parent)
+;; Event class hierarchy. Each line is on the form (Parent . (List of children))
 (define event-classes
-  '(((StreamEvent) . '())
-    ((RemoveContext ChangeParent Override Revert UnsetProperty
-      SetProperty MusicEvent OldMusicEvent CreateContext Prepare
-      OneTimeStep Finish) . StreamEvent)
-    ((arpeggio-event) . MusicEvent)
-    ((Announcement) . '())
-    ((AnnounceNewContext) . Announcement)
+  '((() . (StreamEvent))
+    (StreamEvent .
+		 (RemoveContext ChangeParent Override Revert UnsetProperty
+				SetProperty MusicEvent OldMusicEvent CreateContext Prepare
+				OneTimeStep Finish))
+    (MusicEvent . (arpeggio-event breathing-event extender-event span-event
+      rhythmic-event dynamic-event
+      key-change-event string-number-event tie-event
+      metronome-change-event beam-forbid-event ))
+    (dynamic-event . (absolute-dynamic-event))
+    (span-event . (span-dynamic-event beam-event ligature-event melisma-span-event
+			 pedal-event phrasing-slur-event slur-event staff-span-event
+			 text-span-event trill-span-event tremolo-spanner-event 
+			 tuplet-spanner-event))
+    (span-dynamic-event . (decrescendo-event crescendo-event))
+    (pedal-event . (sostenuto-event sustain-event una-corda-event))
+    (rhythmic-event . (lyric-event melodic-event multi-measure-rest-event
+				   rest-event skip-event))
+    (melodic-event . (cluster-note-event note-event))
+    (() . (Announcement))
+    (Announcement . (AnnounceNewContext))
     ))
 
 ;; Maps event-class to a list of ancestors (inclusive)
 ;; TODO: use resizable hash
-(define ancestor-lookup (make-hash-table 1))
+(define ancestor-lookup (make-hash-table))
 
 ;; Each class will be defined as
 ;; (class parent grandparent .. )
@@ -29,8 +43,9 @@
  (lambda (rel)
    (for-each
     (lambda (type)
-      (hashq-set! ancestor-lookup type (cons type (hashq-ref ancestor-lookup (cdr rel) '())))) ;; `(define ,type (cons ',type ,(cdr rel)))))
-    (car rel)))
+      (hashq-set! ancestor-lookup type 
+		  (cons type (hashq-ref ancestor-lookup (car rel) '()))))
+    (cdr rel)))
  event-classes)
 
 ;; TODO: Allow entering more complex classes, by taking unions.
_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to