home *** CD-ROM | disk | FTP | other *** search
/ Mega CD-ROM 1 / megacd_rom_1.zip / megacd_rom_1 / MATH / RPN30SRC.ZIP / MAKEHELP.C < prev    next >
Text File  |  1990-05-27  |  7KB  |  266 lines

  1. /**
  2.  ** MAKEHELP
  3.  **
  4.  ** Make Help windows.
  5.  **
  6.  ** 90.01.01
  7.  **/
  8. #include <conio.h>
  9. #include <string.h>
  10. #include "rpn.h"
  11. #include "rpnio.h"
  12. #include "helps.h"
  13.  
  14. /* local abbreviations */
  15. #define HN H_NUM
  16. #define HL H_LABEL
  17. #define HC H_TEXT
  18. #define HT H_TITLE
  19.  
  20.  
  21. /*
  22. | Looks like 22 lines...
  23. */
  24. char h_frame[ (H_RIGHT-H_LEFT+1) * (H_BOTTOM-H_TOP+1) + 1 ] =
  25. /* ---------+---------+---------+-------- + */
  26.  "┌──────────────────────────────────────┐"
  27.  "│                                      │"
  28.  "│                                      │"
  29.  "│                                      │"
  30.  "│                                      │"
  31.  "│                                      │"
  32.  "│                                      │"
  33.  "│                                      │"
  34.  "│                                      │"
  35.  "│                                      │"
  36.  "│                                      │"
  37.  "│                                      │"
  38.  "│                                      │"
  39.  "│                                      │"
  40.  "│                                      │"
  41.  "│                                      │"
  42.  "│                                      │"
  43.  "│                                      │"
  44.  "│                                      │"
  45.  "│                                      │"
  46.  "│                                      │"
  47.  "│                                      │"
  48.  "│                                      │"
  49.  "└──────────────────────────────────────┘\000";
  50. /* ---------+---------+---------+-------- + */
  51.  
  52. /*
  53.  * spare parts: ┴ ┐  :
  54.  * char h1_bar2[] = "┐";
  55.  */
  56.  
  57. char horiz_bar[] =
  58.  "├──────────────────────────────────────┤";
  59. char bottom_bar[] =
  60.  "└──────────────────────────────────────┘";
  61.  
  62. char h1_bar1[] = "┬│";
  63. #define BAR_H  14        /* position of inserted */
  64. #define BAR_V   8        /*   h1_bar1 string     */
  65. char h1_bar2[] = "│┴";
  66. #define BAR_H2  7
  67. #define BAR_V2 10
  68.  
  69. char h1_label[] = " Help Screen 1 ";
  70. char h2_label[] = " Help Screen 2 ";
  71.  
  72. help_text help1[] = {
  73. /* ---------+---------+---------+-------- + */
  74.   "+ - * / %  I",HC,
  75.           "nvert  ",HN,
  76.              "abs frac int !",HC,
  77.                    "│",HL,
  78.                     "fact",HC,
  79. /* ---------+---------+---------+-------- + */
  80.   "exp ln lg log  ^",HC,
  81.           "│",HL,
  82.            "pow  p10",HC,
  83.                "│",HL,
  84.                 "pow10  gamma",HC,
  85. /* ---------+---------+---------+-------- + */
  86.   "C",HC,
  87.    "learX ",HN,
  88.      "L",HC,
  89.       "astX  ",HN,
  90.         "pi  sqr sqrt  ",HC,
  91.                   "X\x1DY: ",HL,
  92.                    "X",HC,
  93.                     "chng",HN,
  94. /* ---------+---------+---------+-------- + */
  95.   "clrstk clrreg clrblk",HC,
  96.               "Y..X  ",HN,
  97.                 "CHS:",HL,
  98.                 "'",HC,
  99.                  "│",HL,
  100.                   "N",HC,
  101.                    "egate",HN,
  102. /* ---------+---------+---------+-------- + */
  103.   0,0,    /* terminal entry */
  104.  
  105.  
  106.   "sin asin  rad   sinh isinh  csch icsch",HC,
  107.   "cos acos  deg   cosh icosh  sech isech",HC,
  108.   "tan atan        tanh itanh  coth icoth",HC,
  109.   " atan2",HC,
  110.     "(Y/X) ",HN,
  111.           "  hms  hrs   polar  rect  ",HC,
  112.   "<CTRL>R",HC,
  113.      " / ",HL,
  114.         "<CTRL>D ",HC,
  115.             "Radians/Degrees mode",HL,
  116. /* ---------+---------+---------+-------- + */
  117.   0,0,    /* terminal entry */
  118.  
  119.  
  120. /* ---------+---------+---------+-------- + */
  121.   "",HC, "│",HL, "ru",HC, " / ",HL, "",HC, "│",HL, "rd  ",HC,
  122.     "Stack - roll Up / Down   ",HL,
  123.   "    <CR>     ",HC, "Do-Function or Enter     ",HL,
  124.   "   <SPACE>   ",HC, "Enter (push stack)       ",HL,
  125.   "    <ESC>    ",HC, "erase Ftn or close Help  ",HL,
  126.   "    init     ",HC, "Re-initialize RPN calc.  ",HL,
  127.   "<SCROLL-LOCK>",HC, "Reposition display window",HL,
  128.   "    <F1>     ",HC, "cycle thru HELPscreens   ",HL,
  129.   "    <F2>     ",HC, "toggle save-file on/off  ",HL,
  130.   " <CTRL><F10> ",HC, "Quit, but leave windows  ",HL,
  131.   " <SHFT><F10> ",HC, "escape to sub-shell      ",HL,
  132.   "    <F10>    ",HC, "  QUIT                   ",HL,
  133. /* ---------+---       ------+---------+-------- + */
  134.   0,0,    /* terminal entry */
  135.  
  136.   0,0    /* Final entry */
  137. };   /**  help1  **/
  138.  
  139.  
  140. help_text help2[] = {
  141.   "Memory,Stats; Prts: ",HL,
  142.               "#",HT,
  143.                "=0..99│i   ",HL,
  144.                   "prtstk",HC,
  145. /* ---------+---------+---------+-------- + */
  146.   "sto"  ,HC,
  147.      "│"  ,HL,
  148.       "S "  ,HC,
  149.     "{"  ,HL,
  150.      "+"  ,HC,
  151.       "│"  ,HL,
  152.        "-"  ,HC,
  153.         "│"  ,HL,
  154.          "*"  ,HC,
  155.           "│"  ,HL,
  156.            "/"  ,HC,
  157.         "} "  ,HL,
  158.           "#"  ,HT,
  159.            "     sum+"  ,HC,
  160.                 "│"  ,HL,
  161.                  "]    prtreg",HC,
  162. /* ---------+---------+---------+-------- + */
  163.   "rcl",HC,
  164.      "│",HL,
  165.       "R ",HC,
  166.     "{"  ,HL,
  167.      "#",HT,
  168.           "│",HL,
  169.        "s",HC,
  170.         "um regs.",HN,
  171.             "}   "  ,HL,
  172.                 "sum-",HC,
  173.                 "│",HL,
  174.                  "[    prtsum",HC,
  175. /* ---------+---------+---------+-------- + */
  176.   "mean      linreg    lincoeffs   prtlin",HC,
  177.   "geomean   linstats  interpx     clrsum",HC,
  178.   "harmean  sd",HC,
  179.          "│"  ,HL,
  180.           "stddev  interpy     clrlin",HC,
  181. /* ---------+---------+---------+-------- + */
  182.   0,0,    /* terminal entry */
  183.  
  184.  
  185.   "rad    kg   liters  lymeters  meters  ",HC,
  186.   "deg    lb   gal     ly        feet    ",HC,
  187.   "polar  mps  igal    acres     fahr    ",HC,
  188.   "rect   mph  cuinch  hectares  celsius ",HC,
  189.   "km     hrs  joules  furlongs      ",HC,
  190.                     "Unit",HL,
  191.   "miles  hms  cal     yards  ",HC,
  192.                  "Conversions",HL,
  193. /* ---------+---------+---------+-------- + */
  194.   0,0,    /* terminal entry */
  195.  
  196.  
  197.   "Const's:  ",HL,
  198.         "pi c fc planck avogadro epsi",HC,
  199. /* ---------+---------+---------+-------- + */
  200.   0,0,    /* terminal entry */
  201.  
  202.  
  203.   "default Hex Digits: ",HL,
  204.               "<ALT>-A ",HC,
  205.                   ".. ",HL,
  206.                  "<ALT>-F",HC,
  207. /* ---------+---------+---------+-------- + */
  208.   "Exponent, Precision, Base: ",HL,
  209.   "E",HC,  "#  ",HT, "P",HC, "#  ",HT, "B",HC, "# ",HT,
  210. /* ---------+---------+---------+-------- + */
  211.   0,0,    /* terminal entry */
  212.  
  213.   "    <F3>     ",HC, "toggle fixed/sci notation",HL,
  214.   "    <F1>     ",HC, "cycle thru HELPscreens   ",HL,
  215.   "    <F10>    ",HC, "  QUIT                   ",HL,
  216. /* ---------+---------+---------+-------- + */
  217.   0,0,    /* terminal entry */
  218.  
  219.   0,0    /* Final entry */
  220. };   /**  help2  **/
  221.  
  222.  
  223. /*//////////////////////////////////////////////////////////////////////////*/
  224.  
  225. void make_help(const char *title, help_text *text, const char *signature)
  226. {
  227.     help_text *hp;
  228.     int pos;
  229.     struct text_info r;
  230.  
  231.     textbackground(H_BKGND);
  232.     window(H_LEFT, H_TOP, H_RIGHT, H_BOTTOM+1);    /* left-side help window */
  233.     textcolor(H_BORDER);
  234.     cputs(h_frame);
  235.     pos = (H_WIDTH - strlen(title))/2;
  236.     window(H_LEFT + pos, H_TOP, H_RIGHT, H_TOP);
  237.     textcolor(H_TITLE);
  238.     cputs(title);
  239.  
  240.     window(H_LEFT+1, H_TOP+1, H_RIGHT-1, H_BOTTOM+1);
  241.     hp = text;
  242.     do {
  243.     for ( ; hp->text != 0; ++hp) {
  244.         textcolor(hp->color);
  245.         cputs(hp->text);
  246.     }
  247.     gettextinfo(&r);
  248.     window(H_LEFT, r.cury+1, H_RIGHT, H_BOTTOM+1);
  249.     textcolor(H_BORDER);
  250.     cputs(horiz_bar);
  251.     window(H_LEFT+1, H_TOP+1, H_RIGHT-1, H_BOTTOM+1);
  252.     gotoxy(r.curx, r.cury+1);
  253.     keypause();
  254.     } while ( (++hp)->text != 0 );
  255.  
  256.     window(H_LEFT, r.cury+1, H_RIGHT, H_BOTTOM+1);
  257.     textcolor(H_BORDER);
  258.     cputs(bottom_bar);
  259.  
  260.     if (signature) {
  261.     window(H_LEFT+1, H_BOTTOM, H_RIGHT, H_BOTTOM+1);
  262.     textcolor(H_TITLE);
  263.     cputs(signature);
  264.     }
  265. }
  266.