home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / diverses / him / mmdemo3.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-12-01  |  19.4 KB  |  529 lines

  1. /***************** Program Source Module ***********************/
  2. #ifdef AUTOPDOC
  3.  
  4. MODULE:     mmdemo3.c
  5.  
  6. DESCRIPTION:
  7.  
  8. HIM Menu Manager Demo (Pulldown flavor)
  9.  
  10. TABLE OF CONTENTS:
  11.  
  12. #endif
  13. /*
  14.  *
  15.  *   Copyright 1988  Allsoft (tm)
  16.  *   100 Calle Playa Del Sol NE
  17.  *   Albuquerque, NM  87109
  18.  *
  19.  *   ALL RIGHTS RESERVED.
  20.  *
  21.  *   Unauthorized distribution, adaptation or use may be 
  22.  *   subject to civil and criminal penalties.
  23.  *
  24.  */
  25. /********** Filled by Polytron Version Control System **********
  26.  
  27. $Author:   james borders  $
  28.  
  29. $Date:   01 Dec 1988 12:18:34  $
  30.  
  31. $Revision:   1.0  $
  32.  
  33. $Log:   D:/C/FMLIB/MM/VCS/MMDEMO3.C  $
  34.  * 
  35.  *    Rev 1.0   01 Dec 1988 12:18:34   james borders
  36.  * Initial revision.
  37.  
  38. ****************************************************************/
  39.  
  40. /*** Include Files ***/
  41.  
  42. #include "stdio.h"
  43. #include "stdlib.h"
  44. #ifdef MSC
  45. #include "malloc.h"
  46. #endif
  47. #ifdef TURBOC
  48. #include "alloc.h"
  49. #endif
  50. #include "process.h"
  51. #include "dos.h"
  52. #include "lm.h"
  53. #include "wn.h"
  54. #include "km.h"
  55. #include "mm.h"
  56.  
  57. /*** Typedefs ***/
  58.  
  59. /*** Constants ***/
  60.  
  61. /*** Global Vars ***/
  62.  
  63. int   mm;            /* main menu */
  64. int   mmw,mmr,mmc,mmm,mmf,mmp,mmg,mmd,mms,mmq;  /* second level */
  65. int   mmwg;                                     /* only 1 3rd level for demo*/
  66.  
  67. /*
  68.    Use the menu variable names as the actual menu names to keep things
  69.    consistent.
  70. */
  71.  
  72. /* routines called as action functions */
  73.  
  74. int menuhandler();
  75. int nomorelevelsmsg();
  76. int jumptodos();
  77. int quit();
  78.  
  79. main(argc,argv)
  80. /*****/
  81. int  argc;
  82. char *argv[];
  83. {
  84. int code,mnum,mel,count;
  85. int kbhit(),getch();
  86. char *cfs;
  87. char buf[80];
  88.  
  89. lminit((char *(*)())malloc,free,0);              /* init list manager */
  90. wninit(0,0,NULL,0,(char *(*)())malloc,free);     /* window manager using memory */
  91. kminit(kbhit,getch);                /* keyboard manager */
  92. mminit(kmgetch,NULL);               /* menu manager */
  93.  
  94. vpsvmode(vpgvmode());               /* clear the screen */
  95.  
  96. if (buildmenus() ||
  97.     buildintercepts() ||
  98.     explain()){
  99.    fprintf(stderr,"\nMMDEMO3 -- Error creating menus.  Check memory.");
  100.    }
  101. else{
  102.    mmpromenu(mm,MMDISPLAY,1);   /* display pulldown part of menu */
  103.    while (kmgetch() != KESC)    /* let intercept processor handle menu when */
  104.        ;                        /* hotkey or / is typed */
  105.    }
  106. mmdestroy(-1);
  107. wndestroy(-1);
  108. exit(0);
  109. }
  110.  
  111. buildintercepts()
  112. /***************/
  113. {
  114. kmsir('/',menuhandler);         /* enter menu with last current item */
  115. kmsir(KAW,menuhandler);         /* Worksheet */
  116. kmsir(KAR,menuhandler);         /* Range */
  117. kmsir(KAC,menuhandler);         /* Copy */
  118. kmsir(KAM,menuhandler);         /* Move */
  119. kmsir(KAF,menuhandler);         /* Files */
  120. kmsir(KAP,menuhandler);         /* Print */
  121. kmsir(KAG,menuhandler);         /* Graph */
  122. kmsir(KAD,menuhandler);         /* Data */
  123. kmsir(KAS,menuhandler);         /* System */
  124. if (kmsir(KAQ,menuhandler) < 0) /* Quit */
  125.     return(-1);
  126. return(0);
  127. }
  128.  
  129. menuhandler(keycode)
  130. /******************/
  131. /*
  132.     this routine will get called by the Keyboard Manager everytime one of the
  133.     keys in buildintercepts() is pressed by the user.
  134. */
  135. int keycode;    /* supplied by Keyboard manager */
  136. {
  137. static int active = 0;
  138. int startel,rval;
  139.  
  140. rval = keycode;
  141. if (!active){
  142.     active = 1;
  143.     switch(keycode){
  144.         case    '/':    startel = 0;    break;  /* use last current item */
  145.         case    KAW:    startel = mmgmel(mm,"worksheet");   break;
  146.         case    KAR:    startel = mmgmel(mm,"range");       break;
  147.         case    KAC:    startel = mmgmel(mm,"copy");        break;
  148.         case    KAM:    startel = mmgmel(mm,"move");        break;
  149.         case    KAF:    startel = mmgmel(mm,"file");        break;
  150.         case    KAP:    startel = mmgmel(mm,"print");       break;
  151.         case    KAG:    startel = mmgmel(mm,"graph");       break;
  152.         case    KAD:    startel = mmgmel(mm,"data");        break;
  153.         case    KAS:    startel = mmgmel(mm,"system");      break;
  154.         case    KAQ:    startel = mmgmel(mm,"quit");        break;
  155.         }
  156.     /*
  157.         process the menu.  let all of the action be handled by the action
  158.         routines defined for the menus and menu elements.
  159.     */
  160.     mmpromenu(mm,MMPROCESS,startel);
  161.     active = 0;
  162.     rval = -1;         /* pretend like key never hit.. */
  163.     }
  164. return(rval);
  165. };
  166.  
  167. explain()
  168. /********/
  169. {
  170. int wnum;
  171.  
  172. wnum = wncreate(14,0,80,10,WNBLUE,WNCYAN,WNBLUE,WNBLACK);
  173. if (wnum < 0)
  174.    return(-1);
  175. wnttitle(wnum,"[ MMDEMO (3)  PULL-DOWN Version 1.0 ]");
  176. wnprintf(wnum,"\nThe HIM Menu Manager makes it easy to include sophisticated menus in your");
  177. wnprintf(wnum,"\nprograms.  The three available menu types are: POPUP, PULL-DOWN, and");
  178. wnprintf(wnum,"\nLIGHTBAR (Lotus-style).  The first 2 levels of the standard Lotus 1-2-3");
  179. wnprintf(wnum,"\nmenus are illustrated here in a PULL-DOWN form.");
  180. wnprintf(wnum,"\n");
  181. wnprintf(wnum,"\nHit '/' or Alt-(highlighted letter) to activate menu.  ESC to quit.");
  182. return(0);
  183. }
  184.  
  185.  
  186. buildmenus()
  187. /***********/
  188. {
  189. int mel;
  190. char buf[80];
  191.  
  192. /*
  193.    for a pull-down menu, the top level has to be created after the
  194.    sub-menus are known..
  195. */
  196.  
  197. /*
  198.     Let's do second level first so we can specify the coords of the third
  199.     level to be just below and to the right of the second level.
  200. */
  201.  
  202. mmscparms(WNBLACK, WNLMAGENTA,       /* back/fore */
  203.           WNBLACK, WNGREEN,          /* border back/fore */
  204.           WNBLACK, WNLGREEN,         /* read only back/fore */
  205.           WNBLACK, WNLCYAN,          /* mark character back/fore */
  206.           WNBLACK, WNRED,            /* hightlight back/fore */
  207.           WNBLACK, WNYELLOW,         /* title colors */
  208.           ' ','\0');                /* mark character, no mark key */
  209.  
  210. mmw = mmcreate("mmw",MMPOPUP,0,0,0,0,MMABSDEF,"","",NULL,0,0,0,MMACTIONNULL,NULL);
  211. mmr = mmcreate("mmr",MMPOPUP,0,0,0,0,MMABSDEF,"","",NULL,0,0,0,nomorelevelsmsg,NULL);
  212. mmc = mmcreate("mmc",MMPOPUP,0,0,0,0,MMABSDEF,"","",NULL,0,0,0,nomorelevelsmsg,NULL);
  213. mmm = mmcreate("mmm",MMPOPUP,0,0,0,0,MMABSDEF,"","",NULL,0,0,0,nomorelevelsmsg,NULL);
  214. mmf = mmcreate("mmf",MMPOPUP,0,0,0,0,MMABSDEF,"","",NULL,0,0,0,nomorelevelsmsg,NULL);
  215. mmp = mmcreate("mmp",MMPOPUP,0,0,0,0,MMABSDEF,"","",NULL,0,0,0,nomorelevelsmsg,NULL);
  216. mmg = mmcreate("mmg",MMPOPUP,0,0,0,0,MMABSDEF,"","",NULL,0,0,0,nomorelevelsmsg,NULL);
  217. mmd = mmcreate("mmd",MMPOPUP,0,0,0,0,MMABSDEF,"","",NULL,0,0,0,nomorelevelsmsg,NULL);
  218. mms = mmcreate("mms",MMPOPUP,0,0,0,0,MMABSDEF,"","",NULL,0,0,0,nomorelevelsmsg,NULL);
  219. mmq = mmcreate("mmq",MMPOPUP,0,0,0,0,MMABSDEF,"","",NULL,0,0,0,nomorelevelsmsg,NULL);
  220.  
  221. /* worksheet level 2 menu (mmw) */
  222. /*
  223. The first item "global" is the only one that will call a 3rd level menu.  All
  224. other items will fall back to their menu action routine which will tell the
  225. user that there are no more levels
  226. */
  227.  
  228. mmamel(mmw,"","Global","Set worksheet settings",
  229.              "mmwg",0,0,MMNOCASE | 'g',MMACTIONNULL,NULL);
  230. mmamel(mmw,"","Insert","Insert blank column(s) or row(s)",
  231.              "",0,0,MMNOCASE | 'i',nomorelevelsmsg,NULL);
  232. mmamel(mmw,"","Delete","Delete entire column(s) or row(s)",
  233.              "",0,0,MMNOCASE | 'd',nomorelevelsmsg,NULL);
  234. mmamel(mmw,"","Column","Set display characteristics of the current column",
  235.              "",0,0,MMNOCASE | 'c',nomorelevelsmsg,NULL);
  236. mmamel(mmw,"","Erase","Erase the entire worksheet",
  237.              "",0,0,MMNOCASE | 'e',nomorelevelsmsg,NULL);
  238. mmamel(mmw,"","Titles","Set horizontal or vertical titles",
  239.              "",0,0,MMNOCASE | 't',nomorelevelsmsg,NULL);
  240. mmamel(mmw,"","Window","Set split screen and synchronized scrolling",
  241.              "",0,0,MMNOCASE | 'w',nomorelevelsmsg,NULL);
  242. mmamel(mmw,"","Status","Display worksheet settings",
  243.              "",0,0,MMNOCASE | 's',nomorelevelsmsg,NULL);
  244. mmamel(mmw,"","Page","Insert a page-break above the cell pointer",
  245.              "",0,0,MMNOCASE | 'p',nomorelevelsmsg,NULL);
  246.  
  247. /* range level 2 menu (mmr) */
  248.  
  249. mmamel(mmr,"","Format","Format a cell or range of cells",
  250.              "",0,0,MMNOCASE | 'f',MMACTIONNULL,NULL);
  251. mmamel(mmr,"","Label","Align a label or range of labels (Left, Right, or Center)",
  252.              "",0,0,MMNOCASE | 'l',MMACTIONNULL,NULL);
  253. mmamel(mmr,"","Erase","Erase a cell or range of cells",
  254.              "",0,0,MMNOCASE | 'e',MMACTIONNULL,NULL);
  255. mmamel(mmr,"","Name","Create, delete, or modify range names",
  256.              "",0,0,MMNOCASE | 'n',MMACTIONNULL,NULL);
  257. mmamel(mmr,"","Justify","Adjust width of a column of labels",
  258.              "",0,0,MMNOCASE | 'j',MMACTIONNULL,NULL);
  259. mmamel(mmr,"","Protect","Disallow changes to a range if protection is enabled",
  260.              "",0,0,MMNOCASE | 'p',MMACTIONNULL,NULL);
  261. mmamel(mmr,"","Unprotect","Allow changes to a range",
  262.              "",0,0,MMNOCASE | 'u',MMACTIONNULL,NULL);
  263. mmamel(mmr,"","Input","Enter data into the unprotected cells in a range",
  264.              "",0,0,MMNOCASE | 'i',MMACTIONNULL,NULL);
  265. mmamel(mmr,"","Value","Copy range, converting formulas to values",
  266.              "",0,0,MMNOCASE | 'v',MMACTIONNULL,NULL);
  267. mmamel(mmr,"","Transpose","Copy range, switching columns and rows",
  268.              "",0,0,MMNOCASE | 't',MMACTIONNULL,NULL);
  269.  
  270.  
  271. /* copy level 2 menu (mmc) */
  272.  
  273. mmamel(mmc,"","From","Range of cells to copy from",
  274.              "",0,0,MMNOCASE | 'f',MMACTIONNULL,NULL);
  275. mmamel(mmc,"","To","Range of cells to copy to",
  276.              "",0,1,MMNOCASE | 't',MMACTIONNULL,NULL);
  277.  
  278. /* move level 2 menu (mmm) */
  279.  
  280. mmamel(mmm,"","From","Range of cells to move from",
  281.              "",0,0,MMNOCASE | 'f',MMACTIONNULL,NULL);
  282.  
  283. mmamel(mmm,"","To","Range of cells to move to",
  284.              "",0,1,MMNOCASE | 't',MMACTIONNULL,NULL);
  285.  
  286.  
  287. /* file level 2 menu (mmf) */
  288.  
  289. mmamel(mmf,"","Retrieve","Erase the current worksheet and display the selected worksheet",
  290.              "",0,0,MMNOCASE | 'r',MMACTIONNULL,NULL);
  291. mmamel(mmf,"","Save","Store the entire worksheet in a worksheet file",
  292.              "",0,0,MMNOCASE | 's',MMACTIONNULL,NULL);
  293. mmamel(mmf,"","Combine","Incorporate all or part of a worksheet file into the worksheet",
  294.              "",0,0,MMNOCASE | 'c',MMACTIONNULL,NULL);
  295. mmamel(mmf,"","Xtract","Store a cell range in a worksheet file",
  296.              "",0,0,MMNOCASE | 'x',MMACTIONNULL,NULL);
  297. mmamel(mmf,"","Erase","Erase a worksheet, print, or graph file",
  298.              "",0,0,MMNOCASE | 'e',MMACTIONNULL,NULL);
  299. mmamel(mmf,"","List","Display names of 1-2-3 files in current directory",
  300.              "",0,0,MMNOCASE | 'l',MMACTIONNULL,NULL);
  301. mmamel(mmf,"","Import","Read text or numbers from a print file into the worksheet",
  302.              "",0,0,MMNOCASE | 'i',MMACTIONNULL,NULL);
  303. mmamel(mmf,"","Directory","Display and/or set the current directory",
  304.              "",0,0,MMNOCASE | 'd',MMACTIONNULL,NULL);
  305.  
  306. /* print level 2 menu (mmp) */
  307.  
  308. mmamel(mmp,"","Printer","Send print output directly to printer",
  309.              "",0,0,MMNOCASE | 'p',MMACTIONNULL,NULL);
  310. mmamel(mmp,"","File","Send print output to file",
  311.              "",0,0,MMNOCASE | 'f',MMACTIONNULL,NULL);
  312.  
  313. /* graph level 2 menu (mmg) */
  314.  
  315. mmamel(mmg,"","Type","Set graph type",
  316.              "",0,0,MMNOCASE | 't',MMACTIONNULL,NULL);
  317. mmamel(mmg,"","X","Set X-Range",
  318.              "",0,0,MMNOCASE | 'x',MMACTIONNULL,NULL);
  319. mmamel(mmg,"","A","Set first data range",
  320.              "",0,0,MMNOCASE | 'a',MMACTIONNULL,NULL);
  321. mmamel(mmg,"","B","Set second data range",
  322.              "",0,0,MMNOCASE | 'b',MMACTIONNULL,NULL);
  323. mmamel(mmg,"","C","Set third data range",
  324.              "",0,0,MMNOCASE | 'c',MMACTIONNULL,NULL);
  325. mmamel(mmg,"","D","Set fourth data range",
  326.              "",0,0,MMNOCASE | 'd',MMACTIONNULL,NULL);
  327. mmamel(mmg,"","E","Set fifth data range",
  328.              "",0,0,MMNOCASE | 'e',MMACTIONNULL,NULL);
  329. mmamel(mmg,"","F","Set sixth data range",
  330.              "",0,0,MMNOCASE | 'f',MMACTIONNULL,NULL);
  331. mmamel(mmg,"","Reset","Cancel graph settings",
  332.              "",0,0,MMNOCASE | 'r',MMACTIONNULL,NULL);
  333. mmamel(mmg,"","View","View the current graph",
  334.              "",0,0,MMNOCASE | 'v',MMACTIONNULL,NULL);
  335. mmamel(mmg,"","Save","Save the current graph in a file for later printing",
  336.              "",0,0,MMNOCASE | 's',MMACTIONNULL,NULL);
  337. mmamel(mmg,"","Options","Legend, Format, Titles, Grid, Scale, Color, B&W, Data-Labels",
  338.              "",0,0,MMNOCASE | 'o',MMACTIONNULL,NULL);
  339. mmamel(mmg,"","Name","Use, Create, Delete, or Reset named graphs",
  340.              "",0,0,MMNOCASE | 'n',MMACTIONNULL,NULL);
  341. mmamel(mmg,"","Quit","Return to READY mode",
  342.              "",0,0,MMNOCASE | 'q',MMACTIONNULL,NULL);
  343.  
  344.  
  345. /* data level 2 menu (mmd) */
  346.  
  347. mmamel(mmd,"","Fill","Fill a range with numbers",
  348.              "",0,0,MMNOCASE | 'f',MMACTIONNULL,NULL);
  349. mmamel(mmd,"","Table","Create a table of values",
  350.              "",0,0,MMNOCASE | 't',MMACTIONNULL,NULL);
  351. mmamel(mmd,"","Sort","Sort data records",
  352.              "",0,0,MMNOCASE | 's',MMACTIONNULL,NULL);
  353. mmamel(mmd,"","Query","Find all data records satisfying given criteria",
  354.              "",0,0,MMNOCASE | 'q',MMACTIONNULL,NULL);
  355. mmamel(mmd,"","Distribution","Calculate frequency distribution of a range",
  356.              "",0,0,MMNOCASE | 'd',MMACTIONNULL,NULL);
  357. mmamel(mmd,"","Matrix","Perform matrix operations",
  358.              "",0,0,MMNOCASE | 'm',MMACTIONNULL,NULL);
  359. mmamel(mmd,"","Regression","Calculate linear regressions",
  360.              "",0,0,MMNOCASE | 'r',MMACTIONNULL,NULL);
  361. mmamel(mmd,"","Parse","Parse a column of labels into a range",
  362.              "",0,0,MMNOCASE | 'p',MMACTIONNULL,NULL);
  363.  
  364.  
  365. /* system level 2 menu (mms) */
  366.  
  367. mmamel(mms,"","No","Do not jump to DOS",
  368.              "",0,0,MMNOCASE | 'n',MMACTIONESCONLY,NULL);
  369. mmamel(mms,"","Yes","Jump to DOS",
  370.              "",0,0,MMNOCASE | 'y',jumptodos,NULL);
  371.  
  372.  
  373. /* quit level 2 menu (mmq) */
  374.  
  375. mmamel(mmq,"","No","Do not end 1-2-3 session; return to READY mode",
  376.              "",0,0,MMNOCASE | 'n',MMACTIONESCONLY,NULL);
  377. mmamel(mmq,"","Yes","End 1-2-3 session (Remember to save your worksheet first)",
  378.              "",0,0,MMNOCASE | 'y',quit,NULL);
  379.  
  380. /*
  381.     Now do the main menu.  After each element is added to this menu, a fixup
  382.     to the sub-menu under it (the popup) will be performed.  It doesn't matter
  383.     what location you picked for the subs, they will be altered to fall just
  384.     under each of the items in this main menu.
  385.  
  386.     After this main menu is created, you will be able to set the locations of
  387.     lower level menus based on their parents by using mmgmrow() and mmgmcol()
  388. */
  389.  
  390. mmscparms(WNBLUE,WNWHITE,          /* back/fore */
  391.           WNBLACK,WNWHITE,          /* border back/fore */
  392.           WNBLACK,WNWHITE,          /* read only back/fore */
  393.           WNBLACK,WNWHITE,          /* mark character back/fore */
  394.           WNCYAN,WNBLACK,           /* hightlight back/fore */
  395.           WNBLACK,WNWHITE,          /* title colors */
  396.           ' ','\0');                /* mark character, no mark key */
  397.  
  398. mm = mmcreate("mm",MMPULLDOWN,0,0,40,1,MMABSR | MMABSWH,"","",NULL,0,0,0,MMACTIONNULL,NULL);
  399.  
  400. /* main menu (mm) */
  401.  
  402. sprintf(buf,"~*,%d~W~*,*~orksheet",WNRED);
  403. mmamel(mm,"worksheet",buf,"Global, Insert, Delete, Column, Erase, Titles, Window, Status, Page",
  404.              "mmw",1,0,KAW,MMACTIONNULL,NULL);
  405. sprintf(buf,"~*,%d~R~*,*~ange",WNRED);
  406. mmamel(mm,"range",buf,"Format, Label, Erase, Name, Justify, Protect, Unprotect, Input, Value, Transpose",
  407.              "mmr",1,0,KAR,MMACTIONNULL,NULL);
  408. sprintf(buf,"~*,%d~C~*,*~opy",WNRED);
  409. mmamel(mm,"copy",buf,"Copy a cell or range of cells",
  410.              "mmc",1,0,KAC,MMACTIONNULL,NULL);
  411. sprintf(buf,"~*,%d~M~*,*~ove",WNRED);
  412. mmamel(mm,"move",buf,"Move a cell or range of cells",
  413.              "mmm",1,0,KAM,MMACTIONNULL,NULL);
  414. sprintf(buf,"~*,%d~F~*,*~ile",WNRED);
  415. mmamel(mm,"file",buf,"Retrieve, Save, Combine, Xtract, Erase, List, Import, Directory",
  416.              "mmf",1,0,KAF,MMACTIONNULL,NULL);
  417. sprintf(buf,"~*,%d~P~*,*~rint",WNRED);
  418. mmamel(mm,"print",buf,"Oputput a range to the printer or a print file",
  419.              "mmp",1,0,KAP,MMACTIONNULL,NULL);
  420. sprintf(buf,"~*,%d~G~*,*~raph",WNRED);
  421. mmamel(mm,"graph",buf,"Create a graph",
  422.              "mmg",1,0,KAG,MMACTIONNULL,NULL);
  423. sprintf(buf,"~*,%d~D~*,*~ata",WNRED);
  424. mmamel(mm,"data",buf,"Fill, Table, Sort, Query, Distribution, Matrix, Regression, Parse",
  425.              "mmd",1,0,KAD,MMACTIONNULL,NULL);
  426. sprintf(buf,"~*,%d~S~*,*~ystem",WNRED);
  427. mmamel(mm,"system",buf,"Invoke the DOS Command Interpreter",
  428.              "mms",1,0,KAS,MMACTIONNULL,NULL);
  429. sprintf(buf,"~*,%d~Q~*,*~uit",WNRED);
  430. mmamel(mm,"quit",buf,"End 1-2-3 session (Have you saved your work ?)",
  431.              "mmq",1,0,KAQ,MMACTIONNULL,NULL);
  432.  
  433.  
  434. /*
  435.     Now our one and only 3rd level..
  436. */
  437.  
  438. mmscparms(WNRED,   WNYELLOW,         /* back/fore */
  439.           WNRED,   WNBLACK,          /* border back/fore */
  440.           WNRED,   WNLRED,           /* read only back/fore */
  441.           WNBLACK, WNLCYAN,          /* mark character back/fore */
  442.           WNBLACK, WNRED,            /* hightlight back/fore */
  443.           WNBLACK, WNYELLOW,         /* title colors */
  444.           ' ','\0');                /* mark character, no mark key */
  445. /*
  446.     Offset this menu down and to the right from the parent (mmw).. 
  447. */
  448. mmwg = mmcreate("mmwg",MMPOPUP,
  449.                 mmgmrow(mmgmnum("mmw")) + 1,    /* row + 1 */
  450.                 mmgmcol(mmgmnum("mmw")) + 1,    /* col + 1 */
  451.                 0,0,MMABSRC,"[ Global ]","",NULL,0,0,0,nomorelevelsmsg,NULL);
  452.  
  453. /* worksheet-global level 3 menu (mmwg) */
  454.  
  455. mmamel(mmwg,"","Format","Set global format",
  456.              "",0,0,MMNOCASE | 'f',MMACTIONNULL,NULL);
  457. mmamel(mmwg,"","Label-prefix","Set global label alignment prefix (Left, Right, Center)",
  458.              "",0,0,MMNOCASE | 'l',MMACTIONNULL,NULL);
  459. mmamel(mmwg,"","Column-Width","Set global column width",
  460.              "",0,0,MMNOCASE | 'c',MMACTIONNULL,NULL);
  461. mmamel(mmwg,"","Recalculation","Natural, Columnwise, Rowwise, Automatic, Manual, Iteration",
  462.              "",0,0,MMNOCASE | 'r',MMACTIONNULL,NULL);
  463. mmamel(mmwg,"","Protection","Turn protection on or off",
  464.              "",0,0,MMNOCASE | 'p',MMACTIONNULL,NULL);
  465. mmamel(mmwg,"","Default","Define default disk and printer settings",
  466.              "",0,0,MMNOCASE | 'd',MMACTIONNULL,NULL);
  467. mmamel(mmwg,"","Zero","turn zero suppression on or off",
  468.             "",0,0,MMNOCASE | 'z',MMACTIONNULL,NULL);
  469.  
  470.  
  471. if ((mm|mmw|mmr|mmc|mmm|mmf|mmp|mmg|mmd|mms|mmq|mmwg) < 0)
  472.    return(-1);
  473.  
  474. return(0);
  475. };
  476.  
  477.  
  478. /***** action routines *****/
  479.  
  480. nomorelevelsmsg(mnum,mel,hotkey)
  481. /***************/
  482. int mnum,mel,hotkey;
  483. {
  484. int wnum;
  485.  
  486. if (mel == -1)
  487.       return(0);
  488.  
  489. wnum = wncreate(19,0,40,6,WNBLACK,WNCYAN,WNBLACK,WNCYAN);
  490. wnprintf(wnum,"No more levels defined for this demo.");
  491. wnprintf(wnum,"\nESCAPE backs out of a menu.");
  492. wnprintf(wnum,"\n<Hit a key...>");
  493. kmgetch();
  494. wndestroy(wnum);
  495. return(-1);
  496. }
  497.  
  498. jumptodos(mnum,mel,hotkey)
  499. /***************/
  500. int mnum,mel,hotkey;
  501. {
  502. int wnum;
  503. int wsave,wscroll,wcmode,ul,ur,ll,lr,vti,vbi,hli,hri,ic,vc,hc;
  504.  
  505. wngcparms(&wsave,&wscroll,&wcmode,&ul,&ur,&ll,
  506.           &lr,&vti,&vbi,&hli,&hri,&ic,&vc,&hc);
  507. wnscparms(wsave,wscroll,wcmode,           /* create window wo/border */
  508.           ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ');
  509. wnum = wncreate(0,0,wngscols(),wngsrows(),WNBLACK,WNBLACK,WNBLACK,WNBLACK);
  510. if (wnum > 0){
  511.    spawnl(P_WAIT,getenv("COMSPEC"),NULL);
  512.    wndestroy(wnum);
  513.    }
  514. wnscparms(wsave,wscroll,wcmode,ul,ur,ll,lr,vti,vbi,hli,hri,ic,vc,hc);
  515. return(-1);
  516. }
  517.  
  518. quit(mnum,mel,hotkey)
  519. /************/
  520. int mnum,mel,hotkey;
  521. {
  522. mmdestroy(-1);    /* will NOT take down menus... */
  523. wndestroy(-1);    /* get rid of the windows */
  524. exit(0);
  525. }
  526.  
  527.  
  528.  
  529.