]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #255.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 24 Jan 2007 11:48:12 +0000 (12:48 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 24 Jan 2007 11:48:12 +0000 (12:48 +0100)
Require delta-time before breaking out of separation item loop.
Add time_spanned_interval(Item*, Item*)

input/regression/spacing-horizontal-skyline-grace.ly [new file with mode: 0644]
lily/include/item.hh
lily/item.cc
lily/separating-group-spanner.cc
lily/spanner.cc

diff --git a/input/regression/spacing-horizontal-skyline-grace.ly b/input/regression/spacing-horizontal-skyline-grace.ly
new file mode 100644 (file)
index 0000000..391d516
--- /dev/null
@@ -0,0 +1,32 @@
+\header{
+
+  texidoc = "Skyline horizontal spacing may fold non-adjacent columns
+together, but they still do not collide. In this case, the arpeggio
+and the barline do not collide."
+
+}
+
+\version "2.11.13"
+
+\paper
+{
+  ragged-right = ##t
+}
+
+\new Staff
+\relative c
+{
+  \override Score.NonMusicalPaperColumn #'stencil = #ly:paper-column::print 
+  \time 6/8
+  \clef bass
+  s2. |
+  \relative c <<
+    {
+      <des ges b des>4\arpeggio
+    }
+    \\
+    {
+      \acciaccatura ges,8 \voiceTwo ges4
+    }
+  >>
+}
index a23cab577c1766c2406f721d492f35a9cba41669..fa5092e27ad38e60e805312bd97d292fe93859dd 100644 (file)
@@ -46,4 +46,6 @@ protected:
   virtual void derived_mark () const;
 };
 
+Interval_t<Moment> spanned_time_interval (Item *l, Item *r);
+
 #endif
index 9d6a517d3bd9f3d247965f5d6b09102542f40c7b..521b285d52d86aa89d7c4ed014a39ac2ace40fd9 100644 (file)
@@ -16,6 +16,9 @@
 #include "system.hh"
 #include "pointer-group-interface.hh"
 
+#include "moment.hh"
+
+
 Grob *
 Item::clone () const
 {
@@ -180,6 +183,33 @@ Item::spanned_rank_iv () const
   return Interval_t<int> (c, c);
 }
 
+Interval_t<Moment>
+spanned_time_interval (Item *l, Item *r) 
+{
+  Drul_array<Item*> bounds (l, r);
+  Interval_t<Moment> iv;
+
+  Direction d = LEFT;
+  do
+    {
+      if (bounds[d] && bounds[d]->get_column ())
+       iv[d] = robust_scm2moment (bounds[d]->get_column ()->get_property ("when"),
+                                 iv[d]);
+    }
+  while (flip (&d) != LEFT);
+
+  do
+    {
+      if (!bounds[d] || !bounds[d]->get_column ())
+       iv[d] = iv[-d];
+    }
+  while (flip (&d) != LEFT);
+  
+  
+  return iv;
+}
+
+
 void
 Item::derived_mark () const
 {
index f8975cd5158e5eb62be38f642899c8d3972cc220..7de9341e397868b8f24c812910a37dfef0f60b12 100644 (file)
@@ -13,6 +13,7 @@
 #include "output-def.hh"
 #include "dimensions.hh"
 #include "pointer-group-interface.hh"
+#include "moment.hh"
 
 void
 Separating_group_spanner::find_rods (Item *r,
@@ -37,7 +38,13 @@ Separating_group_spanner::find_rods (Item *r,
          Separation_item::set_distance (Drul_array<Item*> (lb, r), padding);
        }
 
-      if (Separation_item::set_distance (Drul_array<Item *> (l, r), padding))
+      if (Separation_item::set_distance (Drul_array<Item *> (l, r), padding)
+         /*
+           This check is because grace notes are set very tight, and
+           the accidentals of main note may stick out so far to cover
+           a barline preceding the grace note.
+          */
+         && spanned_time_interval (l, r).length ().main_part_ > Rational (0))
        break;
 
       /*
index 8a1e9e62c96204d71a9b6fd5c55c41466f505327..14ab378668eba48b12546c2febb4a4a29ffae231 100644 (file)
@@ -160,28 +160,11 @@ Spanner::spanned_rank_iv () const
 Interval_t<Moment>
 Spanner::spanned_time () const
 {
-  Interval_t<Moment> iv;
-
-  Direction d = LEFT;
-  do
-    {
-      if (spanned_drul_[d] && spanned_drul_[d]->get_column ())
-       iv[d] = robust_scm2moment (spanned_drul_[d]->get_column ()->get_property ("when"),
-                                 iv[d]);
-    }
-  while (flip (&d) != LEFT);
-
-  do
-    {
-      if (!spanned_drul_[d] || !spanned_drul_[d]->get_column ())
-       iv[d] = iv[-d];
-    }
-  while (flip (&d) != LEFT);
-  
-  
-  return iv;
+  return spanned_time_interval (spanned_drul_[LEFT],
+                               spanned_drul_[RIGHT]);
 }
 
+
 Item *
 Spanner::get_bound (Direction d) const
 {