]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #51.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 26 Mar 2007 03:48:35 +0000 (00:48 -0300)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 26 Mar 2007 03:48:35 +0000 (00:48 -0300)
- Add Note_column::dot_column()

- In collision resolution, add inner voice stems to outer voice dot columns

input/regression/dot-up-voice-collision.ly [new file with mode: 0644]
lily/dot-column.cc
lily/include/note-column.hh
lily/note-collision.cc
lily/note-column.cc

diff --git a/input/regression/dot-up-voice-collision.ly b/input/regression/dot-up-voice-collision.ly
new file mode 100644 (file)
index 0000000..2009232
--- /dev/null
@@ -0,0 +1,18 @@
+\header {
+
+  texidoc = "in collisions, the stems of outer voice are added to the
+  dot support of the inner voices."
+
+}
+
+\version "2.11.21"
+
+\layout { ragged-right = ##t }
+
+\new Staff {
+  \key e \major \time 3/4
+  \relative c'' {
+    << { dis4.  } \\
+       { fis,4 } \\ { b4 } >>
+  }
+}
index 133f88ad3c68bb3f143f8a12997754c9182289b2..36c95137970240f526faff57515c68e8f7753f07 100644 (file)
@@ -83,21 +83,31 @@ Dot_column::calc_positioning_done (SCM smob)
         
         Rest collisions should wait after line breaking.
       */
+      Interval y;
       if (Rest::has_interface (s))
        {
          base_x.unite (s->extent (commonx, X_AXIS));
          continue;
        }
+      else if (Stem::has_interface (s))
+       {
+         Real y1 = Stem::head_positions (s)[-get_grob_direction (s)];
+         Real y2 = y1 + get_grob_direction (s) * 7;
+
+         y.add_point (y1);
+         y.add_point (y2);
+       }
+      else
+       y = s->extent (s, Y_AXIS);
 
-      Interval y = s->extent (s, Y_AXIS);
       y *= 2 / ss;
       y += Staff_symbol_referencer::get_position (s);
          
       Box b (s->extent (commonx, X_AXIS), y);
       boxes.push_back (b);
 
-      if (Grob *s = unsmob_grob (s->get_object ("stem")))
-       stems.insert (s);
+      if (Grob *stem = unsmob_grob (s->get_object ("stem")))
+       stems.insert (stem);
     }
 
   for (set<Grob*>::const_iterator i(stems.begin());
index 60c2668890eef9f07aa3ea50a68484295f298042..429b83af3ef29968ac0b6650c96eccf5a35e1e55 100644 (file)
@@ -34,6 +34,7 @@ public:
   static void set_dotcol (Grob *me, Grob *);
   static void add_head (Grob *me, Grob *);
   static bool has_rests (Grob *me);
+  static Grob *dot_column (Grob *me);
   DECLARE_GROB_INTERFACE();
 
   static Item *get_stem (Grob *);
index be69b231f242755adc20c5b6f285b0663d28b1f4..6feb71c8633f0e00f26e4f59c5bc32dbf44f4a20 100644 (file)
@@ -507,6 +507,23 @@ Note_collision_interface::automatic_shift (Grob *me,
     }
   while ((flip (&d)) != UP);
 
+
+  /*
+    see input/regression/dot-up-voice-collision.ly
+   */
+  for (vsize i = 0; i < clash_groups[UP].size (); i++)
+    {
+      Grob *g = clash_groups[UP][i];
+      Grob *dc = Note_column::dot_column (g);
+      
+      if (dc)
+       for (vsize j = i + 1;  j < clash_groups[UP].size (); j++)
+         {
+           Grob *stem = Note_column::get_stem (clash_groups[UP][j]);
+           Side_position_interface::add_support (dc, stem);
+         }
+    }
+  
   /*
     Check if chords are meshing
   */
index 380182f85623cd74fca631b1d04a4715bc02fcf1..3f57d3e63c888b09fb564849aa3809b4307366b3 100644 (file)
@@ -181,6 +181,20 @@ Note_column::accidentals (Grob *me)
   return acc;
 }
 
+Grob *
+Note_column::dot_column (Grob *me)
+{
+  extract_grob_set (me, "note-heads", heads);
+  for (vsize i = 0; i < heads.size (); i++)
+    {
+      Grob *dots = unsmob_grob (heads[i]->get_object ("dot"));
+      if (dots)
+       return dots->get_parent (X_AXIS);
+    }
+  
+  return 0;
+}
+
 Grob *
 Note_column::arpeggio (Grob *me)
 {