/*
This file is part of LilyPond, the GNU music typesetter.
- Copyright (C) 2006--2010 Joe Neeman <joeneeman@gmail.com>
+ Copyright (C) 2006--2014 Joe Neeman <joeneeman@gmail.com>
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
const Real BAD_SPACING_PENALTY = 1e6;
const Real TERRIBLE_SPACING_PENALTY = 1e8;
-
/* for page_count > 2, we use a dynamic algorithm similar to
constrained-breaking -- we have a class that stores the intermediate
calculations so they can be reused for querying different page counts.
class Page_spacer
{
public:
- Page_spacer (vector<Line_details> const &lines, vsize first_page_num, Page_breaking const*);
+ Page_spacer (vector<Line_details> const &lines, vsize first_page_num, Page_breaking const *);
Page_spacing_result solve (vsize page_count);
+ Page_spacing_result solve ();
private:
struct Page_spacing_node
penalty_ = infinity_f;
prev_ = VPOS;
system_count_status_ = SYSTEM_COUNT_OK;
+ page_ = 0;
}
Real demerits_;
Real force_;
Real penalty_;
vsize prev_;
+ vsize page_;
int system_count_status_;
};
Page_breaking const *breaker_;
vsize first_page_num_;
vector<Line_details> lines_;
+
+ // If a page-count is requested, we use state_, which
+ // is indexed by page*system, for our dynamic programming
+ // intermediate storage. Otherwise, we use simple_state_,
+ // which is indexed only by system.
Matrix<Page_spacing_node> state_;
+ vector<Page_spacing_node> simple_state_;
vsize max_page_count_;
bool ragged_;
Real rod_height_;
Real spring_len_;
Real inverse_spring_k_;
+ bool has_footnotes_;
Line_details last_line_;
Line_details first_line_;
{
page_height_ = page_height;
breaker_ = breaker;
+ has_footnotes_ = false;
clear ();
}
void calc_force ();
void resize (Real new_height);
+ Real account_for_footnotes (Line_details const &line);
void append_system (const Line_details &line);
void prepend_system (const Line_details &line);
void clear ();