X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fspacing-determine-loose-columns.cc;h=d7fd373cbab3dc92021e0e5b2a3edc219d25609f;hb=9e781b7dc83b60a543ce218aa1a5f139f74c760f;hp=79551ecac37d5d06aaed4ea40175c413179a1ae2;hpb=f93e4199873c91ae32f0e84a610d14853dc379df;p=lilypond.git diff --git a/lily/spacing-determine-loose-columns.cc b/lily/spacing-determine-loose-columns.cc index 79551ecac3..d7fd373cba 100644 --- a/lily/spacing-determine-loose-columns.cc +++ b/lily/spacing-determine-loose-columns.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 2005--2011 Han-Wen Nienhuys + Copyright (C) 2005--2014 Han-Wen Nienhuys LilyPond is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -134,10 +134,9 @@ Spacing_spanner::set_distances_for_loose_col (Grob *me, Grob *c, Drul_array next_door, Spacing_options const *options) { - Direction d = LEFT; Drul_array dists (0, 0); - do + for (LEFT_and_RIGHT (d)) { Item *lc = dynamic_cast ((d == LEFT) ? next_door[LEFT] : c); Item *rc = dynamic_cast (d == LEFT ? c : next_door[RIGHT]); @@ -156,14 +155,14 @@ Spacing_spanner::set_distances_for_loose_col (Grob *me, Grob *c, The note spacing should be taken from the musical columns. */ - Real base = note_spacing (me, lc, rc, options); + Spring base = note_spacing (me, lc, rc, options); Spring spring = Note_spacing::get_spacing (sp, rc, base, options->increment_); dists[d] = max (dists[d], spring.min_distance ()); } else if (Staff_spacing::has_interface (sp)) { - Spring spring = Staff_spacing::get_spacing (sp, rc); + Spring spring = Staff_spacing::get_spacing (sp, rc, 0.0); dists[d] = max (dists[d], spring.min_distance ()); } @@ -171,7 +170,6 @@ Spacing_spanner::set_distances_for_loose_col (Grob *me, Grob *c, programming_error ("Subversive spacing wish"); } } - while (flip (&d) != LEFT); Rod r; r.distance_ = dists[LEFT] + dists[RIGHT]; @@ -191,7 +189,6 @@ Spacing_spanner::prune_loose_columns (Grob *me, Spacing_options *options) { vector newcols; - for (vsize i = 0; i < cols->size (); i++) { Grob *c = cols->at (i); @@ -231,7 +228,7 @@ Spacing_spanner::prune_loose_columns (Grob *me, */ if (!right_neighbor || !left_neighbor) { - c->programming_error ("Cannot determine neighbors for floating column. "); + c->programming_error ("Cannot determine neighbors for floating column."); c->set_object ("between-cols", scm_cons (cols->at (i - 1)->self_scm (), cols->at (i + 1)->self_scm ())); } @@ -243,14 +240,14 @@ Spacing_spanner::prune_loose_columns (Grob *me, /* Set distance constraints for loose columns */ - Drul_array next_door (dynamic_cast (cols->at (i - 1)), - dynamic_cast (cols->at (i + 1))); + Drul_array next_door (dynamic_cast (left_neighbor), + dynamic_cast (right_neighbor)); set_distances_for_loose_col (me, c, next_door, options); } } - if (!loose) + else newcols.push_back (c); }