]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/item.cc
don't use extent of musical column for horizontal spacing.
[lilypond.git] / lily / item.cc
index c6ca1b2c6939778a77f096ba2671bac0ad0ecdd0..521b285d52d86aa89d7c4ed014a39ac2ace40fd9 100644 (file)
@@ -16,6 +16,9 @@
 #include "system.hh"
 #include "pointer-group-interface.hh"
 
+#include "moment.hh"
+
+
 Grob *
 Item::clone () const
 {
@@ -174,12 +177,39 @@ Item::pure_is_visible (int start, int end) const
 }
 
 Interval_t<int>
-Item::spanned_rank_iv ()
+Item::spanned_rank_iv () const
 {
   int c = get_column ()->get_rank ();
   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
 {