-+-+-+-+-+-+-+-+ START OF PART 212 -+-+-+-+-+-+-+-+ X `7B /* do nothing */ `7D X else X if ((lim.ymin < 0.0) && (lim.ymax > 1.0)) X `7B /* do nothing */ `7D X else X if ((lim.xmin < 0.0) && (lim.ymin < 0.0)) X `7B X /* bottom left */ X pos.x += MIN(1.0 - lim.xmax, -lim.xmin); X pos.y += MIN(1.0 - lim.ymax, -lim.ymin); X `7D X else X if ((lim.xmin < 0.0) && (lim.ymax > 1.0)) X `7B X /* top left */ X pos.x += MIN(1.0 - lim.xmax, -lim.xmin); X pos.y -= MIN(lim.ymin, lim.ymax - 1.0); X `7D X else X if ((lim.xmax > 1.0) && (lim.ymin < 0.0)) X `7B X /* bottom right */ X pos.x -= MIN(lim.xmin, lim.xmax - 1.0); X pos.y += MIN(1.0 - lim.ymax, -lim.ymin); X `7D X else X if ((lim.xmax > 1.0) && (lim.ymax > 1.0)) X `7B X /* top right */ X pos.x -= MIN(lim.xmin, lim.xmax - 1.0); X pos.y -= MIN(lim.ymin, lim.ymax - 1.0); X `7D X else`20 X if (lim.xmin < 0.0) X pos.x += MIN(1.0 - lim.xmax, -lim.xmin); X else X if (lim.xmax > 1.0) X pos.x -= MIN(lim.xmin, lim.xmax - 1.0); X else X if (lim.ymin < 0.0) X pos.y += MIN(1.0 - lim.ymax, -lim.ymin); X else X if (lim.ymax > 1.0) X pos.y -= MIN(lim.ymin, lim.ymax - 1.0); X `7D X ptk_openstruct(menuptr->menustid); X psetelemptr(0); X psetelemptrlabel(ptk_stringtoint("label", "globaltran")); X poffsetelemptr(1); X pdelelem(); X mpos = ptk_point3(pos.x, pos.y, 0.0); X ptk_shift3(&mpos, PREPLACE, mat); X psetglobaltran3(mat); `20 X ptk_closestruct(); X menuptr->menuposition = pos; X `7D X`7D /* ptk_setmenuposition */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setboxmenutextfont(C(Pint) wsid, C(Pint) menuid,`20 X C(Pint) font) XPreANSI(Pint wsid) XPreANSI(Pint menuid) XPreANSI(Pint font) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bmenuid`7D`7Bmenu identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bfont`7D`7Btext font`7D`7BIN`7D X** \paramend X** \blurb`7BThis function sets the text font of all text menu items in the X** menu structure. The menu must be a box menu.`7D X*/ X`7B X Ppoint pt; X Pfloat charheight; X X setmenu(menuid); X if (menuptr != NULL) X `7B X if (menuptr->menutype == PTKEBOXMENU) X `7B X menuptr->wsid = wsid; X menuptr->font = font; X ptk_openstruct(menuptr->menustid); X psetelemptr(0); X psetelemptrlabel(ptk_stringtoint("label", "charheight")); X poffsetelemptr(2); X pdelelem(); X psettextfont(font); X ptk_closestruct(); X if (menuptr->longstr`5B0`5D != '\0') X `7B X pt = ptk_point(menuptr->boxsize.x -`20 X (2.0 * menuptr->framesize.x),`20 X menuptr->boxsize.y - X (2.0 * menuptr->framesize.y));`20 X ptk_computecharheight(menuptr->wsid, menuptr->longstr, `20 X &pt, menuptr->font, &charheight); X if (charheight < menuptr->charheight) X `7B X menuptr->charheight = charheight; X ptk_openstruct(menuptr->menustid); X psetelemptr(0); X psetelemptrlabel(ptk_stringtoint("label", "charheight")); X poffsetelemptr(1); X pdelelem(); X psetcharheight(charheight); X ptk_closestruct(); X `7D`20 X `7D X `7D X `7D X`7D /* ptk_setboxmenutextfont */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setboxmenuattrs(C(Pint) wsid, 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,`20 X C(Pint) boxbrcolour, C(Pint) httextcolour,`20 X C(Pint) htintcolour, C(Pint) htedgecolour) XPreANSI(Pint wsid) 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 X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bmenuid`7D`7Bmenu identifier`7D`7BIN`7D X** \param`7BPtxpath`7D`7Bmenupath`7D`7Bpath of box menu (left, right, up, do Vwn)`7D`7BIN`7D X** \param`7BPint`7D`7Bfont`7D`7Btext font`7D`7BIN`7D X** \param`7BPint`7D`7Btextcolour`7D`7Bcolour index for text`7D`7BIN`7D X** \param`7BPint`7D`7Bintcolour`7D`7Bcolour index for interior`7D`7BIN`7D X** \param`7BPint`7D`7Bedgecolour`7D`7Bcolour index for edges`7D`7BIN`7D X** \param`7BPint`7D`7Bboxtlcolour`7D`7Bcolour index for top-left of box`7D`7 VBIN`7D X** \param`7BPint`7D`7Bboxcolour`7D`7Bcolour index for bottom-right of box`7D V`7BIN`7D X** \param`7BPint`7D`7Bhttextcolour`7D`7Bcolour index for highlight text`7D`7 VBIN`7D X** \param`7BPint`7D`7Bhtintcolour`7D`7Bcolour index for highlight interior`7 VD`7BIN`7D X** \param`7BPint`7D`7Bhtedgecolour`7D`7Bcolour index for highlight edges`7D` V7BIN`7D X** \paramend X** \blurb`7BThis function sets the box menu path, text font and colour attri Vbute X** values. The highlight colour indicies are used by the function X** `7B\tt ptk\_setboxmenuhighlightitem`7D to highlight a single menu item.`7 VD X*/ X`7B X Ppoint pt; X Pfloat charheight; X Pint elptr, lstnum, intstate, err, itemnum; X Peltype elemlist`5B3`5D; X Psrchstatus srchstatus; X Pchar *buffer; X ptkselcontent elcont; X Pmatrix3 shiftmat; X Ppoint3 tlpt; X X setmenu(menuid); X if (menuptr != NULL) X `7B X if (menuptr->menutype == PTKEBOXMENU) X `7B X menuptr->wsid = wsid; X menuptr->font = font; X menuptr->menupath = menupath; X menuptr->intcolour = intcolour; X menuptr->edgecolour = edgecolour; X menuptr->tlcolour = boxtlcolour; X menuptr->brcolour = boxbrcolour; X menuptr->textcolour = textcolour; X menuptr->httlcolour = boxbrcolour; X menuptr->htbrcolour = boxtlcolour; X menuptr->htintcolour = htintcolour; X menuptr->htedgecolour = htedgecolour; X menuptr->httextcolour = httextcolour; X X /* set colours */ X ptk_openstruct(menuptr->menustid); X psetelemptr(0); X psetelemptrlabel(ptk_stringtoint("label", "begin-menu")); X `20 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 = 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 psetedgecolourind(menuptr->edgecolour); X break; X X case 1: /* PEL_TEXT_COLOUR_INDEX */ X psettextcolourind(menuptr->textcolour); X break; X X case 2: /* PEL_INTERIOR_COLOUR_INDEX */ X switch (intstate) X`09 `7B X case 1: /* top-left edge */ X psetintcolourind(menuptr->tlcolour); X break; X X case 2: /* bottom-right edge */ X psetintcolourind(menuptr->brcolour); X break; X X case 3: /* box */ X psetintcolourind(menuptr->intcolour); X break; X `7D X intstate++; X if (intstate == 4) X intstate = 1; X break; X `7D X ptk_unseteditmode(); X poffsetelemptr(1); X `7D X `7D while (srchstatus == PSUCCESS); X `20 X /* redo highlight item */ X if (menuptr->highlight > 0) X `7B X psetelemptr(0); `20 X find_item(menuptr->menustid, menuptr->highlight, &elptr); X psetelemptr(elptr); X redrawboxmenuitem(menuptr->httextcolour,`20 X menuptr->htintcolour, menuptr->htedgecolour,`20 X menuptr->httlcolour, menuptr->htbrcolour); X `7D X ptk_closestruct(); X X /* set text font */ X ptk_openstruct(menuptr->menustid); X psetelemptr(0); X psetelemptrlabel(ptk_stringtoint("label", "charheight")); X poffsetelemptr(2); X pdelelem(); X psettextfont(font); X ptk_closestruct(); X if (menuptr->longstr`5B0`5D != '\0') X `7B X pt = ptk_point(menuptr->boxsize.x -`20 X (2.0 * menuptr->framesize.x),`20 X menuptr->boxsize.y - X (2.0 * menuptr->framesize.y));`20 X ptk_computecharheight(menuptr->wsid, menuptr->longstr, `20 X &pt, menuptr->font, &charheight); X if (charheight < menuptr->charheight) X `7B X menuptr->charheight = charheight; X ptk_openstruct(menuptr->menustid); X psetelemptr(0); X psetelemptrlabel(ptk_stringtoint("label", "charheight")); X poffsetelemptr(1); X pdelelem(); X psetcharheight(charheight); X ptk_closestruct(); X `7D`20 X `7D X `20 X /* set menu path */ X ptk_openstruct(menuptr->menustid); X psetelemptr(0); X psetelemptrlabel(ptk_stringtoint("label", "begin-menu")); X X /* replace all local transformations following pick identifiers */ X elemlist`5B0`5D = PEL_PICK_ID; X elemlist`5B1`5D = PEL_LOCAL_MODELLING_TRANSFORMATION3; X do X `7B X ptk_findelemtype(elemlist, 2, PFORWARD, &srchstatus, &elptr, &lstnum V); X if (srchstatus == PSUCCESS) X`09`7B X psetelemptr(elptr); X switch (lstnum) X`09 `7B X case 0: /* PEL_PICK_ID */ X ptk_inqcurelemtypesizecontent(&err, &buffer, &elcont); X itemnum = elcont.eldata.idata; X free(buffer); X break; X X case 1: /* PEL_LOCAL_MODELLING_TRANSFORMATION3 */ X if (itemnum > 0) X`09 `7B X tlpt = get_tlboxcorner(itemnum); X ptk_shift3(&tlpt, PREPLACE, shiftmat); X ptk_seteditmode(PEDIT_REPLACE); X psetlocaltran3(shiftmat, PREPLACE);`20 X ptk_unseteditmode(); X itemnum = 0; X `7D X break; X `7D X poffsetelemptr(1); X `7D X `7D while (srchstatus == PSUCCESS); `20 X ptk_closestruct(); X `7D X `7D X`7D /* ptk_setboxmenuattrs */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setboxmenuhighlightitem(C(Pint) menuid, C(Pint) itemnum) XPreANSI(Pint menuid) XPreANSI(Pint itemnum) X/* X** \parambegin X** \param`7BPint`7D`7Bmenuid`7D`7Bmenu identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bitemnum`7D`7Bmenu item number`7D`7BIN`7D X** \paramend X** \blurb`7BThis function highlights a menu item by setting the colour X** index values for the text, interior and edge of a box menu item.`7D X*/ X`7B X Pint elptr; X X setmenu(menuid); X if (menuptr != NULL) X `7B X if (menuptr->menutype == PTKEBOXMENU) X `7B X ptk_openstruct(menuptr->menustid); X ptk_seteditmode(PEDIT_INSERT); X psetelemptr(0); X if (itemnum != menuptr->highlight) X `7B X /* redraw previously highlighted item in normal colours*/ X if (menuptr->highlight > 0) X `7B X /* redraw item */ X find_item(menuptr->menustid, menuptr->highlight, &elptr); X psetelemptr(elptr); X redrawboxmenuitem(menuptr->textcolour,`20 X menuptr->intcolour, menuptr->edgecolour,`20 X menuptr->tlcolour, menuptr->brcolour); X `7D X /* redraw item in highlight colours */ X find_item(menuptr->menustid, itemnum, &elptr); X psetelemptr(elptr); X redrawboxmenuitem(menuptr->httextcolour,`20 X menuptr->htintcolour, menuptr->htedgecolour,`20 X menuptr->httlcolour, menuptr->htbrcolour); X `7D X ptk_unseteditmode(); X ptk_closestruct(); X menuptr->highlight = itemnum; X `7D X `7D X`7D /* ptk_setboxmenuhighlightitem */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_clearboxmenuhighlight(C(Pint) menuid) XPreANSI(Pint menuid) X/* X** \parambegin X** \param`7BPint`7D`7Bmenuid`7D`7Bmenu identifier`7D`7BIN`7D X** \paramend X** \blurb`7BThis function returns the attributes of the highlighted menu ite Vm X** to their original values. If no item is highlighted the function is X** ignored.`7D X*/ X`7B X Pint elptr; X X setmenu(menuid); X if (menuptr != NULL) X `7B X if (menuptr->highlight > 0) X `7B X ptk_openstruct(menuptr->menustid); X ptk_seteditmode(PEDIT_INSERT); X psetelemptr(0); X `20 X find_item(menuptr->menustid, menuptr->highlight, &elptr); X psetelemptr(elptr); X redrawboxmenuitem(menuptr->textcolour,`20 X menuptr->intcolour, menuptr->edgecolour,`20 X menuptr->tlcolour, menuptr->brcolour); X `20 X ptk_unseteditmode(); X ptk_closestruct(); X menuptr->highlight = 0; X `7D X `7D X`7D /* ptk_clearboxmenuhighlight */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_inqpostedmenus(C(Pint) wsid, C(Pint) size,`20 X C(Pintlst *) menuids, C(Pint *) totalsize, C(Pint *) err) XPreANSI(Pint wsid) XPreANSI(Pint size) XPreANSI(Pintlst *menuids) XPreANSI(Pint *totalsize) XPreANSI(Pint *err) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bsize`7D`7Bsize of buffer`7D`7BIN`7D X** \param`7BPintlst *`7D`7Bmenuids`7D`7Blist of posted menus`7D`7BOUT`7D +-+-+-+-+-+-+-+- END OF PART 212 +-+-+-+-+-+-+-+-