]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/line-spacer.hh
c8bf02b48cb89ac42fd75de04c360bb866a38a4c
[lilypond.git] / lily / include / line-spacer.hh
1 /*
2   line-spacer.hh -- declare Line_spacer
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9
10 #ifndef LINE_SPACER_HH
11 #define LINE_SPACER_HH
12 #include "lily-proto.hh"
13 #include "varray.hh"
14 #include "vector.hh"
15 #include "interval.hh"
16
17 /**
18   abstract interface to Line spacing.
19
20   TODO
21   add estimate of "force" or energy.
22  */
23
24 class Line_spacer 
25 {
26     
27 public:
28     Paper_def * paper_l_;
29     Paper_def *paper_l()const;
30     Line_spacer();
31     
32     virtual Array<PCol*> error_pcol_l_arr() const=0;
33
34     /** solve the spacing problem
35       
36       @return the column positions, and the energy (last element)
37
38       */
39     virtual Array<Real> solve() const=0;
40
41     /** add a col to the problem. columns have to be added left to
42       right. The column contains info on it's minimum width.  */
43     virtual void add_column(PCol  *, bool fixed=false, Real fixpos=0.0)=0;
44
45     /**
46       can the posed problem be solved?
47       
48       @pre
49
50       prepare() was called
51       
52      */
53     virtual bool check_constraints(Vector v) const=0;
54
55     /**
56       generate a solution which can't fail
57      */
58     virtual Vector default_solution() const=0;
59     
60     virtual void OK() const{}
61     virtual void print() const{}
62     
63     /**
64       Call after construction before solving
65      */
66     virtual void prepare(){}
67 };
68
69 #endif