-void
-Phrasing_slur_engraver::process_music ()
-{
- for (vsize i = 0; i < stop_events_.size (); i++)
- {
- Stream_event *ev = stop_events_[i];
- string id = robust_scm2string (ev->get_property ("spanner-id"), "");
-
- // Find the slurs that are ended with this event (by checking the spanner-id)
- bool ended = false;
- for (vsize j = slurs_.size (); j--;)
- {
- if (id == robust_scm2string (slurs_[j]->get_property ("spanner-id"), ""))
- {
- ended = true;
- end_slurs_.push_back (slurs_[j]);
- slurs_.erase (slurs_.begin () + j);
- }
- }
- if (ended)
- {
- // Ignore redundant stop events for this id
- for (vsize j = stop_events_.size (); --j > i;)
- {
- if (id == robust_scm2string (stop_events_[j]->get_property ("spanner-id"), ""))
- stop_events_.erase (stop_events_.begin () + j);
- }
- }
- else
- ev->origin ()->warning (_ ("cannot end phrasing slur"));
- }
-
- vsize old_slurs = slurs_.size ();
- for (vsize i = start_events_.size (); i--;)
- {
- Stream_event *ev = start_events_[i];
- string id = robust_scm2string (ev->get_property ("spanner-id"), "");
- Direction updown = to_dir (ev->get_property ("direction"));
-
- bool completed;
- for (vsize j = slurs_.size (); !(completed = (j-- == 0));)
- {
- // Check if we already have a slur with the same spanner-id.
- if (id == robust_scm2string (slurs_[j]->get_property ("spanner-id"), ""))
- {
- if (j < old_slurs)
- {
- // We already have an old slur, so give a warning
- // and completely ignore the new slur.
- ev->origin ()->warning (_ ("already have phrasing slur"));
- start_events_.erase (start_events_.begin () + i);
- break;
- }
-
- // If this slur event has no direction, it will not
- // contribute anything new to the existing slur(s), so
- // we can ignore it.
-
- if (!updown)
- break;
-
- Stream_event *c = unsmob_stream_event (slurs_[j]->get_property ("cause"));
-
- if (!c)
- {
- slurs_[j]->programming_error ("phrasing slur without a cause");
- continue;
- }
-
- Direction slur_dir = to_dir (c->get_property ("direction"));
-
- // If the existing slur does not have a direction yet,
- // we'd rather take the new one.
-
- if (!slur_dir)
- {
- slurs_[j]->suicide ();
- slurs_.erase (slurs_.begin () + j);
- continue;
- }
-
- // If the existing slur has the same direction as ours, drop ours
-
- if (slur_dir == updown)
- break;
- }
- }
- // If the loop completed, our slur is new
- if (completed)
- {
- Grob *slur = make_spanner ("PhrasingSlur", ev->self_scm ());
- slur->set_property ("spanner-id", ly_string2scm (id));
- if (updown)
- set_grob_direction (slur, updown);
- slurs_.push_back (slur);
- }
- }
-}
-
-void
-Phrasing_slur_engraver::stop_translation_timestep ()
-{
- if (Grob *g = unsmob_grob (get_property ("currentCommandColumn")))
- {
- for (vsize i = 0; i < end_slurs_.size (); i++)
- Slur::add_extra_encompass (end_slurs_[i], g);
-
- if (!start_events_.size ())
- for (vsize i = 0; i < slurs_.size (); i++)
- Slur::add_extra_encompass (slurs_[i], g);
- }
-
- for (vsize i = 0; i < end_slurs_.size (); i++)
- {
- Spanner *s = dynamic_cast<Spanner *> (end_slurs_[i]);
- if (!s->get_bound (RIGHT))
- s->set_bound (RIGHT, unsmob_grob (get_property ("currentMusicalColumn")));
- announce_end_grob (s, SCM_EOL);
- }
-
- for (vsize i = 0; i < objects_to_acknowledge_.size (); i++)
- Slur::auxiliary_acknowledge_extra_object (objects_to_acknowledge_[i], slurs_, end_slurs_);
-
- objects_to_acknowledge_.clear ();
- end_slurs_.clear ();
- start_events_.clear ();
- stop_events_.clear ();
-}
-
-ADD_ACKNOWLEDGER (Phrasing_slur_engraver, inline_accidental);
-ADD_ACKNOWLEDGER (Phrasing_slur_engraver, fingering)
-ADD_ACKNOWLEDGER (Phrasing_slur_engraver, note_column);
-ADD_ACKNOWLEDGER (Phrasing_slur_engraver, slur);
-ADD_ACKNOWLEDGER (Phrasing_slur_engraver, script);
-ADD_ACKNOWLEDGER (Phrasing_slur_engraver, dots);
-ADD_ACKNOWLEDGER (Phrasing_slur_engraver, text_script);
-ADD_ACKNOWLEDGER (Phrasing_slur_engraver, tie);
-ADD_ACKNOWLEDGER (Phrasing_slur_engraver, tuplet_number);
-