summaryrefslogtreecommitdiff
path: root/lily
diff options
context:
space:
mode:
authorKeith OHara <k-ohara5a5a@oco.net>2012-06-17 21:45:26 -0700
committerKeith OHara <k-ohara5a5a@oco.net>2012-06-20 15:02:29 -0700
commit16a328617e867892e8d5608f95bd6127196e03a2 (patch)
treebad967503bd7fefdcf8b7067aa9a1e6c2278187a /lily
parent619997f335c96cb3720f486650fd284906c90b83 (diff)
Consistent bounds for slurs; issue 427 and 379
Diffstat (limited to 'lily')
-rw-r--r--lily/include/slur-scoring.hh2
-rw-r--r--lily/slur-scoring.cc25
-rw-r--r--lily/spanner.cc26
3 files changed, 14 insertions, 39 deletions
diff --git a/lily/include/slur-scoring.hh b/lily/include/slur-scoring.hh
index 4b379c0913..e5ff38d611 100644
--- a/lily/include/slur-scoring.hh
+++ b/lily/include/slur-scoring.hh
@@ -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);
diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc
index e137c11f01..e1025fa545 100644
--- a/lily/slur-scoring.cc
+++ b/lily/slur-scoring.cc
@@ -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 ();
diff --git a/lily/spanner.cc b/lily/spanner.cc
index 9a8ff83a3f..ae0094fc4b 100644
--- a/lily/spanner.cc
+++ b/lily/spanner.cc
@@ -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
{