]> git.donarmstrong.com Git - lilypond.git/commitdiff
Examine Stem::duration_log() for preventing merge of quarter and half
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 7 Nov 2006 15:43:12 +0000 (16:43 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 7 Nov 2006 15:43:12 +0000 (16:43 +0100)
note. Fixes collision-heads.ly. Add separate regtest for that.

input/regression/collision-merge-differently-headed.ly [new file with mode: 0644]
lily/note-collision.cc

diff --git a/input/regression/collision-merge-differently-headed.ly b/input/regression/collision-merge-differently-headed.ly
new file mode 100644 (file)
index 0000000..62e6e6b
--- /dev/null
@@ -0,0 +1,25 @@
+\version "2.7.39"
+\header {
+  texidoc =
+
+  "If @code{merge-differently-headed} is enabled, then
+open note heads may be merged with black noteheads, but only
+if the black note heads are from 8th or shorter notes.
+"
+  
+}
+
+\layout { ragged-right= ##t }
+
+
+\context Staff  \relative c'' <<
+  {
+    \override Staff.NoteCollision  #'merge-differently-headed = ##t
+    c2 c8 c4.
+    c2
+  }\\
+  {
+    c8 c4. c2
+    c4
+  }
+>>
index bce6d08a60c52dfdb3da8eb4590b6169ae51872c..ddfbf19983e14572dcf8fe4eec4baae09489cce1 100644 (file)
@@ -39,6 +39,9 @@ check_meshing_chords (Grob *me,
   if (!Note_column::get_stem (cu) || !Note_column::get_stem (cd))
     return;
 
+  Drul_array<Grob*> stems (Note_column::get_stem (cd),
+                          Note_column::get_stem (cu));
+  
   Grob *nu = Note_column::first_head (cu);
   Grob *nd = Note_column::first_head (cd);
 
@@ -90,10 +93,10 @@ check_meshing_chords (Grob *me,
   /* Should never merge quarter and half notes, as this would make
      them indistinguishable.  */
   if (merge_possible
-      && ((Rhythmic_head::duration_log (nu) == 1
-          && Rhythmic_head::duration_log (nd) == 2)
-         || (Rhythmic_head::duration_log (nu) == 2
-             && Rhythmic_head::duration_log (nd) == 1)))
+      && ((Stem::duration_log (stems[UP]) == 1
+          && Stem::duration_log (stems[DOWN]) == 2)
+         || (Stem::duration_log (stems[UP]) == 2
+             && Stem::duration_log (stems[DOWN]) == 1)))
     merge_possible = false;
 
   /*
@@ -535,4 +538,4 @@ ADD_INTERFACE (Note_collision_interface, "note-collision-interface",
               /* properties */
               "merge-differently-dotted "
               "merge-differently-headed "
-              "positioning-done");
+              "positioning-done ");