]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/align-interface.cc
CG: Use latest convert-ly for LSR updates (fix 2346)
[lilypond.git] / lily / align-interface.cc
index 44c30e6013027c78a74ef90c3b7f1a66960a91ba..0e350c142628d8db4eda48664b7a6e554f5443d8 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2000--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 2000--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -167,7 +167,7 @@ Align_interface::get_minimum_translations_without_min_dist (Grob *me,
 }
 
 // If include_fixed_spacing is false, the only constraints that will be measured
-// here are those that result from collisions (+ padding) and minimum-distance
+// here are those that result from collisions (+ padding) and the spacing spec
 // between adjacent staves.
 // If include_fixed_spacing is true, constraints from line-break-system-details,
 // basic-distance+stretchable=0, and staff-staff-spacing of spaceable staves
@@ -221,9 +221,13 @@ Align_interface::internal_get_minimum_translations (Grob *me,
 
           dy = down_skyline.distance (skylines[j][-stacking_dir]) + padding;
 
-          Real min_distance = 0;
-          if (Page_layout_problem::read_spacing_spec (spec, &min_distance, ly_symbol2scm ("minimum-distance")))
-            dy = max (dy, min_distance);
+          Real spec_distance = 0;
+          if (Page_layout_problem::read_spacing_spec (spec, &spec_distance, ly_symbol2scm ("minimum-distance")))
+            dy = max (dy, spec_distance);
+          // Consider the likely final spacing when estimating distance between staves of the full score
+          if (INT_MAX == end && 0 == start
+              && Page_layout_problem::read_spacing_spec (spec, &spec_distance, ly_symbol2scm ("basic-distance")))
+            dy = max (dy, spec_distance);
 
           if (include_fixed_spacing && Page_layout_problem::is_spaceable (elems[j]) && last_spaceable_element)
             {
@@ -290,7 +294,7 @@ Align_interface::align_elements_to_ideal_distances (Grob *me)
   System *sys = me->get_system ();
   if (sys)
     {
-      Page_layout_problem layout (NULL, SCM_EOL, scm_list_1 (sys->self_scm ()), 0);
+      Page_layout_problem layout (NULL, SCM_EOL, scm_list_1 (sys->self_scm ()));
       layout.solution (true);
     }
   else
@@ -308,11 +312,24 @@ Align_interface::align_elements_to_minimum_distances (Grob *me, Axis a)
       all_grobs[j]->translate_axis (translates[j], a);
 }
 
+MAKE_SCHEME_CALLBACK (Align_interface, full_score_pure_minimum_translations, 1);
+SCM
+Align_interface::full_score_pure_minimum_translations (SCM smob)
+{
+  Grob *me = unsmob_grob (smob);
+  extract_grob_set (me, "elements", all_grobs);
+
+  vector<Real> pure_minimum_translations = Align_interface::get_pure_minimum_translations (me, all_grobs, Y_AXIS, 0, INT_MAX);
+  return ly_floatvector2scm (pure_minimum_translations);
+}
+
 Real
 Align_interface::get_pure_child_y_translation (Grob *me, Grob *ch, int start, int end)
 {
   extract_grob_set (me, "elements", all_grobs);
-  vector<Real> translates = get_pure_minimum_translations (me, all_grobs, Y_AXIS, start, end);
+  vector<Real> translates = start == 0 && end == INT_MAX
+                            ? ly_scm2floatvector (me->get_object ("full-score-pure-minimum-translations"))
+                            : get_pure_minimum_translations (me, all_grobs, Y_AXIS, start, end);
 
   if (translates.size ())
     {
@@ -369,6 +386,7 @@ ADD_INTERFACE (Align_interface,
                /* properties */
                "align-dir "
                "axes "
+               "full-score-pure-minimum-translations "
                "elements "
                "padding "
                "positioning-done "