From 718c54f4d35bfae090b6d6c938742cac518927b2 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sat, 13 Apr 2002 11:24:14 +0000 Subject: [PATCH] '' --- ChangeLog | 5 ++ input/regression/tie-grace.ly | 8 ++++ lily/tie-engraver.cc | 63 ++++++++++++++++--------- scm/translator-property-description.scm | 2 +- 4 files changed, 54 insertions(+), 24 deletions(-) create mode 100644 input/regression/tie-grace.ly diff --git a/ChangeLog b/ChangeLog index 4a8bc40ec7..cd22684d94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-04-13 Han-Wen + + * input/regression/tie-grace.ly: new file. + + * lily/tie-engraver.cc (create_grobs): fix tied graces. 2002-04-13 Han-Wen diff --git a/input/regression/tie-grace.ly b/input/regression/tie-grace.ly new file mode 100644 index 0000000000..66309e8636 --- /dev/null +++ b/input/regression/tie-grace.ly @@ -0,0 +1,8 @@ +\header { + texidoc = "Tieing a grace to the to a following grace or main note works." +} + +\score { \notes \context Voice \relative c'' { + c4 \grace { c8 ~ c16 ~ } c4 + } +} diff --git a/lily/tie-engraver.cc b/lily/tie-engraver.cc index 447b5ee143..16abacdeec 100644 --- a/lily/tie-engraver.cc +++ b/lily/tie-engraver.cc @@ -113,36 +113,35 @@ Tie_engraver::create_grobs () if (req_l_) { now_heads_.sort (&head_pitch_compare); - stopped_heads_.sort (&head_pitch_compare); + /* + We could sort stopped_heads_ as well (and use a linear alg. in + stead of nested loop), but we'd have to use a stable sorting + algorithm, since the ordering of the stopped heads (of the + same pitch) is relevant. + */ SCM head_list = SCM_EOL; - int j = stopped_heads_.size ()-1; - int i = now_heads_.size ()-1; - - while (i >= 0 && j >=0) + for (int i = now_heads_.size(); i--;) { - int comp - = head_pitch_compare (now_heads_[i], stopped_heads_[j]); - - if (comp) + for (int j = stopped_heads_.size(); j--;) { - (comp < 0) ? j -- : i--; - continue; - } - else - { - head_list = gh_cons (gh_cons (stopped_heads_[j]->self_scm (), - now_heads_[i]->self_scm ()), - head_list); - - now_heads_.del (i); - stopped_heads_.del (j); - i--; - j--; + int comp + = head_pitch_compare (now_heads_[i], stopped_heads_[j]); + + if (!comp) + { + head_list = gh_cons (gh_cons (stopped_heads_[j]->self_scm (), + now_heads_[i]->self_scm ()), + head_list); + + now_heads_.del (i); + stopped_heads_.del (j); + break ; + } } } - + SCM basic = get_property ("Tie"); SCM sparse = get_property ("sparseTies"); if (to_boolean (sparse)) @@ -258,6 +257,24 @@ Tie_engraver::start_translation_timestep () && Note_head::has_interface (grob)) stopped_heads_.push (grob); } + + + /* + + The list starts with entries that start earlier. By going through + it, we reverse the order, where as we'd like to use the `last' + heads first. + + This makes a difference for grace notes. If we have + + c4 \grace c8 ~ c4 + + Then busyGrobs will have ((1/4 . gc8) (1/4 . c4)). + + We want stopped_heads_ to contain (c4 gc8), because we start with + it at the top. + */ + stopped_heads_.reverse(); } diff --git a/scm/translator-property-description.scm b/scm/translator-property-description.scm index 54b5a1df9d..36845bf263 100644 --- a/scm/translator-property-description.scm +++ b/scm/translator-property-description.scm @@ -145,7 +145,7 @@ key signatures after the bar lines: ") (translator-property-description 'busyGrobs list? " a queue of (END-MOMENT . GROB) conses. This is for internal (C++) use only. -Use at your own risk. +Use at your own risk. This property contains the grobs for which END-MOMENT >= NOW. ") (translator-property-description 'centralCPosition number? "Place of the central C. Usually determined by looking at clefPosition and clefGlyph.") (translator-property-description 'changeMoment moment-pair? "duration that voices are examined for differences, when part-combining. Usually unset or zero when combining threads into one voice, and 1 (or the duration of one measure) when combining voices into one staff.") -- 2.39.2