2 break.hh -- declare Break_algorithm
4 source file of the GNU LilyPond music typesetter
6 (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
13 #include "interval.hh"
14 #include "lily-proto.hh"
18 Statistics for the number of columns calced.
26 void add (Line_of_cols
const&l
);
30 /** Class representation of an algorithm which decides where to put
31 the column, and where to break lines.
33 TODO: A "parindent", caching of breakpoints
36 class Break_algorithm
{
39 Paper_score
*pscore_l_
;
42 /// search all pcols which are breakable.
43 Line_of_cols
find_breaks() const;
45 Line_of_cols
all_cols() const;
46 Array
<int> find_break_indices() const;
49 /// helper: solve for the columns in #curline#.
50 void solve_line (Column_x_positions
*) const;
52 /// helper: approximate the energyv
53 void approximate_solve_line (Column_x_positions
*) const;
55 /// does curline fit on the paper?
56 bool feasible (Line_of_cols
) const;
59 Line_spacer
* generate_spacing_problem (Line_of_cols
, Interval
) const;
61 virtual Array
<Column_x_positions
> do_solve() const=0;
62 virtual void do_set_pscore();
65 Col_stats approx_stats_
;
66 Col_stats exact_stats_
;
68 Line_spacer
* (*get_line_spacer
)();
71 void set_pscore (Paper_score
*);
73 /// check if the spacing/breaking problem is well-stated
74 void problem_OK() const;
76 Array
<Column_x_positions
> solve() const;