]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/slur-engraver.cc
*** empty log message ***
[lilypond.git] / lily / slur-engraver.cc
index dca3a3dc90cca5d63abd5b52f4107490b9280958..fb7a9e67c68ec86425e948ce949b0c1e72ccc9d7 100644 (file)
 #include "note-column.hh"
 #include "slur.hh"
 #include "spanner.hh"
+#include "stream-event.hh"
 #include "warn.hh"
 
+#include "translator.icc"
+
 /*
   It is possible that a slur starts and ends on the same note.  At
   least, it is for phrasing slurs: a note can be both beginning and
 */
 class Slur_engraver : public Engraver
 {
-  Drul_array<Music *> events_;
-  Music *running_slur_start_;
+  Drul_array<Stream_event *> events_;
+  Stream_event *running_slur_start_;
   vector<Grob*> slurs_;
   vector<Grob*> end_slurs_;
 
   void set_melisma (bool);
 
 protected:
-  virtual bool try_music (Music *);
-
+  DECLARE_TRANSLATOR_LISTENER (slur);
   DECLARE_ACKNOWLEDGER (accidental);
   DECLARE_ACKNOWLEDGER (dynamic_line_spanner);
   DECLARE_ACKNOWLEDGER (fingering);
@@ -55,24 +57,15 @@ Slur_engraver::Slur_engraver ()
   events_[START] = events_[STOP] = 0;
 }
 
-bool
-Slur_engraver::try_music (Music *m)
+IMPLEMENT_TRANSLATOR_LISTENER (Slur_engraver, slur);
+void
+Slur_engraver::listen_slur (Stream_event *ev)
 {
-  if (m->is_mus_type ("slur-event"))
-    {
-      Direction d = to_dir (m->get_property ("span-direction"));
-      if (d == START)
-       {
-         events_[START] = m;
-         return true;
-       }
-      else if (d == STOP)
-       {
-         events_[STOP] = m;
-         return true;
-       }
-    }
-  return false;
+  Direction d = to_dir (ev->get_property ("span-direction"));
+  if (d == START)
+    events_[START] = ev;
+  else if (d == STOP)
+    events_[STOP] = ev;
 }
 
 void
@@ -163,7 +156,7 @@ Slur_engraver::process_music ()
 
   if (events_[START] && slurs_.empty ())
     {
-      Music *ev = events_[START];
+      Stream_event *ev = events_[START];
 
       bool double_slurs = to_boolean (get_property ("doubleSlurs"));
 
@@ -194,8 +187,6 @@ Slur_engraver::stop_translation_timestep ()
   events_[START] = events_[STOP] = 0;
 }
 
-#include "translator.icc"
-
 ADD_ACKNOWLEDGER (Slur_engraver, accidental);
 ADD_ACKNOWLEDGER (Slur_engraver, dynamic_line_spanner);
 ADD_ACKNOWLEDGER (Slur_engraver, fingering);