lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Modifies Spanner::spanner_length to better handle line-spanners. (issue4


From: mtsolo
Subject: Modifies Spanner::spanner_length to better handle line-spanners. (issue4621044)
Date: Wed, 15 Jun 2011 07:39:25 +0000

Reviewers: ,

Message:
Yes, this is LilyPond patch morning.
This should get line-spanners synced up perfectly with
Spanner::spanner_length.

Description:
Modifies Spanner::spanner_length to better handle line-spanners.

Please review this at http://codereview.appspot.com/4621044/

Affected files:
  M lily/spanner.cc


Index: lily/spanner.cc
diff --git a/lily/spanner.cc b/lily/spanner.cc
index 9fe94ab3acbfa5a9bc1f6bcd93abcca29ed73ae8..b3ac4abfcfb3c196b0a0739f9a037a7c05be67d9 100644
--- a/lily/spanner.cc
+++ b/lily/spanner.cc
@@ -239,13 +239,28 @@ Spanner::Spanner (Spanner const &s)
 Real
 Spanner::spanner_length () const
 {
-  Real l = spanned_drul_[LEFT]->relative_coordinate (0, X_AXIS);
-  Real r = spanned_drul_[RIGHT]->relative_coordinate (0, X_AXIS);
+  Interval lr;
+
+  Drul_array<SCM> bounds (get_property ("left-bound-info"),
+                         get_property ("right-bound-info"));

-  if (r < l)
+  Direction d =  LEFT;
+  do
+      lr[d] = robust_scm2double (ly_assoc_get (ly_symbol2scm ("X"),
+                                               bounds[d], SCM_BOOL_F), -d);
+  while (flip (&d) != LEFT);
+
+  if (lr.is_empty ())
+    {
+      do
+        lr[d] = spanned_drul_[d]->relative_coordinate (0, X_AXIS);
+      while (flip (&d) != LEFT);
+    }
+
+  if (lr.is_empty ())
     programming_error ("spanner with negative length");

-  return r - l;
+  return lr.length ();
 }

 System *





reply via email to

[Prev in Thread] Current Thread [Next in Thread]