]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/page-turn-page-breaking.cc
Merge branch 'master' into lilypond/translation
[lilypond.git] / lily / page-turn-page-breaking.cc
index c9029cf7b53e649fde6ff4455b468976b9c9117c..e57c0cbf2f2c895701d44a8e95d871723aa28901 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2006--2009 Joe Neeman <joeneeman@gmail.com>
+  Copyright (C) 2006--2010 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
@@ -29,8 +29,9 @@
 #include "system.hh"
 #include "warn.hh"
 
+template<typename T>
 static bool
-is_break (Grob *g)
+is_break (T *g)
 {
   bool turnable = scm_is_symbol (g->get_property ("page-turn-permission"));
 
@@ -46,7 +47,7 @@ is_break (Grob *g)
 }
 
 Page_turn_page_breaking::Page_turn_page_breaking (Paper_book *pb)
-  : Page_breaking (pb, is_break)
+  : Page_breaking (pb, is_break<Grob>, is_break<Prob>)
 {
 }
 
@@ -86,14 +87,14 @@ Page_turn_page_breaking::put_systems_on_pages (vsize start,
   if (start == 0 && auto_first)
     {
       if (min_p_count % 2)
-       result = space_systems_on_n_or_one_more_pages (configuration, min_p_count, page_number);
+       result = space_systems_on_n_or_one_more_pages (configuration, min_p_count, page_number, 0);
       else
        result = space_systems_on_n_pages (configuration, min_p_count, page_number);
     }
   else if (page_number % 2 == min_p_count % 2)
     result = space_systems_on_n_pages (configuration, min_p_count, page_number);
   else
-    result = space_systems_on_n_or_one_more_pages (configuration, min_p_count, page_number);
+    result = space_systems_on_n_or_one_more_pages (configuration, min_p_count, page_number, blank_page_penalty ());
 
   Break_node ret;
   ret.prev_ = start - 1;
@@ -213,8 +214,8 @@ Page_turn_page_breaking::calc_subproblem (vsize ending_breakpoint)
       if (start == 0 && end == 1
          && this_start_best.first_page_number_ == 1
          && this_start_best.page_count_ > 1)
-       warning (_ ("cannot fit the first page turn onto a single page.  "
-                   "Consider setting first-page-number to an even number."));
+       warning (_ ("cannot fit the first page turn onto a single page."
+                   "  Consider setting first-page-number to an even number."));
 
       if (this_start_best.demerits_ < best.demerits_)
        best = this_start_best;
@@ -268,6 +269,9 @@ Page_turn_page_breaking::make_lines (vector<Break_node> *psoln)
 SCM
 Page_turn_page_breaking::make_pages (vector<Break_node> const &soln, SCM systems)
 {
+  if (scm_is_null (systems))
+    return SCM_EOL;
+
   vector<vsize> lines_per_page;
   for (vsize i = 0; i < soln.size (); i++)
     {