2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2009--2011 Joe Neeman <joeneeman@gmail.com>
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.
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.
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/>.
20 #ifndef PAGE_LAYOUT_HH
21 #define PAGE_LAYOUT_HH
23 #include "simple-spacer.hh"
26 class Page_layout_problem
29 Page_layout_problem (Paper_book *, SCM page, SCM systems, int footnote_count);
31 SCM solution (bool ragged);
32 void set_header_height (Real);
33 void set_footer_height (Real);
34 static bool read_spacing_spec (SCM spec, Real *dest, SCM sym);
35 static bool is_spaceable (Grob *g);
36 static SCM get_details (Grob *g);
37 static vsize get_footnote_count (SCM lines);
38 static SCM get_footnotes_from_lines (SCM lines, int counter, Paper_book *pb);
39 static Stencil *get_footnote_separator_stencil (Output_def *paper);
40 static SCM get_spacing_spec (Grob *before, Grob *after, bool pure, int start, int end);
41 static Real get_fixed_spacing (Grob *before, Grob *after, int spaceable_index, bool pure, int start, int end);
42 static void add_footnotes_to_footer (SCM footnotes, Stencil *foot, Paper_book *pb);
45 void append_system (System *, Spring const &, Real indent, Real padding);
46 void append_prob (Prob *, Spring const &, Real padding);
48 void solve_rod_spring_problem (bool ragged);
49 SCM find_system_offsets ();
50 void distribute_loose_lines (vector<Grob *> const &, vector<Real> const &, Real, Real);
52 static void build_system_skyline (vector<Grob *> const &, vector<Real> const &, Skyline *up, Skyline *down);
53 static vector<Grob *> filter_dead_elements (vector<Grob *> const &);
55 // This is a union (in spirit).
56 // Either staves must be empty or prob must be null.
57 typedef struct Element
60 vector<Grob *> staves;
61 vector<Real> min_offsets;
62 // Store the appropriate '*-*-spacing 'padding,
63 // for spacing any adjacent loose line
66 Element (vector<Grob *> const &a, vector<Real> const &o, Real p)
74 Element (Prob *p, Real pad)
81 static Interval first_staff_extent (Element const &);
82 static Interval last_staff_extent (Element const &);
83 static Interval prob_extent (Prob *);
84 static SCM get_details (Element const &);
85 static SCM details_get_property (SCM details, const char *);
86 static void alter_spring_from_spacing_spec (SCM spec, Spring *spring);
87 static void mark_as_spaceable (Grob *);
89 vector<Spring> springs_;
90 vector<Element> elements_;
91 vector<Real> solution_;
92 Skyline bottom_skyline_;
100 #endif /* PAGE_LAYOUT_HH */