home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / APPS / dm.lzh / mouse.c < prev    next >
Text File  |  1995-04-02  |  2KB  |  61 lines

  1. /* mouse.c function for DISKMASTER.C          */
  2. /* copyright (c) 1995 by Bob Devries          */
  3. /* email: bdevries@gil.ipswichcity.qld.gov.au */
  4.  
  5. /* adds mouse support to DiskMaster           */
  6.  
  7. #include "diskmaster.h"
  8.  
  9. int
  10. readmouse(pos, ch)
  11. int *pos;
  12. int *ch;
  13. {
  14.        int leftbut, rightbut, xpos, ypos;
  15.        
  16.        if(!MsReady()) {
  17.               return 0;
  18.        }
  19.        
  20.        MsRdAbs(&leftbut, &rightbut, &xpos, &ypos);
  21.        gotoxy(xpos,ypos);
  22.        if(leftbut) {
  23.               if((xpos > 1) && (xpos < 48)) {
  24.                      if((ypos > 2) && (ypos < 23)) {
  25.                             *pos = ypos - 3;
  26.                      }
  27.               }
  28.               if (ypos == 24) {
  29.                      if ((xpos >  1) && (xpos <  6)) *ch = 'a';
  30.                      if ((xpos >  6) && (xpos < 11)) *ch = 'c';
  31.                      if ((xpos > 11) && (xpos < 18)) *ch = 'r';
  32.                      if ((xpos > 18) && (xpos < 22)) *ch = 'd';
  33.                      if ((xpos > 22) && (xpos < 29)) *ch = 'n';
  34.                      if ((xpos > 29) && (xpos < 36)) *ch = 'm';
  35.                      if ((xpos > 36) && (xpos < 41)) *ch = 'o';
  36.                      if ((xpos > 41) && (xpos < 51)) *ch = 't';
  37.                      if ((xpos > 51) && (xpos < 56)) *ch = 'l';
  38.                      if ((xpos > 56) && (xpos < 62)) *ch = 'u';
  39.                      if ((xpos > 62) && (xpos < 67)) *ch = 'h';
  40.                      if ((xpos > 67) && (xpos < 72)) *ch = 'q';
  41.                      if ((xpos > 72) && (xpos < 78)) *ch = 's';
  42.               }
  43.        }
  44.        if(rightbut) {
  45.               if((xpos > 1) && (xpos < 48)) {
  46.                      if((ypos > 2) && (ypos < 23)) {
  47.                             *pos = ypos - 3;
  48.                             *ch = '\n';
  49.                      } else {
  50.                             if (ypos == 2) {
  51.                                    *ch = PgUp;
  52.                             } else if (ypos == 23) {
  53.                                    *ch = PgDn;
  54.                             }
  55.                      }
  56.               }
  57.        }
  58. }
  59.  
  60. /* EOF mouse.c */
  61.