2 break.hh -- declare Break_algorithm
4 source file of the GNU LilyPond music typesetter
6 (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl>
13 #include "lily-proto.hh"
19 Statistics for the number of columns calced.
27 void add (Line_of_cols const&l);
31 /** Class representation of an algorithm which decides where to put
32 the column, and where to break lines.
34 TODO: A "parindent", caching of breakpoints
37 class Break_algorithm {
40 Paper_score *pscore_l_;
43 /// search all pcols which are breakable.
44 Line_of_cols find_breaks() const;
46 Line_of_cols all_cols() const;
47 Array<int> find_break_indices() const;
50 /// helper: solve for the columns in #curline#.
51 void solve_line (Col_hpositions*) const;
53 /// helper: approximate the energyv
54 void approximate_solve_line (Col_hpositions*) const;
56 /// does curline fit on the paper?
57 bool feasible (Line_of_cols) const;
60 Line_spacer* generate_spacing_problem (Line_of_cols) const;
62 virtual Array<Col_hpositions> do_solve() const=0;
63 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<Col_hpositions> solve() const;