]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/p-col.hh
release: 0.0.61
[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     PScore * pscore_l_;
50
51     /* *************** */
52     /// which  one (left =0)
53     int rank() const;
54
55     /// does this column have items
56     bool used_b() const;
57     
58     void add(Item *i);
59
60     /// Can this be broken? true eg. for bars. 
61     bool breakable_b()const;
62     
63     Interval width() const;
64     ~PCol();
65     PCol(PCol * parent);
66
67     /**
68       which col comes first?.
69       signed compare on columns.
70
71       @return < 0 if c1 < c2.
72     */
73     static int compare(const PCol &c1, const PCol &c2);
74     void set_rank(int);
75
76     void OK() const;
77     void set_breakable();
78     void print()const;
79 private:
80     
81     /**
82       The ranking: left is smaller than right 
83       -1 is uninitialised.
84      */
85     int rank_i_;
86     PCol(PCol const&){}
87 };
88
89
90 #include "compare.hh"
91 instantiate_compare(PCol &, PCol::compare);
92      
93
94 #endif