]> git.donarmstrong.com Git - lilypond.git/blob - hdr/break.hh
partial: 0.0.38.hanjan
[lilypond.git] / hdr / break.hh
1 /*
2   break.hh -- part of LilyPond
3
4   (c) 1996,97 Han-Wen Nienhuys
5 */
6
7 #ifndef BREAK_HH
8 #define BREAK_HH
9 #include "varray.hh"
10 #include "proto.hh"
11 #include "colhpos.hh"
12
13 /** Class representation of an algorithm which decides where to put
14   the column, and where to break lines.  */
15 struct Break_algorithm {
16     PScore &pscore_;
17     Real linelength;
18
19     /* *************** */
20
21     Break_algorithm(PScore&);
22
23     /// check if the spacing/breaking problem is well-stated
24     void problem_OK()const;
25
26     /// search all pcols which are breakable.
27     Line_of_cols find_breaks() const;
28
29      /// helper: solve for the columns in #curline#.
30     Col_hpositions solve_line(Line_of_cols) const;
31
32     /// does curline fit on the paper?    
33     bool feasible(Line_of_cols)const;
34     
35     virtual Array<Col_hpositions> solve()=0;
36 };
37
38 /// wordwrap type algorithm: move to next line if current is optimal.
39 struct Word_wrap : Break_algorithm {
40     virtual Array<Col_hpositions> solve();
41     Word_wrap(PScore&);
42 };
43 #endif // BREAK_HH
44