-+-+-+-+-+-+-+-+ START OF PART 284 -+-+-+-+-+-+-+-+ X ppoststruct(windptr->wsid, windptr->windowstid, priority); X windptr->windowstate = PTKEWINDOWOPEN; X windptr->currentstid = windptr->windowstid; X `7D X `7D X`7D /* ptk_openwindow */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_closewindow(C(Pint) windid) XPreANSI(Pint windid) X/* X** \parambegin X** \param`7BPint`7D`7Bwindid`7D`7Bwindow identifier`7D`7BIN`7D X** \paramend`20 X** \blurb`7BThis function posts the icon structure and unposts the window X** structure from the window's workstation.`7D X*/ X`7B X Pfloat priority; X Pint err; X X setwindow(windid); X if (windptr != NULL) X `7B X if (windptr->windowstate == PTKEWINDOWOPEN) X `7B X ptk_inqpostpriority(windptr->wsid, windptr->windowstid, &priority,`20 X &err); X punpoststruct(windptr->wsid, windptr->windowstid); X ppoststruct(windptr->wsid, windptr->iconstid, priority); X windptr->windowstate = PTKEWINDOWCLOSED; X windptr->currentstid = windptr->iconstid; X `7D X `7D X`7D /* ptk_closewindow */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setwindowposition(C(Pint) windid, C(Ppoint *) position) XPreANSI(Pint windid) XPreANSI(Ppoint *position) X/* X** \parambegin X** \param`7BPint`7D`7Bwindid`7D`7Bwindow identifier`7D`7BIN`7D X** \param`7BPpoint *`7D`7Bposition`7D`7Bwindow position`7D`7BIN`7D X** \paramend`20 X** \blurb`7BThis function sets the position of the centre of the window. X** The position is given in the range `5B0, 1`5D. If the position results X** in part of the window being clipped then the position is adjusted X** so that the whole window is visible.`7D X*/ X`7B`20 X setwindow(windid); X if (windptr != NULL) X `7B X windptr->windowposition = *position; X setvalidwindowpos(); X updateframe(); X adjustlimits(&windptr->viewvolume); X if (windptr->windowtype == PTKETERMINALWINDOW) X windptr->viewport = windptr->cliplimit = windptr->viewlims; X if (windptr->windowtype == PTKECONTENTWINDOW) X ptk_setcontentviewrange(windid, windptr->viewrange1,`20 X windptr->viewrange2); X else X updatewindowview(); X `7D X`7D /* ptk_setwindowposition */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setwindowsize(C(Pint) windid, C(Ppoint *) size) XPreANSI(Pint windid) XPreANSI(Ppoint *size) X/* X** \parambegin X** \param`7BPint`7D`7Bwindid`7D`7Bwindow identifier`7D`7BIN`7D X** \param`7BPpoint *`7D`7Bsize`7D`7Bwindow size`7D`7BIN`7D X** \paramend`20 X** \blurb`7BThis function sets the size of the window using the x value X** as the width and the y value as the height. The values are given X** in the range `5B0, 1`5D. If the size results in part of the window X** being clipped then the window size is adjusted to give as large a X** window as possible.`7D X*/ X`7B X Pfloat height, extraspace, textspace, oldlinesize; X Pfloat newlinesize, newlines; X Ppoint oldsize; X X setwindow(windid); X if (windptr != NULL) X `7B X oldsize = windptr->windowsize; X windptr->windowsize = *size; X setvalidwindowsize(); X switch (windptr->windowtype) X `7B X case PTKESTRUCTWINDOW: X updateframe(); X adjustlimits(&windptr->viewvolume); X updatewindowview(); X break; X X case PTKETERMINALWINDOW: X windptr->term.realcols *= (windptr->windowsize.x / oldsize.x);`20 X windptr->term.columns = windptr->term.curr_colm =`20 X (Pint)windptr->term.realcols; X height = windptr->windowsize.y / oldsize.y; X oldlinesize = oldsize.y/(Pfloat)windptr->term.lines; X windptr->term.reallines *= height; X newlines = (Pfloat)floor(windptr->term.reallines); X extraspace = windptr->windowsize.y - (oldsize.y *`20 X (newlines / (Pfloat)windptr->term.lines)); X windptr->term.lines = (Pint)windptr->term.reallines; X windptr->term.increment += extraspace/newlines; X newlinesize = size->y/(Pfloat)windptr->term.lines;`20 X textspace = (Pfloat)windptr->term.curr_line * oldlinesize; X windptr->term.curr_line = (Pint)((Pfloat)textspace / newlinesize) + V 1; X updateframe(); X initialiseterminal(); X break; X X case PTKECONTENTWINDOW: X updateframe(); X ptk_setcontentviewrange(windid, windptr->viewrange1,`20 X windptr->viewrange2); X break; X X case PTKETOPOLOGYWINDOW: X updateframe(); X ptk_settopologyviewarea(windid, &windptr->topviewarea); X break; X `7D X `7D X`7D /* ptk_setwindowsize */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setwindowtraninputpri(C(Pint) windid, C(Pint) refwindid,`20 X C(Pvpri) priority) XPreANSI(Pint windid) XPreANSI(Pint refwindid) XPreANSI(Pvpri priority) X/* X** \parambegin X** \param`7BPint`7D`7Bwindid`7D`7Bwindow identifier`7D`7BIN`7D X** \param`7BPint`7D`7Brefwindid`7D`7Breference window identifier`7D`7BIN`7D X** \param`7BPvpri`7D`7Bpriority`7D`7Brelative priority`7D`7BIN`7D X** \paramend`20 X** \blurb`7BThis function sets the transformation input priority of the`20 X** window's view representation relative to another window. X** The relative priority is also set relative to view index 0.`7D X*/ X`7B X Pint refindex; X ptkswindow *ptrwindow; X X setwindow(windid); X if (windptr != NULL) X `7B X if (iswindow(refwindid, &ptrwindow)) X `7B X refindex = ptrwindow->windowviewind; X psetviewtraninputpri(windptr->wsid, windptr->windowviewind, refindex, X priority); X `7D X psetviewtraninputpri(windptr->wsid, windptr->windowviewind, 0, X priority); X `7D X`7D /* ptk_setwindowtraninputpri */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setframesize(C(Pint) windid, C(Ppoint *) size) XPreANSI(Pint windid) XPreANSI(Ppoint *size) X/* X** \parambegin X** \param`7BPint`7D`7Bwindid`7D`7Bwindow identifier`7D`7BIN`7D X** \param`7BPpoint *`7D`7Bsize`7D`7Bframe size`7D`7BIN`7D X** \paramend`20 X** \blurb`7BThis function sets the thickness of the window frame. The X** x and y dimensions are given in the range `5B0, 1`5D.`7D X*/ X`7B X setwindow(windid); X if (windptr != NULL) X `7B X if ((size->x > 0.0) && (size->y > 0.0)) X `7B `20 X windptr->framesize = *size; X updateframe(); X `7D X `7D X`7D /* ptk_setframesize */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern ptkboolean ptk_stringscanwindows(C(Pint) wsid, C(Pchar *) str,`20 X C(Pint *) windowid) XPreANSI(Pint wsid) XPreANSI(Pchar *str) XPreANSI(Pint *windowid) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPchar *`7D`7Bstr`7D`7Bstring`7D`7BIN`7D X** \param`7BPint *`7D`7Bwindowid`7D`7Bwindow identifier`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function compares the character string `7B\tt str`7D with X** title string of all the windows posted to workstation `7B\tt wsid`7D. X** The string comparison is case sensitive and begins with the X** front window and works back to the lowest priority window. X** The function returns TRUE if a match is found, otherwise FALSE.`7D X*/ X`7B X ptkboolean windowfound; X Pintlst *windows; X ptkswindow *ptrwindow; X Pint numstructs, i, err; X Pstructpostlst structlist; X Pintlst incl, excl; X Pint incllen, excllen; X X windowfound = FALSE; X structlist.postings = NULL; 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 X /* inquire invisibility filter */ X pinqinvisfilter(wsid, 0, 0, 0, 0, &err, &incl, &incllen, &excl, &excllen); X incl.integers = (Pint *)calloc(incllen, sizeof(Pint)); X excl.integers = (Pint *)calloc(excllen, sizeof(Pint)); X incl.number = incllen; X excl.number = excllen; X pinqinvisfilter(wsid, incllen, 0, excllen, 0, &err, &incl, &incllen,`20 X &excl, &excllen); X X /* This bit is a bit dodgy because it relies on structlist being ordered X ** by PHIGS into highest priority last. This is not standard PHIGS, X ** so if version is not sorted do a sort. X */ X i = numstructs - 1; X while ((i >= 0) && (!windowfound))`20 X `7B X if (iswindow(structlist.postings`5Bi`5D.id, &ptrwindow)) X `7B X /* check invisibility filter */ X if (!((inintlst(ptrwindow->windowname, &incl) != -1) &&`20 X (inintlst(ptrwindow->windowname, &excl) == -1))) X `7B X if (find_string(ptrwindow->currentstid, str)) X `7B X windowfound = TRUE; X *windowid = ptrwindow->windowid; X `7D X `7D X `7D X i--; X `7D X free(structlist.postings); X return windowfound; X`7D /* ptk_stringscanwindows */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern ptkboolean ptk_pickscanwindows(C(Ppickpath *) pickpath,`20 X C(Ppathorder) pathorder, C(Pint *) windowid, C(ptkewindowarea *) windoware Va) XPreANSI(Ppickpath *pickpath) XPreANSI(Ppathorder pathorder) XPreANSI(Pint *windowid) XPreANSI(ptkewindowarea *windowarea) X/* X** \parambegin X** \param`7BPpickpath *`7D`7Bpickpath`7D`7Bpath through structure network`7D V`7BIN`7D X** \param`7BPpathorder`7D`7Bpathorder`7D`7Border of path through network`7D` V7BIN`7D X** \param`7BPint *`7D`7Bwindowid`7D`7Bwindow identifier`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function tests the pick path to inquire if a window`20 X** structure was picked. The window area picked may be one of X** BANNER, VIEW, FRAME or ICON. The function X** returns TRUE if a window was picked, otherwise FALSE.`7D X*/ X`7B X Pint windowstid; X X if (pathorder == PTOP_FIRST) X `7B X *windowarea = pickpath->pick_path`5Bpickpath->depth - 1`5D.pick_id; X windowstid = pickpath->pick_path`5B0`5D.struct_id; X return (getwindowid(windowstid, windowid)); X `7D X else X `7B X *windowarea = pickpath->pick_path`5B0`5D.pick_id; X windowstid = pickpath->pick_path`5Bpickpath->depth - 1`5D.struct_id; X return (getwindowid(windowstid, windowid)); X `7D X`7D /* ptk_pickscanwindows */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern ptkboolean ptk_locscanwindows(C(Pint) wsid, C(Ppoint *) point,`20 X C(Pint *) windowid, C(ptkewindowarea *) windowarea, C(Ppoint *) valu Ve) XPreANSI(Pint wsid) XPreANSI(Ppoint *point) XPreANSI(Pint *windowid) XPreANSI(ptkewindowarea *windowarea) XPreANSI(Ppoint *value) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPpoint *`7D`7Bpoint`7D`7Binput point`7D`7BIN`7D X** \param`7BPint *`7D`7Bwindowid`7D`7Bwindow identifier`7D`7BOUT`7D X** \param`7Bptkewindowarea *`7D`7Bwindowarea`7D`7Bwindow area`7D`7BOUT`7D X** \param`7BPpoint *`7D`7Bvalue`7D`7Bposition of point within window area`7D V`7BOUT`7D X** \paramend X** \blurb`7BThis function uses the INCREMENTAL SPATIAL SEARCH function`20 X** of PHIGS to test if `7B\tt point`7D lies within a window X** posted to workstation `7B\tt wsid`7D. The window area (one of X** BANNER, VIEW, FRAME or ICON) and the position of `7B\tt point`7D relative X** to the bottom-left corner of the bounding box of the window area are X** returned in `7B\tt windowarea`7D and `7B\tt value`7D. X** The function returns TRUE if `7B\tt point`7D lies within a window, X** otherwise FALSE.`7D X*/ X`7B X ptkboolean windowfound; X ptkswindow *ptrwindow; X Plimit3 windowbox, area; X Pint numstructs, i, err; X Pstructpostlst structlist; X Pint lstnum, stopelem; X Peltype eltype; X Psrchstatus stat; X Pfloat div; X Pintlst incl, excl; X Pint incllen, excllen; X X ptk_stacktsl(); X ptk_stackbbox(); X eltype = PEL_VIEW_INDEX; X windowfound = FALSE; X structlist.postings = NULL; 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 X /* inquire invisibility filter */ X pinqinvisfilter(wsid, 0, 0, 0, 0, &err, &incl, &incllen, &excl, &excllen); X incl.integers = (Pint *)calloc(incllen, sizeof(Pint)); X excl.integers = (Pint *)calloc(excllen, sizeof(Pint)); X incl.number = incllen; X excl.number = excllen; X pinqinvisfilter(wsid, incllen, 0, excllen, 0, &err, &incl, &incllen,`20 X &excl, &excllen); X X /* This bit is a bit dodgy because it relies on structlist being ordered X ** by PHIGS into highest priority last. This is not standard PHIGS, X ** so if version is not sorted do a sort. X */ X i = numstructs - 1; X while ((i >= 0) && (!windowfound))`20 X `7B X if (iswindow(structlist.postings`5Bi`5D.id, &ptrwindow)) X `7B X /* check invisibility filter */ X if (!((inintlst(ptrwindow->windowname, &incl) != -1) &&`20 X (inintlst(ptrwindow->windowname, &excl) == -1))) X `7B X if (ptrwindow->windowstate == PTKEWINDOWOPEN) X`09`7B X ptk_openstruct(ptrwindow->currentstid); X psetelemptr(0); X ptk_findelemtype(&eltype, 1, PFORWARD, &stat, &stopelem, &lstnum); X ptk_closestruct(); X ptk_inittsl(); X ptk_tsltraverserange(ptrwindow->currentstid, 1,`20 X ptrwindow->currentstid, stopelem, TRUE); X ptk_inqboundingbox(&windowbox); X `7D X else X ptk_boundingbox(ptrwindow->currentstid, &windowbox, TRUE); X if (ptinlimit3(point, &windowbox)) X `7B X windowfound = TRUE; +-+-+-+-+-+-+-+- END OF PART 284 +-+-+-+-+-+-+-+-