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"
12 #include "spring-spacer.hh"
14 #include "line-of-score.hh"
15 #include "paper-score.hh"
16 #include "paper-column.hh"
17 #include "cpu-timer.hh"
18 #include "command-request.hh"
19 #include "spring-spacer.hh"
20 #include "simple-spacer.hh"
27 Break_algorithm::find_break_indices () const
29 Line_of_cols all (pscore_l_->col_l_arr_);
32 for (int i=0; i < all.size (); i++)
33 if (all[i]->breakable_b ())
37 while (retval.size () >2)
45 Break_algorithm::find_breaks () const
47 Line_of_cols all (pscore_l_->col_l_arr_);
50 for (int i=0; i < all.size (); i++)
51 if (all[i]->breakable_b ())
55 while (retval.size () >2)
63 Break_algorithm::generate_spacing_problem (Line_of_cols curline, Interval line) const
65 Real r = pscore_l_->paper_l_->get_var ("simple_spacing_solver");
69 sp = new Simple_spacer;
71 sp = new Spring_spacer;
73 sp->default_space_f_ = pscore_l_->paper_l_->get_var ("loose_column_distance");
75 sp->indent_f_ = line[LEFT];
78 sort out how interfacing this should work;
85 sp->line_len_f_ = line.length ();
87 sp->add_columns (curline);
93 Break_algorithm::Break_algorithm ()
101 Break_algorithm::set_pscore (Paper_score*s)
104 linelength = s->paper_l_->linewidth_f ();
109 Break_algorithm::feasible (Line_of_cols curline) const
114 for (int i=0; i < curline.size (); i++)
116 if (i && i < curline.size () -1
117 && ((dynamic_cast<Score_column*>(curline[i]))->break_penalty_i () >= Break_req::FORCE))
124 Break_algorithm::problem_OK () const
126 if (pscore_l_->col_l_arr_.empty ())
127 error (_("Score does not have any columns"));
132 Break_algorithm::OK () const
136 Array<Column_x_positions>
137 Break_algorithm::solve () const
139 Array<Column_x_positions> h= do_solve ();
145 Break_algorithm::do_set_pscore ()