bool ragged_last () const;
bool is_last () const;
bool ends_score () const;
+ int systems_per_page () const;
+ int max_systems_per_page () const;
Real page_height (int page_number, bool last) const;
Real page_top_space () const;
vsize system_count () const;
vsize current_configuration_count () const;
Line_division current_configuration (vsize configuration_index) const;
Page_spacing_result space_systems_on_n_pages (vsize configuration_index,
- vsize n, vsize first_page_num,
- int systems_per_page=0);
+ vsize n, vsize first_page_num);
Page_spacing_result space_systems_on_n_or_one_more_pages (vsize configuration_index, vsize n,
- vsize first_page_num,
- int systems_per_page=0);
+ vsize first_page_num);
Page_spacing_result space_systems_on_best_pages (vsize configuration_index,
vsize first_page_num);
Page_spacing_result space_systems_with_fixed_number_per_page (vsize configuration_index,
- vsize first_page_num,
- int systems_per_page);
+ vsize first_page_num);
Page_spacing_result pack_systems_on_least_pages (vsize configuration_index,
vsize first_page_num);
vsize min_page_count (vsize configuration_index, vsize first_page_num);
vector<Constrained_breaking> line_breaking_;
bool ragged_;
bool ragged_last_;
+ int systems_per_page_;
+ int max_systems_per_page_;
Real page_top_space_;
vsize system_count_;
vsize max_sys_count = max_system_count (0, end);
vsize first_page_num = robust_scm2int (book_->paper_->c_variable ("first-page-number"), 1);
SCM forced_page_count = book_->paper_->c_variable ("page-count");
- int systems_per_page = robust_scm2int (book_->paper_->c_variable ("systems-per-page"), 0);
set_to_ideal_line_configuration (0, end);
/* find out the ideal number of pages */
message (_ ("Finding the ideal number of pages..."));
- if (systems_per_page > 0)
- best = space_systems_with_fixed_number_per_page (0, first_page_num, systems_per_page);
+ if (systems_per_page () > 0)
+ best = space_systems_with_fixed_number_per_page (0, first_page_num);
else
best = space_systems_on_best_pages (0, first_page_num);
ideal line spacing doesn't fit on PAGE_COUNT pages */
/* TODO: the interaction between systems_per_page and page_count needs to
be considered. */
- best = space_systems_on_n_pages (0, page_count, first_page_num, systems_per_page);
+ best = space_systems_on_n_pages (0, page_count, first_page_num);
min_sys_count = page_count;
}
Page_spacing_result cur;
if (min_p_count == page_count || scm_is_integer (forced_page_count))
- cur = space_systems_on_n_pages (i, page_count, first_page_num, systems_per_page);
+ cur = space_systems_on_n_pages (i, page_count, first_page_num);
else
- cur = space_systems_on_n_or_one_more_pages (i, page_count-1, first_page_num, systems_per_page);
+ cur = space_systems_on_n_or_one_more_pages (i, page_count-1, first_page_num);
if (cur.demerits_ < best_for_this_sys_count.demerits_ || isinf (best_for_this_sys_count.demerits_))
{
if (min_p_count > page_count)
continue;
else
- cur = space_systems_on_n_pages (i, page_count, first_page_num, systems_per_page);
+ cur = space_systems_on_n_pages (i, page_count, first_page_num);
if (cur.demerits_ < best.demerits_ || isinf (best.demerits_))
{
ragged_ = to_boolean (pb->paper_->c_variable ("ragged-bottom"));
ragged_last_ = to_boolean (pb->paper_->c_variable ("ragged-last-bottom"));
page_top_space_ = robust_scm2double (pb->paper_->c_variable ("page-top-space"), 0);
+ systems_per_page_ = robust_scm2int (pb->paper_->c_variable ("systems-per-page"), 0);
+ max_systems_per_page_ = robust_scm2int (pb->paper_->c_variable ("max-systems-per-page"), 0);
+
create_system_list ();
find_chunks_and_breaks (is_break);
}
return ragged_last_;
}
+int
+Page_breaking::systems_per_page () const
+{
+ return systems_per_page_;
+}
+
+int
+Page_breaking::max_systems_per_page () const
+{
+ return max_systems_per_page_;
+}
+
Real
Page_breaking::page_top_space () const
{
return ret;
}
-// If systems_per_page is positive, we don't really try to space on N pages;
+// If systems_per_page_ is positive, we don't really try to space on N pages;
// we just put the requested number of systems on each page and penalize
// if the result doesn't have N pages.
Page_spacing_result
-Page_breaking::space_systems_on_n_pages (vsize configuration, vsize n, vsize first_page_num,
- int systems_per_page)
+Page_breaking::space_systems_on_n_pages (vsize configuration, vsize n, vsize first_page_num)
{
Page_spacing_result ret;
- if (systems_per_page > 0)
+ if (systems_per_page_ > 0)
{
- Page_spacing_result ret = space_systems_with_fixed_number_per_page (configuration, first_page_num,
- systems_per_page);
+ Page_spacing_result ret = space_systems_with_fixed_number_per_page (configuration, first_page_num);
ret.demerits_ += (ret.force_.size () == n) ? 0 : BAD_SPACING_PENALTY;
return ret;
}
return robust_scm2double (book_->paper_->lookup_variable (penalty_sym), 0.0);
}
-// If systems_per_page is positive, we don't really try to space on N
+// If systems_per_page_ is positive, we don't really try to space on N
// or N+1 pages; see the comment to space_systems_on_n_pages.
Page_spacing_result
-Page_breaking::space_systems_on_n_or_one_more_pages (vsize configuration, vsize n, vsize first_page_num,
- int systems_per_page)
+Page_breaking::space_systems_on_n_or_one_more_pages (vsize configuration, vsize n, vsize first_page_num)
{
Page_spacing_result n_res;
Page_spacing_result m_res;
- if (systems_per_page > 0)
+ if (systems_per_page_ > 0)
{
- Page_spacing_result ret = space_systems_with_fixed_number_per_page (configuration, first_page_num,
- systems_per_page);
+ Page_spacing_result ret = space_systems_with_fixed_number_per_page (configuration, first_page_num);
ret.demerits_ += (ret.force_.size () == n || ret.force_.size () == (n-1)) ? 0 : BAD_SPACING_PENALTY;
return ret;
}
Page_spacing_result
Page_breaking::space_systems_with_fixed_number_per_page (vsize configuration,
- vsize first_page_num,
- int systems_per_page)
+ vsize first_page_num)
{
Page_spacing_result res;
Page_spacing space (page_height (first_page_num, false), page_top_space_);
space.resize (page_height (first_page_num + page, false));
int system_count_on_this_page = 0;
- while (system_count_on_this_page < systems_per_page
+ while (system_count_on_this_page < systems_per_page_
&& line < cached_line_details_.size ())
{
Line_details const &cur_line = cached_line_details_[line];