This method is fairly typical of the major methods in Box-- most of them are extremely detailed and must have been sheer agony to debug. However, the fine layout control implemented by Box makes it one of ET++'s most useful classes.
void Box::SetOrigin(Point at)
{
VObjectIter next(this);
register VObject *vop;
register int x, y;
Point g, r, rr, a, rc(ColsRowsSize());
rcinfo *rci= new rcinfo[Math::Max(rc.x, rc.y)];
expand(rc, rci, g, r);
VObject::SetOrigin(at);
a.y= at.y;
rr.y= r.y;
for (y= 0; y < rc.y; y++) {
a.x= at.x;
rr.x= r.x;
for (x= 0; x < rc.x; x++) {
if (vop= next())
vop->Align(a, Metric(rci[x].wd, rci[y].ht, rci[y].bs), align);
a.x+= rci[x].wd + g.x;
if (rr.x > 0) {
a.x++;
rr.x--;
}
}
a.y+= rci[y].ht + g.y;
if (rr.y > 0) {
a.y++;
rr.y--;
}
}
delete rci;
}