]> git.donarmstrong.com Git - lilypond.git/commitdiff
make spanned_rank_iv() const; add Spanner::spanned_time() method
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 24 Jan 2007 01:27:00 +0000 (02:27 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 24 Jan 2007 01:27:00 +0000 (02:27 +0100)
lily/grob.cc
lily/include/grob.hh
lily/include/item.hh
lily/include/spanner.hh
lily/item.cc
lily/spanner.cc

index 01b2c7f3e313b33fdeb12e35de11ee33082752fe..bc948659f12b1a93e233c831ae55101660707862 100644 (file)
@@ -446,7 +446,7 @@ Grob::maybe_pure_extent (Grob *refp, Axis a, bool pure, int start, int end)
 }
 
 Interval_t<int>
-Grob::spanned_rank_iv ()
+Grob::spanned_rank_iv () const
 {
   return Interval_t<int> (-1, 0);
 }
index bcd101b98ed971859e7f8e28631e347d38a291c3..c7ecbbabfdeebad050a178490defc73b8bddb8a2 100644 (file)
@@ -125,7 +125,7 @@ public:
   Grob *get_parent (Axis a) const;
   void fixup_refpoint ();
 
-  virtual Interval_t<int> spanned_rank_iv ();
+  virtual Interval_t<int> spanned_rank_iv () const;
 };
 
 /* smob utilities */
index d00541a8bf26fe35a19e90f43f03515de50eaadd..a23cab577c1766c2406f721d492f35a9cba41669 100644 (file)
@@ -38,7 +38,7 @@ public:
   virtual System *get_system () const;
   virtual Paper_column *get_column () const;
   virtual void handle_prebroken_dependencies ();
-  virtual Interval_t<int> spanned_rank_iv ();
+  virtual Interval_t<int> spanned_rank_iv () const;
   DECLARE_GROB_INTERFACE();
 protected:
   virtual void discretionary_processing ();
index e4a09cc0cf8395e6dc0ec5da6a2c3926230a43d6..23455d73b1b65ae82fd8243cef509fe4ed4fd0af 100644 (file)
@@ -47,7 +47,8 @@ public:
   void substitute_one_mutable_property (SCM sym, SCM val);
   bool fast_substitute_grob_array (SCM sym, Grob_array *);
 
-  virtual Interval_t<int> spanned_rank_iv ();
+  Interval_t<Moment> spanned_time () const;
+  virtual Interval_t<int> spanned_rank_iv () const;
   void set_bound (Direction d, Grob *);
   Item *get_bound (Direction d) const;
 
@@ -64,6 +65,7 @@ public:
   DECLARE_GROB_INTERFACE();
   virtual System *get_system () const;
 
+  
 protected:
   void set_my_columns ();
   virtual Grob *clone () const;
index c6ca1b2c6939778a77f096ba2671bac0ad0ecdd0..9d6a517d3bd9f3d247965f5d6b09102542f40c7b 100644 (file)
@@ -174,7 +174,7 @@ 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);
index e1fe55efe1d04d6ee65ea6e0ce80ad5f9b94bbbd..8a1e9e62c96204d71a9b6fd5c55c41466f505327 100644 (file)
@@ -14,6 +14,7 @@
 #include "stencil.hh"
 #include "system.hh"
 #include "warn.hh"
+#include "moment.hh"
 
 Grob *
 Spanner::clone () const
@@ -145,7 +146,7 @@ Spanner::set_my_columns ()
 }
 
 Interval_t<int>
-Spanner::spanned_rank_iv ()
+Spanner::spanned_rank_iv () const
 {
   Interval_t<int> iv (0, 0);
 
@@ -156,6 +157,31 @@ Spanner::spanned_rank_iv ()
   return iv;
 }
 
+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;
+}
+
 Item *
 Spanner::get_bound (Direction d) const
 {