flower-1.0.3
[lilypond.git] / pcol.hh
blob203482b10e1b1d12ead779cbc5fa2278f8abf1a8
1 #ifndef COLS_HH
2 #define COLS_HH
4 #include "glob.hh"
5 #include "boxes.hh"
6 #include "list.hh"
7 #include "item.hh"
9 /// stuff grouped vertically.
10 struct PCol {
11 List<const Item*> its;
12 List<const Spanner*> stoppers, starters;
14 /// Can this be broken? true eg. for bars.
15 bool breakable()const;
17 /// does this column have items, does it have spacings attached?
18 bool used;
20 /// prebreak is put before end of line.
21 PCol *prebreak;
22 /**
23 if broken here, then (*this) column is discarded, and prebreak
24 is put at end of line, owned by Col
27 /// postbreak at beginning of the new line
28 PCol *postbreak;
29 /** \See{prebreak}
31 PCol *daddy;
33 if this column is pre or postbreak, then this field points to the parent.
35 /// if lines are broken then this column is in #line#
36 const Line_of_score *line;
38 /// if lines are broken then this column x-coord #hpos#
39 Real hpos;
42 /****************************************************************/
44 void add(const Item*i);
46 Interval width() const;
47 ~PCol();
48 PCol(PCol * parent);
50 /// which col comes first?
51 static int compare(const PCol &c1, const PCol &c2);
52 /**
53 signed compare on columns.
55 return < 0 if c1 < c2.
58 void OK() const;
59 void set_breakable();
60 void print()const;
62 /**
63 This is a class to address items vertically. It contains the data for:
64 \begin{itemize}
65 \item
66 unbroken score
67 \item
68 broken score
69 \item
70 the linespacing problem
71 \end{itemize}
74 #include "compare.hh"
75 instantiate_compare(const PCol &, PCol::compare);
78 /// ideal spacing between two columns
79 struct Idealspacing {
81 /// the ideal distance
82 Real space;
84 /// Hooke's constant: how strong are the "springs" attached to columns
85 Real hooke;
87 /// the two columns
88 const PCol *left, *right;
90 void print()const;
91 void OK() const ;
92 Idealspacing(const PCol *left,const PCol *right);
95 #endif