X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fgourlay-breaking.cc;h=b442cca427624fd373f484fb8b329f22a0c76eb2;hb=0e0a18dbaa12275d0a07b76104243a15da821a15;hp=9ea2b8259e319edc2ddc4ccf117a96381de56e1c;hpb=fd7e615444cf58b38283a59b56d3457c07778397;p=lilypond.git diff --git a/lily/gourlay-breaking.cc b/lily/gourlay-breaking.cc index 9ea2b8259e..b442cca427 100644 --- a/lily/gourlay-breaking.cc +++ b/lily/gourlay-breaking.cc @@ -3,8 +3,9 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1999 Han-Wen Nienhuys + (c) 1997--2000 Han-Wen Nienhuys */ +#include // rint #include "gourlay-breaking.hh" #include "column-x-positions.hh" @@ -13,8 +14,7 @@ #include "paper-score.hh" #include "paper-def.hh" #include "simple-spacer.hh" - -#include "killing-cons.tcc" +#include "line-of-score.hh" /// How often to print operator pacification marks? const int HAPPY_DOTS_I = 3; @@ -46,18 +46,22 @@ struct Break_node { /** This algorithms is adapted from the OSU Tech report on breaking lines. + + this function is longish, but not very complicated. + */ Array Gourlay_breaking::do_solve () const { Array optimal_paths; - Link_array all = pscore_l_->col_l_arr_ ; + Link_array all = + pscore_l_->line_l_->column_l_arr (); + Array breaks = find_break_indices (); optimal_paths.set_size (breaks.size ()); Break_node first_node ; - first_node.line_config_.energy_f_ = 0; optimal_paths[0] = first_node; int break_idx=1; @@ -76,10 +80,10 @@ Gourlay_breaking::do_solve () const for (int start_idx = break_idx; start_idx--;) { - Link_array line = all.slice (breaks[start_idx], breaks[break_idx]+1); + Link_array line = all.slice (breaks[start_idx], breaks[break_idx]+1); - line[0] = dynamic_cast(line[0]->find_broken_piece (RIGHT)); - line.top () = dynamic_cast(line.top ()->find_broken_piece (LEFT)); + line[0] = dynamic_cast (line[0]) ->find_prebroken_piece (RIGHT); + line.top () = dynamic_cast (line.top ())->find_prebroken_piece (LEFT); Column_x_positions cp; cp.cols_ = line; @@ -127,14 +131,15 @@ Gourlay_breaking::do_solve () const optimal_paths[break_idx].line_i_ = optimal_paths[prev].line_i_ + 1; if (! (break_idx % HAPPY_DOTS_I)) - *mlog << "[" << break_idx << "]" << flush; + progress_indication (String ("[") + to_str (break_idx) + "]"); } /* do the last one */ - if (break_idx % HAPPY_DOTS_I) - *mlog << "[" << break_idx << "]"; + if (break_idx % HAPPY_DOTS_I) + progress_indication (String ("[") + to_str (break_idx) + "]"); - *mlog << endl; + + progress_indication ("\n"); Array final_breaks; Array lines; @@ -160,15 +165,8 @@ Gourlay_breaking::do_solve () const Gourlay_breaking::Gourlay_breaking () { - energy_bound_f_ = infinity_f; - max_measures_i_ = INT_MAX; } -void -Gourlay_breaking::do_set_pscore () -{ - max_measures_i_ =int (rint (pscore_l_->paper_l_->get_var ("gourlay_maxmeasures"))); -} /* @@ -179,11 +177,11 @@ Gourlay_breaking::combine_demerits (Column_x_positions const &prev, Column_x_positions const &this_one) const { Real break_penalties = 0.0; - Paper_column * pc = this_one.cols_.top (); + Score_element * pc = this_one.cols_.top (); if (pc->original_l_) { SCM pen = pc->get_elt_property ("penalty"); - if (pen != SCM_UNDEFINED) + if (gh_number_p (pen)) { break_penalties += gh_scm2double (pen); }