]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/line-spacer.hh
07f4b6757094552d3db61125e3161fe14907dfbd
[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--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9
10 #ifndef LINE_SPACER_HH
11 #define LINE_SPACER_HH
12 #include "lily-proto.hh"
13 #include "array.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   /** solve the spacing problem
33    */
34   virtual void solve (Column_x_positions *) const=0;
35
36   /**
37     Approximate the spacing problem:
38     return a lower bound on the energy
39     */
40   virtual void lower_bound_solution (Column_x_positions *) const=0;
41     
42   /** add a col to the problem. columns have to be added left to
43     right. The column contains info on it's minimum width.  */
44   virtual void add_column (Paper_column  *, bool fixed=false, Real fixpos=0.0)=0;
45
46   /**
47     can the posed problem be solved?
48       
49     @pre
50
51     prepare() was called
52       
53     */
54   virtual bool check_constraints (Vector v) const=0;
55
56   /**
57     generate a solution which can't fail
58     */
59   virtual Vector default_solution() const=0;
60
61     
62   virtual void OK() const{}
63   virtual void print() const{}
64     
65   /**
66     Call after construction before solving
67     */
68   virtual void prepare(){}
69   virtual ~Line_spacer ();
70 };
71
72 #endif