]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/break.hh
release: 0.0.57
[lilypond.git] / lily / include / break.hh
1 /*
2   break.hh -- declare  Break_algorithm
3
4   source file of the LilyPond music typesetter
5
6   (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9
10 #ifndef BREAK_HH
11 #define BREAK_HH
12 #include "varray.hh"
13 #include "proto.hh"
14 #include "colhpos.hh"
15
16 /** Class representation of an algorithm which decides where to put
17   the column, and where to break lines.
18   
19   TODO: a decent algorithm, based on dynamic programming or something
20   a like. A "parindent", caching of breakpoints
21   
22   */
23 struct Break_algorithm {
24     PScore &pscore_;
25     Real linelength;
26
27     /* *************** */
28
29     Break_algorithm(PScore&);
30
31     /// check if the spacing/breaking problem is well-stated
32     void problem_OK()const;
33
34     /// search all pcols which are breakable.
35     Line_of_cols find_breaks() const;
36
37      /// helper: solve for the columns in #curline#.
38     Col_hpositions solve_line(Line_of_cols) const;
39
40     /// does curline fit on the paper?    
41     bool feasible(Line_of_cols)const;
42     
43     virtual Array<Col_hpositions> solve()=0;
44 };
45
46 /// wordwrap type algorithm: move to next line if current is optimal.
47 struct Word_wrap : Break_algorithm {
48     virtual Array<Col_hpositions> solve();
49     Word_wrap(PScore&);
50 };
51 #endif // BREAK_HH
52