home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
APPS
/
dm14.lzh
/
mouse.c
< prev
next >
Wrap
Text File
|
1996-08-03
|
2KB
|
81 lines
/* mouse.c function for DISKMASTER.C */
/* copyright (c) 1995 by Bob Devries */
/* email: bdevries@gil.ipswichcity.qld.gov.au */
/* adds mouse support to DiskMaster */
#include "diskmaster.h"
int
readmouse(pos, ch)
int *pos;
int *ch;
{
int leftbut, rightbut, xpos, ypos;
#ifndef MM1
if(!MsReady()) {
return 0;
}
#endif
#ifdef MM1
#include <mouse.h>
MSRET ms;
_gs_mouse(STDOUT,&ms);
if (ms.pt_valid == 0) {
return(0);
}
#endif
*ch = 0;
#ifdef MM1
leftbut = (int)ms.pt_cbsa;
rightbut = (int)ms.pt_cbsc;
xpos = ms.pt_acx/8+1; /* MM1 has 8*8 fonts? */
ypos = ms.pt_acy/8+1 ; /* " " */
#else
MsRdAbs(&leftbut, &rightbut, &xpos, &ypos);
gotoxy(xpos,ypos);
#endif
if(leftbut == 1) {
if((xpos > 1) && (xpos < 48)) {
if((ypos > 2) && (ypos < 23)) {
*pos = ypos - 3;
}
}
if (ypos == 24) {
if ((xpos > 1) && (xpos < 6)) *ch = 'a';
if ((xpos > 6) && (xpos < 11)) *ch = 'c';
if ((xpos > 11) && (xpos < 18)) *ch = 'r';
if ((xpos > 18) && (xpos < 22)) *ch = 'd';
if ((xpos > 22) && (xpos < 29)) *ch = 'n';
if ((xpos > 29) && (xpos < 36)) *ch = 'm';
if ((xpos > 36) && (xpos < 41)) *ch = 'o';
if ((xpos > 41) && (xpos < 51)) *ch = 't';
if ((xpos > 51) && (xpos < 56)) *ch = 'l';
if ((xpos > 56) && (xpos < 62)) *ch = 'u';
if ((xpos > 62) && (xpos < 67)) *ch = 'h';
if ((xpos > 67) && (xpos < 72)) *ch = 'q';
if ((xpos > 72) && (xpos < 78)) *ch = 's';
}
}
if(rightbut == 1) {
if((xpos > 1) && (xpos < 48)) {
if((ypos > 2) && (ypos < 23)) {
*pos = ypos - 3;
*ch = '\n';
} else {
if (ypos == 2) {
*ch = PgUp;
} else if (ypos == 23) {
*ch = PgDn;
}
}
}
}
}
/* EOF mouse.c */