home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / CSCAPE32.ZIP / LNFARC.EXE / PIANO.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-11-04  |  6.0 KB  |  170 lines

  1. /*
  2.     piano.c
  3.     generated by Look & Feel version 3.2 from sample.lnf
  4.     11/04/90
  5. */                   
  6. /* This program was created in less time than it took
  7.    Joe to go to California for a party.
  8. */
  9.  
  10.  
  11. #include <stdio.h>
  12. #include "cscape.h"
  13. #include "teddecl.h"
  14. #include "msys.h"
  15. #include "sled.h"
  16.  
  17. #include "kbrecord.h"
  18.  
  19. int lnf_Beep(_arg2(VOID *, int));
  20.  
  21. int lnf_Beep(sdata, idata)
  22.     VOID *sdata;
  23.     int idata;
  24. /*
  25.     A sample user function for LNF.
  26.     beeps the speaker using the value passed by idata
  27.  
  28.     Audible values are between 300 and 5000.
  29. */
  30. {
  31.     if (idata > 0) {
  32.         hard_Speaker(idata, 10);
  33.     }
  34.  
  35.     return(0);
  36. }
  37.  
  38.  
  39. void main(argc, argv)
  40.     int argc;
  41.     char *argv[];
  42. /* 
  43.     Uses kb_Record if the following command line arguments are given.  
  44.     The -r command records a sequence of keystrokes to a file.
  45.     The -p command plays the sequence back from a file.
  46.     For example, the command line
  47.     
  48.     piano -rmusic
  49.  
  50.     will record keystrokes in the file "music".
  51.  
  52.     The command line 
  53.  
  54.     piano -pmusic
  55.  
  56.     will play back the recording.
  57. */
  58.  
  59. {
  60.     FILE *key = NULL;
  61.  
  62.     disp_Init(def_ModeText, NULL);
  63.  
  64.     /* check for kb record */
  65.     if (argc > 1) {
  66.         if (argv[1][0] == '-' && argv[1][1] == 'r') {
  67.             /* open file for record keystrokes */
  68.             key = fopen(argv[1]+2, "w");
  69.             kb_Record(key, KB_RECORD, 0);
  70.         }
  71.         else if (argv[1][0] == '-' && argv[1][1] == 'p') {
  72.             /* open file to play back keystrokes */
  73.             key = fopen(argv[1]+2, "r");
  74.             kb_Record(key, KB_PLAY, 0);
  75.         }
  76.     }
  77.  
  78.     piano();
  79.     disp_Close();
  80.  
  81.     if (key != NULL) {
  82.         fclose(key);
  83.     }
  84. }
  85.  
  86. int piano()
  87. {
  88.     menu_type    menu;
  89.     sed_type    sed;
  90.     int         ret;
  91.  
  92.     menu = menu_Open();
  93.  
  94.     menu_Printf(menu, " │    @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │    @a[0x07]│   ");
  95.     menu_Printf(menu, "│@a[0x00]  @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │      │\n │");
  96.     menu_Printf(menu, "    @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │    @a[0x07]│   ");
  97.     menu_Printf(menu, "│@a[0x00]  @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │      │\n │");
  98.     menu_Printf(menu, "    @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │    @a[0x07]│   ");
  99.     menu_Printf(menu, "│@a[0x00]  @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │      │\n │");
  100.     menu_Printf(menu, "    @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │    @a[0x07]│   ");
  101.     menu_Printf(menu, "│@a[0x00]  @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │      │\n │");
  102.     menu_Printf(menu, "    @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │    @a[0x07]│   ");
  103.     menu_Printf(menu, "│@a[0x00]  @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │      │\n │");
  104.     menu_Printf(menu, "    @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │    @a[0x07]│   ");
  105.     menu_Printf(menu, "│@a[0x00]  @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │      │\n │");
  106.     menu_Printf(menu, "    @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │    @a[0x07]│   ");
  107.     menu_Printf(menu, "│@a[0x00]  @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │      │\n │");
  108.     menu_Printf(menu, "    @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │    @a[0x07]│   ");
  109.     menu_Printf(menu, "│@a[0x00]  @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │      │\n │");
  110.     menu_Printf(menu, "    @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │    @a[0x07]│   ");
  111.     menu_Printf(menu, "│@a[0x00]  @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │      │\n │");
  112.     menu_Printf(menu, "    @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │    @a[0x07]│   ");
  113.     menu_Printf(menu, "│@a[0x00]  @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │      │\n │");
  114.     menu_Printf(menu, "    @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │    @a[0x07]│   ");
  115.     menu_Printf(menu, "│@a[0x00]  @a[0x07]│   │@a[0x00]  @a[0x07]│   │@a[0x00]    │      │\n │");
  116.     menu_Printf(menu, "    @a[0x07]└─┬─┘@a[0x00]  @a[0x07]└─┬─┘@a[0x00]    │    @a[0x07]└─┬─");
  117.     menu_Printf(menu, "┘@a[0x00]  @a[0x07]└─┬─┘@a[0x00]  @a[0x07]└─┬─┘@a[0x00]    │      │\n │      │      │      │      │      │      │      │      │\n │      │      │      │");
  118.     menu_Printf(menu, "      │      │      │      │      │\n │      │      │      │      │      │      │      │      │\n │      │");
  119.     menu_Printf(menu, "      │      │      │      │      │      │      │\n │      │      │      │      │      │      │      ");
  120.     menu_Printf(menu, "│      │\n └──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┘");
  121.  
  122.     menu_Printf(menu, "@p[16,3]@fb[ AA ]",
  123.       NULL, &framer_funcs, ufunc_Open(lnf_Beep, 2000));
  124.     menu_Printf(menu, "@p[10,7]@fb[ W ]",
  125.       NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1887));
  126.     menu_Printf(menu, "@p[10,14]@fb[ E ]",
  127.       NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1681));
  128.     menu_Printf(menu, "@p[10,28]@fb[ T ]",
  129.       NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1414));
  130.     menu_Printf(menu, "@p[10,35]@fb[ Y ]",
  131.       NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1260));
  132.     menu_Printf(menu, "@p[10,42]@fb[ U ]",
  133.       NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1122));
  134.     menu_Printf(menu, "@p[16,10]@fb[ SS ]",
  135.       NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1781));
  136.     menu_Printf(menu, "@p[16,17]@fb[ DD ]",
  137.       NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1587));
  138.     menu_Printf(menu, "@p[16,24]@fb[ FF ]",
  139.       NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1498));
  140.     menu_Printf(menu, "@p[16,31]@fb[ GG ]",
  141.       NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1335));
  142.     menu_Printf(menu, "@p[16,38]@fb[ HH ]",
  143.       NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1189));
  144.     menu_Printf(menu, "@p[16,45]@fb[ JJ ]",
  145.       NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1059));
  146.     menu_Printf(menu, "@p[16,52]@fb[ KK ]",
  147.       NULL, &framer_funcs, ufunc_Open(lnf_Beep, 1000));
  148.  
  149.     menu_Flush(menu);
  150.  
  151.     sed = sed_Open(menu);
  152.     sed_SetColors(sed, 0x70, 0x70, 0x07);
  153.  
  154.     sed_MarkField(sed, 1, 0x07, 0x70);
  155.     sed_MarkField(sed, 2, 0x07, 0x70);
  156.     sed_MarkField(sed, 3, 0x07, 0x70);
  157.     sed_MarkField(sed, 4, 0x07, 0x70);
  158.     sed_MarkField(sed, 5, 0x07, 0x70);
  159.     sed_SetPosition(sed, 3, 11);
  160.     sed_SetHeight(sed, 18);
  161.     sed_SetWidth(sed, 59);
  162.     sed_SetMouse(sed, sedmou_Framer);
  163.  
  164.     sed_Repaint(sed);
  165.     ret = sed_Go(sed);
  166.  
  167.     sed_Close(sed);
  168.     return(ret);
  169. }
  170.