X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fbreak-algorithm.cc;h=7176d928ffb0d1439e292f7527bf848b37250401;hb=90f11558943cc2381d2eae4d64029a0f8572f144;hp=540c6597c83671e329f39c7aaa9bc2753c2bd1f6;hpb=bb36bac02a64770871780231ecc709cb18b20932;p=lilypond.git diff --git a/lily/break-algorithm.cc b/lily/break-algorithm.cc index 540c6597c8..7176d928ff 100644 --- a/lily/break-algorithm.cc +++ b/lily/break-algorithm.cc @@ -3,35 +3,32 @@ source file of the GNU LilyPond music typesetter - (c) 1996, 1997--2000 Han-Wen Nienhuys + (c) 1996--2004 Han-Wen Nienhuys */ #include "paper-column.hh" #include "break-algorithm.hh" #include "paper-def.hh" -#include "debug.hh" -#include "line-of-score.hh" +#include "system.hh" #include "paper-score.hh" #include "paper-column.hh" #include "cpu-timer.hh" -#include "command-request.hh" -#include "simple-spacer.hh" - - +#include "simple-spacer.hh" +#include "group-interface.hh" Array Break_algorithm::find_break_indices () const { - Link_array all (pscore_l_->col_l_arr_); + Link_array all = pscore_->system_->columns (); Array retval; for (int i=0; i < all.size (); i++) - if (all[i]->breakable_b ()) + if (Item::is_breakable (all[i])) retval.push (i); - if (linewidth_f_ <=0) + if (linewidth_ <=0) while (retval.size () >2) retval.del (1); @@ -39,17 +36,17 @@ Break_algorithm::find_break_indices () const } -Link_array +Link_array Break_algorithm::find_breaks () const { - Link_array all (pscore_l_->col_l_arr_); - Link_array retval; + Link_array all = pscore_->system_->columns (); + Link_array retval; for (int i=0; i < all.size (); i++) - if (all[i]->breakable_b ()) + if (Item::is_breakable (all[i])) retval.push (all[i]); - if (linewidth_f_ <=0) + if (linewidth_ <=0) while (retval.size () >2) retval.del (1); @@ -58,24 +55,29 @@ Break_algorithm::find_breaks () const Simple_spacer* -Break_algorithm::generate_spacing_problem (Link_array curline, Interval line) const +Break_algorithm::generate_spacing_problem (Link_array const &curline, + Interval line) const { Simple_spacer * sp = new Simple_spacer; - Paper_def * d = pscore_l_->paper_l_; - sp->compression_energy_factor_f_ = d->get_var ("compression_energy_factor"); - sp->default_space_f_ = d->get_var ("loose_column_distance"); - sp->indent_f_ = line[LEFT]; + /* + this is hardcoded, but this shouldn't happen anyway. + used to be get_realvar (ly_symbol2scm ("loose_column_distance")); + */ + sp->default_space_ = 1.0; + + + sp->indent_ = line[LEFT]; /* sort out how interfacing this should work; */ - if (line.empty_b()) + if (line.is_empty ()) { - sp->line_len_f_ = -1; + sp->line_len_ = -1; } else - sp->line_len_f_ = line.length (); + sp->line_len_ = line.length (); sp->add_columns (curline); @@ -85,31 +87,15 @@ Break_algorithm::generate_spacing_problem (Link_array curline, Int Break_algorithm::Break_algorithm () { - pscore_l_ = 0; - linewidth_f_ = 0; + pscore_ = 0; + linewidth_ = 0; } void Break_algorithm::set_pscore (Paper_score*s) { - pscore_l_ = s; - linewidth_f_ = s->paper_l_->get_var("linewidth"); - do_set_pscore (); -} - - - -void -Break_algorithm::problem_OK () const -{ - if (pscore_l_->col_l_arr_.empty ()) - error (_("Score does not have any columns")); - OK (); -} - -void -Break_algorithm::OK () const -{ + pscore_ = s; + linewidth_ = s->paper_->get_realvar (ly_symbol2scm ("linewidth")); } Array @@ -120,8 +106,3 @@ Break_algorithm::solve () const return h; } -void -Break_algorithm::do_set_pscore () -{ - -}