- bool completed;
- for (vsize j = 0; !(completed = (j == slurs_.size ())); j++)
- {
- // 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 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. This is not entirely accurate:
- // tweaks or context properties like those set with
- // \slurUp can still override a neutral direction, so
- // when encountering a slur event with "opposite"
- // direction first, then one with neutral direction, we
- // only let the "opposite" direction remain, while if
- // the order is the other way round, a double slur
- // results since the direction of the first slur is no
- // longer attributable to a "neutral" slur event. A
- // mixture of neutral and directed events is nothing
- // that the partcombiner should crank out, and it would
- // be decidedly strange for manual input.
-
- if (!updown)
- break;
-
- // If the existing slur does not have a direction yet,
- // give it ours
-
- Direction slur_dir = to_dir (slurs_[j]->get_property ("direction"));
-
- if (!slur_dir)
- {
- set_grob_direction (slurs_[j], updown);
- break;
- }
-
- // 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 ("Slur", ev->self_scm ());
- slur->set_property ("spanner-id", ly_string2scm (id));
- if (updown)
- set_grob_direction (slur, updown);
- slurs_.push_back (slur);
-
- if (to_boolean (get_property ("doubleSlurs")))
- {
- set_grob_direction (slur, DOWN);
- slur = make_spanner ("Slur", ev->self_scm ());
- slur->set_property ("spanner-id", ly_string2scm (id));
- set_grob_direction (slur, UP);
- slurs_.push_back (slur);
- }
- }