-+-+-+-+-+-+-+-+ START OF PART 252 -+-+-+-+-+-+-+-+ Xextern void ptk_copyinvisfilter(C(Pint) sourcewsid, C(Pint) destwsid) XPreANSI(Pint sourcewsid) XPreANSI(Pint destwsid) X/* X** \parambegin X** \param`7BPint`7D`7Bsourcewsid`7D`7Bsource workstation identifier`7D`7BIN` V7D X** \param`7BPint`7D`7Bdestwsid`7D`7Bdestination workstation identifier`7D`7B VIN`7D X** \paramend X** \blurb`7BThis function copies the invisibilty filter`20 X** from workstation \pardesc`7Bsourcewsid`7D to workstation \pardesc`7Bdestw Vsid`7D.`7D X*/ X`7B X Pint err, totincl, totexcl; X Pintlst incl, excl; X X /* invisibility filter */ X pinqinvisfilter(sourcewsid, 0, 0, 0, 0, &err, &incl, &totincl, X &excl, &totexcl); `20 X incl.integers = (Pint *)calloc(totincl, sizeof(Pint)); X incl.number = totincl; X excl.integers = (Pint *)calloc(totexcl, sizeof(Pint)); X excl.number = totexcl; X pinqinvisfilter(sourcewsid, totincl, 0, totexcl, 0, &err, &incl, &totincl, X &excl, &totexcl); X psetinvisfilter(destwsid, &incl, &excl); X`7D /* ptk_copyinvisfilter */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_copyhlhsrmode(C(Pint) sourcewsid, C(Pint) destwsid) XPreANSI(Pint sourcewsid) XPreANSI(Pint destwsid) X/* X** \parambegin X** \param`7BPint`7D`7Bsourcewsid`7D`7Bsource workstation identifier`7D`7BIN` V7D X** \param`7BPint`7D`7Bdestwsid`7D`7Bdestination workstation identifier`7D`7B VIN`7D X** \paramend X** \blurb`7BThis function copies the HLHSR mode X** from workstation \pardesc`7Bsourcewsid`7D to workstation \pardesc`7Bdestw Vsid`7D.`7D X*/ X`7B X /* inquire hlhsr mode */ X /* inquire wstype */ X /* inquire hlhsr facilities */ X /* if mode available set otherwise default */ X`7D /* ptk_copyhlhsrmode */ X X/* copy workstation window, workstation viewport, deferral mode, X** modification mode, colour model, input devices. X*/ X X/*-------------------------------------------------------------------------- V*/ X/*------------------------ Inquiry Functions ------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqmaxdevicecoords(C(Pint) wsid, C(Pfloat *) maxdevx,`20 X C(Pfloat *) maxdevy) XPreANSI(Pint wsid) XPreANSI(Pfloat *maxdevx) XPreANSI(Pfloat *maxdevy) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPfloat *`7D`7Bmaxdevx`7D`7Bmaximum device coords along x axis`7D V`7BOUT`7D X** \param`7BPfloat *`7D`7Bmaxdevy`7D`7Bmaximum device coords along y axis`7D V`7BOUT`7D X** \paramend X** \blurb`7BThis function returns the the`20 X** maximum device coordinates for $x$ and $y$ for workstation \pardesc`7Bwsi Vd`7D.`7D X*/ X`7B `20 X Pint err, totsize; X Pdspsize disprec; X Pwstype wstype; X Pchar *buffer; X Pconnid connid; X X pinqwsconntype(wsid, 0, &err, buffer, &connid, X &totsize, &wstype); X buffer = (Pchar *)malloc(totsize); X pinqwsconntype(wsid, totsize, &err, buffer, &connid, X &totsize, &wstype); X pinqdisplayspacesize(wstype, &err, &disprec); X *maxdevx = disprec.device.x; X *maxdevy = disprec.device.y; X free(buffer); X`7D /* ptk_inqmaxdevicecoords */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqmaxdevicecoords3(C(Pint) wsid, C(Pfloat *) maxdevx,`20 X C(Pfloat *) maxdevy, C(Pfloat *) maxdevz V) XPreANSI(Pint wsid) XPreANSI(Pfloat *maxdevx) XPreANSI(Pfloat *maxdevy) XPreANSI(Pfloat *maxdevz) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPfloat *`7D`7Bmaxdevx`7D`7Bmaximum device coords along x axis`7D V`7BOUT`7D X** \param`7BPfloat *`7D`7Bmaxdevy`7D`7Bmaximum device coords along y axis`7D V`7BOUT`7D X** \param`7BPfloat *`7D`7Bmaxdevz`7D`7Bmaximum device coords along z axis`7D V`7BOUT`7D X** \paramend X** \blurb`7BThis function returns the the`20 X** maximum device coordinates for $x$, $y$ X** and $z$ for workstation \pardesc`7Bwsid`7D.`7D X*/ X`7B `20 X Pint err, totsize; X Pwstype wstype; X#ifdef SUN X Pdspsize3 disprec; X#endif X#ifdef VMS X Pdspvolume disprec; X#endif X Pchar *buffer; X Pconnid connid; X X pinqwsconntype(wsid, 0, &err, buffer, &connid, X &totsize, &wstype); X buffer = (Pchar *)malloc(totsize); X pinqwsconntype(wsid, totsize, &err, buffer, &connid, X &totsize, &wstype); X pinqdisplayspacesize3(wstype, &err, &disprec); X *maxdevx = disprec.device.x; X *maxdevy = disprec.device.y; X *maxdevz = disprec.device.z; X free(buffer); X`7D /* ptk_inqmaxdevicecoords3 */ X X/*-------------------------------------------------------------------------- V*/ X/*---------------------- Miscellaneous Functions --------------------------- V*/ X Xstatic void box(C(Ppoint *) pos, C(Pint) c, C(Ppoint *) size) XPreANSI(Ppoint *pos) XPreANSI(Pint c) XPreANSI(Ppoint *size) X/* X** \parambegin X** \param`7B`7D`7Bxx`7D`7Bposition of box on x axis`7D`7BIN`7D X** \param`7B`7D`7Byy`7D`7Bposition of box on y axis`7D`7BIN`7D X** \param`7B`7D`7Bc`7D`7Binterior colour of box (index to colour table)`7D`7 VBIN`7D X** \param`7B`7D`7Bboxptr`7D`7Bpointer to ptkscolourtable struct`7D`7BIN`7D X** \paramend X** \blurb`7BDraws a box and fills with given colour.`7D X*/ X`7B X Ppoint boxcords`5B4`5D; X Ppoint textpoint; X Pchar textnum`5B5`5D; X X textpoint.x = pos->x + size->x / 2.0; X textpoint.y = pos->y + size->y / 2.0; X X boxcords`5B0`5D = ptk_point(pos->x, pos->y); X boxcords`5B1`5D = ptk_point(pos->x + size->x, pos->y); X boxcords`5B2`5D = ptk_point(pos->x + size->x, pos->y + size->y); X boxcords`5B3`5D = ptk_point(pos->x, pos->y + size->y); X X sprintf(textnum, "%d", c); X psetintcolourind(c); X pfillarea(4, boxcords); X ptext(&textpoint, textnum); X`7D /* box */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_drawcolourtable(C(Pint) stid, C(Pint) llim, C(pint) ulim) XPreANSI(Pint stid) XPreANSI(Pint llim) XPreANSI(Pint ulim) X/* X** \parambegin X** \param`7BPint`7D`7Bstid`7D`7Bstructure identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bllim`7D`7Blower index value of colour table range`7D`7 VBIN`7D X** \param`7BPint`7D`7Bulim`7D`7Bupper limit of colour table range.`7D`7BIN`7 VD X** \paramend X** \blurb`7BThis function draws a rectangular array of boxes representing X** the range \pardesc`7Bllim`7D to \pardesc`7Bulim`7D of X** the workstation colour table. The boxes are drawn into structure X** \pardesc`7Bstid`7D.`7D X*/ X`7B`20 X Pint x, y, numboxes, cindex; X Ptxalign alignrec; X Pfloat entryrange; X Ppoint size, pos; X X entryrange = (Pfloat)(ulim - llim + 1); X entryrange = sqrt(entryrange); X /* numboxes = number of boxes down each side of grid */ X numboxes = (entryrange/1); X if (entryrange > numboxes) `7B numboxes++; `7D`20 X X size.x = 1.0 / numboxes; X size.y = 1.0 / numboxes; X alignrec.hor = PAH_CENTRE; X alignrec.ver = PAV_NORMAL; X X ptk_openstruct(stid); X psettextalign(&alignrec); X psetintstyle(PSOLID); X for (y = 0; y < numboxes; y++)`20 X `7B X for (x = 0; x < numboxes; x++) X `7B X pos = ptk_point((Pfloat)x * size.x, 1.0 - ((Pfloat)(y + 1) * size.y)); X cindex = (y * numboxes) + x + 1; X if (cindex > ulim) X cindex = 0; X box(&pos, cindex, &size); X `7D X `7D X ptk_closestruct(); X`7D /* ptk_drawcolourtable */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_arrow(C(Pfloat) length, C(Pfloat) width, C(Ppoint3 *) centre V,`20 X C(Pfloat) angle) XPreANSI(Pfloat length) XPreANSI(Pfloat width) XPreANSI(Ppoint3 *centre) XPreANSI(Pfloat angle) X/* X** \parambegin X** \param`7BPfloat`7D`7Blength`7D`7Blength of arrow`7D`7BIN`7D X** \param`7BPfloat`7D`7Bwidth`7D`7Bwidth of arrow`7D`7BIN`7D X** \param`7BPpoint3 *`7D`7Bcentre`7D`7Bcentre of arrow`7D`7BIN`7D X** \param`7BPfloat`7D`7Bangle`7D`7Brotation of arrow in degrees anti-clockwi Vse about`20 X** arrow pointing along x-axis.`7D`7BIN`7D X** \paramend X** \blurb`7BThis function draws an arrow with the specified X** length \pardesc`7Blength`7D and \pardesc`7Bwidth`7D, rotated through X** \pardesc`7Bangle`7D, centred at \pardesc`7Bcentre`7D.`7D`20 X*/ X`7B X Pmatrix3 matrix; X Ppoint3 fp`5B7`5D; X Pint i; X Ppointlst3 sets; X X ptk_rotate3(angle, 3, PREPLACE, matrix); X ptk_shift3(centre, PPOSTCONCATENATE, matrix); X fp`5B0`5D = ptk_point3(-width/4.0, -length/2.0, 0.0); X fp`5B1`5D = ptk_point3(fp`5B0`5D.x, length/6.0, 0.0); X fp`5B2`5D = ptk_point3(-width/2.0, fp`5B1`5D.y, 0.0); X fp`5B3`5D = ptk_point3(0.0, -fp`5B0`5D.y, 0.0);`20 X fp`5B4`5D = ptk_point3(width/2.0, fp`5B1`5D.y, 0.0);`20 X fp`5B5`5D = ptk_point3(-fp`5B0`5D.x, fp`5B1`5D.y, 0.0); X fp`5B6`5D = ptk_point3(fp`5B5`5D.x, fp`5B0`5D.y, 0.0); X for (i = 0; i < 7; i++) X fp`5Bi`5D = ptk_transform3(matrix, &fp`5Bi`5D); X sets.number = 7; X sets.points = fp; X ptk_fillareaset3(1, &sets);`20 X`7D /* ptk_arrow */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_grid(C(Pint) stid) XPreANSI(Pint stid) X/* X** \parambegin X** \param`7BPint`7D`7Bstid`7D`7Bgrid structure identifier`7D`7BIN`7D X** \paramend X** \blurb`7BThis functions draws a grid of lines on `5B0,1`5D, X** into structure \pardesc`7Bstid`7D. `7D X*/ X`7B X Pint i; X Ppoint pts`5B2`5D, textpt; X Ptxalign al; X Pchar str`5B80`5D; X X ptk_openstruct(stid); X al.hor = PAH_CENTRE; X al.ver = PAV_NORMAL; X psettextalign(&al); X psetcharheight(0.01); X for (i = 1; i <= 9; i++)`20 X `7B `20 X /* horizontal lines, x = 0.1,..,0.9 */ X pts`5B0`5D = ptk_point((Pfloat)i * 0.1, 0.93); X pts`5B1`5D = ptk_point((Pfloat)i * 0.1, 0.07); X ppolyline(2, pts); X sprintf(str, "%d", i); X textpt = ptk_point(i * 0.1, 0.94);`20 X ptext(&textpt, str); X textpt = ptk_point(i * 0.1, 0.04);`20 X ptext(&textpt, str); X `7D X X al.hor = PAH_NORMAL; X al.ver = PAV_HALF; X psettextalign(&al); X for (i = 1; i <= 9; i++)`20 X `7B `20 X /* vertical lines, y = 0.1,..,0.9 */ X pts`5B0`5D = ptk_point(0.07, i * 0.1); X pts`5B1`5D = ptk_point(0.93, i * 0.1); X ppolyline(2, pts); X sprintf(str, "%d", i); X textpt = ptk_point(0.03, i * 0.1);`20 X ptext(&textpt, str); X textpt = ptk_point(0.94, i * 0.1);`20 X ptext(&textpt, str); X `7D X ptk_closestruct(); X`7D /* ptk_grid */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_framebox(C(Ppoint3 *) boxcentre, C(Ppoint *) boxsize, X C(Ppoint *) framesize, C(Pint) boxcolour, C(Pint) edgecolour, X C(Pint) tlcolour, C(Pint) brcolour) XPreANSI(Ppoint3 *boxcentre) XPreANSI(Ppoint *boxsize) XPreANSI(Ppoint *framesize) XPreANSI(Pint boxcolour) XPreANSI(Pint edgecolour) XPreANSI(Pint tlcolour) XPreANSI(Pint brcolour) X/* X** \parambegin X** \param`7BPpoint3 *`7D`7Bboxcentre`7D`7Bcentre of box`7D`7BIN`7D X** \param`7BPpoint *`7D`7Bboxsize`7D`7Bheight and width box`7D`7BIN`7D X** \param`7BPpoint *`7D`7Bframesize`7D`7Bheight and width of frame`7D`7BIN`7 VD X** \param`7BPint`7D`7Bboxcolour`7D`7Bbox interior colour index`7D`7BIN`7D X** \param`7BPint`7D`7Bedgecolour`7D`7Bbox edge colour index`7D`7BIN`7D X** \param`7BPint`7D`7Btlcolour`7D`7Bframe top-left colour index`7D`7BIN`7D X** \param`7BPint`7D`7Bbrcolour`7D`7Bframe bottom-right colour index`7D`7BIN` V7D X** \paramend X** \blurb`7BThis function draws a box in the open X** structure with a frame to give a 3D X** effect.`7D X*/ X`7B X Ppoint3 pts`5B6`5D; X Ppointlst3 sets; X X psetintstyle(PSOLID); X pts`5B0`5D = ptk_point3(boxcentre->x - (boxsize->x / 2.0) - framesize->x,` V20 X boxcentre->y - (boxsize->y / 2.0) - framesize->y, X boxcentre->z); X pts`5B1`5D = ptk_point3(pts`5B0`5D.x, pts`5B0`5D.y + boxsize->y + (2.0 * f Vramesize->y), X boxcentre->z); X pts`5B2`5D = ptk_point3(pts`5B0`5D.x + boxsize->x + (2.0 * framesize->x), V pts`5B1`5D.y, X boxcentre->z); X pts`5B3`5D = ptk_point3(pts`5B2`5D.x - framesize->x,`20 X pts`5B2`5D.y - framesize->y, boxcentre->z); X pts`5B4`5D = ptk_point3(pts`5B1`5D.x + framesize->x, pts`5B3`5D.y,`20 X boxcentre->z); X pts`5B5`5D = ptk_point3(pts`5B4`5D.x, pts`5B0`5D.y + framesize->y,`20 X boxcentre->z); X X psetintcolourind(tlcolour); X pts`5B2`5D = ptk_point3(pts`5B0`5D.x + boxsize->x + (2.0 * framesize->x), V pts`5B1`5D.y, X boxcentre->z); X pfillarea3(6, pts); X X psetintcolourind(brcolour); X pts`5B1`5D.x += boxsize->x + (2.0 * framesize->x); X pts`5B1`5D.y -= boxsize->y + (2.0 * framesize->y); X pts`5B4`5D.x = pts`5B3`5D.x; X pts`5B4`5D.y = pts`5B5`5D.y; X pfillarea3(6, pts); X X pts`5B2`5D = ptk_point3(pts`5B3`5D.x, pts`5B5`5D.y, boxcentre->z); X pts`5B4`5D = ptk_point3(pts`5B0`5D.x + framesize->x, pts`5B3`5D.y,`20 X boxcentre->z); X psetintcolourind(boxcolour); X psetedgeflag(PEDGE_ON); X psetedgecolourind(edgecolour); X sets.number = 4; X sets.points = &pts`5B2`5D; X ptk_fillareaset3(1, &sets); X`7D /* ptk_framebox */ X X/*-------------------------------------------------------------------------- V*/ X X/* phigslib */ X X/* End. */ $ CALL UNPACK [.SOURCE.LIBRARY]PLIB.C;1 1618228356 $ create 'f' X/*-------------------------------------------------------------------------- V*/ X/*---------------------- phinter set functions ----------------------------- V*/ X/*-------------------------------------------------------------------------- V*/ X Xstatic void do_psetannotationalign() X`7B X Ptxalign a; X X a.hor = readphigsenum(PTKETXHOR, "horizontal alignment ? "); X a.ver = readphigsenum(PTKETXVER, "vertical alignment ? "); X psetannotationalign(&a); X`7D /* do_psetannotationalign */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void do_psetannotationcharheight() X`7B +-+-+-+-+-+-+-+- END OF PART 252 +-+-+-+-+-+-+-+-