]> git.donarmstrong.com Git - lilypond.git/commitdiff
''
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 13 Apr 2002 11:24:14 +0000 (11:24 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 13 Apr 2002 11:24:14 +0000 (11:24 +0000)
ChangeLog
input/regression/tie-grace.ly [new file with mode: 0644]
lily/tie-engraver.cc
scm/translator-property-description.scm

index 4a8bc40ec7bb45c7a531566b89f8f107740052b5..cd22684d9478265b70db7743d3ad72a61bb84f90 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-04-13  Han-Wen  <hanwen@cs.uu.nl>
+
+       * input/regression/tie-grace.ly: new file.
+
+       * lily/tie-engraver.cc (create_grobs): fix tied graces.
 
 2002-04-13  Han-Wen  <hanwen@cs.uu.nl>
 
diff --git a/input/regression/tie-grace.ly b/input/regression/tie-grace.ly
new file mode 100644 (file)
index 0000000..66309e8
--- /dev/null
@@ -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 
+  }
+}
index 447b5ee143be107f1da2255f0a68fac96affca07..16abacdeeca0b92d8cccb7dca54d5841c60612b7 100644 (file)
@@ -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();
 }
 
 
index 54b5a1df9d3a69f5fc1a4061eb9f20baab2dcfff..36845bf2631d869e876e5078db0cbc6178176c73 100644 (file)
@@ -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.")