]> git.donarmstrong.com Git - lilypond.git/blob - lily/minimal-page-breaking.cc
Merge branch 'lilypond/translation' of ssh://jomand@git.sv.gnu.org/srv/git/lilypond...
[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 *)
19 {
20   return false;
21 }
22
23 Minimal_page_breaking::Minimal_page_breaking (Paper_book *pb)
24   : Page_breaking (pb, is_break)
25 {
26 }
27
28 Minimal_page_breaking::~Minimal_page_breaking ()
29 {
30 }
31
32 SCM
33 Minimal_page_breaking::solve ()
34 {
35   vsize end = last_break_position ();
36
37   message (_ ("Calculating line breaks..."));
38   set_to_ideal_line_configuration (0, end);
39   break_into_pieces (0, end, current_configuration (0));
40
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);
46 }