]> git.donarmstrong.com Git - lilypond.git/blob - lily/minimal-page-breaking.cc
Web-ja: update introduction
[lilypond.git] / lily / minimal-page-breaking.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2007--2015 Nicolas Sceaux <nicolas.sceaux@free.fr>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "international.hh"
21 #include "minimal-page-breaking.hh"
22 #include "output-def.hh"
23 #include "page-spacing.hh"
24 #include "paper-book.hh"
25
26 Minimal_page_breaking::Minimal_page_breaking (Paper_book *pb)
27   : Page_breaking (pb, 0, 0)
28 {
29 }
30
31 Minimal_page_breaking::~Minimal_page_breaking ()
32 {
33 }
34
35 SCM
36 Minimal_page_breaking::solve ()
37 {
38   vsize end = last_break_position ();
39
40   message (_ ("Calculating line breaks..."));
41   set_to_ideal_line_configuration (0, end);
42   break_into_pieces (0, end, current_configuration (0));
43
44   message (_ ("Calculating page breaks..."));
45   vsize first_page_num = robust_scm2int (book_->paper_->c_variable ("first-page-number"), 1);
46   Page_spacing_result res = pack_systems_on_least_pages (0, first_page_num);
47   SCM lines = systems ();
48   return make_pages (res.systems_per_page_, lines);
49 }