home *** CD-ROM | disk | FTP | other *** search
/ Hot Shareware 35 / hot35.iso / ficheros / LC / SIMPWN93.ZIP / SIMPWIN.ZIP / SWTUT92.C < prev    next >
C/C++ Source or Header  |  1997-09-17  |  28KB  |  1,201 lines

  1. /*  simpwin9 copyright 1995 - 1997 by bruce r. o'banion */
  2.  
  3. # include <dos.h>
  4. # include <string.h>
  5. # include <stdio.h>
  6. # include <bios.h>
  7. # include <stdlib.h>
  8. # include <conio.h>
  9. # include <mem.h>
  10. # include <sys\stat.h>
  11. # include <io.h>
  12. /***************************************************************************
  13.  
  14.                         simple windows includes
  15.  
  16. ***************************************************************************/
  17.  
  18. # include "simpwn92.h"
  19. # include "mouse92.h"
  20. # include "skdef92.h"
  21.  
  22. /***************************************************************************
  23.  
  24.                         window call defines
  25.  
  26. ***************************************************************************/
  27.  
  28. # define MAIN_WIN 1
  29. # define DEMO_WIN 2
  30. # define TEXT_WIN 3
  31. # define FONT_TEXT 4
  32. # define FONT_WIN 5
  33. # define QUIT_WIN 6
  34. # define FUNG_WIN 7
  35. # define DEMO_TEXT 8
  36. # define ENTER_WIN 9
  37. # define EDIT_WIN 10
  38.  
  39. /***************************************************************************
  40.  
  41.     fungtion prototypes
  42.  
  43. ***************************************************************************/
  44.  
  45. int font_demo(void);
  46. int main_menu(void);
  47. int quit(void);
  48. int demo_menu(void);
  49. int tutor_menu(void);
  50. int tut_menu(void);
  51. int demo_popup(void);
  52. int shad_demo(void);
  53. int boarder_demo(void);
  54. int enter_demo(void);
  55. void reed_text(char *file_name);
  56. int read_text_demo(void);
  57. int mou_menu(void);
  58.  
  59. int display_switch = 1;
  60. char font_string[50];
  61. int mou_switch;
  62.  
  63. void main(void)
  64. {
  65.     int i,j,k;
  66.  
  67. /***************************************************************************
  68.     initialize simpwin9 and mou105
  69. ****************************************************************************/
  70.     init_window(12,5,"");
  71.     strcpy(font_string,"lfsw92 medieval.fnt");
  72.     system(font_string);
  73.     hide_cursor();
  74.     system("cls");
  75.     if(mouinstalled())
  76.     {
  77.         moureset();
  78.         mouhide();
  79.         mousetposition(1,1);
  80.         mou_switch = 1;
  81.         simp_window(30,10,50,12,1,0,14,4,0,0,0,0,0);
  82.         write_window(3,2,"Mouse Installed !");
  83.         delay(1000);
  84.     }
  85.     k= 3;
  86.     for(i = 0;i < 13;i++)
  87.     {
  88.         for(j = k - 3;j < k;j++)
  89.         {
  90.             simp_window(40 - j,13 - i,40 + j,13 + i,1,0,14,4,0,0,0,0,0);
  91.         }
  92.         k = k + 3;
  93.     }
  94.     simp_window(1,1,80,25,1,0,14,4,0,0,0,0,0);
  95.     read_text("title.scr",3);
  96.     save_screen(1);
  97.  
  98. /****************************************************************************
  99.  
  100.     run program menu system
  101.  
  102. ***************************************************************************/
  103.     moucursortype(0x02);
  104.     moushow();
  105.     /*mou_switch = 0;*/
  106.     while(main_menu())
  107.     {
  108.     }
  109.  
  110. /***************************************************************************
  111.  
  112.     uninitialize simpwin9 and mou105 and exit and restore font
  113.  
  114. ****************************************************************************/
  115.  
  116.     uninit_window();
  117.     moureset();
  118.     show_cursor();
  119.     system("lfsw92 ibmstd.fnt");
  120.     system("cls");
  121. }
  122.  
  123. /**************************************************************************
  124.  
  125.     This is a typical menu fungtion. I will comment this one only
  126.     to save on redundancy. All the other menuing moduals are similar.
  127.  
  128. **************************************************************************/
  129.  
  130. int font_demo(void)
  131. {
  132.     int i,choice = -1,old_i = 9,moux = 0,mouy = 0;
  133.     char lable[8][13] = {"ROMan","SCRipt","ANTique","BROdway","SANserif",
  134.         "COUrrier","MEDieval","IBM std vga"};
  135.  
  136. /**************************************************************************
  137.  
  138.     draw window and menu with hilght
  139.  
  140. **************************************************************************/
  141.     popup_window(FONT_TEXT,20,5,65,14,2,2,14,6,1,8,0,0,0);
  142.     write_window(16,10," HIT ANY KEY ");
  143.     read_text("font.txt",2);
  144.     popup_window(FONT_WIN,30,6,45,15,2,2,14,6,1,8,0,0,0);
  145.     write_window(5,1," FONTS ");
  146.     read_text("font.men",3);
  147.     textcolor(0);
  148.     write_window(3,2,"R");
  149.     write_window(3,3,"S");
  150.     write_window(3,4,"A");
  151.     write_window(3,5,"B");
  152.     write_window(5,6,"N");
  153.     write_window(3,7,"C");
  154.     write_window(3,8,"M");
  155.     write_window(3,9,"I");
  156.     save_screen(0);
  157. /***************************************************************************
  158.  
  159.     This is the cursor and mouse control
  160.  
  161. ***************************************************************************/
  162.  
  163.     i = 0;
  164.     moushow();
  165.     for(;;)
  166.     {
  167.         choice = 0;
  168.     /******************************************************************
  169.  
  170.         This tells where is mouse
  171.  
  172.     ******************************************************************/
  173.         if(mouposition(&moux,&mouy))
  174.         {
  175.             if((moux > 30 ) & (moux < 45 ))
  176.             {
  177.                 i = mouy - 7;
  178.             }
  179.         }
  180.     /******************************************************************
  181.  
  182.         this is for cursor control
  183.  
  184.     ******************************************************************/
  185.  
  186.         if(i < 0)
  187.         {
  188.             i = 0;
  189.         }
  190.         if(i > 7)
  191.         {
  192.             i = 7;
  193.         }
  194.     /******************************************************************
  195.  
  196.         This checks for key entery
  197.  
  198.     ******************************************************************/
  199.  
  200.         if(bioskey(1) | (mou_switch == 0))
  201.         {
  202.             switch(bioskey(0))
  203.             {
  204.                 case ESC : choice = 10; break;
  205.                 case ENTER : choice = 1; break;
  206.                 case CURSOR_UP : i = i - 1; break;
  207.                 case CURSOR_DN : i = i + 1; break;
  208.                 case ALT_R : choice = 2; break;
  209.                 case ALT_S : choice = 3; break;
  210.                 case ALT_A : choice = 4; break;
  211.                 case ALT_B : choice = 5; break;
  212.                 case ALT_N : choice = 6; break;
  213.                 case ALT_C : choice = 7; break;
  214.                 case ALT_M : choice = 8; break;
  215.                 case ALT_I : choice = 9; break;
  216.             }
  217.         }
  218.  
  219.  
  220.     /******************************************************************
  221.  
  222.         this draws shadowed hilight
  223.  
  224.     ********************************************************************/
  225.  
  226.         if(old_i != i)
  227.         {
  228.             old_i = i;
  229.             mouhide();
  230.             load_screen(0);
  231.             simp_window(31,7 + i,44,7 + i,0,2,4,3,1,8,0,0,0);
  232.             write_window(2,1,"%s",lable[i]);
  233.             moushow();
  234.         }
  235.  
  236.     /******************************************************************
  237.  
  238.         this checks mouse button
  239.  
  240.     ******************************************************************/
  241.  
  242.         if(moubuttonpressed(LEFTBUTTON))
  243.         {
  244.             if((moux < 45) & (moux > 30) & (mouy > 6) & (mouy < 15))
  245.             {
  246.                 choice = 1;
  247.             }
  248.         }
  249.         if(choice != 0)
  250.         {
  251.             break;
  252.         }
  253.     }
  254.     mouhide();
  255.     load_screen(0);
  256.  
  257. /************************************************************************
  258.  
  259.     this check to see if there is a selection
  260.  
  261. ************************************************************************/
  262.  
  263.     if(choice == 1)
  264.     {
  265.         choice = i + 2;
  266.     }
  267.     switch(choice)
  268.     {
  269.         case 2 : strcpy(font_string,"lfsw92 roman.fnt"); break;
  270.         case 3 : strcpy(font_string,"lfsw92 script.fnt"); break;
  271.         case 4 : strcpy(font_string,"lfsw92 antique.fnt"); break;
  272.         case 5 : strcpy(font_string,"lfsw92 brodway.fnt"); break;
  273.         case 6 : strcpy(font_string,"lfsw92 sanserif.fnt"); break;
  274.         case 7 : strcpy(font_string,"lfsw92 courrier.fnt"); break;
  275.         case 8 : strcpy(font_string,"lfsw92 medieval.fnt"); break;
  276.         case 9 : strcpy(font_string,"lfsw92 ibmstd.fnt"); break;
  277.     }
  278.     system(font_string);
  279.     unpopup_window(FONT_WIN);
  280.     unpopup_window(FONT_TEXT);
  281.     display_switch = 0;
  282.     hide_cursor();
  283.     return(0);
  284. }
  285.  
  286. int main_menu(void)
  287. {
  288.     int pick,choice,i = 0,old_i = 9,moux = 0,mouy = 0;
  289.     char lable[4][13] = {"Demo","Text","Fonts","eXit"};
  290.  
  291. /***************************************************************************
  292.  
  293.     this code is used to get rid of window flash
  294.  
  295. **************************************************************************/
  296.     if(display_switch)
  297.     {
  298.         load_screen(1);
  299.         popup_window(MAIN_WIN,5,3,52,5,2,2,14,6,1,8,0,0,0);
  300.         read_text("main.men",3);
  301.         save_screen(2);
  302.     }
  303.     else
  304.     {
  305.         load_screen(2);
  306.     }
  307.  
  308. /**************************************************************************/
  309.  
  310.     display_switch = 1;
  311.     textcolor(0);
  312.     write_window(3,2,"D");
  313.     write_window(15,2,"T");
  314.     write_window(28,2,"F");
  315.     write_window(43,2,"X");
  316.     save_screen(0);
  317.     i = 0;
  318.     moushow();
  319.     for(;;)
  320.     {
  321.         choice = 0;
  322.         if(mouposition(&moux,&mouy))
  323.         {
  324.             if(mouy == 4)
  325.             {
  326.                 if((moux > 5) & (moux < 11))
  327.                 {
  328.                     i = 0;
  329.                 }
  330.                 else if((moux > 17) & (moux < 24))
  331.                 {
  332.                     i = 1;
  333.                 }
  334.                 else if((moux > 30) & (moux < 39))
  335.                 {
  336.                     i = 2;
  337.                 }
  338.                 else if((moux > 44) & (moux < 50))
  339.                 {
  340.                     i = 3;
  341.                 }
  342.             }
  343.         }
  344.         if(bioskey(1) | (mou_switch == 0))
  345.         {
  346.             switch(bioskey(0))
  347.             {
  348.                 case ESC : choice = 6; break;
  349.                 case CURSOR_RIGHT : i = i + 1; break;
  350.                 case CURSOR_LEFT : i = i - 1; break;
  351.                 case ENTER : choice = 1; break;
  352.                 case ALT_D : choice = 2; break;
  353.                 case ALT_T : choice = 3; break;
  354.                 case ALT_X : choice = 5; break;
  355.                 case ALT_F : choice = 4; break;
  356.             }
  357.         }
  358.         if(i < 0)
  359.         {
  360.             i = 0;
  361.         }
  362.         if(i > 3)
  363.         {
  364.             i = 3;
  365.         }
  366.  
  367.         if(old_i != i)
  368.         {
  369.             mouhide();
  370.             old_i = i;
  371.             load_screen(0);
  372.             switch(i)
  373.             {
  374.                 case 0 : simp_window(6,4,11,4,0,2,4,3,1,8,0,0,0); break;
  375.                 case 1 : simp_window(18,4,24,4,0,2,4,3,1,8,0,0,0); break;
  376.                 case 2 : simp_window(31,4,39,4,0,2,4,3,1,8,0,0,0); break;
  377.                 case 3 : simp_window(45,4,50,4,0,2,4,3,1,8,0,0,0); break;
  378.             }
  379.             write_window(2,1,"%s",lable[i]);
  380.             moushow();
  381.         }
  382.         if(moubuttonpressed(0))
  383.         {
  384.             if(mouy == 4)
  385.             {
  386.                 if(((moux > 5) & (moux < 11)) |
  387.                     ((moux > 17) & (moux < 24)) |
  388.                     ((moux > 30) & (moux < 39)) |
  389.                     ((moux > 44) & (moux < 50)))
  390.                 {
  391.                     choice = 1;
  392.                 }
  393.             }
  394.         }
  395.         if(choice != 0)
  396.         {
  397.             break;
  398.         }
  399.     }
  400.     mouhide();
  401.     load_screen(0);
  402.     if(choice == 1)
  403.     {
  404.         choice = i + 2;
  405.     }
  406.     pick = 1;
  407.     switch(choice)
  408.     {
  409.         case 2 : while(demo_menu()){} break;
  410.         case 3 : while(tutor_menu()){} break;
  411.         case 4 : font_demo(); break;
  412.         case 6 :
  413.         case 5 : pick = quit(); break;
  414.     }
  415.     return(pick);
  416. }
  417.  
  418. /*************************************************************************
  419.  
  420.     this modual ask if you are shure you wish to quit
  421.  
  422. ************************************************************************/
  423.  
  424. int quit(void)
  425. {
  426.     int pick = 1;
  427.     char choice[2] = "N";
  428.  
  429.     show_cursor();
  430.     popup_window(QUIT_WIN,32,10,48,12,1,2,15,4,1,8,0,0,0);
  431.     write_window(3,2,"Quit Y/N ?");
  432.     get_string(choice," ","Y",14,2,1,1);
  433.     strupr(choice);
  434.     hide_cursor();
  435.     if(strcmp(choice,"Y") == 0)
  436.     {
  437.         pick = 0;
  438.     }
  439.     unpopup_window(QUIT_WIN);
  440.     return(pick);
  441. }
  442.  
  443. int demo_menu(void)
  444. {
  445.     int pick,choice,i = 0,old_i = 7 ,moux = 0,mouy = 0;
  446.     char lable[5][13] = {"Capacity","Shadow","Boarder","Enteries","Read text"};
  447.  
  448.     if(display_switch)
  449.     {
  450.         load_screen(2);
  451.         popup_window(DEMO_WIN,7,4,19,10,2,2,14,6,1,8,0,0,0);
  452.         read_text("demo.men",3);
  453.         save_screen(3);
  454.     }
  455.     else
  456.     {
  457.         load_screen(3);
  458.     }
  459.     display_switch = 1;
  460.     textcolor(0);
  461.     write_window(3,2,"C");
  462.     write_window(3,3,"S");
  463.     write_window(3,4,"B");
  464.     write_window(3,5,"E");
  465.     write_window(3,6,"R");
  466.     save_screen(0);
  467.     i = 0;
  468.     moushow();
  469.     for(;;)
  470.     {
  471.         choice = 0;
  472.         if(mouposition(&moux,&mouy))
  473.         {
  474.             if((moux > 7) & (moux < 19))
  475.             {
  476.                 i = mouy - 5;
  477.             }
  478.         }
  479.         if(bioskey(1) | (mou_switch == 0))
  480.         {
  481.             switch(bioskey(0))
  482.             {
  483.                 case ESC : choice = 7; break;
  484.                 case CURSOR_DN : i = i + 1; break;
  485.                 case CURSOR_UP : i = i - 1; break;
  486.                 case ENTER : choice = 1; break;
  487.                 case ALT_C : choice = 2; break;
  488.                 case ALT_S : choice = 3; break;
  489.                 case ALT_B : choice = 4; break;
  490.                 case ALT_E : choice = 5; break;
  491.                 case ALT_R : choice = 6; break;
  492.             }
  493.         }
  494.         if(i < 0)
  495.         {
  496.             i = 0;
  497.         }
  498.         if(i > 4)
  499.         {
  500.             i = 4;
  501.         }
  502.         if(old_i != i)
  503.         {
  504.             old_i = i;
  505.             mouhide();
  506.             load_screen(0);
  507.             simp_window(8,5 + i,18,5 + i,0,2,4,3,1,8,0,0,0);
  508.             write_window(2,1,"%s",lable[i]);
  509.             moushow();
  510.         }
  511.         if(moubuttonpressed(LEFTBUTTON))
  512.         {
  513.             if((moux > 7) & (moux < 19) & (mouy > 4) & (mouy < 10))
  514.             {
  515.                 choice = 1;
  516.             }
  517.             else
  518.             {
  519.                 choice = 7;
  520.             }
  521.         }
  522.         if(choice != 0)
  523.         {
  524.             break;
  525.         }
  526.     }
  527.     mouhide();
  528.     load_screen(0);
  529.     pick = 1;
  530.     if(choice == 1)
  531.     {
  532.         choice = i + 2;
  533.     }
  534.     switch(choice)
  535.     {
  536.         case 2 : demo_popup(); break;
  537.         case 3 : shad_demo(); break;
  538.         case 4 : boarder_demo(); break;
  539.         case 5 : enter_demo(); break;
  540.         case 6 : read_text_demo(); break;
  541.         case 7 : pick = 0; break;
  542.     }
  543.     display_switch = 0;
  544.     return(pick);
  545. }
  546.  
  547. int tutor_menu(void)
  548. {
  549.     int pick,choice,i = 0,old_i = 12,moux = 0,mouy = 0;
  550.     char lable[7][13] = {"Genral info","Disclaimer",
  551.         "Functions","Support","Mouse91","Loadfonts","simply sOft"};
  552.  
  553.     if(display_switch)
  554.     {
  555.         load_screen(2);
  556.         popup_window(TEXT_WIN,17,4,32,12,2,2,14,6,1,8,0,0,0);
  557.         read_text("tutor.men",3);
  558.         save_screen(3);
  559.     }
  560.     else
  561.     {
  562.         load_screen(3);
  563.     }
  564.     display_switch = 1;
  565.     textcolor(0);
  566.     write_window(3,2,"G");
  567.     write_window(3,3,"D");
  568.     write_window(3,4,"F");
  569.     write_window(3,5,"S");
  570.     write_window(3,6,"M");
  571.     write_window(3,7,"L");
  572.     write_window(11,8,"O");
  573.     save_screen(0);
  574.     moushow();
  575.     for(;;)
  576.     {
  577.         choice = 0;
  578.         if(mouposition(&moux,&mouy))
  579.         {
  580.             if((moux > 17) & (moux < 32))
  581.             {
  582.                 i = mouy - 5;
  583.             }
  584.         }
  585.         if(bioskey(1) | (mou_switch == 0))
  586.         {
  587.             switch(bioskey(0))
  588.             {
  589.                 case ESC : choice = 10; break;
  590.                 case CURSOR_DN : i = i + 1; break;
  591.                 case CURSOR_UP : i = i - 1; break;
  592.                 case ENTER : choice = 1; break;
  593.                 case ALT_G : choice = 2; break;
  594.                 case ALT_D : choice = 3; break;
  595.                 case ALT_F : choice = 4; break;
  596.                 case ALT_S : choice = 5; break;
  597.                 case ALT_M : choice = 6; break;
  598.                 case ALT_V : choice = 7; break;
  599.                 case ALT_O : choice = 8; break;
  600.             }
  601.         }
  602.         if(i < 0)
  603.         {
  604.             i = 0;
  605.         }
  606.         if(i > 6)
  607.         {
  608.             i = 6;
  609.         }
  610.         if(old_i != i)
  611.         {
  612.             old_i = i;
  613.             mouhide();
  614.             load_screen(0);
  615.             simp_window(18,5 + i,31,5 + i,0,2,4,3,1,8,0,0,0);
  616.             write_window(2,1,"%s",lable[i]);
  617.             moushow();
  618.         }
  619.         if(moubuttonpressed(LEFTBUTTON))
  620.         {
  621.             if((moux > 17) & (moux < 32) & (mouy > 4) & (mouy < 12))
  622.             {
  623.                 choice = 1;
  624.             }
  625.             else
  626.             {
  627.                 choice = 10;
  628.             }
  629.         }
  630.         if(choice != 0)
  631.         {
  632.             break;
  633.         }
  634.     }
  635.     mouhide();
  636.     load_screen(0);
  637.     pick = 1;
  638.     if(choice == 1)
  639.     {
  640.         choice = i + 2;
  641.     }
  642.     switch(choice)
  643.     {
  644.         case 2 : reed_text("genral.txt"); break;
  645.         case 3 : reed_text("disclam.txt"); break;
  646.         case 4 : while(tut_menu()){} break;
  647.         case 5 : reed_text("support.txt"); break;
  648.         case 6 : while(mou_menu()){}; break;
  649.         case 7 : reed_text("loadfont.txt"); break;
  650.         case 8 : reed_text("simpsoft.txt"); break;
  651.         case 10 : pick = 0; break;
  652.     }
  653.     display_switch = 0;
  654.     return(pick);
  655. }
  656.  
  657. int tut_menu(void)
  658. {
  659.     int pick,choice,i = 0,old_i = 13,moux = 0,mouy = 0;
  660.         char lable[13][25] = {"simp_window\(\)","popup_window\(\)","unpopup_window\(\)","get_string\(\)",
  661.         "clear_window\(\)","show_cursor\(\)","hide_cursor\(\)","write_window\(\)","read_text\(\)",
  662.         "save_screen\(\)","load_screen\(\)","init_window\(\)","uninit_window\(\)"};
  663.  
  664.     if(display_switch)
  665.     {
  666.         popup_window(FUNG_WIN,20,5,40,19,2,2,14,6,1,8,0,0,0);
  667.         read_text("fung.men",3);
  668.         write_window(3,1," FUNGTION MENU ");
  669.         save_screen(4);
  670.     }
  671.     else
  672.     {
  673.         load_screen(4);
  674.     }
  675.     save_screen(0);
  676.     moushow();
  677.     for(;;)
  678.     {
  679.         choice = 0;
  680.         if(mouposition(&moux,&mouy))
  681.         {
  682.             if((moux > 21) & (moux < 46))
  683.             {
  684.                 i = mouy - 6;
  685.             }
  686.         }
  687.         if(bioskey(1) | (mou_switch == 0))
  688.         {
  689.             switch(bioskey(0))
  690.             {
  691.                 case ESC : choice = 13; break;
  692.                 case ENTER : choice = 1; break;
  693.                 case CURSOR_UP : i = i - 1; break;
  694.                 case CURSOR_DN : i = i + 1; break;
  695.             }
  696.         }
  697.         if(i < 0)
  698.         {
  699.             i = 0;
  700.         }
  701.         if(i > 12)
  702.         {
  703.             i = 12;
  704.         }
  705.         if(old_i != i)
  706.         {
  707.             mouhide();
  708.             old_i = i;
  709.             load_screen(0);
  710.             simp_window(21,6 + i,21 + strlen(lable[i]) + 1,6 + i,0,2,4,3,1,8,0,0,0);
  711.             write_window(2,1,"%s",lable[i]);
  712.             moushow();
  713.         }
  714.         if(moubuttonpressed(LEFTBUTTON))
  715.         {
  716.             if((moux > 21) & (moux < 46) & (mouy > 5) & (mouy < 19))
  717.             {
  718.                 choice = 1;
  719.             }
  720.             else
  721.             {
  722.                 choice = 13;
  723.             }
  724.         }
  725.         if(choice != 0)
  726.         {
  727.             break;
  728.         }
  729.     }
  730.     mouhide();
  731.     load_screen(0);
  732.     pick = 1;
  733.     if(choice == 1)
  734.     {
  735.         choice = i;
  736.     }
  737.     pick = 1;
  738.     switch(choice)
  739.     {
  740.         case 0 : reed_text("fung1.txt"); break;
  741.         case 1 : reed_text("fung2.txt"); break;
  742.         case 2 : reed_text("fung3.txt"); break;
  743.         case 3 : reed_text("fung4.txt"); break;
  744.         case 4 : reed_text("fung5.txt"); break;
  745.         case 5 : reed_text("fung6.txt"); break;
  746.         case 6 : reed_text("fung7.txt"); break;
  747.         case 7 : reed_text("fung8.txt"); break;
  748.         case 8 : reed_text("fung9.txt"); break;
  749.         case 9 : reed_text("fung10.txt"); break;
  750.         case 10 : reed_text("fung11.txt"); break;
  751.         case 11 : reed_text("fung12.txt"); break;
  752.         case 12 : reed_text("fung13.txt"); break;
  753.         case 13 : pick = 0; break;
  754.     }
  755.     display_switch = 0;
  756.     return(pick);
  757. }
  758.  
  759.  
  760. int mou_menu(void)
  761. {
  762.     int pick,choice,i = 0,old_i = 13,moux = 0,mouy = 0;
  763.         char lable[10][25] = {"mouinstalled\(\)","moureset\(\)",
  764.         "moubuttonpressed\(\)","mouhide\(\)","moushow\(\)",
  765.         "moucursortype\(\)","mouseposition\(\)","mouposition\(\)",
  766.         "mousetmaxposition\(\)","moubuttonreleased\(\)"};
  767.  
  768.     if(display_switch)
  769.     {
  770.         popup_window(FUNG_WIN,18,5,42,16,2,2,14,6,1,8,0,0,0);
  771.         read_text("mou.men",3);
  772.         write_window(5,1," MOUSE MENU ");
  773.         save_screen(4);
  774.     }
  775.     else
  776.     {
  777.         load_screen(4);
  778.     }
  779.     save_screen(0);
  780.     moushow();
  781.     for(;;)
  782.     {
  783.         choice = 0;
  784.         if(mouposition(&moux,&mouy))
  785.         {
  786.             moushow();
  787.             if((moux > 19) & (moux < 43))
  788.             {
  789.                 i = mouy - 6;
  790.             }
  791.         }
  792.         if(bioskey(1) | (mou_switch == 0))
  793.         {
  794.             switch(bioskey(0))
  795.             {
  796.                 case ESC : choice = 12; break;
  797.                 case ENTER : choice = 1; break;
  798.                 case CURSOR_UP : i = i - 1; break;
  799.                 case CURSOR_DN : i = i + 1; break;
  800.             }
  801.         }
  802.         if(i < 0)
  803.         {
  804.             i = 0;
  805.         }
  806.         if(i > 9)
  807.         {
  808.             i = 9;
  809.         }
  810.         if(old_i != i)
  811.         {
  812.             mouhide();
  813.             old_i = i;
  814.             load_screen(0);
  815.             simp_window(19,6 + i,19 + strlen(lable[i]) + 1,6 + i,0,2,4,3,1,8,0,0,0);
  816.             write_window(2,1,"%s",lable[i]);
  817.             moushow();
  818.         }
  819.         if(moubuttonpressed(LEFTBUTTON))
  820.         {
  821.             if((moux > 18) & (moux < 43) & (mouy > 5) & (mouy < 16))
  822.             {
  823.                 choice = 1;
  824.             }
  825.             else
  826.             {
  827.                 choice = 12;
  828.             }
  829.         }
  830.         if(choice != 0)
  831.         {
  832.             break;
  833.         }
  834.     }
  835.     mouhide();
  836.     load_screen(0);
  837.     pick = 1;
  838.     if(choice == 1)
  839.     {
  840.         choice = i;
  841.     }
  842.     pick = 1;
  843.     switch(choice)
  844.     {
  845.         case 0 : reed_text("fung14.txt"); break;
  846.         case 1 : reed_text("fung15.txt"); break;
  847.         case 2 : reed_text("fung16.txt"); break;
  848.         case 3 : reed_text("fung19.txt"); break;
  849.         case 4 : reed_text("fung20.txt"); break;
  850.         case 5 : reed_text("fung17.txt"); break;
  851.         case 6 : reed_text("fung21.txt"); break;
  852.         case 7 : reed_text("fung22.txt"); break;
  853.         case 8 : reed_text("fung23.txt"); break;
  854.         case 9 : reed_text("fung24.txt"); break;
  855.         case 10 : reed_text("fung25.txt"); break;
  856.         case 12 : pick = 0; break;
  857.     }
  858.     display_switch = 0;
  859.     return(pick);
  860. }
  861.  
  862. int demo_popup(void)
  863. {
  864.     long int free_space,block = 4056L,convert = 1L,temp_num;
  865.     struct dfree space;
  866.     char drive[3] = "C",int_data[7];
  867.     unsigned char drive_num;
  868.     int i,x,y,fore,back,done = 0;
  869.     unsigned int num_file;
  870.  
  871.     popup_window(DEMO_TEXT,10,5,70,20,2,2,15,6,1,8,0,0,0);
  872.     write_window(25,16," HIT ANY KEY ");
  873.     window(12,6,70,20);
  874.     read_text("capdemo.txt",2);
  875. /*************************************************************************
  876.  
  877.     this code asks for a drive letter and selects that drive
  878.     for the utilitie files checking to see if there is enough
  879.     memory
  880.  
  881. *************************************************************************/
  882.  
  883.     popup_window(ENTER_WIN,20,10,60,12,1,2,14,2,1,8,0,0,0);
  884.     write_window(3,2,"Enter drive letter :");
  885.     if(get_string(drive," ","u",24,2,1,1) == 1)
  886.     {
  887.         unpopup_window(ENTER_WIN);
  888.         unpopup_window(DEMO_TEXT);
  889.         return(0);
  890.     }
  891.     switch(drive[0])
  892.     {
  893.         case 'A' : drive_num = 1; break;
  894.         case 'B' : drive_num = 2; break;
  895.         case 'C' : drive_num = 3; break;
  896.         case 'D' : drive_num = 4; break;
  897.         case 'E' : drive_num = 5; break;
  898.         case 'F' : drive_num = 6; break;
  899.         case 'G' : drive_num = 7; break;
  900.         default : drive_num = 0; break;
  901.     }
  902.     getdfree(drive_num,&space);
  903.     free_space = (convert * space.df_avail * space.df_bsec * space.df_sclus);
  904.     temp_num = (free_space / block) - 5;
  905.     if(temp_num < 0)
  906.     {
  907.         popup_window(0,1,25,80,25,0,0,14,4,0,0,0,0,0);
  908.         write_window(3,1,"Not enough disk space !");
  909.         bioskey(0);
  910.         unpopup_window(0);
  911.         unpopup_window(ENTER_WIN);
  912.         unpopup_window(DEMO_TEXT);
  913.         return(1);
  914.     }
  915.  
  916. /****************************************************************************/
  917.  
  918.     clear_window(0);
  919.     write_window(3,2,"Enter number of popups:");
  920.     if(temp_num > 65530L)
  921.     {
  922.         temp_num = 65530L;
  923.     }
  924.     ltoa(temp_num,int_data,10);
  925.     show_cursor();
  926.     while(done == 0)
  927.     {
  928.  
  929.         if(get_string(int_data,"     ","99999",27,2,1,1) == 1)
  930.         {
  931.             hide_cursor();
  932.             unpopup_window(9);
  933.             unpopup_window(8);
  934.             return(0);
  935.         }
  936.         num_file = atoi(int_data);
  937.         if(temp_num < num_file)
  938.         {
  939.             clear_window(0);
  940.             write_window(3,2,"To many popups !");
  941.             bioskey(0);
  942.             clear_window(0);
  943.             write_window(3,2,"Enter number of popups:");
  944.             ltoa(temp_num,int_data,10);
  945.         }
  946.         else
  947.         {
  948.             done = 1;
  949.         }
  950.     }
  951.     hide_cursor();
  952.     unpopup_window(9);
  953.     unpopup_window(8);
  954.     creat("win.tem",S_IREAD|S_IWRITE);
  955.     creat("screen.tem",S_IREAD|S_IWRITE);
  956.     system("copy win.dat win.tem > font.tem");
  957.     system("copy screen.dat screen.tem > font.tem");
  958.     uninit_window();
  959.     if(init_window(0,0,drive) == 0)
  960.     {
  961.         for(i = 1;i < num_file;i++)
  962.         {
  963.             x = (random(69) + 3);
  964.             y = (random(20) + 2);
  965.             fore = random(16);
  966.             back = random(8);
  967.             popup_window(i,x,y,x + 7,y + 2,1,2,fore,back,1,8,0,0,0);
  968.             write_window(3,2,"%d",i);
  969.         }
  970.         popup_window(num_file,35,10,42,12,1,2,14,12,1,8,0,0,0);
  971.         write_window(3,2,"%d",num_file);
  972.         done = 0;
  973.         while(done == 0)
  974.         {
  975.             for(i = 500;i < 800;i++)
  976.             {
  977.                 sound(i);
  978.                 delay(5);
  979.             }
  980.             if(bioskey(1))
  981.             {
  982.                 break;
  983.             }
  984.             for(i = 800;i > 500;i--)
  985.             {
  986.                 sound(i);
  987.                 delay(5);
  988.             }
  989.             if(bioskey(1))
  990.             {
  991.                 bioskey(0);
  992.                 break;
  993.             }
  994.         }
  995.         nosound();
  996.         for(i = num_file; i > 0;i--)
  997.         {
  998.             unpopup_window(i);
  999.         }
  1000.         uninit_window();
  1001.     }
  1002.     init_window(12,5,"");
  1003.     system("copy win.tem win.dat > font.tem");
  1004.     system("copy screen.tem screen.dat > font.tem");
  1005.     remove("win.tem");
  1006.     remove("screen.tem");
  1007.     display_switch = 0;
  1008.     return(0);
  1009. }
  1010.  
  1011. int shad_demo(void)
  1012. {
  1013.     int fore,back,i;
  1014.  
  1015.     popup_window(DEMO_TEXT,10,5,70,20,2,2,14,6,1,8,0,0,0);
  1016.     write_window(25,16," HIT ANY KEY ");
  1017.     window(16,9,70,20);
  1018.     read_text("shaddemo.txt",2);
  1019.     for(i = 0;i < 3;i++)
  1020.     {
  1021.         popup_window(11,20,10,63,15,2,i,14,2,1,8,0,0,0);
  1022.         switch(i)
  1023.         {
  1024.             case 0 : write_window(3,3,"This is the 0 or NO_SHADOW style."); break;
  1025.             case 1 : write_window(3,3,"This is the 1 or WIDE_SHADOW style"); break;
  1026.             case 2 : write_window(3,3,"This is the 2 or NARROW_SHADOW style"); break;
  1027.         }
  1028.         write_window(15,6," HIT ANY KEY ");
  1029.         bioskey(0);
  1030.         unpopup_window(11);
  1031.     }
  1032.     for(i = 1;i < 5;i++)
  1033.     {
  1034.         popup_window(11,20,10,63,15,2,1,14,2,i,8,0,0,0);
  1035.         switch(i)
  1036.         {
  1037.             case 1 : write_window(3,3,"This is the 1 or LOWER LEFT location"); break;
  1038.             case 2 : write_window(3,3,"This is the 2 or UPPER_LEFT location"); break;
  1039.             case 3 : write_window(3,3,"This is the 3 or LOWER_RIGHT location"); break;
  1040.             case 4 : write_window(3,3,"This is the 4 or UPPER_RIGHT location"); break;
  1041.         }
  1042.         write_window(15,6," HIT ANY KEY ");
  1043.         bioskey(0);
  1044.         unpopup_window(11);
  1045.     }
  1046.     for(;;)
  1047.     {
  1048.         fore = random(16);
  1049.         back = random(8);
  1050.         popup_window(11,20,10,63,15,2,2,14,2,1,fore,back,0,0);
  1051.         write_window(15,6," HIT ANY KEY ");
  1052.         write_window(6,3,"These are the diffrent colors that");
  1053.         write_window(11,4,"you can use for shadows.");
  1054.         delay(700);
  1055.         if(bioskey(1))
  1056.         {
  1057.             bioskey(0);
  1058.             unpopup_window(11);
  1059.             break;
  1060.         }
  1061.     }
  1062.     unpopup_window(DEMO_TEXT);
  1063.     display_switch = 0;
  1064.     return(0);
  1065. }
  1066.  
  1067. int boarder_demo(void)
  1068. {
  1069.     int i,char_boarder;
  1070.  
  1071.     save_screen(5);
  1072.     system(font_string);
  1073.     load_screen(5);
  1074.     popup_window(DEMO_TEXT,10,5,70,20,2,2,14,6,1,8,0,0,0);
  1075.     write_window(25,16," HIT ANY KEY ");
  1076.     window(16,10,70,20);
  1077.     read_text("boarder.txt",2);
  1078.     for(i = 0;i <5;i++)
  1079.     {
  1080.         popup_window(11,20,10,60,15,i,2,14,2,1,8,0,0,0);
  1081.         switch(i)
  1082.         {
  1083.             case 0 : write_window(3,3,"This is the 0 or NO_BOARDER style."); break;
  1084.             case 1 : write_window(3,3,"This is the 1 or SINGLE_BOARDER style"); break;
  1085.             case 2 : write_window(3,3,"This is the 2 or DOUBLE_BOARDER style"); break;
  1086.             case 3 : write_window(3,3,"This is the 3 or SIG_DUB_BOARDER style"); break;
  1087.             case 4 : write_window(3,3,"This is the 4 or DUB_SIG_BOARDER style"); break;
  1088.         }
  1089.         write_window(15,6," HIT ANY KEY ");
  1090.         bioskey(0);
  1091.     }
  1092.     for(;;)
  1093.     {
  1094.         char_boarder = random(255);
  1095.         if(char_boarder < 15)
  1096.         {
  1097.             char_boarder = char_boarder + 15;
  1098.         }
  1099.         popup_window(11,20,10,60,15,5,2,14,2,1,8,0,char_boarder,0);
  1100.         write_window(15,3," HIT ANY KEY ");
  1101.         delay(700);
  1102.         if(bioskey(1))
  1103.         {
  1104.             bioskey(0);
  1105.             unpopup_window(11);
  1106.             break;
  1107.         }
  1108.     }
  1109.     unpopup_window(DEMO_TEXT);
  1110.     display_switch = 0;
  1111.     return(0);
  1112. }
  1113.  
  1114. int enter_demo(void)
  1115. {
  1116.     int int_data = 0,i;
  1117.     double float_data = 0.0;
  1118.     char enter_string[30] = "";
  1119.  
  1120.     popup_window(DEMO_TEXT,10,5,70,20,2,2,15,6,1,8,0,0,0);
  1121.     write_window(25,16," HIT ANY KEY ");
  1122.     window(18,10,70,20);
  1123.     read_text("entdemo.txt",2);
  1124.     show_cursor();
  1125.     for(i = 0;i < 4;i++)
  1126.     {
  1127.         popup_window(11,20,10,60,15,2,2,14,2,1,0,8,0,0);
  1128.         switch(i)
  1129.         {
  1130.             case 0 : write_window(3,3,"Enter Int :");
  1131.                     strcpy(enter_string,"0");
  1132.                     get_string(enter_string,"   ","#999",16,3,1,1);
  1133.                     int_data = atoi(enter_string);
  1134.                     write_window(3,4,"You entered %d",int_data);
  1135.                     break;
  1136.             case 1 : write_window(3,3,"Enter Float :");
  1137.                     strcpy(enter_string,"0.0");
  1138.                     get_string(enter_string,"       ","FFFFFFF",18,3,1,1);
  1139.                     float_data = atof(enter_string);
  1140.                     write_window(3,4,"You entered %3.4f",float_data);
  1141.                     break;
  1142.             case 2 : write_window(3,3,"Enter String :");
  1143.                     get_string(enter_string,"          --        ","**********  ********",18,3,1,0);
  1144.                     write_window(3,4,"You entered %s",enter_string);
  1145.                     break;
  1146.             case 3 : write_window(3,3,"Enter date :");
  1147.                     get_string(enter_string,"  /  /  ","99 99 99",16,3,0,0);
  1148.                     write_window(3,4,"You enterd %s",enter_string);
  1149.                     break;
  1150.         }
  1151.         write_window(15,5," HIT ANY KEY ");
  1152.         bioskey(0);
  1153.         clear_window(0);
  1154.     }
  1155.     hide_cursor();
  1156.     unpopup_window(11);
  1157.     unpopup_window(DEMO_TEXT);
  1158.     display_switch = 0;
  1159.     return(0);
  1160. }
  1161.  
  1162. /***************************************************************************
  1163.  
  1164.     this modual reads a text file and displays it on the screen
  1165.  
  1166. **************************************************************************/
  1167.  
  1168. void reed_text(char *file_name)
  1169. {
  1170.     popup_window(EDIT_WIN,1,1,80,25,1,0,14,6,0,0,0,0,0);
  1171.     write_window(35,1," %s ",file_name);
  1172.     write_window(32,25," PGUP/PGDN ESC ");
  1173.     read_text(file_name,0);
  1174.     unpopup_window(EDIT_WIN);
  1175.     display_switch = 0;
  1176. }
  1177.  
  1178. int read_text_demo(void)
  1179. {
  1180.     char file_name[255] = "";
  1181.  
  1182.     popup_window(DEMO_TEXT,10,5,70,20,2,2,14,6,1,8,0,0,0);
  1183.     write_window(25,16," HIT ANY KEY ");
  1184.     window(19,10,70,20);
  1185.     read_text("readtext.txt",2);
  1186.     popup_window(ENTER_WIN,10,10,70,12,1,2,14,2,1,8,0,0,0);
  1187.     write_window(3,2,"Enter File Name: ");
  1188.     if(get_string(file_name,"                                        ",
  1189.             "**************************************",20,2,1,1) == 1)
  1190.     {
  1191.         unpopup_window(ENTER_WIN);
  1192.         unpopup_window(DEMO_TEXT);
  1193.         return(0);
  1194.     }
  1195.     reed_text(file_name);
  1196.     unpopup_window(ENTER_WIN);
  1197.     unpopup_window(DEMO_TEXT);
  1198.     return(0);
  1199. }
  1200.  
  1201.