]> git.donarmstrong.com Git - lilypond.git/blob - pcol.hh
release: 0.0.6
[lilypond.git] / pcol.hh
1 #ifndef COLS_HH
2 #define COLS_HH
3
4 #include "glob.hh"
5 #include "boxes.hh"
6 #include "plist.hh"
7 #include "item.hh"
8
9 /// stuff grouped vertically.
10 struct PCol {
11     List<const Item*> its;
12     List<const Spanner*> stoppers, starters;
13     
14     /// Can this be broken? true eg. for bars. 
15     bool breakable()const;
16
17     /// does this column have items, does it have spacings attached?
18     bool used;
19
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
25     */
26
27     /// postbreak at beginning of the new line
28     PCol *postbreak;
29     /**  \See{prebreak}
30     */
31     PCol *daddy;
32     /*
33     if this column is pre or postbreak, then this field points to the parent.
34     */
35     /// if lines are broken then this column is in #line#
36     const Line_of_score *line;
37
38     /// if lines are broken then this column x-coord #hpos#
39     Real hpos;
40
41
42     /****************************************************************/
43
44     void add(const Item*i);
45
46     Interval width() const;
47     ~PCol();
48     PCol(PCol * parent);
49
50     /// which col comes first?
51     static int compare(const PCol &c1, const PCol &c2);
52     /**
53     signed compare on columns.
54
55     return < 0 if c1 < c2.
56     */
57
58     void OK() const;
59     void set_breakable();
60     void print()const;
61 };
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}
72   */
73
74 #include "compare.hh"
75 instantiate_compare(const PCol &, PCol::compare);
76      
77
78 /// ideal spacing between two columns
79 struct Idealspacing {
80
81     /// the ideal distance
82     Real space;
83
84     /// Hooke's constant: how strong are the "springs" attached to columns
85     Real hooke;
86
87     /// the two columns
88     const PCol *left, *right;
89     
90     void print()const;
91     void OK() const ;
92     Idealspacing(const PCol *left,const PCol *right);    
93 };
94
95 #endif