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

  1. /***************** Program Source Module ***********************/
  2. #ifdef AUTOPDOC
  3.  
  4. MODULE:     mmdemo1.c
  5.  
  6. DESCRIPTION:
  7.  
  8. HIM Menu Manager Demo (Popup 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:17:54  $
  30.  
  31. $Revision:   1.0  $
  32.  
  33. $Log:   D:/C/FMLIB/MM/VCS/MMDEMO1.C  $
  34.  * 
  35.  *    Rev 1.0   01 Dec 1988 12:17:54   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 nomorelevelsmsg();
  75. int yesnojumptodos();
  76. int yesnoquit();
  77. int jumptodos();
  78. int quit();
  79. int noaction();
  80.  
  81. main(argc,argv)
  82. /*****/
  83. int  argc;
  84. char *argv[];
  85. {
  86. int code,mnum,mel,count;
  87. int kbhit(),getch();
  88. char *cfs;
  89. char buf[80];
  90.  
  91. lminit((char *(*)())malloc,free,0);          /* init list manager */
  92. wninit(0,0,NULL,0,(char *(*)())malloc,free); /* window manager using memory */
  93. kminit(kbhit,getch);                /* keyboard manager */
  94. mminit(kmgetch,NULL);               /* menu manager */
  95.  
  96. vpsvmode(vpgvmode());               /* clear the screen */
  97.  
  98. if (buildmenus() || explain()){
  99.    fprintf(stderr,"\nMMDEMO1 -- Error creating menus.  Check memory.");
  100.    }
  101. else{
  102.    mmpromenu(mm,MMPROCESS,1);
  103.    }
  104. mmdestroy(-1);
  105. exit(0);
  106. }
  107.  
  108. explain()
  109. /********/
  110. {
  111. int wnum;
  112.  
  113. wnum = wncreate(14,0,80,10,WNBLUE,WNCYAN,WNBLUE,WNBLACK);
  114. if (wnum < 0)
  115.    return(-1);
  116. wnttitle(wnum,"[ MMDEMO (1)  POPUP Version 1.0 ]");
  117. wnprintf(wnum,"\nThe HIM Menu Manager makes it easy to include sophisticated menus in your");
  118. wnprintf(wnum,"\nprograms.  The three available menu types are: POPUP, PULL-DOWN, and");
  119. wnprintf(wnum,"\nLIGHTBAR (Lotus-style).  The first 2 levels of the standard Lotus 1-2-3");
  120. wnprintf(wnum,"\nmenus are illustrated here in a popup form.");
  121. return(0);
  122. }
  123.  
  124.  
  125. buildmenus()
  126. /***********/
  127. {
  128. if (createmenus() || createelements())
  129.    return(-1);
  130. return(0);
  131. }
  132.  
  133. createmenus()
  134. /***********/
  135. {
  136.  
  137. /* first create the top level menu */
  138.  
  139. mmscparms(WNBLUE,WNLCYAN,           /* back/fore */
  140.           WNBLUE,WNLCYAN,           /* border back/fore */
  141.           WNBLACK,WNCYAN,           /* read only back/fore */
  142.           WNBLACK,WNLCYAN,          /* mark character back/fore */
  143.           WNBLACK,WNLCYAN,          /* hightlight back/fore */
  144.           WNBLACK,WNYELLOW,         /* title colors */
  145.           ' ','\0');                /* mark character, no mark key */
  146.  
  147. mm = mmcreate("mm",MMPOPUP,1,1,0,0,MMABSDEF,"[ mmdemo1 ]","",NULL,0,0,0,noaction,NULL);
  148.  
  149. /* now the second level */
  150.  
  151. mmscparms(WNBLACK, WNLMAGENTA,       /* back/fore */
  152.           WNBLACK, WNGREEN,          /* border back/fore */
  153.           WNBLACK, WNLGREEN,         /* read only back/fore */
  154.           WNBLACK, WNLCYAN,          /* mark character back/fore */
  155.           WNBLACK, WNRED,            /* hightlight back/fore */
  156.           WNBLACK, WNYELLOW,         /* title colors */
  157.           ' ','\0');                /* mark character, no mark key */
  158.  
  159. mmw = mmcreate("mmw",MMPOPUP,2,2,0,0,MMABSRC,"[ Worksheet ]","",NULL,0,0,0,MMACTIONNULL,NULL);
  160. mmr = mmcreate("mmr",MMPOPUP,2,2,0,0,MMABSRC,"[ Range ]","",NULL,0,0,0,nomorelevelsmsg,NULL);
  161. mmc = mmcreate("mmc",MMPOPUP,2,2,0,0,MMABSRC,"[ Copy ]","",NULL,0,0,0,nomorelevelsmsg,NULL);
  162. mmm = mmcreate("mmm",MMPOPUP,2,2,0,0,MMABSRC,"[ Move ]","",NULL,0,0,0,nomorelevelsmsg,NULL);
  163. mmf = mmcreate("mmf",MMPOPUP,2,2,0,0,MMABSRC,"[ File ]","",NULL,0,0,0,nomorelevelsmsg,NULL);
  164. mmp = mmcreate("mmp",MMPOPUP,2,2,0,0,MMABSRC,"[ Print ]","",NULL,0,0,0,nomorelevelsmsg,NULL);
  165. mmg = mmcreate("mmg",MMPOPUP,2,2,0,0,MMABSRC,"[ Graph ]","",NULL,0,0,0,nomorelevelsmsg,NULL);
  166. mmd = mmcreate("mmd",MMPOPUP,2,2,0,0,MMABSRC,"[ Data ]","",NULL,0,0,0,nomorelevelsmsg,NULL);
  167. mms = mmcreate("mms",MMPOPUP,2,2,0,0,MMABSRC,"[ System ]","",NULL,0,0,0,nomorelevelsmsg,NULL);
  168. mmq = mmcreate("mmq",MMPOPUP,2,2,0,0,MMABSRC,"[ Quit ]","",NULL,0,0,0,nomorelevelsmsg,NULL);
  169.  
  170.  
  171. /* now the 3rd level */
  172.  
  173. mmscparms(WNRED,   WNYELLOW,         /* back/fore */
  174.           WNRED,   WNBLACK,          /* border back/fore */
  175.           WNRED,   WNLRED,           /* read only back/fore */
  176.           WNBLACK, WNLCYAN,          /* mark character back/fore */
  177.           WNBLACK, WNRED,            /* hightlight back/fore */
  178.           WNBLACK, WNYELLOW,         /* title colors */
  179.           ' ','\0');                /* mark character, no mark key */
  180.  
  181. mmwg = mmcreate("mmwg",MMPOPUP,4,4,0,0,MMABSRC,"[ Global ]","",NULL,0,0,0,nomorelevelsmsg,NULL);
  182.  
  183. if ((mm|mmw|mmr|mmc|mmm|mmf|mmp|mmg|mmd|mms|mmq|mmwg) < 0)
  184.    return(-1);
  185.  
  186. return(0);
  187. };
  188.  
  189. createelements()
  190. /***************/
  191. {
  192. int mel;
  193. char buf[80];
  194.  
  195. /* main menu (mm) */
  196.  
  197. sprintf(buf,"~*,%d~W~*,*~orksheet",WNRED);
  198. mmamel(mm,"",buf,"Global, Insert, Delete, Column, Erase, Titles, Window, Status, Page",
  199.              "mmw",1,0,MMNOCASE | 'w',MMACTIONNULL,NULL);
  200. sprintf(buf,"~*,%d~R~*,*~ange",WNRED);
  201. mmamel(mm,"",buf,"Format, Label, Erase, Name, Justify, Protect, Unprotect, Input, Value, Transpose",
  202.              "mmr",1,0,MMNOCASE | 'r',MMACTIONNULL,NULL);
  203. sprintf(buf,"~*,%d~C~*,*~opy",WNRED);
  204. mmamel(mm,"",buf,"Copy a cell or range of cells",
  205.              "mmc",1,0,MMNOCASE | 'c',MMACTIONNULL,NULL);
  206. sprintf(buf,"~*,%d~M~*,*~ove",WNRED);
  207. mmamel(mm,"",buf,"Move a cell or range of cells",
  208.              "mmm",1,0,MMNOCASE | 'm',MMACTIONNULL,NULL);
  209. sprintf(buf,"~*,%d~F~*,*~ile",WNRED);
  210. mmamel(mm,"",buf,"Retrieve, Save, Combine, Xtract, Erase, List, Import, Directory",
  211.              "mmf",1,0,MMNOCASE | 'f',MMACTIONNULL,NULL);
  212. sprintf(buf,"~*,%d~P~*,*~rint",WNRED);
  213. mmamel(mm,"",buf,"Oputput a range to the printer or a print file",
  214.              "mmp",1,0,MMNOCASE | 'p',MMACTIONNULL,NULL);
  215. sprintf(buf,"~*,%d~G~*,*~raph",WNRED);
  216. mmamel(mm,"",buf,"Create a graph",
  217.              "mmg",1,0,MMNOCASE | 'g',MMACTIONNULL,NULL);
  218. sprintf(buf,"~*,%d~D~*,*~ata",WNRED);
  219. mmamel(mm,"",buf,"Fill, Table, Sort, Query, Distribution, Matrix, Regression, Parse",
  220.              "mmd",1,0,MMNOCASE | 'd',MMACTIONNULL,NULL);
  221. sprintf(buf,"System ~*,%d~Alt-s",WNRED);
  222. mmamel(mm,"",buf,"Invoke the DOS Command Interpreter",
  223.              "",1,0,KAS,yesnojumptodos,NULL);
  224. sprintf(buf,"Quit   ~*,%d~Alt-x",WNRED);
  225. mmamel(mm,"",buf,"End 1-2-3 session (Have you saved your work ?)",
  226.              "",1,0,KAX,yesnoquit,NULL);
  227.  
  228.  
  229. /* worksheet level 2 menu (mmw) */
  230. /*
  231. The first item "global" is the only one that will call a 3rd level menu.  All
  232. other items will fall back to their menu action routine which will tell the
  233. user that there are no more levels
  234. */
  235.  
  236. mmamel(mmw,"","Global","Set worksheet settings",
  237.              "mmwg",0,0,MMNOCASE | 'g',MMACTIONNULL,NULL);
  238. mmamel(mmw,"","Insert","Insert blank column(s) or row(s)",
  239.              "",0,0,MMNOCASE | 'i',nomorelevelsmsg,NULL);
  240. mmamel(mmw,"","Delete","Delete entire column(s) or row(s)",
  241.              "",0,0,MMNOCASE | 'd',nomorelevelsmsg,NULL);
  242. mmamel(mmw,"","Column","Set display characteristics of the current column",
  243.              "",0,0,MMNOCASE | 'c',nomorelevelsmsg,NULL);
  244. mmamel(mmw,"","Erase","Erase the entire worksheet",
  245.              "",0,0,MMNOCASE | 'e',nomorelevelsmsg,NULL);
  246. mmamel(mmw,"","Titles","Set horizontal or vertical titles",
  247.              "",0,0,MMNOCASE | 't',nomorelevelsmsg,NULL);
  248. mmamel(mmw,"","Window","Set split screen and synchronized scrolling",
  249.              "",0,0,MMNOCASE | 'w',nomorelevelsmsg,NULL);
  250. mmamel(mmw,"","Status","Display worksheet settings",
  251.              "",0,0,MMNOCASE | 's',nomorelevelsmsg,NULL);
  252. mmamel(mmw,"","Page","Insert a page-break above the cell pointer",
  253.              "",0,0,MMNOCASE | 'p',nomorelevelsmsg,NULL);
  254.  
  255. /* range level 2 menu (mmr) */
  256.  
  257. mmamel(mmr,"","Format","Format a cell or range of cells",
  258.              "",0,0,MMNOCASE | 'f',MMACTIONNULL,NULL);
  259. mmamel(mmr,"","Label","Align a label or range of labels (Left, Right, or Center)",
  260.              "",0,0,MMNOCASE | 'l',MMACTIONNULL,NULL);
  261. mmamel(mmr,"","Erase","Erase a cell or range of cells",
  262.              "",0,0,MMNOCASE | 'e',MMACTIONNULL,NULL);
  263. mmamel(mmr,"","Name","Create, delete, or modify range names",
  264.              "",0,0,MMNOCASE | 'n',MMACTIONNULL,NULL);
  265. mmamel(mmr,"","Justify","Adjust width of a column of labels",
  266.              "",0,0,MMNOCASE | 'j',MMACTIONNULL,NULL);
  267. mmamel(mmr,"","Protect","Disallow changes to a range if protection is enabled",
  268.              "",0,0,MMNOCASE | 'p',MMACTIONNULL,NULL);
  269. mmamel(mmr,"","Unprotect","Allow changes to a range",
  270.              "",0,0,MMNOCASE | 'u',MMACTIONNULL,NULL);
  271. mmamel(mmr,"","Input","Enter data into the unprotected cells in a range",
  272.              "",0,0,MMNOCASE | 'i',MMACTIONNULL,NULL);
  273. mmamel(mmr,"","Value","Copy range, converting formulas to values",
  274.              "",0,0,MMNOCASE | 'v',MMACTIONNULL,NULL);
  275. mmamel(mmr,"","Transpose","Copy range, switching columns and rows",
  276.              "",0,0,MMNOCASE | 't',MMACTIONNULL,NULL);
  277.  
  278.  
  279. /* copy level 2 menu (mmc) */
  280.  
  281. mmamel(mmc,"","From","Range of cells to copy from",
  282.              "",0,0,MMNOCASE | 'f',MMACTIONNULL,NULL);
  283. mmamel(mmc,"","To","Range of cells to copy to",
  284.              "",0,1,MMNOCASE | 't',MMACTIONNULL,NULL);
  285.  
  286. /* move level 2 menu (mmm) */
  287.  
  288. mmamel(mmm,"","From","Range of cells to move from",
  289.              "",0,0,MMNOCASE | 'f',MMACTIONNULL,NULL);
  290.  
  291. mmamel(mmm,"","To","Range of cells to move to",
  292.              "",0,1,MMNOCASE | 't',MMACTIONNULL,NULL);
  293.  
  294.  
  295. /* file level 2 menu (mmf) */
  296.  
  297. mmamel(mmf,"","Retrieve","Erase the current worksheet and display the selected worksheet",
  298.              "",0,0,MMNOCASE | 'r',MMACTIONNULL,NULL);
  299. mmamel(mmf,"","Save","Store the entire worksheet in a worksheet file",
  300.              "",0,0,MMNOCASE | 's',MMACTIONNULL,NULL);
  301. mmamel(mmf,"","Combine","Incorporate all or part of a worksheet file into the worksheet",
  302.              "",0,0,MMNOCASE | 'c',MMACTIONNULL,NULL);
  303. mmamel(mmf,"","Xtract","Store a cell range in a worksheet file",
  304.              "",0,0,MMNOCASE | 'x',MMACTIONNULL,NULL);
  305. mmamel(mmf,"","Erase","Erase a worksheet, print, or graph file",
  306.              "",0,0,MMNOCASE | 'e',MMACTIONNULL,NULL);
  307. mmamel(mmf,"","List","Display names of 1-2-3 files in current directory",
  308.              "",0,0,MMNOCASE | 'l',MMACTIONNULL,NULL);
  309. mmamel(mmf,"","Import","Read text or numbers from a print file into the worksheet",
  310.              "",0,0,MMNOCASE | 'i',MMACTIONNULL,NULL);
  311. mmamel(mmf,"","Directory","Display and/or set the current directory",
  312.              "",0,0,MMNOCASE | 'd',MMACTIONNULL,NULL);
  313.  
  314. /* print level 2 menu (mmp) */
  315.  
  316. mmamel(mmp,"","Printer","Send print output directly to printer",
  317.              "",0,0,MMNOCASE | 'p',MMACTIONNULL,NULL);
  318. mmamel(mmp,"","File","Send print output to file",
  319.              "",0,0,MMNOCASE | 'f',MMACTIONNULL,NULL);
  320.  
  321. /* graph level 2 menu (mmg) */
  322.  
  323. mmamel(mmg,"","Type","Set graph type",
  324.              "",0,0,MMNOCASE | 't',MMACTIONNULL,NULL);
  325. mmamel(mmg,"","X","Set X-Range",
  326.              "",0,0,MMNOCASE | 'x',MMACTIONNULL,NULL);
  327. mmamel(mmg,"","A","Set first data range",
  328.              "",0,0,MMNOCASE | 'a',MMACTIONNULL,NULL);
  329. mmamel(mmg,"","B","Set second data range",
  330.              "",0,0,MMNOCASE | 'b',MMACTIONNULL,NULL);
  331. mmamel(mmg,"","C","Set third data range",
  332.              "",0,0,MMNOCASE | 'c',MMACTIONNULL,NULL);
  333. mmamel(mmg,"","D","Set fourth data range",
  334.              "",0,0,MMNOCASE | 'd',MMACTIONNULL,NULL);
  335. mmamel(mmg,"","E","Set fifth data range",
  336.              "",0,0,MMNOCASE | 'e',MMACTIONNULL,NULL);
  337. mmamel(mmg,"","F","Set sixth data range",
  338.              "",0,0,MMNOCASE | 'f',MMACTIONNULL,NULL);
  339. mmamel(mmg,"","Reset","Cancel graph settings",
  340.              "",0,0,MMNOCASE | 'r',MMACTIONNULL,NULL);
  341. mmamel(mmg,"","View","View the current graph",
  342.              "",0,0,MMNOCASE | 'v',MMACTIONNULL,NULL);
  343. mmamel(mmg,"","Save","Save the current graph in a file for later printing",
  344.              "",0,0,MMNOCASE | 's',MMACTIONNULL,NULL);
  345. mmamel(mmg,"","Options","Legend, Format, Titles, Grid, Scale, Color, B&W, Data-Labels",
  346.              "",0,0,MMNOCASE | 'o',MMACTIONNULL,NULL);
  347. mmamel(mmg,"","Name","Use, Create, Delete, or Reset named graphs",
  348.              "",0,0,MMNOCASE | 'n',MMACTIONNULL,NULL);
  349. mmamel(mmg,"","Quit","Return to READY mode",
  350.              "",0,0,MMNOCASE | 'q',MMACTIONNULL,NULL);
  351.  
  352.  
  353. /* data level 2 menu (mmd) */
  354.  
  355. mmamel(mmd,"","Fill","Fill a range with numbers",
  356.              "",0,0,MMNOCASE | 'f',MMACTIONNULL,NULL);
  357. mmamel(mmd,"","Table","create a table of values",
  358.              "",0,0,MMNOCASE | 't',MMACTIONNULL,NULL);
  359. mmamel(mmd,"","Sort","Sort data records",
  360.              "",0,0,MMNOCASE | 's',MMACTIONNULL,NULL);
  361. mmamel(mmd,"","Query","Find all data records satisfying given criteria",
  362.              "",0,0,MMNOCASE | 'q',MMACTIONNULL,NULL);
  363. mmamel(mmd,"","Distribution","Calculate frequency distribution of a range",
  364.              "",0,0,MMNOCASE | 'd',MMACTIONNULL,NULL);
  365. mmamel(mmd,"","Matrix","Perform matrix operations",
  366.              "",0,0,MMNOCASE | 'm',MMACTIONNULL,NULL);
  367. mmamel(mmd,"","Regression","Calculate linear regressions",
  368.              "",0,0,MMNOCASE | 'r',MMACTIONNULL,NULL);
  369. mmamel(mmd,"","Parse","Parse a column of labels into a range",
  370.              "",0,0,MMNOCASE | 'p',MMACTIONNULL,NULL);
  371.  
  372.  
  373. /* system level 2 menu (mms) */
  374.  
  375. mmamel(mms,"","No","Do not jump to DOS",
  376.              "",0,0,MMNOCASE | 'n',noaction,NULL);
  377. mmamel(mms,"","Yes","Jump to DOS",
  378.              "",0,0,MMNOCASE | 'y',jumptodos,NULL);
  379.  
  380.  
  381. /* quit level 2 menu (mmq) */
  382.  
  383. mmamel(mmq,"","No","Do not end 1-2-3 session; return to READY mode",
  384.              "",0,0,MMNOCASE | 'n',noaction,NULL);
  385. mmamel(mmq,"","Yes","End 1-2-3 session (Remember to save your worksheet first)",
  386.              "",0,0,MMNOCASE | 'y',quit,NULL);
  387.  
  388. /* worksheet-global level 3 menu (mmwg) */
  389.  
  390. mmamel(mmwg,"","Format","Set global format",
  391.              "",0,0,MMNOCASE | 'f',MMACTIONNULL,NULL);
  392. mmamel(mmwg,"","Label-prefix","Set global label alignment prefix (Left, Right, Center)",
  393.              "",0,0,MMNOCASE | 'l',MMACTIONNULL,NULL);
  394. mmamel(mmwg,"","Column-Width","set global column width",
  395.              "",0,0,MMNOCASE | 'c',MMACTIONNULL,NULL);
  396. mmamel(mmwg,"","Recalculation","Natural, Columnwise, Rowwise, Automatic, Manual, Iteration",
  397.              "",0,0,MMNOCASE | 'r',MMACTIONNULL,NULL);
  398. mmamel(mmwg,"","Protection","Turn protection on or off",
  399.              "",0,0,MMNOCASE | 'p',MMACTIONNULL,NULL);
  400. mmamel(mmwg,"","Default","Define default disk and printer settings",
  401.              "",0,0,MMNOCASE | 'd',MMACTIONNULL,NULL);
  402.  
  403. mel = mmamel(mmwg,"","Zero","turn zero suppression on or off",
  404.              "",0,0,MMNOCASE | 'z',MMACTIONNULL,NULL);
  405.  
  406. /*
  407.    if the last element took then all the others probably did too.
  408. */
  409.  
  410. if (mel < 0){
  411.    return(-1);
  412.    }
  413. return(0);
  414. };
  415.  
  416. /***** action routines *****/
  417.  
  418. nomorelevelsmsg(mnum,mel,hotkey)
  419. /***************/
  420. int mnum,mel,hotkey;
  421. {
  422. int wnum;
  423.  
  424. if (mel == -1){
  425.    if (strcmp(mmgmname(mnum),"mm") == 0) /* at main already */
  426.       return(-1);
  427.    else
  428.       return(0);
  429.    };
  430. wnum = wncreate(19,0,40,6,WNBLACK,WNCYAN,WNBLACK,WNCYAN);
  431. wnprintf(wnum,"No more levels defined for this demo.");
  432. wnprintf(wnum,"\nESCAPE backs out of a menu.");
  433. wnprintf(wnum,"\n<Hit a key...>");
  434. kmgetch();
  435. wndestroy(wnum);
  436. return(-1);
  437. }
  438.  
  439. yesnojumptodos(mnum,mel,hotkey)
  440. /*****************************/
  441. int mnum,mel,hotkey;
  442. {
  443. if (hotkey)    /* don't ask user, just do it */
  444.    jumptodos(mnum,mel,hotkey);
  445. else
  446.    mmpromenu(mms,MMPROCESS,1);
  447. return(-1);
  448.  
  449. }
  450.  
  451. yesnoquit(mnum,mel,hotkey)
  452. /*****************************/
  453. int mnum,mel,hotkey;
  454. {
  455. if (hotkey)   /* don't ask user, just do it */
  456.    quit(mnum,mel,hotkey);
  457. else
  458.    mmpromenu(mmq,MMPROCESS,1);
  459. return(-1);
  460. }
  461.  
  462.  
  463. jumptodos(mnum,mel,hotkey)
  464. /***************/
  465. int mnum,mel,hotkey;
  466. {
  467. static toggle = 0;
  468. int wnum;
  469. int wsave,wscroll,wcmode,ul,ur,ll,lr,vti,vbi,hli,hri,ic,vc,hc;
  470.  
  471. wngcparms(&wsave,&wscroll,&wcmode,&ul,&ur,&ll,
  472.           &lr,&vti,&vbi,&hli,&hri,&ic,&vc,&hc);
  473. wnscparms(wsave,wscroll,wcmode,           /* create window wo/border */
  474.           ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ');
  475. wnum = wncreate(0,0,wngscols(),wngsrows(),WNBLACK,WNBLACK,WNBLACK,WNBLACK);
  476. if (wnum > 0){
  477.    spawnl(P_WAIT,getenv("COMSPEC"),NULL);
  478.    wndestroy(wnum);
  479.    }
  480. wnscparms(wsave,wscroll,wcmode,ul,ur,ll,lr,vti,vbi,hli,hri,ic,vc,hc);
  481. /*
  482.     just a little something to demonstrate that you can change a menu
  483.     element on the fly.
  484. */
  485. if (toggle){
  486.     mmsmel(mnum,mel,"","Yes","Jump to DOS",
  487.                  "",0,0,MMNOCASE | 'y',jumptodos,NULL);
  488.     toggle = 0;
  489.     }
  490. else{
  491.     mmsmel(mnum,mel,"","Yes, jump to DOS","Jump to DOS",
  492.                  "",0,0,MMNOCASE | 'y',jumptodos,NULL);
  493.     toggle = 1;
  494.     }
  495. return(0);
  496. }
  497.  
  498. quit(mnum,mel,hotkey)
  499. /************/
  500. int mnum,mel,hotkey;
  501. {
  502. mmdestroy(-1);    /* will NOT take down menus... */
  503. wndestroy(-1);    /* get rid of the windows */
  504. exit(0);
  505. }
  506.  
  507. noaction(mnum,mel,hotkey)
  508. /***************/
  509. int mnum,mel,hotkey;
  510. {
  511. if (mel == -1){
  512.    if (strcmp(mmgmname(mnum),"mm") == 0) /* at main already */
  513.       return(-1);
  514.    else
  515.       return(0);
  516.    };
  517.  
  518. return(0);
  519. };
  520.  
  521.  
  522.