property-init.ly: Organize, cleanup.
[lilypond/mpolesky.git] / lily / minimal-page-breaking.cc
blob4588dddc3a8a34f6a301c095fc6b4d14677b31c8
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.
6 source file of the GNU LilyPond music typesetter
8 (c) 2007--2009 Nicolas Sceaux <nicolas.sceaux@free.fr>
9 */
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"
17 static bool
18 is_break (Grob *)
20 return false;
23 Minimal_page_breaking::Minimal_page_breaking (Paper_book *pb)
24 : Page_breaking (pb, is_break)
28 Minimal_page_breaking::~Minimal_page_breaking ()
32 SCM
33 Minimal_page_breaking::solve ()
35 vsize end = last_break_position ();
37 message (_ ("Calculating line breaks..."));
38 set_to_ideal_line_configuration (0, end);
39 break_into_pieces (0, end, current_configuration (0));
41 message (_ ("Calculating page breaks..."));
42 vsize first_page_num = robust_scm2int (book_->paper_->c_variable ("first-page-number"), 1);
43 Page_spacing_result res = pack_systems_on_least_pages (0, first_page_num);
44 SCM lines = systems ();
45 return make_pages (res.systems_per_page_, lines);