X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fspacing-determine-loose-columns.cc;h=4be23042ad44bbddc007c8879714cd0c201bd35d;hb=5d84bfad4626892bcffd05adcced53c8a2329047;hp=4fe7885259a336b259e18061252a7cc83b9d7007;hpb=d61cf3bbdb1c6670a127ba3baddf2f04d3e34fd3;p=lilypond.git diff --git a/lily/spacing-determine-loose-columns.cc b/lily/spacing-determine-loose-columns.cc index 4fe7885259..4be23042ad 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--2012 Han-Wen Nienhuys + Copyright (C) 2005--2015 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 @@ -80,8 +80,8 @@ is_loose_column (Grob *l, Grob *col, Grob *r, Spacing_options const *options) */ - Item *r_neighbor = unsmob_item (col->get_object ("right-neighbor")); - Item *l_neighbor = unsmob_item (col->get_object ("left-neighbor")); + Item *r_neighbor = unsmob (col->get_object ("right-neighbor")); + Item *l_neighbor = unsmob (col->get_object ("left-neighbor")); if (!l_neighbor || !r_neighbor) return false; @@ -108,14 +108,15 @@ is_loose_column (Grob *l, Grob *col, Grob *r, Spacing_options const *options) for (vsize i = elts.size (); i--;) { Grob *g = elts[i]; - if (g && Break_alignment_interface::has_interface (g)) + if (has_interface (g)) { extract_grob_set (g, "elements", gelts); for (vsize j = gelts.size (); j--;) { Grob *h = gelts[j]; - if (h && h->get_property ("break-align-symbol") == ly_symbol2scm ("staff-bar")) + if (h && scm_is_eq (h->get_property ("break-align-symbol"), + ly_symbol2scm ("staff-bar"))) { extract_grob_set (h, "elements", helts); for (vsize k = helts.size (); k--;) @@ -134,10 +135,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]); @@ -150,18 +150,18 @@ Spacing_spanner::set_distances_for_loose_col (Grob *me, Grob *c, || Spacing_interface::right_column (sp) != rc) continue; - if (Note_spacing::has_interface (sp)) + if (has_interface (sp)) { /* 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)) + else if (has_interface (sp)) { Spring spring = Staff_spacing::get_spacing (sp, rc, 0.0); @@ -171,7 +171,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]; @@ -221,8 +220,8 @@ Spacing_spanner::prune_loose_columns (Grob *me, if (loose) { - Grob *right_neighbor = unsmob_grob (c->get_object ("right-neighbor")); - Grob *left_neighbor = unsmob_grob (c->get_object ("left-neighbor")); + Grob *right_neighbor = unsmob (c->get_object ("right-neighbor")); + Grob *left_neighbor = unsmob (c->get_object ("left-neighbor")); /* Either object can be non existent, if the score ends @@ -230,7 +229,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 ())); } @@ -284,7 +283,7 @@ Spacing_spanner::set_explicit_neighbor_columns (vector const &cols) min_right_rank = right_rank; } - Grob *old_left_neighbor = unsmob_grob (right_col->get_object ("left-neighbor")); + Grob *old_left_neighbor = unsmob (right_col->get_object ("left-neighbor")); if (!old_left_neighbor || left_rank > Paper_column::get_rank (old_left_neighbor)) right_col->set_object ("left-neighbor", left_col->self_scm ()); } @@ -306,9 +305,9 @@ Spacing_spanner::set_implicit_neighbor_columns (vector const &cols) if (!Paper_column::is_breakable (it) && !Paper_column::is_musical (it)) continue; - if (i && !unsmob_grob (cols[i]->get_object ("left-neighbor"))) + if (i && !unsmob (cols[i]->get_object ("left-neighbor"))) cols[i]->set_object ("left-neighbor", cols[i - 1]->self_scm ()); - if (i + 1 < cols.size () && !unsmob_grob (cols[i]->get_object ("right-neighbor"))) + if (i + 1 < cols.size () && !unsmob (cols[i]->get_object ("right-neighbor"))) cols[i]->set_object ("right-neighbor", cols[i + 1]->self_scm ()); } }