-+-+-+-+-+-+-+-+ START OF PART 213 -+-+-+-+-+-+-+-+ X** \param`7BPint *`7D`7Btotalsize`7D`7Blength of posted menus list`7D`7BOUT` V7D X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function may be used to inquire the list of all menus X** which are posted to workstation `7B\tt wsid`7D. The error code is X** a standard PHIGS error code.`7D X*/ X`7B X ptksmenu *ptrmenu; X Pint numstructs, i; X Pstructpostlst structlist; X X *err = 0; X *totalsize = 0; X ptrmenu = firstmenu; X while (ptrmenu != NULL) X `7B X if ((inintlst(wsid, &ptrmenu->posted) != -1)) X (*totalsize)++; X ptrmenu = ptrmenu->next; X `7D X if (size >= *totalsize) X `7B X pinqpostedstruct(wsid, 0, 0, err, &structlist, &numstructs); X structlist.postings = (Pstructpost *)calloc(numstructs,`20 X sizeof(Pstructpost)); X pinqpostedstruct(wsid, numstructs, 0, err, &structlist, &numstructs); X menuids->number = 0; X for (i = 0; i < structlist.number; i++) X `7B X if (ismenu(structlist.postings`5Bi`5D.id, &ptrmenu)) X `7B X menuids->integers`5Bmenuids->number`5D = ptrmenu->menuid; X menuids->number++; X `7D X `7D X `7D X`7D /* ptk_inqpostedmenus */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqmenuids(C(Pint) size, C(Pintlst *) menuids,`20 X C(Pint *) totalsize, C(Pint *) err) XPreANSI(Pint size) XPreANSI(Pintlst *menuids) XPreANSI(Pint *totalsize) XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Bsize`7D`7Bsize of buffer`7D`7BIN`7D X** \param`7BPintlst *`7D`7Bmenuids`7D`7Blist of menus`7D`7BOUT`7D X** \param`7BPint *`7D`7Btotalsize`7D`7Blength of menus list`7D`7BOUT`7D X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function may be used to obtain a list of all menus X** in the PHIGS Toolkit menu store.`7D X*/ X`7B X ptksmenu *ptrmenu; X X *err = 0; X *totalsize = menucount; X if (size >= *totalsize) X `7B X menuids->number = 0; X ptrmenu = firstmenu; X while (ptrmenu != NULL) X `7B X menuids->integers`5Bmenuids->number`5D = ptrmenu->menuid; X menuids->number++; X ptrmenu = ptrmenu->next; X `7D X `7D X`7D /* ptk_inqmenuids */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqmenustructid(C(Pint) menuid, C(Pint *) menustid,`20 X C(Pint *) err) XPreANSI(Pint menuid) XPreANSI(Pint *menustid) XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Bmenuid`7D`7Bmenu identifier`7D`7BIN`7D X** \param`7BPint *`7D`7Bmenustid`7D`7Bmenu structure identifier`7D`7BOUT`7D X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function may be used to obtain the identifier X** of a menu structure. The error code = 1 if `7B\tt menuid`7D doesn't exist V.`7D X*/ X`7B X *err = 0; X setmenu(menuid); X if (menuptr != NULL) X *menustid = menuptr->menustid; X else X *err = 1; X`7D /* ptk_inqmenustructid */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqmenuname(C(Pint) menuid, C(Pint *) name,`20 X C(Pint *) err)`20 XPreANSI(Pint menuid) XPreANSI(Pint *name) XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Bwindid`7D`7Bmenu identifier`7D`7BIN`7D X** \param`7BPint *`7D`7Bname`7D`7Bmenu name`7D`7BOUT`7D X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function may be used to obtain the menu name`20 X** for use in the pick filter. X** The error code = 1 if `7B\tt menuid`7D doesn't exist.`7D X*/ X`7B X *err = 0; X setmenu(menuid); X if (menuptr != NULL) X *name = menuptr->menuname; X else X *err = 1; X`7D /* ptk_inqmenuname */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern ptkboolean ptk_inqfrontbackmenuid(C(Pint) wsid, C(Pint *) frontid,`20 X C(Pint *) backid, C(Pint *) err) XPreANSI(Pint wsid) XPreANSI(Pint *frontid) XPreANSI(Pint *backid) XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPint *`7D`7Bfrontstid`7D`7Bfront menu identifier`7D`7BOUT`7D X** \param`7BPint *`7D`7Bbackstid`7D`7Bback menu identifier`7D`7BOUT`7D X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function may be used to obtain the menu identifiers X** of the front and back menus which are posted to workstation `7B\tt wsid`7 VD.`20 X** These are the menus with the highest and lowest post priority.`7D X**`20 X*/ X`7B X Pint ind; X X *err = 0; X findwsid(wsid, &ind); X if (wsmenus`5Bind`5D.postedmenus) X `7B X *frontid = wsmenus`5Bind`5D.frontptr->menuid; X *backid = wsmenus`5Bind`5D.backptr->menuid; X return TRUE; X `7D X else X return FALSE; X`7D /* ptk_inqfrontbackmenuid */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqboxmenuattrs(C(Pint) menuid,`20 X C(Ptxpath *) menupath, C(Pint *) font, C(Pint *) textcolour,`20 X C(Pint *) intcolour, C(Pint *) edgecolour, C(Pint *) boxtlcolour V,`20 X C(Pint *) boxbrcolour, C(Pint *) httextcolour,`20 X C(Pint *) htintcolour, C(Pint *) htedgecolour, C(Pint *) err) XPreANSI(Pint menuid) XPreANSI(Ptxpath *menupath) XPreANSI(Pint *font) XPreANSI(Pint *textcolour) XPreANSI(Pint *intcolour) XPreANSI(Pint *edgecolour) XPreANSI(Pint *boxtlcolour) XPreANSI(Pint *boxbrcolour) XPreANSI(Pint *httextcolour) XPreANSI(Pint *htintcolour) XPreANSI(Pint *htedgecolour)`20 XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Bmenuid`7D`7Bmenu identifier`7D`7BIN`7D X** \param`7BPtxpath *`7D`7Bmenupath`7D`7Bpath of box menu (left, right, up, V down)`7D`7BOUT`7D X** \param`7BPint *`7D`7Bfont`7D`7Btext font`7D`7BOUT`7D X** \param`7BPint *`7D`7Btextcolour`7D`7Bcolour index for text`7D`7BOUT`7D X** \param`7BPint *`7D`7Bintcolour`7D`7Bcolour index for interior`7D`7BOUT`7D X** \param`7BPint *`7D`7Bedgecolour`7D`7Bcolour index for edges`7D`7BOUT`7D X** \param`7BPint *`7D`7Bboxtlcolour`7D`7Bcolour index for top-left of box`7D V`7BOUT`7D X** \param`7BPint *`7D`7Bboxcolour`7D`7Bcolour index for bottom-right of box` V7D`7BOUT`7D X** \param`7BPint *`7D`7Bhttextcolour`7D`7Bcolour index for highlight text`7D V`7BOUT`7D X** \param`7BPint *`7D`7Bhtintcolour`7D`7Bcolour index for highlight interior V`7D`7BOUT`7D X** \param`7BPint *`7D`7Bhtedgecolour`7D`7Bcolour index for highlight edges`7 VD`7BOUT`7D X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function may be used to obtain the boxmenu attribute X** values for `7B\tt menuid`7D. These include the menu path, text font and X** colour indicies. The error code = 1 if `7B\tt menuid`7D doesn't exist X** and = 2 if it is not a box menu.`7D X*/ X`7B X *err = 0; X setmenu(menuid); X if (menuptr != NULL) X `7B X if (menuptr->menutype == PTKEBOXMENU) X `7B X *menupath = menuptr->menupath; X *font = menuptr->font; X *textcolour = menuptr->textcolour; X *intcolour = menuptr->intcolour; X *edgecolour = menuptr->edgecolour; X *boxtlcolour = menuptr->tlcolour; X *boxbrcolour = menuptr->brcolour; X *httextcolour = menuptr->httextcolour; X *htintcolour = menuptr->htintcolour; X *htedgecolour = menuptr->htedgecolour; X `7D X else X *err = 2; X `7D X else X *err = 1; X`7D /* ptk_inqboxmenuattrs */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqmenuposition(C(Pint) menuid, C(Ppoint *) position,`20 X C(Pint *) err) XPreANSI(Pint menuid) XPreANSI(Ppoint *position) XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Bmenuid`7D`7Bmenu identifier`7D`7BIN`7D X** \param`7BPpoint *`7D`7Bposition`7D`7Bmenu position`7D`7BOUT`7D X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function may be used to obtain the position of the X** top-left corner of first menu item. The position is returned in the X** range `5B0, 1`5D. The error code = 1 if `7B\tt menuid`7D doesn't exist.`7 VD X*/ X`7B X *err = 0; X setmenu(menuid); X if (menuptr != NULL) X *position = menuptr->menuposition; X else X *err = 1; X`7D /* ptk_inqmenuposition */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqboxmenuhighlightitem(C(Pint) menuid, C(Pint *) item,`20 X C(Pint *) err) XPreANSI(Pint menuid) XPreANSI(Pint *item) XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Bmenuid`7D`7Bmenu identifier`7D`7BIN`7D X** \param`7BPint *`7D`7Bitem`7D`7Bhightlight item number`7D`7BOUT`7D X** \param`7BPint *`7D`7Berr`7D`7Berror indicator`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function may be used to obtain the item number of the X** currently highlight box menu item.`20 X** The error code = 1 if `7B\tt menuid`7D doesn't exist and = 2 if there X** is no highlighted item.`7D X*/ X`7B X *err = 0; X setmenu(menuid); X if (menuptr != NULL) X `7B X if (menuptr->highlight > 0) X *item = menuptr->highlight; X else X *err = 2; X `7D X else X *err = 1; X`7D /* ptk_inqboxmenuhighlightitem */ X X/*-------------------------------------------------------------------------- V*/ X/*------------------- exported rotator routines ---------------------------- V*/ X/*-------------------------------------------------------------------------- V*/ X Xstatic void createrotator(C(Pint) wsid, C(Pint) menuid, X C(ptkerotatortype) rottype, C(Ppoint *) size,`20 X C(Pchar *) titlestr, C(Pfloat) titleheight, C(Pint) titlecolour, X C(Pint) titlefont, C(Pint) arrowcolour, C(Pint) arrowedgecolour, X C(Pint) intcolour, C(Pint) edgecolour, C(Pint) bannercolour,`20 X C(Pint) boxtlcolour, C(Pint) boxbrcolour) XPreANSI(Pint wsid) XPreANSI(Pint menuid) XPreANSI(ptkerotatortype rottype) XPreANSI(Ppoint *size) XPreANSI(Pchar *titlestr) XPreANSI(Pfloat titleheight) XPreANSI(Pint titlecolour) XPreANSI(Pint titlefont) XPreANSI(Pint arrowcolour) XPreANSI(Pint arrowedgecolour) XPreANSI(Pint intcolour) XPreANSI(Pint edgecolour) XPreANSI(Pint bannercolour) XPreANSI(Pint boxtlcolour) XPreANSI(Pint boxbrcolour) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bmenuid`7D`7Brotator identifier`7D`7BIN`7D X** \param`7Bptkerotatortype`7D`7Brottype`7D`7Brotator type`7D`7BIN`7D X** \param`7BPpoint *`7D`7Bsize`7D`7Brotator size`7D`7BIN`7D X** \param`7BPchar *`7D`7Btitlestr`7D`7Brotator title`7D`7BIN`7D X** \param`7BPfloat`7D`7Btitleheight`7D`7Brotator title height`7D`7BIN`7D X** \param`7BPint`7D`7Btitlecolour`7D`7Btitle colour index`7D`7BIN`7D X** \param`7BPint`7D`7Btitlefont`7D`7Btitle font`7D`7BIN`7D X** \param`7BPint`7D`7Barrowcolour`7D`7Barrow interior colour index`7D`7BIN`7 VD X** \param`7BPint`7D`7Barrowedgecolour`7D`7Barrow edge colour index`7D`7BIN`7 VD X** \param`7BPint`7D`7Bintcolour`7D`7Brotator interior colour index`7D`7BIN`7 VD X** \param`7BPint`7D`7Bedgecolour`7D`7Bedge colour index`7D`7BIN`7D X** \param`7BPint`7D`7Bbannercolour`7D`7Bbanner colour index`7D`7BIN`7D X** \param`7BPint`7D`7Bboxtlcolour`7D`7Btop-left colour index`7D`7BIN`7D X** \param`7BPint`7D`7Bboxbrcolour`7D`7Bbottom-right colour index`7D`7BIN`7D X** \paramend X** \blurb`7BCreate rotator with given specification.`7D X*/ X`7B X Pmatrix3 matrix, mat, boxmat; X Pchar stname`5B30`5D; X Pint arrowid, menustid; X Pint elptr, pickval, err; X Pfloat charheight; X Plimit3 ubox, rbox; X Ppoint3 arrowcentre, centre; X Ppoint3 arrowshift, arrowscale, boxscale; X Ppointlst sets; X Ppoint pts`5B4`5D, centresize, framesize; X Ptxalign txalign; X X setmenu(menuid); X if (menuptr == NULL) X `7B X sprintf(stname, "struct$menu%d", menuid); X menustid = ptk_stringtoint("structureid", stname); X ptk_createusermenu(menuid, menustid); X setmenu(menuid); X ptk_openstruct(menustid); X ptk_seteditmode(PEDIT_INSERT); X psetelemptr(0); X psetelemptrlabel(ptk_stringtoint("label", "begin-menu")); X poffsetelemptr(-2); X `20 X /* rotator surrounds */ X menuptr->wsid = wsid; X menuptr->font = titlefont; X menuptr->menutype = PTKEROTATOR; X menuptr->intcolour = intcolour; X menuptr->edgecolour = edgecolour; X menuptr->tlcolour = boxtlcolour; X menuptr->brcolour = boxbrcolour; X menuptr->textcolour = titlecolour; X menuptr->arrowcolour = arrowcolour; X menuptr->arrowedgecolour = arrowedgecolour; X menuptr->bannercolour = bannercolour; X strcpy(menuptr->longstr, titlestr); X `20 X centre = ptk_point3(0.0, titleheight / 2.0, 0.0); X centresize = *size; X framesize = ptk_point(0.01, 0.01); X centresize.y += titleheight; X centresize.x -= framesize.x * 2.0; X centresize.y -= framesize.y * 2.0; X ptk_framebox(¢re, ¢resize, &framesize, X intcolour, edgecolour, boxtlcolour, boxbrcolour); X pts`5B0`5D = ptk_point(-centresize.x / 2.0, centresize.y / 2.0 -`20 X titleheight / 2.0); X pts`5B1`5D = ptk_point(pts`5B0`5D.x, pts`5B0`5D.y + titleheight); X pts`5B2`5D = ptk_point(pts`5B0`5D.x + centresize.x, pts`5B1`5D.y); X pts`5B3`5D = ptk_point(pts`5B2`5D.x, pts`5B0`5D.y); X sets.number = 4; X sets.points = pts; X psetintcolourind(bannercolour); X ptk_fillareaset(1, &sets); X menuptr->bannerbox = ptk_point(centresize.x, titleheight); X txalign.hor = PAH_CENTRE; X txalign.ver = PAV_BOTTOM; X psettextalign(&txalign); X psettextfont(menuptr->font); X psettextcolourind(titlecolour); X plabel(ptk_stringtoint("label", "rotator$title")); X ptk_computecharheight(wsid, titlestr, &menuptr->bannerbox, menuptr->font V,`20 +-+-+-+-+-+-+-+- END OF PART 213 +-+-+-+-+-+-+-+-