]> git.donarmstrong.com Git - lilypond.git/commitdiff
resolve note-collisions in absence of explicit voicing; issue 4255
authorKeith OHara <k-ohara5a5a@oco.net>
Sun, 11 Jan 2015 06:36:07 +0000 (22:36 -0800)
committerKeith OHara <k-ohara5a5a@oco.net>
Sun, 18 Jan 2015 05:37:02 +0000 (21:37 -0800)
lily/note-collision.cc

index a0be58907a6547151b167f7bd6fe63fb2cdd6556..728f64dfaef591a41d8006099253404bc2d2e60d 100644 (file)
@@ -503,24 +503,23 @@ Note_collision_interface::automatic_shift (Grob *me,
 
           if (i == 0)
             offset = inner_offset;
-          else if (shifts[i] == shifts[i - 1])
-            {
-              // Match the previous notecolumn offset,
-              // but warn if the user did not set these equal shifts explictly
-              if (!scm_is_number (sh))
-                col->warning (_ ("this Voice needs a \\voiceXx or \\shiftXx setting"));
-            }
-          else if (extents[d][i][UP] > extents[d][i - 1][DOWN]
-                   && extents[d][i][DOWN] < extents[d][i - 1][UP])
-            offset += 1.0; // fully clear the inner-voice heads
           else
             {
-              // check if we cross the inner voice
-              if (d * extents[d][i][-d] >= d * extents[d][i - 1][d])
+              bool explicit_shift = scm_is_number (sh);
+              if (!explicit_shift)
+                col->warning (_ ("this Voice needs a \\voiceXx or \\shiftXx setting"));
+
+              if (explicit_shift && shifts[i] == shifts[i - 1])
+                ; // Match the previous notecolumn offset
+              else if (extents[d][i][UP] > extents[d][i - 1][DOWN]
+                       && extents[d][i][DOWN] < extents[d][i - 1][UP])
+                offset += 1.0; // fully clear the previous-notecolumn heads
+              else if (d * extents[d][i][-d] >= d * extents[d][i - 1][d])
                 offset += Stem::is_valid_stem (stems[d][i - 1])
-                          ? 1.0 : 0.5;
+                          ? 1.0 : 0.5; // we cross the previous notecolumn
               else if (Stem::is_valid_stem (stems[d][i]))
                 offset += 0.5;
+
               // check if we cross the opposite-stemmed voices
               if (d * extents[d][i][-d] < d * extent_union[-d][d])
                 offset = max (offset, 0.5);