]> git.donarmstrong.com Git - lilypond.git/blob - lily/minimal-page-breaking.cc
Run `make grand-replace'.
[lilypond.git] / lily / minimal-page-breaking.cc
1 /*
2   minimal-page-breaking.cc -- implement a page-breaker that stacks as
3   many systems on a page before moving to the next one. Specialized
4   for books with many pages, or a lot of text.
5
6   source file of the GNU LilyPond music typesetter
7
8   (c) 2007--2008 Nicolas Sceaux <nicolas.sceaux@free.fr>
9 */
10
11 #include "international.hh"
12 #include "minimal-page-breaking.hh"
13 #include "output-def.hh"
14 #include "page-spacing.hh"
15 #include "paper-book.hh"
16
17 static bool
18 is_break (Grob *g)
19 {
20   (void) g; /* shutup warning */
21   return false;
22 }
23
24 Minimal_page_breaking::Minimal_page_breaking (Paper_book *pb)
25   : Page_breaking (pb, is_break)
26 {
27 }
28
29 Minimal_page_breaking::~Minimal_page_breaking ()
30 {
31 }
32
33 SCM
34 Minimal_page_breaking::solve ()
35 {
36   vsize end = last_break_position ();
37
38   message ("Computing line breaks...");
39   set_to_ideal_line_configuration (0, end);
40   break_into_pieces (0, end, current_configuration (0));
41
42   message (_ ("Computing page breaks..."));
43   vsize first_page_num = robust_scm2int (book_->paper_->c_variable ("first-page-number"), 1);
44   Page_spacing_result res = pack_systems_on_least_pages (0, first_page_num);
45   SCM lines = systems ();
46   return make_pages (res.systems_per_page_, lines);
47 }