summaryrefslogtreecommitdiff
path: root/cols.cc
blob: 0de683cc55ade3586268e4678257e842ef880c90 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "cols.hh"
#include "pstaff.hh"

Idealspacing::Idealspacing(const PCol * l,const PCol * r)
{
    space = 0.0;
    hooke = 0.0;
    left = l;
    right = r;
}
void
Idealspacing::OK() const
{
#ifndef NDEBUG
    assert(hooke >= 0 && left  && right);
#endif    
}

Interval
PCol::width() const
{
    Interval w;

    for (PCursor<const Item *> ic(its); ic.ok(); ic++)
	w.unite(ic->width());
    if (w.empty())
	w.unite(Interval(0,0));
    return w;
}
/****************************************************************/

int
PCol::compare(const PCol &c1, const PCol &c2)
{
    assert(false);
    return 0 ;
}

void
PCol::OK () const
{
    if (prebreak || postbreak ) {
	assert(breakable);
    }
}

void
PCol::set_breakable()
{
    if (breakable)
	return;

    prebreak = new PCol(this);
    postbreak = new PCol(this);
    breakable = true;
    used = true;
}

PCol::PCol(PCol *parent) {
    daddy = parent;
    prebreak=0;
    postbreak=0;
    breakable=false;
    line=0;
    used  = false;
}

PCol::~PCol()
{
    if (prebreak)
	delete prebreak;	// no recursion!
    if (postbreak)
	delete postbreak;	
}

void
PCol::add(const Item *i)
{
    its.bottom().add(i);
    used = true;
}