Ejemplo n.º 1
0
void PageBoundary::ToggleOrientation () {
    int nw = pageheight;
    int nh = pagewidth;
    pagewidth = nw;
    pageheight = nh;
    uncacheParents();
}
Ejemplo n.º 2
0
void PageBoundary::SetLandscape () {
    int nw = max(pagewidth, pageheight);
    int nh = min(pagewidth, pageheight);
    pagewidth = nw;
    pageheight = nh;
    uncacheParents();
}
Ejemplo n.º 3
0
void Picture::InsertAfter (Iterator i, Graphic* g) {
    invalidateCachesGraphic(g);
    Elem(i)->Prepend(new UList(g));
    setParent(g, this);
    uncacheExtent();
    uncacheParents();
}
Ejemplo n.º 4
0
void Graphic::Translate (float dx, float dy) {
    if (dx != 0 || dy != 0) {
        if (_t == nil) {
            _t = new Transformer;
        }
        _t->Translate(dx, dy);
        uncacheParents();
    }
}
Ejemplo n.º 5
0
void Graphic::SetTransformer (Transformer* t) {
    if (t != _t) {
        Unref(_t);
        if (t != nil) {
            Ref(t);
        }
        _t = t;
        uncacheParents();
    }
}
Ejemplo n.º 6
0
void Picture::Remove (Iterator& i) {
    UList* doomed = Elem(i);
    Graphic* g = graphic(doomed);

    Next(i);
    unsetParent(g);
    _kids->Remove(doomed);
    delete doomed;
    uncacheExtent();
    uncacheParents();
}
Ejemplo n.º 7
0
void Graphic::Scale (float sx, float sy, float cx, float cy) {
    float ncx, ncy;

    if (sx != 1 || sy != 1) {
        if (_t == nil) {
            _t = new Transformer;
        }
        Transformer parents;
        parentXform(parents);
        parents.InvTransform(cx, cy, ncx, ncy);

        if (ncx != 0 || ncy != 0) {
            _t->Translate(-ncx, -ncy);
            _t->Scale(sx, sy);
            _t->Translate(ncx, ncy);
        } else {
            _t->Scale(sx, sy);
        }
        uncacheParents();
    }
}
Ejemplo n.º 8
0
void Graphic::Rotate (float angle, float cx, float cy) {
    float mag = (angle < 0) ? -angle : angle;
    float ncx, ncy;

    if ((mag - int(mag)) != 0 || int(mag)%360 != 0) {
        if (_t == nil) {
            _t = new Transformer;
        }
        Transformer parents;
        parentXform(parents);
        parents.InvTransform(cx, cy, ncx, ncy);

        if (ncx != 0 || ncy != 0) {
            _t->Translate(-ncx, -ncy);
            _t->Rotate(angle);
            _t->Translate(ncx, ncy);
        } else {
            _t->Rotate(angle);
        }
        uncacheParents();
    }
}
Ejemplo n.º 9
0
void Picture::Prepend (Graphic* g0, Graphic* g1, Graphic* g2, Graphic* g3) {
    if (g3 != nil) {
	invalidateCachesGraphic(g3);
	_kids->Prepend(new UList(g3));
	setParent(g3, this);
    }
    if (g2 != nil) {
	invalidateCachesGraphic(g2);
	_kids->Prepend(new UList(g2));
	setParent(g2, this);
    }
    if (g1 != nil) {
	invalidateCachesGraphic(g1);
	_kids->Prepend(new UList(g1));
	setParent(g1, this);
    }
    invalidateCachesGraphic(g0);
    _kids->Prepend(new UList(g0));
    setParent(g0, this);
    uncacheExtent();
    uncacheParents();
}
Ejemplo n.º 10
0
void Graphic::invalidateCaches() {
    uncacheParents();
    uncacheExtent();
    uncacheChildren();
}
Ejemplo n.º 11
0
void Picture::Remove (Graphic* g) {
    unsetParent(g);
    _kids->Delete(g);
    uncacheExtent();
    uncacheParents();
}