X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fspacing-determine-loose-columns.cc;h=fe072bca0aba3a93097095595e49101faaded388;hb=5ed1fab7b536fe3b0a14415e580c7ffc83fbd346;hp=ee21f51c91d4fb1bb08dcd1253e1784143b3f989;hpb=a276a19dc6bd57832db3107f2f2cbb04cb4677b6;p=lilypond.git diff --git a/lily/spacing-determine-loose-columns.cc b/lily/spacing-determine-loose-columns.cc index ee21f51c91..fe072bca0a 100644 --- a/lily/spacing-determine-loose-columns.cc +++ b/lily/spacing-determine-loose-columns.cc @@ -14,6 +14,7 @@ #include "paper-column.hh" #include "column-x-positions.hh" #include "pointer-group-interface.hh" +#include "spacing-interface.hh" #include "spacing-spanner.hh" #include "note-spacing.hh" #include "moment.hh" @@ -86,7 +87,7 @@ is_loose_column (Grob *l, Grob *col, Grob *r, Spacing_options const *options) return false; l_neighbor = l_neighbor->get_column (); - r_neighbor = dynamic_cast (Note_spacing::right_column (r_neighbor)); + r_neighbor = dynamic_cast (Spacing_interface::right_column (r_neighbor)); if (l == l_neighbor && r == r_neighbor) return false; @@ -143,8 +144,8 @@ Spacing_spanner::set_distances_for_loose_col (Grob *me, Grob *c, for (vsize k = wishes.size (); k--;) { Grob *sp = wishes[k]; - if (Note_spacing::left_column (sp) != lc - || Note_spacing::right_column (sp) != rc) + if (Spacing_interface::left_column (sp) != lc + || Spacing_interface::right_column (sp) != rc) continue; if (Note_spacing::has_interface (sp)) @@ -153,26 +154,16 @@ Spacing_spanner::set_distances_for_loose_col (Grob *me, Grob *c, The note spacing should be taken from the musical columns. */ - Real space = 0.0; - Real fixed = 0.0; - bool dummy = false; - - Real base = note_spacing (me, lc, rc, options, &dummy); - Note_spacing::get_spacing (sp, rc, base, options->increment_, - &space, &fixed); + Real base = note_spacing (me, lc, rc, options); + Spring spring = Note_spacing::get_spacing (sp, rc, base, options->increment_); - space -= options->increment_; - - dists[d] = max (dists[d], space); + dists[d] = max (dists[d], spring.min_distance ()); } else if (Staff_spacing::has_interface (sp)) { - Real space = 0; - Real fixed_space = 0; - Staff_spacing::get_spacing_params (sp, - &space, &fixed_space); + Spring spring = Staff_spacing::get_spacing (sp, rc); - dists[d] = max (dists[d], fixed_space); + dists[d] = max (dists[d], spring.min_distance ()); } else programming_error ("Subversive spacing wish"); @@ -204,7 +195,7 @@ Spacing_spanner::prune_loose_columns (Grob *me, { Grob *c = cols->at (i); - bool loose = (i > 0 && i < cols->size () - 1) + bool loose = (i > 0 && i + 1 < cols->size ()) && is_loose_column (cols->at (i - 1), c, cols->at (i + 1), options); if (loose) @@ -279,7 +270,7 @@ Spacing_spanner::set_explicit_neighbor_columns (vector const &cols) Item *wish = dynamic_cast (wishes[k]); Item *lc = wish->get_column (); - Grob *right = Note_spacing::right_column (wish); + Grob *right = Spacing_interface::right_column (wish); if (!right) continue; @@ -357,7 +348,7 @@ Spacing_spanner::set_implicit_neighbor_columns (vector const &cols) cols[i]->set_object ("left-neighbors", ga_scm); } extract_grob_set (cols[i], "right-neighbors", rns); - if (rns.empty () && i < cols.size () - 1) + if (rns.empty () && i + 1 < cols.size ()) { SCM ga_scm = Grob_array::make_array (); Grob_array *ga = unsmob_grob_array (ga_scm);