-+-+-+-+-+-+-+-+ START OF PART 215 -+-+-+-+-+-+-+-+ X /* replace all edges, text and interior (in special order) */ X elemlist`5B0`5D = PEL_EDGE_COLOUR_INDEX; X elemlist`5B1`5D = PEL_TEXT_COLOUR_INDEX; X elemlist`5B2`5D = PEL_INTERIOR_COLOUR_INDEX; X intstate = edgestate = 1; X do X `7B X ptk_findelemtype(elemlist, 3, PFORWARD, &srchstatus, &elptr, &lstnum V); X if (srchstatus == PSUCCESS) X`09`7B X psetelemptr(elptr); X ptk_seteditmode(PEDIT_REPLACE); X switch (lstnum) X`09 `7B X case 0: /* PEL_EDGE_COLOUR_INDEX */ X if (edgestate == 1) X psetedgecolourind(edgecolour); X else X psetedgecolourind(arrowedgecolour); X edgestate++; X break; X X case 1: /* PEL_TEXT_COLOUR_INDEX */ X psettextcolourind(titlecolour); X break; X X case 2: /* PEL_INTERIOR_COLOUR_INDEX */ X switch (intstate) X`09 `7B X case 1: /* top-left edge */ X psetintcolourind(boxtlcolour); X break; X X case 2: /* bottom-right edge */ X psetintcolourind(boxbrcolour); X break; X X case 3: /* box */ X psetintcolourind(intcolour); X break; X X case 4: /* banner */ X psetintcolourind(bannercolour); X break; X X case 5: /* arrow */ X psetintcolourind(arrowcolour); X break; X `7D X intstate++; X break; X `7D X ptk_unseteditmode(); X poffsetelemptr(1); X `7D X `7D while (srchstatus == PSUCCESS); X ptk_closestruct(); X X /* set font */ X ptk_openstruct(menuptr->menustid); X ptk_seteditmode(PEDIT_INSERT); X psetelemptr(0); X psetelemptrlabel(ptk_stringtoint("label", "rotator$title")); X poffsetelemptr(-2); X pdelelem(); X psettextfont(titlefont); X X if (menuptr->longstr`5B0`5D != '\0') X `7B X ptk_computecharheight(wsid, menuptr->longstr, `20 X &menuptr->bannerbox, titlefont, &charheight); X poffsetelemptr(3); X pdelelem(); X psetcharheight(charheight); X `7D X ptk_unseteditmode(); X ptk_closestruct(); X `7D X `7D X`7D /* ptk_setrotatorattrs */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqrotatortitle(C(Pint) menuid, C(Pint) len, X C(Pchar *) titlestr, C(Pint *) totlen, C(Pint *) err) XPreANSI(Pint menuid) XPreANSI(Pint len) XPreANSI(Pchar *titlestr) XPreANSI(Pint *totlen) XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Bmenuid`7D`7Bmenu identifier`7D`7BIN`7D X** \param`7BPint`7D`7Blen`7D`7Blength of string`7D`7BIN`7D X** \param`7BPchar *`7D`7Btitlestr`7D`7Btitle string of rotator banner`7D`7BI VN`7D X** \param`7BPint *`7D`7Btotlen`7D`7Bactual length of string`7D`7BOUT`7D X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend`20 X** \blurb`7BThis function may be used to obtain the title string of a rotato Vr X** menu. The error code = 1 if `7B\tt menuid`7D doesn't exist and = 2 if X** the menu is not a rotator.`7D X*/ X`7B X *err = 0; X setmenu(menuid); X if (menuptr != NULL) X `7B `20 X if (menuptr->menutype == PTKEROTATOR) X `7B X *totlen = strlen(menuptr->longstr) + 1; X if (len >= *totlen) X strncpy(titlestr, menuptr->longstr, *totlen); X `7D X else X *err = 2; X `7D X else X *err = 1; X`7D /* ptk_inqrotatortitle */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqrotatorattrs(C(Pint) menuid,`20 X C(Pint *) titlefont, C(Pint *) titlecolour,`20 X C(Pint *) arrowcolour, C(Pint *) arrowedgecolour, X C(Pint *) intcolour, C(Pint *) edgecolour, C(Pint *) bannercolour V,`20 X C(Pint *) boxtlcolour, C(Pint *) boxbrcolour, C(Pint *) err) XPreANSI(Pint menuid) XPreANSI(Pint *titlefont) XPreANSI(Pint *titlecolour) XPreANSI(Pint *arrowcolour) XPreANSI(Pint *arrowedgecolour) XPreANSI(Pint *intcolour) XPreANSI(Pint *edgecolour) XPreANSI(Pint *bannercolour) XPreANSI(Pint *boxtlcolour) XPreANSI(Pint *boxbrcolour) XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Bmenuid`7D`7Brotator identifier`7D`7BIN`7D X** \param`7BPint *`7D`7Btitlefont`7D`7Btitle font`7D`7BOUT`7D X** \param`7BPint *`7D`7Btitlecolour`7D`7Btitle colour index`7D`7BOUT`7D X** \param`7BPint *`7D`7Barrowcolour`7D`7Barrow interior colour index`7D`7BOU VT`7D X** \param`7BPint *`7D`7Barrowedgecolour`7D`7Barrow edge colour index`7D`7BOU VT`7D X** \param`7BPint *`7D`7Bintcolour`7D`7Brotator interior colour index`7D`7BOU VT`7D X** \param`7BPint *`7D`7Bedgecolour`7D`7Bedge colour index`7D`7BOUT`7D X** \param`7BPint *`7D`7Bbannercolour`7D`7Bbanner colour index`7D`7BOUT`7D X** \param`7BPint *`7D`7Bboxtlcolour`7D`7Btop-left colour index`7D`7BOUT`7D X** \param`7BPint *`7D`7Bboxbrcolour`7D`7Bbottom-right colour index`7D`7BOUT` V7D X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function may be used to obtain the attribute values of X** a rotator menu. The error code = 1 if `7B\tt menuid`7D doesn't exist and V = 2 if X** the menu is not a rotator.`7D X*/ X`7B X *err = 0; X setmenu(menuid); X if (menuptr != NULL) X `7B X if (menuptr->menutype == PTKEROTATOR) X `7B X *titlefont = menuptr->font; X *titlecolour = menuptr->textcolour; X *intcolour = menuptr->intcolour; X *edgecolour = menuptr->edgecolour; X *boxtlcolour = menuptr->tlcolour; X *boxbrcolour = menuptr->brcolour; X *arrowcolour = menuptr->arrowcolour; X *arrowedgecolour = menuptr->arrowedgecolour; X *bannercolour = menuptr->bannercolour; X `7D X else X *err = 2; X `7D X else X *err = 1; X`7D /* ptk_inqrotatorattrs */ X X/*-------------------------------------------------------------------------- V*/ X X/* end of menu.c */ $ CALL UNPACK [.SOURCE.LIBRARY]MENU.C;2 728829420 $ create 'f' X/*-------------------------------------------------------------------------- V-- X X Module name: Miscellaneous X X Author: Gareth Williams. X X Function: module containing PHIGS functions which work for both DEC PHIGS X and SunPHIGS. Also functions which use Ppoint datatypes instead of X Pvector. X X Dependencies: X X Internal function list:`20 X X External function list:`20 X X Hashtables used: none. X X Modification history: (Version), (Date), (name), (Description). X X 1.0, 5th September 1991, G. Williams, First version. X X---------------------------------------------------------------------------- V*/ X X#include X#include X#include X#include X#include X#include "ptk.h" X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_fillareaset(C(Pint) numsets, C(Ppointlst *) sets) XPreANSI(Pint numsets) XPreANSI(Ppointlst *sets) X/* X** \parambegin X** \param`7BPint`7D`7Bnumsets`7D`7Bnumber of point sets`7D`7BIN`7D X** \param`7BPpointlst *`7D`7Bsets`7D`7Blist of point sets`7D`7BIN`7D X** \paramend`20 X** \blurb`7BThis function creates a FILL AREA SET output primitive X** and works for both SunPHIGS and DEC PHIGS.`7D X*/ X`7B X#ifdef VMS X Pint i, j, ptindex, numpts; X Pint *bounds; X Ppoint *pts; X X bounds = (Pint *)calloc(numsets, sizeof(Pint)); X numpts = ptindex = 0; X for (i = 0; i < numsets; i++) X numpts += sets`5Bi`5D.number; X pts = (Ppoint *)calloc(numpts, sizeof(Ppoint)); X for (i = 0; i < numsets; i++) X `7B X bounds`5Bi`5D = sets`5Bi`5D.number; X for (j = 0; j < sets`5Bi`5D.number; j++) X `7B X pts`5Bptindex`5D = sets`5Bi`5D.points`5Bj`5D; X ptindex++; X `7D X `7D X pfillareaset(numsets, bounds, pts); X free(bounds); X free(pts); X#endif X#ifdef SUN X pfillareaset(numsets, sets); X#endif X`7D /* ptk_fillareaset */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_fillareaset3(C(Pint) numsets, C(Ppointlst3 *) sets) XPreANSI(Pint numsets) XPreANSI(Ppointlst3 *sets) X/* X** \parambegin X** \param`7BPint`7D`7Bnumsets`7D`7Bnumber of point sets`7D`7BIN`7D X** \param`7BPpointlst3 *`7D`7Bsets`7D`7Blist of point sets`7D`7BIN`7D X** \paramend`20 X** \blurb`7BThis function creates a FILL AREA SET3 output primitive X** and works for both SunPHIGS and DEC PHIGS.`7D X*/ X`7B X#ifdef VMS X Pint i, j, ptindex, numpts; X Pint *bounds; X Ppoint3 *pts; X X bounds = (Pint *)calloc(numsets, sizeof(Pint)); X numpts = ptindex = 0; X for (i = 0; i < numsets; i++) X numpts += sets`5Bi`5D.number; X pts = (Ppoint3 *)calloc(numpts, sizeof(Ppoint3)); X for (i = 0; i < numsets; i++) X `7B X bounds`5Bi`5D = sets`5Bi`5D.number; X for (j = 0; j < sets`5Bi`5D.number; j++) X `7B X pts`5Bptindex`5D = sets`5Bi`5D.points`5Bj`5D; X ptindex++; X `7D X `7D X pfillareaset3(numsets, bounds, pts); X free(bounds); X free(pts); X#endif X#ifdef SUN X pfillareaset3(numsets, sets); X#endif X`7D /* ptk_fillareaset3 */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqcurelemtypesizecontent(C(Pint *) error,`20 X C(Pchar **) databuf, C(ptkselcontent *) elcontent) XPreANSI(Pint *error) XPreANSI(Pchar **databuf) XPreANSI(ptkselcontent *elcontent) X/* X** \parambegin X** \param`7BPint *`7D`7Berror`7D`7Berror indicator`7D`7BOUT`7D X** \param`7BPchar **`7D`7Bdatabuf`7D`7Bdata buffer`7D`7BOUT`7D X** \param`7Bptkselcontent *`7D`7Belcontent`7D`7Belement content data record` V7D`7BOUT`7D X** \paramend`20 X** \blurb`7BThis function may be used to obtain the type, size and X** contents of the current element. The data buffer is used to store X** the element contents data and is allocated by the function. The X** buffer should be deallocated by the application when the element X** data is no longer required. This function works with both SunPHIGS X** and DEC PHIGS.`7D X*/ X`7B X#ifdef VMS X Pelsize size; X#endif X#ifdef SUN X Pint size; X#endif X Pint bufsize; X X pinqcurelemtypesize(error, &elcontent->eltype, &size); X if (*error != 0) X return; X else X `7B X#ifdef SUN X bufsize = size; X *databuf = (Pchar *)malloc(bufsize); X pinqcurelemcontent(bufsize, error, *databuf, &elcontent->size,`20 X &elcontent->eldata); X#endif X#ifdef VMS X switch (elcontent->eltype) X `7B X case PEL_POLYLINE3: X case PEL_POLYMARKER3: X case PEL_FILL_AREA3: X bufsize = size.number * sizeof(Ppoint3); X *databuf = (Pchar *)calloc(bufsize, sizeof(Pchar)); X pinqcurelemcontent(bufsize, error, *databuf, &elcontent->size,`20 X &elcontent->eldata); X elcontent->size = size.number; X break; X `20 X case PEL_POLYLINE: X case PEL_POLYMARKER: X case PEL_FILL_AREA: X bufsize = size.number * sizeof(Ppoint); X *databuf = (Pchar *)calloc(bufsize, sizeof(Pchar)); X pinqcurelemcontent(bufsize, error, *databuf, &elcontent->size,`20 X &elcontent->eldata); X elcontent->size = size.number; X break; X `20 X case PEL_FILL_AREA_SET3: X bufsize = size.fas_size.total_pts * sizeof(Ppoint3); X bufsize += size.fas_size.num_bounds * sizeof(Pint); X *databuf = (Pchar *)calloc(bufsize, sizeof(Pchar)); X pinqcurelemcontent(bufsize, error, *databuf, &elcontent->size,`20 X &elcontent->eldata); X elcontent->size = size.fas_size.num_bounds; X break; X `20 X case PEL_FILL_AREA_SET: X bufsize = size.fas_size.total_pts * sizeof(Ppoint); X bufsize += size.fas_size.num_bounds * sizeof(Pint); X *databuf = (Pchar *)calloc(bufsize, sizeof(Pchar)); X pinqcurelemcontent(bufsize, error, *databuf, &elcontent->size,`20 X &elcontent->eldata); X elcontent->size = size.fas_size.num_bounds; X break; X X case PEL_ADD_NAMES_TO_SET: X case PEL_REMOVE_NAMES_FROM_SET: X bufsize = size.number * sizeof(Pint); X *databuf = (Pchar *)calloc(bufsize, sizeof(Pchar)); X pinqcurelemcontent(bufsize, error, *databuf, &elcontent->size,`20 X &elcontent->eldata); X break; X `20 X default: X bufsize = size.number; X *databuf = (Pchar *)malloc(bufsize); X pinqcurelemcontent(bufsize, error, *databuf, &elcontent->size,`20 X &elcontent->eldata); X break; X `7D X#endif X `7D X`7D /* ptk_inqcurelemtypesizecontent */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqcurelemtype(C(Pint *) error, C(Peltype *) eltype) XPreANSI(Pint *error) XPreANSI(Peltype *eltype) X/* X** \parambegin X** \param`7BPint *`7D`7Berror`7D`7Berror indicator`7D`7BOUT`7D X** \param`7BPeltype *`7D`7Beltype`7D`7Belement type`7D`7BOUT`7D X** \paramend`20 X** \blurb`7BThis function may be used to obtain the current element type X** and works for both SunPHIGS and DEC PHIGS.`7D X*/ X`7B X#ifdef VMS X Pelsize size; X#endif X#ifdef SUN X Pint size; X#endif X X pinqcurelemtypesize(error, eltype, &size); X`7D /* ptk_inqcurelemtype */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqelemtypesizecontent(C(Pint) stid, C(Pint) elemid,`20 X C(Pint *) error, C(Pchar **) databuf,`20 X C(ptkselcontent *) elcontent) XPreANSI(Pint stid) XPreANSI(Pint elemid) XPreANSI(Pint *error) XPreANSI(Pchar **databuf) XPreANSI(ptkselcontent *elcontent) X/* X** \parambegin X** \param`7BPint`7D`7Bstid`7D`7Bstructure identifier`7D`7BIN`7D X** \param`7BPint`7D`7Belemid`7D`7Belement number`7D`7BIN`7D +-+-+-+-+-+-+-+- END OF PART 215 +-+-+-+-+-+-+-+-