]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/slur-engraver.cc
*** empty log message ***
[lilypond.git] / lily / slur-engraver.cc
index e21c39841602dbe5a10763a22a7ae14a452feb98..7c6bc4fb6a160aa325f2448657a94fafa1a55cc0 100644 (file)
@@ -1,14 +1,15 @@
 /*
   slur-engraver.cc -- implement Slur_engraver
 
-  (c)  1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "event.hh"
 #include "slur.hh"
 #include "warn.hh"
 #include "note-column.hh"
-#include "translator-group.hh"
+#include "context.hh"
+
 #include "engraver.hh"
 #include "spanner.hh"
 
@@ -44,27 +45,12 @@ Slur_engraver::Slur_engraver ()
 bool
 Slur_engraver::try_music (Music *ev)
 {
-  if (ev->is_mus_type ("abort-event"))
-    {
-      for (int i = 0; i < slur_stack_.size (); i++)
-       {
-         slur_stack_[i]->suicide ();
-       }
-      slur_stack_.clear ();
-      for (int i = 0; i < end_slurs_.size (); i++)
-       {
-         end_slurs_[i]->suicide ();
-       }
-      end_slurs_.clear ();
-      events_.clear ();
-      new_slur_evs_.clear ();
-    }
-  else if (ev->is_mus_type ("slur-event"))
+  if (ev->is_mus_type ("slur-event"))
     {
       /*
        Let's not start more than one slur per moment.
       */
-      Direction d = to_dir (ev->get_mus_property ("span-direction"));
+      Direction d = to_dir (ev->get_property ("span-direction"));
       if (d == START)
        {
          if (now_mom () > last_start_)
@@ -84,9 +70,9 @@ Slur_engraver::try_music (Music *ev)
          /*
            Swallow other events.
          */
-         for (int j = new_slur_evs_.size(); j--;)
+         for (int j = new_slur_evs_.size (); j--;)
            {
-             Direction nd = to_dir (new_slur_evs_[j]->get_mus_property ("span-direction"));
+             Direction nd = to_dir (new_slur_evs_[j]->get_property ("span-direction"));
              
              if (nd == STOP)
                return true;
@@ -102,7 +88,7 @@ Slur_engraver::try_music (Music *ev)
 void
 Slur_engraver::set_melisma (bool m)
 {
-  daddy_trans_->set_property ("slurMelismaBusy", m ? SCM_BOOL_T :SCM_BOOL_F);
+  context ()->set_property ("slurMelismaBusy", m ? SCM_BOOL_T :SCM_BOOL_F);
 }
 
 void
@@ -144,10 +130,10 @@ Slur_engraver::process_music ()
     {
       Music* slur_ev = new_slur_evs_[i];
       // end slur: move the slur to other array
-      Direction d = to_dir (slur_ev->get_mus_property ("span-direction"));
+      Direction d = to_dir (slur_ev->get_property ("span-direction"));
       if (d== STOP)
        {
-         if (slur_stack_.empty ())
+         if (slur_stack_.is_empty ())
            /* How to shut up this warning, when Voice_devnull_engraver has
               eaten start event? */
            slur_ev->origin ()->warning (_f ("can't find start of slur"));
@@ -163,18 +149,17 @@ Slur_engraver::process_music ()
        {
          // push a new slur onto stack.
          // (use temp. array to wait for all slur STOPs)
-         Grob* slur = new Spanner (get_property ("Slur"));
+         Grob* slur = make_spanner ("Slur", slur_ev->self_scm ());
          Slur::set_interface (slur); // cannot remove yet!
 
 
-         if (Direction updown = to_dir (slur_ev->get_mus_property ("direction")))
+         if (Direction updown = to_dir (slur_ev->get_property ("direction")))
            {
-             slur->set_grob_property ("direction", gh_int2scm (updown));
+             slur->set_property ("direction", scm_int2num (updown));
            }
          
          start_slurs.push (slur);
          events_.push (slur_ev);
-         announce_grob (slur, slur_ev->self_scm ());
        }
     }
 
@@ -188,10 +173,6 @@ Slur_engraver::process_music ()
 void
 Slur_engraver::stop_translation_timestep ()
 {
-  for (int i = 0; i < end_slurs_.size (); i++)
-    {
-      typeset_grob (end_slurs_[i]);
-    }
   end_slurs_.clear ();
   new_slur_evs_.clear ();
 }