From 7ce72b4325ac54d7f26770430d9bd632cb9cdb29 Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Mon, 25 Feb 2008 21:36:33 +0200 Subject: [PATCH] Fix 550. Update a regression test that was broken by spacing changes. Fix a corner case that would incorrectly choose a 3-page layout (with nicer spacing) over a 2-page layout (with no page turns) with the page-turn breaker and auto-first-page-number = ##t. --- .../page-turn-page-breaking-auto-first-page.ly | 2 +- lily/include/page-turn-page-breaking.hh | 2 +- lily/page-turn-page-breaking.cc | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/input/regression/page-turn-page-breaking-auto-first-page.ly b/input/regression/page-turn-page-breaking-auto-first-page.ly index 07eb9e497d..04c849506e 100644 --- a/input/regression/page-turn-page-breaking-auto-first-page.ly +++ b/input/regression/page-turn-page-breaking-auto-first-page.ly @@ -17,6 +17,6 @@ number to 2 in order to avoid a bad page turn." \book { \score { - {\repeat unfold 30 {a b c d}} + {\repeat unfold 40 {a b c d}} } } \ No newline at end of file diff --git a/lily/include/page-turn-page-breaking.hh b/lily/include/page-turn-page-breaking.hh index bdaec43706..b91bdb6bed 100644 --- a/lily/include/page-turn-page-breaking.hh +++ b/lily/include/page-turn-page-breaking.hh @@ -52,7 +52,7 @@ protected: vector state_; - vsize final_page_num (Break_node const &b); + vsize total_page_count (Break_node const &b); Break_node put_systems_on_pages (vsize start, vsize end, vsize configuration, diff --git a/lily/page-turn-page-breaking.cc b/lily/page-turn-page-breaking.cc index b818dc09a1..75e1a3bbf2 100644 --- a/lily/page-turn-page-breaking.cc +++ b/lily/page-turn-page-breaking.cc @@ -93,13 +93,13 @@ Page_turn_page_breaking::put_systems_on_pages (vsize start, return ret; } -/* "final page" meaning the number of the final right-hand page, - which always has an odd page number */ +/* The number of pages taken up by a Break_node, including + the blank page if there is one */ vsize -Page_turn_page_breaking::final_page_num (Break_node const &b) +Page_turn_page_breaking::total_page_count (Break_node const &b) { vsize end = b.first_page_number_ + b.page_count_; - return end - 1 + (end % 2); + return end - 1 + (end % 2) - b.first_page_number_; } extern bool debug_page_breaking_scoring; @@ -160,7 +160,7 @@ Page_turn_page_breaking::calc_subproblem (vsize ending_breakpoint) if (isinf (cur.demerits_) || (cur.page_count_ + (p_num % 2) > 2 && (!isinf (this_start_best.demerits_)) - && final_page_num (cur) > final_page_num (this_start_best))) + && total_page_count (cur) > total_page_count (this_start_best))) { ok_page = false; break; -- 2.39.2