2 break.cc -- implement Break_algorithm
4 source file of the GNU LilyPond music typesetter
6 (c) 1996, 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "score-column.hh"
11 #include "paper-def.hh"
13 #include "line-of-score.hh"
14 #include "paper-score.hh"
15 #include "paper-column.hh"
16 #include "cpu-timer.hh"
17 #include "command-request.hh"
18 #include "simple-spacer.hh"
25 Break_algorithm::find_break_indices () const
27 Line_of_cols all (pscore_l_->col_l_arr_);
30 for (int i=0; i < all.size (); i++)
31 if (all[i]->breakable_b ())
35 while (retval.size () >2)
43 Break_algorithm::find_breaks () const
45 Line_of_cols all (pscore_l_->col_l_arr_);
48 for (int i=0; i < all.size (); i++)
49 if (all[i]->breakable_b ())
53 while (retval.size () >2)
61 Break_algorithm::generate_spacing_problem (Line_of_cols curline, Interval line) const
63 Line_spacer * sp = new Simple_spacer;
65 sp->default_space_f_ = pscore_l_->paper_l_->get_var ("loose_column_distance");
67 sp->indent_f_ = line[LEFT];
70 sort out how interfacing this should work;
77 sp->line_len_f_ = line.length ();
79 sp->add_columns (curline);
85 Break_algorithm::Break_algorithm ()
93 Break_algorithm::set_pscore (Paper_score*s)
96 linelength = s->paper_l_->linewidth_f ();
101 Break_algorithm::feasible (Line_of_cols curline) const
106 for (int i=0; i < curline.size (); i++)
108 if (i && i < curline.size () -1
109 && ((dynamic_cast<Score_column*>(curline[i]))->break_penalty_i () >= Break_req::FORCE))
116 Break_algorithm::problem_OK () const
118 if (pscore_l_->col_l_arr_.empty ())
119 error (_("Score does not have any columns"));
124 Break_algorithm::OK () const
128 Array<Column_x_positions>
129 Break_algorithm::solve () const
131 Array<Column_x_positions> h= do_solve ();
137 Break_algorithm::do_set_pscore ()