X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Fpage-spacing.hh;h=fe7056c597c1fa1bcdf30a19c7b979756ef3ba16;hb=45dbb4db1979bd4bd531e0d66690fb8d3144f473;hp=b91540a03f7937622ea5eadafbd443f403939744;hpb=837a30f66f73ed048a82bef3a3ff1551d06a96da;p=lilypond.git diff --git a/lily/include/page-spacing.hh b/lily/include/page-spacing.hh index b91540a03f..fe7056c597 100644 --- a/lily/include/page-spacing.hh +++ b/lily/include/page-spacing.hh @@ -4,37 +4,25 @@ source file of the GNU LilyPond music typesetter - (c) 2006 Joe Neeman + (c) 2006--2007 Joe Neeman */ #ifndef PAGE_SPACING_HH #define PAGE_SPACING_HH #include "constrained-breaking.hh" +#include "page-spacing-result.hh" -struct Spacing_result { - vector systems_per_page_; - vector force_; - Real penalty_; - Real demerits_; - - Spacing_result () - { - penalty_ = 0; - demerits_ = infinity_f; - } -}; /* 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 const &lines, Real page_height, bool ragged, bool ragged_last); - Spacing_result solve (vsize page_count); + Page_spacer (vector const &lines, vsize first_page_num, Page_breaking const*); + Page_spacing_result solve (vsize page_count); private: struct Page_spacing_node @@ -53,7 +41,8 @@ private: vsize prev_; }; - Real page_height_; + Page_breaking const *breaker_; + vsize first_page_num_; vector lines_; Matrix state_; vsize max_page_count_; @@ -65,17 +54,30 @@ private: bool calc_subproblem (vsize page, vsize lines); }; -Spacing_result -space_systems_on_min_pages (vector const&, - Real page_height, - Real odd_pages_penalty, - bool ragged, - bool ragged_last); -Spacing_result -space_systems_on_best_pages (vector const&, - Real page_height, - Real odd_pages_penalty, - bool ragged, - bool ragged_last); +struct Page_spacing +{ + Real force_; + Real page_height_; + Real rod_height_; + Real spring_len_; + Real inverse_spring_k_; + Real page_top_space_; + + Line_details last_line_; + Line_details first_line_; + + Page_spacing (Real page_height, Real page_top_space) + { + page_height_ = page_height; + page_top_space_ = page_top_space; + clear (); + } + + void calc_force (); + void resize (Real new_height); + void append_system (const Line_details &line); + void prepend_system (const Line_details &line); + void clear (); +}; #endif /* PAGE_SPACING_HH */