]> git.donarmstrong.com Git - lilypond.git/commitdiff
Consistent bounds for slurs; issue 427 and 379
authorKeith OHara <k-ohara5a5a@oco.net>
Mon, 18 Jun 2012 04:45:26 +0000 (21:45 -0700)
committerKeith OHara <k-ohara5a5a@oco.net>
Wed, 20 Jun 2012 22:02:29 +0000 (15:02 -0700)
lily/include/slur-scoring.hh
lily/slur-scoring.cc
lily/spanner.cc

index 4b379c09137ade2207c9edbaf7bc5e6b1b9c2503..e5ff38d6112c73750aab1d89e0baa8d1cbff4303 100644 (file)
@@ -120,7 +120,7 @@ struct Slur_score_state
   vector<Extra_collision_info> get_extra_encompass_infos () const;
   Real move_away_from_staffline (Real y, Grob *on_staff) const;
 
-  Grob *breakable_bound_item (Direction) const;
+  Interval breakable_bound_extent (Direction) const;
 };
 
 void set_slur_control_points (Grob *me);
index e137c11f013bd3cc6728102e2f7d22574e170961..e1025fa545c56c1c20ee0a476355b778229cf336 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <queue>
 
+#include "axis-group-interface.hh"
 #include "accidental-interface.hh"
 #include "beam.hh"
 #include "clef.hh"
@@ -426,10 +427,12 @@ Slur_score_state::get_best_curve () const
   return best;
 }
 
-Grob *
-Slur_score_state::breakable_bound_item (Direction d) const
+Interval
+Slur_score_state::breakable_bound_extent (Direction d) const
 {
   Grob *col = slur_->get_bound (d)->get_column ();
+  Interval ret;
+  ret.set_empty ();
 
   extract_grob_set (slur_, "encompass-objects", extra_encompasses);
 
@@ -437,10 +440,10 @@ Slur_score_state::breakable_bound_item (Direction d) const
     {
       Item *item = dynamic_cast<Item *> (extra_encompasses[i]);
       if (item && col == item->get_column ())
-        return item;
+        ret.unite (robust_relative_extent (item, common_[X_AXIS], X_AXIS));
     }
 
-  return 0;
+  return ret;
 }
 
 /*
@@ -530,14 +533,12 @@ Slur_score_state::get_base_attachments () const
           Real x = 0;
           Real y = 0;
 
-          if (Grob *g = breakable_bound_item (d))
-            {
-              x = robust_relative_extent (g, common_[X_AXIS], X_AXIS)[RIGHT];
-            }
-          else if (d == RIGHT)
-            x = robust_relative_extent (extremes_[d].bound_, common_[X_AXIS], X_AXIS)[d];
-          else
-            x = slur_->get_broken_left_end_align ();
+          Interval ext = breakable_bound_extent (d);
+          if (ext.is_empty ())
+            ext = Axis_group_interface::
+                  generic_bound_extent (extremes_[d].bound_,
+                                        common_[X_AXIS], X_AXIS);
+          x = ext[-d];
 
           Grob *col = (d == LEFT) ? columns_[0] : columns_.back ();
 
index 9a8ff83a3ffca20c2579e67ec9770b716c5779bc..ae0094fc4bdbc0329c1eb611e81f8935b7f92424 100644 (file)
@@ -319,32 +319,6 @@ Spanner::is_broken () const
   return broken_intos_.size ();
 }
 
-/*
-  If this is a broken spanner, return the amount the left end is to be
-  shifted horizontally so that the spanner starts after the initial
-  clef and key on the staves. This is necessary for ties, slurs,
-  crescendo and decrescendo signs, for example.
-*/
-Real
-Spanner::get_broken_left_end_align () const
-{
-  Paper_column *sc = dynamic_cast<Paper_column *> (spanned_drul_[LEFT]->get_column ());
-
-  // Relevant only if left span point is first column in line
-  if (sc != NULL
-      && sc->break_status_dir () == RIGHT)
-    {
-      /*
-        We used to do a full search for the Break_align_item.
-        But that doesn't make a difference, since the Paper_column
-        is likely to contain only a Break_align_item.
-      */
-      return sc->extent (sc, X_AXIS)[RIGHT];
-    }
-
-  return 0.0;
-}
-
 void
 Spanner::derived_mark () const
 {