]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/break-algorithm.hh
release: 1.3.53
[lilypond.git] / lily / include / break-algorithm.hh
1 /*
2   break-algorithm.hh -- declare  Break_algorithm
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1996--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9
10 #ifndef BREAK_HH
11 #define BREAK_HH
12
13 #include "array.hh"
14 #include "interval.hh"
15 #include "lily-proto.hh"
16 #include "column-x-positions.hh"
17
18
19 /** Class representation of an algorithm which decides where to put
20   the column, and where to break lines.
21   
22   */
23 class Break_algorithm {
24 protected:
25   Paper_score *pscore_l_;
26   Real linewidth_f_;
27
28   /// search all pcols which are breakable.
29   Link_array<Paper_column> find_breaks() const;
30
31   Array<int> find_break_indices() const;
32     
33
34   /// helper: solve for the columns in #curline#.
35   void solve_line (Column_x_positions*) const;
36
37   /// does curline fit on the paper?    
38   bool feasible (Link_array<Paper_column>) const;
39     
40
41   Simple_spacer* generate_spacing_problem (Link_array<Paper_column>, Interval) const;
42
43   virtual Array<Column_x_positions> do_solve() const=0;
44
45 public:
46   Simple_spacer* (*get_line_spacer)();
47   Break_algorithm();
48   void set_pscore (Paper_score*);
49
50   Array<Column_x_positions> solve() const;
51 };
52
53 #endif // BREAK_HH
54