lilypond-0.0.4
[lilypond.git] / cols.hh
blobe51e2d56c0511dca48c15b7c24877187fd8e0f0e
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;
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);
49 /// initialize the prebreak and postbreak fields
50 setup_breaks();
52 /// which col comes first?
53 static int compare(const PCol &c1, const PCol &c2);
54 /**
55 signed compare on columns.
57 return < 0 if c1 < c2.
60 void OK() const;
61 void set_breakable();
64 /**
65 This is a class to address items vertically. It contains the data for:
66 \begin{itemize}
67 \item
68 unbroken score
69 \item
70 broken score
71 \item
72 the linespacing problem
73 \end{itemize}
76 #include "compare.hh"
77 instantiate_compare(const PCol &, PCol::compare);
80 /// ideal spacing between two columns
81 struct Idealspacing {
83 /// the ideal distance
84 Real space;
86 /// Hooke's constant: how strong are the "springs" attached to columns
87 Real hooke;
89 /// the two columns
90 const PCol *left, *right;
92 void OK() const ;
93 Idealspacing(const PCol *left,const PCol *right);
96 #endif