lilypond-0.0.4
[lilypond.git] / cols.cc
blob0de683cc55ade3586268e4678257e842ef880c90
1 #include "cols.hh"
2 #include "pstaff.hh"
4 Idealspacing::Idealspacing(const PCol * l,const PCol * r)
6 space = 0.0;
7 hooke = 0.0;
8 left = l;
9 right = r;
11 void
12 Idealspacing::OK() const
14 #ifndef NDEBUG
15 assert(hooke >= 0 && left && right);
16 #endif
19 Interval
20 PCol::width() const
22 Interval w;
24 for (PCursor<const Item *> ic(its); ic.ok(); ic++)
25 w.unite(ic->width());
26 if (w.empty())
27 w.unite(Interval(0,0));
28 return w;
30 /****************************************************************/
32 int
33 PCol::compare(const PCol &c1, const PCol &c2)
35 assert(false);
36 return 0 ;
39 void
40 PCol::OK () const
42 if (prebreak || postbreak ) {
43 assert(breakable);
47 void
48 PCol::set_breakable()
50 if (breakable)
51 return;
53 prebreak = new PCol(this);
54 postbreak = new PCol(this);
55 breakable = true;
56 used = true;
59 PCol::PCol(PCol *parent) {
60 daddy = parent;
61 prebreak=0;
62 postbreak=0;
63 breakable=false;
64 line=0;
65 used = false;
68 PCol::~PCol()
70 if (prebreak)
71 delete prebreak; // no recursion!
72 if (postbreak)
73 delete postbreak;
76 void
77 PCol::add(const Item *i)
79 its.bottom().add(i);
80 used = true;