]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/p-col.hh
release: 0.0.62
[lilypond.git] / lily / include / p-col.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
10 /**
11    stuff grouped vertically.
12     This is a class to address items vertically. It contains the data for:
13     \begin{itemize}
14     \item
15     unbroken score
16     \item
17     broken score
18     \item
19     the linespacing problem
20     \end{itemize}
21   */
22
23 class PCol { 
24 public:
25     Pointer_list<Item const *> its;
26     Pointer_list<Spanner const *> stoppers, starters;
27     
28     /** prebreak is put before end of line.
29     if broken here, then (*this) column is discarded, and prebreak
30     is put at end of line, owned by Col
31     */
32     PCol *prebreak_p_;
33
34     /// postbreak at beginning of the new line
35     PCol *postbreak_p_;
36     
37     /** if this column is pre or postbreak, then this field points to
38      the parent.  */
39     PCol *daddy_l_;
40     
41     /// if lines are broken then this column is in #line#
42     Line_of_score const *line_l_;
43
44     /** if lines are broken then this column x-coord #hpos# if not
45       known, then hpos == -1.(ugh?)  */
46
47     Real hpos;                  // should use ptr?
48
49     bool error_mark_b_;
50     
51     PScore * pscore_l_;
52
53     /* *************** */
54     /// which  one (left =0)
55     int rank() const;
56
57     /// does this column have items
58     bool used_b() const;
59     
60     void add(Item *i);
61
62     /// Can this be broken? true eg. for bars. 
63     bool breakable_b()const;
64     
65     Interval width() const;
66     ~PCol();
67     PCol(PCol * parent);
68
69     /**
70       which col comes first?.
71       signed compare on columns.
72
73       @return < 0 if c1 < c2.
74     */
75     static int compare(const PCol &c1, const PCol &c2);
76     void set_rank(int);
77
78     void OK() const;
79     void set_breakable();
80     void print()const;
81 private:
82     
83     /**
84       The ranking: left is smaller than right 
85       -1 is uninitialised.
86      */
87     int rank_i_;
88     PCol(PCol const&){}
89 };
90
91
92 #include "compare.hh"
93 instantiate_compare(PCol &, PCol::compare);
94      
95
96 #endif