]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/optimal-page-breaking.cc
Put systems_per_page_ in an object property instead of passing it around.
[lilypond.git] / lily / optimal-page-breaking.cc
index c5a61335633c6790f8bbdba7d83238fb5c521c01..47a2edafbe2d1cba34517a8ea193cf6ebdb71b3a 100644 (file)
@@ -5,7 +5,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2006--2008 Joe Neeman <joeneeman@gmail.com>
+  (c) 2006--2009 Joe Neeman <joeneeman@gmail.com>
 */
 
 #include "international.hh"
@@ -54,9 +54,12 @@ Optimal_page_breaking::solve ()
       /* find out the ideal number of pages */
       message (_ ("Finding the ideal number of pages..."));
   
-      best = space_systems_on_best_pages (0, first_page_num);
-      page_count = best.systems_per_page_.size ();
+      if (systems_per_page () > 0)
+       best = space_systems_with_fixed_number_per_page (0, first_page_num);
+      else
+       best = space_systems_on_best_pages (0, first_page_num);
 
+      page_count = best.systems_per_page_.size ();
       ideal_sys_count = best.system_count ();
       min_sys_count = ideal_sys_count - best.systems_per_page_.back ();
   
@@ -67,8 +70,10 @@ Optimal_page_breaking::solve ()
     }
   else
     {
-      /* todo: the following line will spit out programming errors if the
+      /* TODO: the following line will spit out programming errors if the
         ideal line spacing doesn't fit on PAGE_COUNT pages */
+      /* TODO: the interaction between systems_per_page and page_count needs to
+        be considered. */
       best = space_systems_on_n_pages (0, page_count, first_page_num);
       min_sys_count = page_count;
     }