diff options
author | David Nalesnik <david.nalesnik@gmail.com> | 2015-02-04 14:07:01 -0600 |
---|---|---|
committer | David Nalesnik <david.nalesnik@gmail.com> | 2015-02-14 08:54:15 -0600 |
commit | 3668bac590386ed98cf517d7bd71f79ae35abbc4 (patch) | |
tree | b8d063ed5f8dc84d7909b27cb42c4b2d19ed84b8 /lily/spanner.cc | |
parent | a32b19f4716ca1184fa1dc837927baba96773bff (diff) |
Allow independent adjustment of minimum length for spanner siblings
The property minimum-length does not allow independent adjustment
of the siblings of broken spanners. This patch adds a property,
minimum-length-after-break, which, if set, behaves similarly to minimum-length,
but only affects siblings starting a line. If minimum-length-after-break is
unset, minimum-length still controls all lengths.
A regtest demonstrates usage of the new property with a number of spanners.
Another regtest demonstrates usage and compatibility of minimum-distance
and minimum-distance-after-break.
Diffstat (limited to 'lily/spanner.cc')
-rw-r--r-- | lily/spanner.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lily/spanner.cc b/lily/spanner.cc index 66b35dcd1b..8475231321 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -366,9 +366,10 @@ Spanner::set_spacing_rods (SCM smob) { Grob *me = Grob::unsmob (smob); SCM num_length = me->get_property ("minimum-length"); - if (scm_is_number (num_length)) + SCM broken_length = me->get_property ("minimum-length-after-break"); + if (scm_is_number (num_length) + || scm_is_number (broken_length)) { - Rod r; Spanner *sp = dynamic_cast<Spanner *> (me); System *root = get_root_system (me); Drul_array<Item *> bounds (sp->get_bound (LEFT), @@ -389,9 +390,23 @@ Spanner::set_spacing_rods (SCM smob) r.item_drul_[LEFT] = cols.back ()->find_prebroken_piece (RIGHT); r.item_drul_[RIGHT] = sp->get_bound (RIGHT); + if (scm_is_number (broken_length)) + /* + r.distance_ may have been modified by add_to_cols () + above. For treatment of minimum-distance-after-break + consistent with minimum-distance (which will use the + changed value), we cannot directly reset r.distance_ to + broken_length. + */ + r.distance_ += robust_scm2double (broken_length, 0) - + robust_scm2double (num_length, 0); r.add_to_cols (); } + Rod r; + /* + As r is a fresh rod, we can set distance_ with no complication. + */ r.distance_ = robust_scm2double (num_length, 0); r.item_drul_[LEFT] = sp->get_bound (LEFT); r.item_drul_[RIGHT] = sp->get_bound (RIGHT); @@ -546,6 +561,7 @@ ADD_INTERFACE (Spanner, /* properties */ "normalized-endpoints " "minimum-length " + "minimum-length-after-break " "spanner-broken " "spanner-id " "to-barline " |