X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fpage-breaking.cc;h=9a6f8f40f25c0edbe47f45ecde1780c2babc89b6;hb=4024156d2ebb9d7b5caf34dde98afca000d4b296;hp=9956c9f9784450c3a7f7fec8fd2d435af2ff7f10;hpb=16ac0db39d8cca1de68ce79154386764172aca10;p=lilypond.git diff --git a/lily/page-breaking.cc b/lily/page-breaking.cc index 9956c9f978..9a6f8f40f2 100644 --- a/lily/page-breaking.cc +++ b/lily/page-breaking.cc @@ -504,7 +504,7 @@ Page_breaking::page_height (int page_num, bool last) const // This means that we won't cache properly if page_num is negative or // if calc_height returns a negative number. But that's likely to // be rare, so it shouldn't affect performance. - vector& cache = last ? last_page_height_cache_ : page_height_cache_; + vector &cache = last ? last_page_height_cache_ : page_height_cache_; if (page_num >= 0 && (int) cache.size () > page_num && cache[page_num] >= 0) return cache[page_num]; else @@ -567,9 +567,6 @@ Page_breaking::draw_page (SCM systems, SCM configuration, int page_num, bool las // Create the page and draw it. SCM page = make_page (page_num, last); - SCM page_module = scm_c_resolve_module ("scm page"); - SCM page_stencil = scm_c_module_lookup (page_module, "page-stencil"); - page_stencil = scm_variable_ref (page_stencil); Prob *p = unsmob_prob (page); p->set_property ("lines", paper_systems); @@ -583,7 +580,6 @@ Page_breaking::draw_page (SCM systems, SCM configuration, int page_num, bool las foot = Page_layout_problem::add_footnotes_to_footer (footnotes, foot, book_); p->set_property ("foot-stencil", foot.smobbed_copy ()); - scm_apply_1 (page_stencil, page, SCM_EOL); return page; } @@ -603,10 +599,11 @@ Page_breaking::make_pages (vector lines_per_page, SCM systems) label_page_table = SCM_EOL; // Build a list of (systems configuration . footnote-count) triples. - // Note that we lay out - // the staves and find the configurations before drawing anything. Some + // Note that we lay out the staves and find the configurations, + // but we do not draw anything in this function. It is important + // that all staves are laid out vertically before any are drawn; some // grobs (like tuplet brackets) look at their neighbours while drawing - // themselves. If this happens before the neighbouring staves have + // themselves. If this happens before the neighbouring staves have // been laid out, bad side-effects could happen (in particular, // Align_interface::align_to_ideal_distances might be called). SCM systems_configs_fncounts = SCM_EOL; @@ -642,7 +639,9 @@ Page_breaking::make_pages (vector lines_per_page, SCM systems) systems = scm_list_tail (systems, line_count); } - // Now it's safe to make the pages. + // TODO: previously, the following loop caused the systems to be + // drawn. Now that we no longer draw anything in Page_breaking, + // it is safe to merge these two loops. int page_num = first_page_number + lines_per_page.size () - 1; for (SCM s = systems_configs_fncounts; scm_is_pair (s); s = scm_cdr (s)) { @@ -681,14 +680,6 @@ Page_breaking::make_pages (vector lines_per_page, SCM systems) return ret; } -/* The page-turn-page-breaker needs to have a line-breaker between any two - columns with non-NULL page-turn-permission. - - The optimal-breaker needs to have a line-breaker between any two columns - with page-break-permission = 'force. - - By using a grob predicate, we can accommodate both of these uses. -*/ void Page_breaking::create_system_list () { @@ -712,6 +703,14 @@ Page_breaking::create_system_list () system_specs_.push_back (System_spec ()); } +/* The page-turn-page-breaker needs to have a line-breaker between any two + columns with non-NULL page-turn-permission. + + The optimal-breaker needs to have a line-breaker between any two columns + with page-break-permission = 'force. + + By using a grob predicate, we can accommodate both of these uses. +*/ void Page_breaking::find_chunks_and_breaks (Break_predicate is_break, Prob_break_predicate prob_is_break) { @@ -1225,11 +1224,11 @@ Page_breaking::blank_page_penalty () const SCM penalty_sym; if (is_last ()) - penalty_sym = ly_symbol2scm ("blank-last-page-force"); + penalty_sym = ly_symbol2scm ("blank-last-page-penalty"); else if (ends_score ()) - penalty_sym = ly_symbol2scm ("blank-after-score-page-force"); + penalty_sym = ly_symbol2scm ("blank-after-score-page-penalty"); else - penalty_sym = ly_symbol2scm ("blank-page-force"); + penalty_sym = ly_symbol2scm ("blank-page-penalty"); Break_position const &pos = breaks_[current_end_breakpoint_]; if (Paper_score *ps = system_specs_[pos.system_spec_index_].pscore_)