/* Defines a "standard" viewport with seven character heights for   */
/* the left margin and four character heights everywhere else       */

#include "plplot.h"

void plvsta()
{
    PLFLT xmin, xmax, ymin, ymax;
    PLFLT chrdef, chrht, spdxmi, spdxma, spdymi, spdyma;
    PLINT level;

    glev(&level);
    if (level < 1) plexit("Please call plstar before calling plvsta.");

    gchr(&chrdef,&chrht);
    gspd(&spdxmi,&spdxma,&spdymi,&spdyma);

/*  Find out position of subpage boundaries in millimetres, reduce by */
/*  the desired border, and convert back into normalized subpage */
/*  coordinates */

    xmin = dcscx(mmdcx((PLFLT)(dcmmx(spdxmi) + 7 * chrht)));
    xmax = dcscx(mmdcx((PLFLT)(dcmmx(spdxma) - 4 * chrht)));
    ymin = dcscy(mmdcy((PLFLT)(dcmmy(spdymi) + 4 * chrht)));
    ymax = dcscy(mmdcy((PLFLT)(dcmmy(spdyma) - 4 * chrht)));

    plvpor(xmin,xmax,ymin,ymax);
}
