X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fslur-engraver.cc;h=49f92ab0ed5a96b04e5bd5331fb1b49cf12f4e35;hb=c3d30cde5a4e1ba4d8e044fec7677629269b9443;hp=fde4d9447def65123f93532dc8421a8420e9a634;hpb=8f48aae564544d143022f5ddfde5bd9fdc600bf4;p=lilypond.git diff --git a/lily/slur-engraver.cc b/lily/slur-engraver.cc index fde4d9447d..49f92ab0ed 100644 --- a/lily/slur-engraver.cc +++ b/lily/slur-engraver.cc @@ -63,7 +63,7 @@ protected: DECLARE_ACKNOWLEDGER (script); DECLARE_ACKNOWLEDGER (dots); DECLARE_ACKNOWLEDGER (text_script); - DECLARE_ACKNOWLEDGER (tie); + DECLARE_END_ACKNOWLEDGER (tie); DECLARE_ACKNOWLEDGER (tuplet_number); void acknowledge_extra_object (Grob_info); @@ -84,9 +84,9 @@ Slur_engraver::Slur_engraver () void Slur_engraver::derived_mark () const { - for (vsize i=start_events_.size(); i--;) + for (vsize i = start_events_.size (); i--;) scm_gc_mark (start_events_[i]->self_scm ()); - for (vsize i=stop_events_.size(); i--;) + for (vsize i = stop_events_.size (); i--;) scm_gc_mark (stop_events_[i]->self_scm ()); } @@ -163,7 +163,7 @@ Slur_engraver::acknowledge_text_script (Grob_info info) } void -Slur_engraver::acknowledge_tie (Grob_info info) +Slur_engraver::acknowledge_end_tie (Grob_info info) { acknowledge_extra_object (info); } @@ -204,7 +204,7 @@ Slur_engraver::process_music () 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); + stop_events_.erase (stop_events_.begin () + j); } } else @@ -219,7 +219,7 @@ Slur_engraver::process_music () Direction updown = to_dir (ev->get_property ("direction")); bool completed; - for (vsize j = 0; !(completed = (j == slurs_.size ())); j++) + 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"), "")) @@ -235,31 +235,29 @@ Slur_engraver::process_music () // 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. + // we can ignore it. if (!updown) break; - // If the existing slur does not have a direction yet, - // give it ours + Stream_event *c = unsmob_stream_event (slurs_[j]->get_property ("cause")); + + if (!c) + { + slurs_[j]->programming_error ("slur without a cause"); + continue; + } + + Direction slur_dir = to_dir (c->get_property ("direction")); - Direction slur_dir = to_dir (slurs_[j]->get_property ("direction")); + // If the existing slur does not have a direction yet, + // we'd rather take the new one. if (!slur_dir) { - set_grob_direction (slurs_[j], updown); - break; + slurs_[j]->suicide (); + slurs_.erase (slurs_.begin () + j); + continue; } // If the existing slur has the same direction as ours, drop ours @@ -326,7 +324,7 @@ ADD_ACKNOWLEDGER (Slur_engraver, note_column); ADD_ACKNOWLEDGER (Slur_engraver, script); ADD_ACKNOWLEDGER (Slur_engraver, text_script); ADD_ACKNOWLEDGER (Slur_engraver, dots); -ADD_ACKNOWLEDGER (Slur_engraver, tie); +ADD_END_ACKNOWLEDGER (Slur_engraver, tie); ADD_ACKNOWLEDGER (Slur_engraver, tuplet_number); ADD_TRANSLATOR (Slur_engraver, /* doc */