]> git.donarmstrong.com Git - lilypond.git/commitdiff
* input/regression/collision-dots-move.ly: New test.
authorJan Nieuwenhuizen <janneke@gnu.org>
Sun, 1 Feb 2004 12:44:56 +0000 (12:44 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sun, 1 Feb 2004 12:44:56 +0000 (12:44 +0000)
* lily/note-collision.cc (check_meshing_chords): Move dots on left
hand side note head of non-merged collision to the right.

ChangeLog
input/regression/collision-dots-move.ly [new file with mode: 0644]
lily/note-collision.cc

index 89ddc56e6d6ca1695f8a5be20915ca2a4669a87f..878911fda732bba395d0c554d25a03f5f49002e9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2004-02-01  Jan Nieuwenhuizen  <janneke@gnu.org>
 
+       * input/regression/collision-dots-move.ly: New test.
+
+       * lily/note-collision.cc (check_meshing_chords): Move dots on left
+       hand side note head of non-merged collision to the right.
+
        * lily/new-lyric-combine-music-iterator.cc (start_new_syllable):
        Construct children before accessing property from emtpy
        lyrics_context_.
diff --git a/input/regression/collision-dots-move.ly b/input/regression/collision-dots-move.ly
new file mode 100644 (file)
index 0000000..31ca437
--- /dev/null
@@ -0,0 +1,16 @@
+\header {
+    
+    texidoc = "If collision resolution finds dotted note head must
+       remain on left hand side, move dots to the right."
+
+}
+
+\paper { raggedright = ##t }
+
+\score {
+  \notes \relative c {
+    \key d \minor
+    \clef bass
+    << <cis a' cis>4 \\ { g'8. bes16} >>
+  }
+}
index 01364cb838cff207228101158db8f718fbbf922e..a53eae524f68af6aef7faea4c8b0278549d26905 100644 (file)
@@ -15,6 +15,8 @@
 #include "axis-group-interface.hh"
 #include "item.hh"
 #include "stem.hh"
+#include "side-position-interface.hh"
+#include "dot-column.hh"
 
 MAKE_SCHEME_CALLBACK (Note_collision_interface,force_shift_callback,2);
 
@@ -168,12 +170,10 @@ check_meshing_chords (Grob *me,
   if (touch)
     shift_amount *= -1;
 
-  /*
-    for full collisions, the right hand head may obscure dots, so
-    make sure the dotted heads go to the right.
-   */
-  if ((Rhythmic_head::dot_count (nu) > Rhythmic_head::dot_count (nd)
-       && full_collide))
+  /* For full collisions, the right hand head may obscure dots, so
+     make sure the dotted heads go to the right.  */
+  if (Rhythmic_head::dot_count (nu) > Rhythmic_head::dot_count (nd)
+      && full_collide)
     shift_amount = 1;
 
   if (merge_possible)
@@ -218,6 +218,18 @@ check_meshing_chords (Grob *me,
   else
     shift_amount *= 0.25;
 
+  /* For full or close half collisions, the right hand head may
+     obscure dots.  Move dots to the right.  */
+  if (abs (shift_amount) > 1e-6
+      && Rhythmic_head::dot_count (nd) > Rhythmic_head::dot_count (nu)
+      && (full_collide || close_half_collide))
+    {
+      Grob *d = unsmob_grob (nd->get_grob_property ("dot"));
+      Grob *parent = d->get_parent (X_AXIS);
+      if (Dot_column::has_interface (parent))
+       Side_position_interface::add_support (parent, nu);
+    }
+
   Direction d = UP;
   do
     {
@@ -387,8 +399,9 @@ Note_collision_interface::automatic_shift (Grob *me,
   do
     {
       for (int i=0; i < clash_groups[d].size (); i++)
-       tups = gh_cons (gh_cons (clash_groups[d][i]->self_scm (), gh_double2scm (offsets[d][i])),
-                                tups);
+       tups = gh_cons (gh_cons (clash_groups[d][i]->self_scm (),
+                                gh_double2scm (offsets[d][i])),
+                       tups);
     }
   while (flip (&d) != UP);
   return tups;