]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/p-col.hh
136d25293c3fefd0e1b8bdd3ff982eb7b209f3e8
[lilypond.git] / lily / include / p-col.hh
1 #ifndef COLS_HH
2 #define COLS_HH
3
4
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     Link_list<Item *> its;
26     Link_list<Spanner *> 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 *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_f_;                       // should use ptr?
48
49     bool error_mark_b_;
50     bool used_b_ ;              // manual override.. 
51     
52     PScore * pscore_l_;
53
54     /* *************** */
55     /// which  one (left =0)
56     int rank_i() const;
57
58     /// does this column have items
59     bool used_b() const;
60     bool breakpoint_b() const;
61     void clean_breakable_items();
62     
63     void add(Item *i);
64
65     /// Can this be broken? true eg. for bars. 
66     bool breakable_b()const;
67     
68     Interval width() const;
69     virtual ~PCol();
70     PCol();
71
72     /**
73       which col comes first?.
74       signed compare on columns.
75
76       @return < 0 if c1 < c2.
77     */
78     static int compare(const PCol &c1, const PCol &c2);
79     void set_rank(int);
80
81     void OK() const;
82  void set_breakable();
83     virtual void do_set_breakable();
84     void print()const;
85 private:
86     
87     /**
88       The ranking: left is smaller than right 
89       -1 is uninitialised.
90      */
91     int rank_i_;
92     PCol(PCol const&){}
93 };
94
95
96 #include "compare.hh"
97 instantiate_compare(PCol &, PCol::compare);
98      
99
100 #endif