#include "defs.h" /* set scale factors */ XY framehx, framelx, framehy, framely; sscale() { REG SKT sp; REAL f; REAL fhx, flx, fhy, fly; framehx = framehy = 0; framelx = framely = MAXINT; pinscan(updscale); scanboard(sp) { if (sp->typid == UNUSED) continue; updscale(sp->x, sp->y, ""); updscale(sp->x + sp->dx, sp->y + sp->dy, ""); } if ((framehx == framelx) || (framehy == framely)) error("cannot scale"); fhx = framehx; fhy = framehy; flx = framelx; fly = framely; f = XRANGE / (fhx - flx); xymul = YRANGE / (fhy - fly); if (f < xymul) xymul = f; xoff = ((fhx +flx) * xymul) / 2.0; xoff = XMID - xoff; yoff = ((fhy + fly) * xymul) / 2.0; yoff = YMID - yoff; } updscale(px, py, s) INT px, py; STRING s; { /* s is ignored but required - see uses */ px &= ~UNPLAC; py &= ~UNPLAC; if (px < framelx) framelx = px; if (py < framely) framely = py; if (px > framehx) framehx = px; if (py > framehy) framehy = py; }