-+-+-+-+-+-+-+-+ START OF PART 192 -+-+-+-+-+-+-+-+ X ptk_postmenu(WS1, inputmenuid); X X ptk_postmenu(WS1, usermenuid); `20 X pupdatews(WS1, PPERFORM); X usermenuquit = FALSE; X do X `7B X output.itemnum = 0; X if (getmenupick(inputmenuid, &output)) X `7B X switch (output.itemnum) X `7B X case 1: pickinput(&itemnum); X break; X case 2: pointinput(&itemnum); X break; X case 3: stringinput(&itemnum); X break; X case 4: usermenuquit = TRUE; X break; `20 X `7D X highlightshadeitem(lastitemnum); `20 X highlightshadeitem(itemnum); X lastitemnum = itemnum; X pupdatews(WS1, PPERFORM); X `7D X `7D while (!usermenuquit); X highlightshadeitem(lastitemnum); `20 X incl.number = 0; `20 X psetinvisfilter(WS1, &incl, &excl); X ptk_unpostmenu(WS1, usermenuid); X`7D X X/*-------------------------------------------------------------------------- V*/ X Xstatic void testrotator(C(void)) X/* enable pick and locator input on rotators */ X`7B X ptkboolean rotatorquit; X ptksmenuoutput output; X Pint err, itemnum; X X ptk_delmenuitem(inputmenuid, 3); X ptk_unpostmenu(WS1, mainmenuid); `20 X ptk_postmenu(WS1, inputmenuid); X `20 X ptk_postmenu(WS1, rotator1); X ptk_postmenu(WS1, rotator2); X ptk_postmenu(WS1, rotator3); X pupdatews(WS1, PPERFORM); X rotatorquit = FALSE; X do X `7B X output.itemnum = 0; X if (getmenupick(inputmenuid, &output)) X switch (output.itemnum) X `7B X case 1: pickinput(&itemnum); X break; X case 2: pointinput(&itemnum); X break; X case 3: rotatorquit = TRUE; X break; `20 X `7D X `7D while (!rotatorquit); X ptk_unpostmenu(WS1, rotator1); X ptk_unpostmenu(WS1, rotator2); X ptk_unpostmenu(WS1, rotator3); X ptk_createtextmenuitem(inputmenuid, "string", 3, PEDIT_INSERT, &err); X`7D X X/*-------------------------------------------------------------------------- V*/ X Xmain() X`7B X Peditmode mode; X Pint err; X Pinterbundl rotintrep, boxintrep; X Ptxbundl textrep; X Pedgebundl rotedgerep, boxedgerep; X ptkboolean menuquit; X ptksmenuoutput output; X Pwstables lens; X X /* open PHIGS */ X printf("Demonstrating the menus utility of the PHIGS Toolkit...\n"); X#ifdef VMS X printf("Opening DEC PHIGS...\n"); X popenphigs(0, 0); X popenws(WS1, 0, 0); X wst = 0; X#endif X#ifdef SUN X printf("Opening SunPHIGS...\n"); X popenphigs(stderr, PDEFAULT_MEM_SIZE); X `20 X /* create the workstation type (tool) */ X X wst = phigs_ws_type_create( phigs_ws_type_sun_tool, X`09PHIGS_TOOL_LABEL, "SunPHIGS Tool Workstation", X`090); X if ( !wst )`20 X `7B X pclosephigs(); X exit(1); X `7D X`20 X /* open the workstation */ X X popenws(WS1, (Pconnid)NULL, wst); X `7B X Pwsstate ws_state; X`09 X pinqwsst(&ws_state); X if (ws_state != PWSOP) X exit(3); X `7D X#endif X `20 X psetdisplayupdatest(WS1, PWAIT, PNIVE); X X /* set up required hashtables */ `20 X ptk_inithashtables(); X ptk_createhashtable("structureid", 0, 100); X ptk_createhashtable("viewindex", 1, 100); X ptk_createhashtable("label", 0, 100); X ptk_createhashtable("colourindex", 1, 100); X ptk_createhashtable("name", 1, 100); X ptk_createhashtable("menuid", 1, 100); X X#ifdef VMS X ptk_inqmaxdevicecoords(WS1, &devx, &devy); X devz = 0.0; X#endif X#ifdef SUN X devx = devy = devz = 1.0; X#endif X pointecho.xmin = pointecho.ymin = pointecho.zmin = 0.0; X pointecho.xmax = devx; X pointecho.ymax = devy; X pointecho.zmax = devz; X X#ifdef VMS X pinqwssttable(wst, &err, &lens); X if (lens.colour > 9) X docolour = TRUE; X#endif X#ifdef SUN X#ifndef SUNMONO X docolour = TRUE; X#endif X#endif X X /* set colours */ X if (docolour) X `7B X ptk_setupcolourtable(WS1, 9, colwrd); X ptk_setbackgroundcolourind(WS1, ptk_stringtoint("colourindex", "grey")); X `7D X X /* menus to select type of menu and type of input */ X `20 X makemainmenu(); X X makeinputmenu(); X X /* create box, user and rotator menus */ X X createbox(); X X createuser(); X X createrotator(); X X /* interaction loop */ X menuquit = FALSE; X do X `7B X ptk_postmenu(WS1, mainmenuid); X ptk_unpostmenu(WS1, inputmenuid); `20 X pupdatews(WS1, PPERFORM); X output.itemnum = 0; X if (getmenupick(mainmenuid, &output)) X switch (output.itemnum) X `7B X case 1: testboxmenu(); X break; X case 2: testusermenu(); X break; X case 3: testrotator(); X break; X case 4: menuquit = TRUE; X break; `20 X `7D X `7D while (!menuquit); X X pclosews(WS1); X printf("Closing PHIGS...\n"); X pclosephigs(); X exit(0); X`7D X X/*-------------------------------------------------------------------------- V*/ X X/* end of menutest.c */ $ CALL UNPACK [.SOURCE.DEMO]MENUTEST.C;3 137187573 $ create 'f' X/*-------------------------------------------------------------------------- V-`20 X X Program name: Phinter utility program. X X Author: Gareth Williams X X Description: X X Modification history : (Version), (Date), (Name), (Description). X X 1.0, 1st March 1991, G. Williams, First Version. X X---------------------------------------------------------------------------- V*/ X X#include X#include X#include X#include "ptk.h" X X/*-------------------------------------------------------------------------- V*/ X Xmain() X`7B X printf("Testing the phinter module of the PHIGS Toolkit...\n"); X ptk_inithashtables(); X ptk_createhashtable("structureid", 1, 100); X ptk_createhashtable("colourindex", 2, 32); X ptk_createhashtable("label", 1, 100); X ptk_createhashtable("pickid", 1, 100); X ptk_createhashtable("viewindex", 1, 64); X ptk_createhashtable("name", 1, 100); X ptk_callphinter(); X exit(0); X`7D X X/*-------------------------------------------------------------------------- V*/ X X/* end of phinter.c */ $ CALL UNPACK [.SOURCE.DEMO]PHINTER.C;1 2070889758 $ create 'f' X/*-------------------------------------------------------------------------- V-`20 X X Program name: Structure Content Drawer demo program. X X Author: Gareth Williams X X Description: Demonstrates the structure content drawer module. X X Modification history : (Version), (Date), (Name), (Description). X X 1.0, 1st July 1991, G. Williams, First Version. X X SunOS requirements: SunPHIGS (all versions before v2.0), X SunView or OpenWindows. X VMS requirements: DEC PHIGS v2.2, DECWindows workstation type. X (To run with ReGIS workstation type remove all printf statements) X X---------------------------------------------------------------------------- V*/ X X#include X#include X#include X#include "ptk.h" X X#define WS1 1 X X#ifdef SUN X#define SCRIPTNAME "../scripts/postcard.scr" X#endif X#ifdef VMS X#define SCRIPTNAME "`5B-.scripts`5Dpostcard.scr" X#endif X Xstatic Pfloat devx, devy, devz; X X/*-------------------------------------------------------------------------- V*/ X Xstatic void options(C(void)) X`7B X Pchar commandstr`5B20`5D, writestr`5B50`5D; X Pint lencom, lenstr, err, elem1, elem2, eptr, postcardid; X ptkboolean structquit; X Plimit echoarea; X X structquit = FALSE; X eptr = 0; X postcardid = ptk_stringtoint("structureid", "postcard"); X do X `7B X echoarea = ptk_limit(0.0, devx * 0.5, 0.0, devy * 0.05); X ptk_readstring(WS1, "range", "Input command (default = range) >",`20 X &echoarea, 20, commandstr, &lencom); X if (strncmp(commandstr, "range", lencom) == 0) X `7B X elem1 = ptk_readint(WS1, 1, "Input element number (1) >", &echoarea); X elem2 = ptk_readint(WS1, 0, "Input element number (0) >", &echoarea); X pemptystruct(ptk_stringtoint("structureid", "content")); X popenstruct(ptk_stringtoint("structureid", "content")); X ptk_structcontent(WS1, postcardid, elem1, elem2, eptr, 1, &err); X pclosestruct(); X `7D X else X if (strncmp(commandstr, "pointer", lencom) == 0) X `7B X eptr = ptk_readint(WS1, 0, "Input element pointer (0) >", &echoarea); X popenstruct(ptk_stringtoint("structureid", "content")); X ptk_setstructcontentelemptr(ptk_stringtoint("structureid", "content"), V`20 X eptr); X pclosestruct(); X `7D X else if (strncmp(commandstr, "hardcopy", lencom) == 0) X `7B X Pint stid, lenname; X Pchar filename`5B80`5D; X X ptk_readstring(WS1, "content",`20 X "Input filename (default = content) >", &echoarea, X 80, filename, &lenname); X#ifdef VMS X popenws(2, filename, 61); X#endif X#ifdef SUN X popenws(2, filename, phigs_ws_type_cgm_out); X#endif X ppoststruct(2, ptk_stringtoint("structureid", "content"), 0.0); X pupdatews(2, PPERFORM); X pclosews(2); X `7D `20 X else if (strncmp(commandstr, "help", lencom) == 0) X `7B X printf("stcttest options\n"); X printf("----------------\n"); X printf("range - define element range for structure content diagram\n") V; X printf("pointer - set element pointer\n"); X printf("hardcopy - post structure content to hardcopy workstation\n"); X printf("quit - exit stcttest\n"); X `7D `20 X else if (strncmp(commandstr, "quit", lencom) == 0) X `7B X structquit = TRUE; X `7D `20 X else X `7B X printf("Command unknown\n"); `20 X `7D X pupdatews(WS1, PPERFORM); X `7D while (structquit == FALSE); X`7D X X/*-------------------------------------------------------------------------- V*/ X Xmain() X`7B X FILE *f; X Pchar dummystr`5B10`5D; X Pint dummylen, err, minid, maxid; X Pwstype wst; X X printf("Demonstrating the structure draw module of the PHIGS Toolkit...\n" V); X#ifdef VMS X printf("Opening DEC PHIGS...\n"); X popenphigs(0, 0); X popenws(WS1, 0, 0); X#endif X#ifdef SUN X printf("Opening SunPHIGS...\n"); X popenphigs((Pchar*)NULL, PDEFAULT_MEM_SIZE); X `20 X /* create the workstation type (either tool or canvas) */ X X wst = phigs_ws_type_create( phigs_ws_type_sun_tool, X`09PHIGS_TOOL_LABEL, "SunPHIGS Tool Workstation", X`090); X if ( !wst )`20 X `7B X pclosephigs(); X exit(1); X `7D X`20 X /* open the workstation */ X X popenws(WS1, (Pconnid)NULL, wst); X `7B X Pwsstate ws_state; X`09 X pinqwsst(&ws_state); X if (ws_state != PWSOP) X exit(3); X `7D X#endif X X#ifdef VMS X ptk_inqmaxdevicecoords(WS1, &devx, &devy); X devz = 0.0; X#endif X#ifdef SUN X devx = devy = devz = 1.0; X#endif X X psetdisplayupdatest(WS1, PWAIT, PNIVE); X minid = 1; X maxid = 30; X ptk_inithashtables(); X ptk_createhashtable("structureid", minid, maxid); X ptk_createhashtable("label", 0, maxid); X X if (ptk_readphinterscript(SCRIPTNAME, NULL, NULL)) X `7B X popenstruct(ptk_stringtoint("structureid", "content")); X ptk_structcontent(WS1, ptk_stringtoint("structureid", "postcard"),`20 X 1, 0, 0, 1, &err); X pclosestruct(); X X if (err == 0) X ppoststruct(WS1, ptk_stringtoint("structureid", "content"), 0.0); X X pupdatews(WS1, PPERFORM); X options(); X `7D X X pclosews(1); X pclosephigs(); X exit(0); X`7D X X/*-------------------------------------------------------------------------- V*/ X X/* end of stcttest.c */ $ CALL UNPACK [.SOURCE.DEMO]STCTTEST.C;2 1415403841 $ create 'f' X/*-------------------------------------------------------------------------- V-`20 X X Program name: Topology Drawer demo program. X X Author: Gareth Williams X X Description: Demonstrates the topology drawer module. X X Modification history : (Version), (Date), (Name), (Description). X X 1.0, 1st June 1991, G. Williams, First Version. X X SunOS requirements: SunPHIGS (all versions before v2.0), X SunView or OpenWindows. X VMS requirements: DEC PHIGS v2.2, DECWindows workstation type. X (To run with ReGIS workstation type remove all printf statements) X X---------------------------------------------------------------------------- V*/ X X#include X#include X#include X#include "ptk.h" X X#define WS1 1 X X#ifdef SUN X#define SCRIPTNAME "../scripts/lamp.scr" X#define STORENAME "../data/topology.lyt" X#endif X#ifdef VMS X#define SCRIPTNAME "`5B-.scripts`5Dlamp.scr" X#define STORENAME "`5B-.data`5Dtopology.lyt" X#endif X Xstatic Pfloat devx, devy, devz; X X/*-------------------------------------------------------------------------- V*/ X Xstatic void options(C(void)) X`7B X Pchar commandstr`5B20`5D, writestr`5B50`5D; X Pint lencom, lenstr, err; X ptkboolean topquit; X Plimit echoarea; X X topquit = FALSE; X do X `7B X echoarea = ptk_limit(0.0, devx * 0.5, 0.0, devy * 0.05); X ptk_readstring(WS1, "boxtopology",`20 X "Input command (default = boxtopology) >", &echoarea, X 20, commandstr, &lencom); X if (strncmp(commandstr, "boxtopology", lencom) == 0) X `7B X ptk_settopologytype(ptk_stringtoint("topologyid", "topology"),`20 X PTKEBOXTOPOLOGY); X ptk_posttopology(WS1, ptk_stringtoint("topologyid", "topology"), 0.0); X predrawallstruct(WS1, PALWAYS); `20 X `7D X else if (strncmp(commandstr, "structnettopology", lencom) == 0) X `7B X ptk_settopologytype(ptk_stringtoint("topologyid", "topology"),`20 X PTKESTRUCTNETTOPOLOGY); X ptk_posttopology(WS1, ptk_stringtoint("topologyid", "topology"), 0.0); X predrawallstruct(WS1, PALWAYS); `20 X `7D X else if (strncmp(commandstr, "structtopology", lencom) == 0) X `7B X ptk_settopologytype(ptk_stringtoint("topologyid", "topology"),`20 X PTKESTRUCTTOPOLOGY); X ptk_posttopology(WS1, ptk_stringtoint("topologyid", "topology"), 0.0); X predrawallstruct(WS1, PALWAYS); `20 X `7D X else if (strncmp(commandstr, "tidysingle", lencom) == 0) X `7B X Ppickrec pickrec; X Plocrec locrec; X X#ifdef VMS X pickrec.pickpet1_datarec.aperature = 0.01; +-+-+-+-+-+-+-+- END OF PART 192 +-+-+-+-+-+-+-+-