]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/page-layout-problem.cc
Guile-1.9 compatibility fixes.
[lilypond.git] / lily / page-layout-problem.cc
index aec0b80ac8380ea9a957731410152eb4edba81b3..54624304d540f60b85367e2bdf54be296b415ef3 100644 (file)
@@ -1,7 +1,7 @@
 /*
   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
@@ -201,7 +201,13 @@ Page_layout_problem::append_system (System *sys, Spring const& spring, Real inde
   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);
@@ -312,13 +318,18 @@ Page_layout_problem::solve_rod_spring_problem (bool ragged)
     {
       Real overflow = spacer.configuration_length (spacer.force ())
                      - page_height_;
-      warning (_f ("couldn't fit music on page: overflow is %f",
-                   overflow));
-      warning (_ ("compressing music to fit"));
-      vsize space_count = solution_.size ();
-      Real spacing_increment = overflow / (space_count - 2);
-      for (vsize i = 2; i < space_count; i++)
-       solution_[i] -= (i-1) * spacing_increment;
+      if (ragged && overflow < 1e-6)
+       warning (_ ("couldn't fit music on page: ragged-spacing was requested, but page was compressed"));
+      else
+       {
+         warning (_f ("couldn't fit music on page: overflow is %f",
+                      overflow));
+         warning (_ ("compressing music to fit"));
+         vsize space_count = solution_.size ();
+         Real spacing_increment = overflow / (space_count - 2);
+         for (vsize i = 2; i < space_count; i++)
+           solution_[i] -= (i-1) * spacing_increment;
+       }
     }
 }
 
@@ -652,7 +663,7 @@ Page_layout_problem::get_fixed_spacing (Grob *before, Grob *after, int spaceable
   Real stretchability = 0;
   if (Page_layout_problem::read_spacing_spec (spec, &stretchability, ly_symbol2scm ("stretchability"))
       && stretchability == 0)
-    Page_layout_problem::read_spacing_spec (spec, &ret, ly_symbol2scm ("space"));
+    Page_layout_problem::read_spacing_spec (spec, &ret, ly_symbol2scm ("basic-distance"));
 
   // If we're pure, then paper-columns have not had their systems set,
   // and so elts[i]->get_system () is unreliable.
@@ -752,7 +763,7 @@ Page_layout_problem::alter_spring_from_spacing_spec (SCM spec, Spring* spring)
   Real space;
   Real stretch;
   Real min_dist;
-  if (read_spacing_spec (spec, &space, ly_symbol2scm ("space")))
+  if (read_spacing_spec (spec, &space, ly_symbol2scm ("basic-distance")))
     spring->set_distance (space);
   if (read_spacing_spec (spec, &min_dist, ly_symbol2scm ("minimum-distance")))
     spring->set_min_distance (min_dist);