lilypond-0.0.1
[lilypond.git] / cols.cc
blobe2a13f35f32b39c0f1e5ca884fb3741a1ecb8f4d
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 assert(hooke >= 0 && left && right);
17 Interval
18 PCol::width() const
20 Interval w;
22 for (PCursor<const Item *> ic(its); ic.ok(); ic++)
23 w.unite(ic->width());
24 if (w.empty())
25 w.unite(Interval(0,0));
26 return w;
28 /****************************************************************/
30 int
31 PCol::compare(const PCol &c1, const PCol &c2)
33 assert(false);
36 void
37 PCol::OK () const
39 if (prebreak || postbreak ) {
40 assert(breakable);
44 void
45 PCol::set_breakable()
47 if (breakable)
48 return;
50 prebreak = new PCol(this);
51 postbreak = new PCol(this);
52 breakable = true;
53 used = true;
56 PCol::PCol(PCol *parent) {
57 daddy = parent;
58 prebreak=0;
59 postbreak=0;
60 breakable=false;
61 line=0;
62 used = false;
65 PCol::~PCol()
67 delete prebreak;
68 delete postbreak;
71 void
72 PCol::add(const Item *i)
74 its.bottom().add(i);
75 used = true;