/*
This file is part of LilyPond, the GNU music typesetter.
- Copyright (C) 2009--2010 Joe Neeman <joeneeman@gmail.com>
+ Copyright (C) 2009--2011 Joe Neeman <joeneeman@gmail.com>
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
up_skyline.shift (indent);
down_skyline.shift (indent);
- Real minimum_distance = up_skyline.distance (bottom_skyline_) + padding;
+ /*
+ We need to call distance with skyline-horizontal-padding because
+ the system skyline-horizontal-padding is not added during the creation
+ of an individual staff. So we add the padding for the distance check
+ at the time of adding in the system.
+ */
+ Real minimum_distance = up_skyline.distance (bottom_skyline_, robust_scm2double (sys->get_property ("skyline-horizontal-padding"), 0)) + padding;
Spring spring_copy = spring;
spring_copy.ensure_min_distance (minimum_distance);
loose_line_min_distances.clear ();
}
last_spaceable_line = staff;
- // Negative is down but the translation is relative to the whole page.
- last_spaceable_line_translation = -system_position + translation;
+ last_spaceable_line_translation = -solution_[spring_idx - 1];
staff->translate_axis (translation, Y_AXIS);
found_spaceable_staff = true;
loose_lines.push_back (last_spaceable_line);
if (staff_idx)
+ // NOTE: the way we do distances between loose lines (and other lines too, actually)
+ // is not the most accurate way possible: we only insert rods between adjacent
+ // lines. To be more accurate, we could insert rods between non-adjacent lines
+ // using a scheme similar to the one in set_column_rods.
loose_line_min_distances.push_back (min_offsets[staff_idx-1] - min_offsets[staff_idx]);
else
{
Real
Page_layout_problem::get_fixed_spacing (Grob *before, Grob *after, int spaceable_index, bool pure, int start, int end)
{
+ Spanner *after_sp = dynamic_cast<Spanner*> (after);
+ SCM cache_symbol = (is_spaceable (before) && is_spaceable (after))
+ ? ly_symbol2scm ("spaceable-fixed-spacing")
+ : ly_symbol2scm ("loose-fixed-spacing");
+ if (pure)
+ {
+ // The result of this function doesn't depend on "end," so we can reduce the
+ // size of the cache by ignoring it.
+ SCM cached = after_sp->get_cached_pure_property (cache_symbol, start, 0);
+ if (scm_is_number (cached))
+ return robust_scm2double (cached, 0.0);
+ }
+
SCM spec = Page_layout_problem::get_spacing_spec (before, after, pure, start, end);
Real ret = -infinity_f;
Real stretchability = 0;
ret = max (ret, scm_to_double (forced));
}
}
+
+ // Cache the result. As above, we ignore "end."
+ if (pure)
+ after_sp->cache_pure_property (cache_symbol, start, 0, scm_from_double (ret));
+
return ret;
}