*** empty log message ***
This commit is contained in:
@@ -1,3 +1,20 @@
|
||||
19990826-22:00 EDT Paul Tucker <ptucker@sympatico.ca>
|
||||
* include/hbsetup.h
|
||||
+ add mouse driver selector defines
|
||||
+ source/rtl/mouse.c
|
||||
* harbour level mouse interface
|
||||
code by Jose Lalin dezac@corevia.com
|
||||
and Luiz Rafael Culik (culik@sl.conex.net)
|
||||
+ source/rtl/msxxx.c
|
||||
* similar usage to gtxxx.c
|
||||
+ source/rtl/mouse directory
|
||||
+ source/rtl/mousedos.c
|
||||
code by Jose Lalin dezac@corevia.com
|
||||
and Luiz Rafael Culik (culik@sl.conex.net)
|
||||
+ source/rtl/mouseos2.c
|
||||
code by Chen Kedem <niki@actcom.co.il>
|
||||
+ source/rtl/mousetpl.c
|
||||
|
||||
19990826-20:05 GMT+1 Bruno Cantero <bruno@issnet.net>
|
||||
* funclist.txt
|
||||
include/rddapi.h
|
||||
|
||||
@@ -118,6 +118,21 @@
|
||||
#define HARBOUR_USE_GTAPI
|
||||
#endif
|
||||
|
||||
/* ***********************************************************************
|
||||
* These symbols defined if we want to use the MOUSE API (and which platform
|
||||
* to build the MOUSE API for, if using the GNU Make System).
|
||||
*
|
||||
* By default they are disabled (symbols are not defined)
|
||||
*/
|
||||
/*#define HARBOUR_USE_DOS_MSAPI*/
|
||||
/*#define HARBOUR_USE_OS2_MSAPI*/
|
||||
/*#define HARBOUR_USE_WIN_MSAPI*/
|
||||
|
||||
/* Indicate that one of the GTAPIs is defined */
|
||||
#if defined(HARBOUR_USE_DOS_MSAPI) || defined(HARBOUR_USE_OS2_MSAPI) || defined(HARBOUR_USE_WIN_MSAPI)
|
||||
#define HARBOUR_USE_MSAPI
|
||||
#endif
|
||||
|
||||
/* ***********************************************************************
|
||||
* Operating system specific definitions
|
||||
*/
|
||||
|
||||
90
harbour/include/mouse.h
Normal file
90
harbour/include/mouse.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
Harbour Project source code
|
||||
|
||||
Harbour mouse support
|
||||
|
||||
Copyright(C) 1999 by Jose Lalin.
|
||||
http://www.Harbour-Project.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
an executable, this does not by itself cause the resulting executable
|
||||
to be covered by the GNU General Public License. Your use of that
|
||||
executable is in no way restricted on account of linking the HRL
|
||||
and/or HVM code into it.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
their web site at http://www.gnu.org/).
|
||||
|
||||
You can contact me at: dezac@corevia.com
|
||||
|
||||
The Follow Functions or Copyright(C) 1999 Luiz Rafael Culik (culik@sl.conex.net)
|
||||
int hb_MouseButton(void);
|
||||
int hb_MouseGetPage(void);
|
||||
void hb_MouseSetPage(int iPage)
|
||||
void hb_MouseDefCursor(int nCurType,nScrMask,nCurMask)
|
||||
void hb_MouseSetCoord(int nX, int nY)
|
||||
void hb_MouseSetLanguage(int nLang)
|
||||
char hb_MouseVersion(void)
|
||||
HARBOUR HB_MBPRESSED(void)
|
||||
HARBOUR HB_MGETPAGE(void)
|
||||
HARBOUR HB_MSETPAGE(void)
|
||||
HARBOUR HB_MDEFCURSOR(void)
|
||||
HARBOUR HB_MSETCOORDS(void)
|
||||
HARBOUR HB_MSETLANG(void);
|
||||
HARBOUR HB_MGETLANG(void)
|
||||
HARBOUR HB_MVERSION(void)
|
||||
*/
|
||||
|
||||
#ifndef HB_MOUSE_H_
|
||||
#define HB_MOUSE_H_
|
||||
|
||||
#define MOUSE_INTERRUPT 0x33
|
||||
|
||||
void hb_MouseInit( void );
|
||||
void hb_MouseDone( void );
|
||||
int hb_MousePresent( void );
|
||||
void hb_MouseShow( void );
|
||||
void hb_MouseHide( void );
|
||||
int hb_MouseCol( void );
|
||||
int hb_MouseRow( void );
|
||||
void hb_MouseSetPos( int, int );
|
||||
int hb_MouseSetCursor( int );
|
||||
void hb_MouseSetBounds( int, int, int, int );
|
||||
int hb_MouseButton(void);
|
||||
int hb_MouseGetPage(void);
|
||||
void hb_MouseSetPage(int );
|
||||
void hb_MouseDefCursor(int ,int,int );
|
||||
void hb_MouseSetCoord(int , int );
|
||||
void hb_MouseSetLanguage(int );
|
||||
int hb_MouseGetLanguage(void);
|
||||
char *hb_MouseVersion(void);
|
||||
HARBOUR HB_MPRESENT( void );
|
||||
HARBOUR HB_MSHOW( void );
|
||||
HARBOUR HB_MHIDE( void );
|
||||
HARBOUR HB_MCOL( void );
|
||||
HARBOUR HB_MROW( void );
|
||||
HARBOUR HB_MSETPOS( void );
|
||||
HARBOUR HB_MSETCURSOR( void );
|
||||
HARBOUR HB_MSETBOUNDS( void );
|
||||
HARBOUR HB_MBPRESSED(void);
|
||||
HARBOUR HB_MGETPAGE(void);
|
||||
HARBOUR HB_MSETPAGE(void);
|
||||
HARBOUR HB_MDEFCURSOR(void);
|
||||
HARBOUR HB_MSETCOORDS(void) ;
|
||||
HARBOUR HB_MSETLANG(void);
|
||||
HARBOUR HB_MGETLANG(void);
|
||||
HARBOUR HB_MVERSION(void);
|
||||
#endif /* HB_MOUSE_H_ */
|
||||
197
harbour/source/rtl/mouse.c
Normal file
197
harbour/source/rtl/mouse.c
Normal file
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
Harbour Project source code
|
||||
|
||||
Harbour mouse support
|
||||
|
||||
Copyright(C) 1999 by Jose Lalin.
|
||||
http://www.Harbour-Project.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
an executable, this does not by itself cause the resulting executable
|
||||
to be covered by the GNU General Public License. Your use of that
|
||||
executable is in no way restricted on account of linking the HRL
|
||||
and/or HVM code into it.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
their web site at http://www.gnu.org/).
|
||||
|
||||
You can contact me at: dezac@corevia.com
|
||||
|
||||
The Follow Functions or Copyright(C) 1999 Luiz Rafael Culik (culik@sl.conex.net)
|
||||
int hb_MouseButton(void);
|
||||
int hb_MouseGetPage(void);
|
||||
void hb_MouseSetPage(int iPage)
|
||||
void hb_MouseDefCursor(int nCurType,nScrMask,nCurMask)
|
||||
void hb_MouseSetCoord(int nX, int nY)
|
||||
void hb_MouseSetLanguage(int nLang)
|
||||
char hb_MouseVersion(void)
|
||||
HARBOUR HB_MBPRESSED(void)
|
||||
HARBOUR HB_MGETPAGE(void)
|
||||
HARBOUR HB_MSETPAGE(void)
|
||||
HARBOUR HB_MDEFCURSOR(void)
|
||||
HARBOUR HB_MSETCOORDS(void)
|
||||
HARBOUR HB_MSETLANG(void);
|
||||
HARBOUR HB_MGETLANG(void)
|
||||
HARBOUR HB_MVERSION(void)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <dos.h>
|
||||
#include "hbdefs.h"
|
||||
#include "extend.h"
|
||||
#include "gtapi.h"
|
||||
#include "mouse.h"
|
||||
#include "init.h"
|
||||
HB_INIT_SYMBOLS_BEGIN( Mouse__InitSymbols )
|
||||
{"MPRESENT",FS_PUBLIC,"HB_PRESENT",0},
|
||||
{"MSHOW",FS_PUBLIC,"HB_MSHOW",0},
|
||||
{"MHIDE",FS_PUBLIC,"HB_MHIDE",0},
|
||||
{"MCOL",FS_PUBLIC,"HB_MCOL",0},
|
||||
{"MROW",FS_PUBLIC,"HB_MROW",0},
|
||||
{"MSETPOS",FS_PUBLIC,"HB_MSETPOS",0},
|
||||
{"MSETCURSOR",FS_PUBLIC,"HB_MSETCURSOR",0},
|
||||
{"MSETBOUND",FS_PUBLIC,"HB_MSETBOUNDS",0},
|
||||
{"MPRESSED",FS_PUBLIC,"HB_MBPRESSED",0},
|
||||
{"MGETPAGE",FS_PUBLIC,"HB_MGETPAGE",0},
|
||||
{"MSETPAGE",FS_PUBLIC,"HB_MSETPAGE",0},
|
||||
{"MDEFCURSOR",FS_PUBLIC,"HB_MDEFCURSOR",0},
|
||||
{"MSETCURSOR",FS_PUBLIC,"HB_MSETCOORDS",0},
|
||||
{"MSETLANG",FS_PUBLIC,"HB_MSETLANG",0},
|
||||
{"MGETLANG",FS_PUBLIC,"HB_MGETLANG",0},
|
||||
{"MVERSION",FS_PUBLIC,"HB_MVERSION",0}
|
||||
HB_INIT_SYMBOLS_END( Mouse__InitSymbols )
|
||||
#if ! defined(__GNUC__)
|
||||
#pragma startup Mouse__InitSymbols
|
||||
#endif
|
||||
|
||||
|
||||
HARBOUR HB_MPRESENT( void )
|
||||
{
|
||||
hb_retni( hb_MousePresent() );
|
||||
}
|
||||
|
||||
HARBOUR HB_MSHOW( void )
|
||||
{
|
||||
hb_MouseShow();
|
||||
}
|
||||
|
||||
HARBOUR HB_MHIDE( void )
|
||||
{
|
||||
hb_MouseHide();
|
||||
}
|
||||
|
||||
HARBOUR HB_MCOL( void )
|
||||
{
|
||||
hb_retni( hb_MouseCol() );
|
||||
}
|
||||
|
||||
HARBOUR HB_MROW( void )
|
||||
{
|
||||
hb_retni( hb_MouseRow() );
|
||||
}
|
||||
|
||||
HARBOUR HB_MSETPOS( void )
|
||||
{
|
||||
if( ISNUM( 1 ) && ISNUM( 2 ) )
|
||||
hb_MouseSetPos( hb_parni( 1 ), hb_parni( 2 ) );
|
||||
}
|
||||
|
||||
HARBOUR HB_MSETCURSOR( void )
|
||||
{
|
||||
if( ISLOG( 1 ) )
|
||||
hb_retl( hb_MouseSetCursor( hb_parl( 1 ) ) );
|
||||
}
|
||||
|
||||
HARBOUR HB_MSETBOUNDS( void )
|
||||
{
|
||||
if( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) && ISNUM( 4 ) )
|
||||
hb_MouseSetBounds( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ) );
|
||||
}
|
||||
/* $DOC$
|
||||
* $FUNCNAME$
|
||||
* HB_MBPRESSED()
|
||||
* $CATEGORY$
|
||||
* Mouse
|
||||
* $ONELINER$
|
||||
* Get the last mouse button number
|
||||
* $SYNTAX$
|
||||
* <var>:=MPRESSED() --> lButton
|
||||
* $ARGUMENTS$
|
||||
*
|
||||
* $RETURNS$
|
||||
* The last mouse button pressed
|
||||
* $DESCRIPTION$
|
||||
*
|
||||
* This function will return the last mouse button pressed
|
||||
* 1 for left button,2 for the right button
|
||||
* 3 for both left and right button, 4 for the middle button
|
||||
* 5 for both left and middle button, 6 for both right and middle button
|
||||
* 7 for all 3 button
|
||||
*
|
||||
* $EXAMPLES$
|
||||
* x:=mPressed()
|
||||
* $TESTS$
|
||||
*
|
||||
* $STATUS$
|
||||
*
|
||||
* $COMPLIANCE$
|
||||
*
|
||||
* $SEEALSO$
|
||||
*
|
||||
* $END$
|
||||
*/
|
||||
|
||||
HARBOUR HB_MBPRESSED(void)
|
||||
{
|
||||
hb_retni( hb_MouseButton());
|
||||
}
|
||||
|
||||
HARBOUR HB_MSETPAGE(void)
|
||||
{
|
||||
if( ISNUM( 1 ))
|
||||
hb_MouseSetPage(hb_parni(1));
|
||||
}
|
||||
|
||||
HARBOUR HB_MGETPAGE()
|
||||
{
|
||||
int iPage;
|
||||
hb_retni(hb_MouseGetPage());
|
||||
}
|
||||
|
||||
HARBOUR HB_MDEFCURSOR(void)
|
||||
{
|
||||
hb_MouseDefCursor( hb_parni(1),hb_parni(2),hb_parni(3));
|
||||
|
||||
}
|
||||
|
||||
HARBOUR HB_MSETCOORDS(void)
|
||||
{
|
||||
if( ISNUM(1) &&ISNUM(2) )
|
||||
hb_MouseSetCoord(hb_parni(1),hb_parni(2));
|
||||
}
|
||||
|
||||
HARBOUR HB_MSETLANG(void)
|
||||
{
|
||||
if (ISNUM(1))
|
||||
hb_MouseSetLanguage(hb_parni(1));
|
||||
}
|
||||
|
||||
HARBOUR HB_MVERSION(void)
|
||||
{
|
||||
hb_retclen(hb_MouseVersion(),4);
|
||||
}
|
||||
340
harbour/source/rtl/mouse/mousedos.c
Normal file
340
harbour/source/rtl/mouse/mousedos.c
Normal file
@@ -0,0 +1,340 @@
|
||||
/*
|
||||
Harbour Project source code
|
||||
|
||||
Harbour mouse support
|
||||
|
||||
Copyright(C) 1999 by Jose Lalin.
|
||||
http://www.Harbour-Project.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
an executable, this does not by itself cause the resulting executable
|
||||
to be covered by the GNU General Public License. Your use of that
|
||||
executable is in no way restricted on account of linking the HRL
|
||||
and/or HVM code into it.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
their web site at http://www.gnu.org/).
|
||||
|
||||
You can contact me at: dezac@corevia.com
|
||||
|
||||
The Follow Functions or Copyright(C) 1999 Luiz Rafael Culik (culik@sl.conex.net)
|
||||
int hb_MouseButton(void);
|
||||
int hb_MouseGetPage(void);
|
||||
void hb_MouseSetPage(int iPage)
|
||||
void hb_MouseDefCursor(int nCurType,nScrMask,nCurMask)
|
||||
void hb_MouseSetCoord(int nX, int nY)
|
||||
void hb_MouseSetLanguage(int nLang)
|
||||
char hb_MouseVersion(void)
|
||||
HARBOUR HB_MBPRESSED(void)
|
||||
HARBOUR HB_MGETPAGE(void)
|
||||
HARBOUR HB_MSETPAGE(void)
|
||||
HARBOUR HB_MDEFCURSOR(void)
|
||||
HARBOUR HB_MSETCOORDS(void)
|
||||
HARBOUR HB_MSETLANG(void);
|
||||
HARBOUR HB_MGETLANG(void)
|
||||
HARBOUR HB_MVERSION(void)
|
||||
V 1.11 Luiz Rafael Fixed Another bug on hb_MouseVersion() . Now it returning the Correct Value
|
||||
V 1.1 Luiz Rafael Fixed bug on hb_MouseVersion() and hb_MouseSetCoord()
|
||||
V 1.0 Luiz Rafael Initial Release
|
||||
*/
|
||||
|
||||
#pragma inline
|
||||
|
||||
|
||||
|
||||
#include "hbdefs.h"
|
||||
#include "extend.h"
|
||||
#include "gtapi.h"
|
||||
#include "mouse.h"
|
||||
#include "init.h"
|
||||
#include "string.h"
|
||||
#include "stdlib.h"
|
||||
#include "dos.h"
|
||||
#include "stdio.h"
|
||||
/* Is there a mouse ? */
|
||||
int iMouse = 0;
|
||||
|
||||
/* Mouse buttons */
|
||||
int iButtons = 0;
|
||||
|
||||
/* Is mouse cursor visible ? */
|
||||
int iCursorVisible = 0;
|
||||
|
||||
/* Init mouse pos */
|
||||
int iInitCol = 0;
|
||||
int iInitRow = 0;
|
||||
|
||||
|
||||
void hb_MouseSetLanguage(int nLang)
|
||||
{
|
||||
asm
|
||||
{
|
||||
mov ax,34
|
||||
mov bx,nLang
|
||||
int MOUSE_INTERRUPT
|
||||
}
|
||||
}
|
||||
|
||||
int hb_MouseGetLanguage(void)
|
||||
{
|
||||
int nLang;
|
||||
|
||||
asm
|
||||
{
|
||||
mov ax,35
|
||||
int MOUSE_INTERRUPT
|
||||
mov nLang,bx
|
||||
|
||||
}
|
||||
return nLang;
|
||||
}
|
||||
|
||||
void hb_MouseSetCoord(int nX, int nY)
|
||||
{
|
||||
union REGS regs;
|
||||
|
||||
nX*=8;
|
||||
nY*=8;
|
||||
|
||||
regs.x.ax=4 ;
|
||||
regs.x.cx=nY ;
|
||||
regs.x.dx=nX;
|
||||
int86(MOUSE_INTERRUPT,®s,®s);
|
||||
/*
|
||||
asm
|
||||
{
|
||||
mox ax,4
|
||||
mov cx,nY
|
||||
mov dx,nX
|
||||
int MOUSE_INTERRUPT
|
||||
}
|
||||
*/
|
||||
}
|
||||
void hb_MouseDefCursor(int nCurType,int nScrMask,int nCurMask)
|
||||
{
|
||||
asm
|
||||
{
|
||||
mov ax,10
|
||||
mov bx,nCurType
|
||||
mov cx,nScrMask
|
||||
mov dx,nCurMask
|
||||
int MOUSE_INTERRUPT
|
||||
}
|
||||
}
|
||||
|
||||
int hb_MouseGetPage()
|
||||
{
|
||||
int iPage;
|
||||
asm
|
||||
{
|
||||
mov ax,30
|
||||
int MOUSE_INTERRUPT
|
||||
mov iPage,bx
|
||||
}
|
||||
return iPage;
|
||||
}
|
||||
|
||||
void hb_MouseSetPage(int iPage)
|
||||
{
|
||||
asm
|
||||
{
|
||||
mov ax,29
|
||||
mov bx,iPage
|
||||
int MOUSE_INTERRUPT
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void hb_MouseInit( void )
|
||||
{
|
||||
asm
|
||||
{
|
||||
xor ax, ax
|
||||
int MOUSE_INTERRUPT
|
||||
mov iMouse, ax
|
||||
mov iButtons, bx
|
||||
}
|
||||
|
||||
if( iMouse )
|
||||
{
|
||||
iInitCol = hb_MouseCol();
|
||||
iInitRow = hb_MouseRow();
|
||||
}
|
||||
}
|
||||
|
||||
int hb_MouseButton()
|
||||
{
|
||||
int iButton;
|
||||
if (iMouse)
|
||||
{
|
||||
asm
|
||||
{
|
||||
mov ax,3
|
||||
int MOUSE_INTERRUPT
|
||||
mov iButton,bx
|
||||
}
|
||||
|
||||
}
|
||||
return iButton;
|
||||
}
|
||||
|
||||
void hb_MouseDone( void )
|
||||
{
|
||||
hb_MouseSetPos( iInitRow, iInitCol );
|
||||
hb_MouseSetBounds( 0, 0, hb_gtMaxCol(), hb_gtMaxRow() );
|
||||
}
|
||||
|
||||
int hb_MousePresent( void )
|
||||
{
|
||||
return( iMouse );
|
||||
}
|
||||
|
||||
void hb_MouseShow( void )
|
||||
{
|
||||
if( iMouse )
|
||||
{
|
||||
asm
|
||||
{
|
||||
mov ax, 1
|
||||
int MOUSE_INTERRUPT
|
||||
}
|
||||
iCursorVisible = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void hb_MouseHide( void )
|
||||
{
|
||||
if( iMouse )
|
||||
{
|
||||
asm
|
||||
{
|
||||
mov ax, 2
|
||||
int MOUSE_INTERRUPT
|
||||
}
|
||||
iCursorVisible = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
int hb_MouseCol( void )
|
||||
{
|
||||
int iCol;
|
||||
|
||||
if( iMouse )
|
||||
{
|
||||
asm
|
||||
{
|
||||
mov ax, 3
|
||||
int MOUSE_INTERRUPT
|
||||
mov iCol, cx
|
||||
}
|
||||
return( iCol / 8 );
|
||||
}
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
int hb_MouseRow( void )
|
||||
{
|
||||
int iRow;
|
||||
|
||||
if( iMouse )
|
||||
{
|
||||
asm
|
||||
{
|
||||
mov ax, 3
|
||||
int MOUSE_INTERRUPT
|
||||
mov iRow, dx
|
||||
}
|
||||
return( iRow / 8 );
|
||||
}
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
void hb_MouseSetPos( int iRow, int iCol )
|
||||
{
|
||||
if( iMouse )
|
||||
{
|
||||
iRow *= 8;
|
||||
iCol *= 8;
|
||||
|
||||
asm
|
||||
{
|
||||
mov ax, 4
|
||||
mov cx, iRow
|
||||
mov dx, iCol
|
||||
int MOUSE_INTERRUPT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int hb_MouseSetCursor( int iVisible )
|
||||
{
|
||||
if( iVisible )
|
||||
hb_MouseShow();
|
||||
else
|
||||
hb_MouseHide();
|
||||
|
||||
return( iCursorVisible );
|
||||
}
|
||||
|
||||
void hb_MouseSetBounds( int iTop, int iLeft, int iBottom, int iRight )
|
||||
{
|
||||
if( iMouse )
|
||||
{
|
||||
iLeft *= 8;
|
||||
iRight *= 8;
|
||||
|
||||
asm
|
||||
{
|
||||
mov ax, 7
|
||||
mov cx, iLeft
|
||||
mov dx, iRight
|
||||
int MOUSE_INTERRUPT
|
||||
}
|
||||
|
||||
iTop *= 8;
|
||||
iBottom *= 8;
|
||||
|
||||
asm
|
||||
{
|
||||
mov ax, 8
|
||||
mov cx, iTop
|
||||
mov dx, iBottom
|
||||
int MOUSE_INTERRUPT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char *hb_MouseVersion(void)
|
||||
{
|
||||
union REGS regs;
|
||||
char Major[4],Minor[4], Version[10];
|
||||
char *cReturn;
|
||||
int nMajor,nMinor;
|
||||
|
||||
regs.x.ax=0x024;
|
||||
int86(MOUSE_INTERRUPT,®s,®s);
|
||||
nMajor=regs.h.bh;
|
||||
nMinor=regs.h.bl;
|
||||
itoa(nMajor,Major,10);
|
||||
itoa(nMinor,Minor,10);
|
||||
strcpy(Version,Major);
|
||||
strcat(Version,".");
|
||||
strcat(Version,Minor);
|
||||
strcpy(cReturn,Version);
|
||||
|
||||
return cReturn;
|
||||
|
||||
}
|
||||
258
harbour/source/rtl/mouse/mouseos2.c
Normal file
258
harbour/source/rtl/mouse/mouseos2.c
Normal file
@@ -0,0 +1,258 @@
|
||||
/*
|
||||
* $Id:
|
||||
*/
|
||||
|
||||
/*
|
||||
Harbour mouse subsystem for OS/2 compilers.
|
||||
|
||||
Copyright 1999 by Chen Kedem <niki@actcom.co.il>
|
||||
www - http://www.harbour-project.org
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version, with one exception:
|
||||
|
||||
The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
an executable, this does not by itself cause the resulting executable
|
||||
to be covered by the GNU General Public License. Your use of that
|
||||
executable is in no way restricted on account of linking the HRL
|
||||
and/or HVM code into it.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
their web site at http://www.gnu.org/).
|
||||
|
||||
V 1.0 Chen Kedem Initial version.
|
||||
*/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* TODO: those exist in os2.h which I don't have */
|
||||
/* #define INCL_???? as needed */
|
||||
/* #include <os2.h> */
|
||||
typedef unsigned BOOL;
|
||||
typedef unsigned short USHORT;
|
||||
typedef unsigned long ULONG;
|
||||
#define API unsigned extern far pascal
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
API MouOpen ( void far *, unsigned far * );
|
||||
API MouClose ( unsigned );
|
||||
API MouDrawPtr ( unsigned );
|
||||
API MouRemovePtr ();
|
||||
API MouGetPtrPos ();
|
||||
API MouSetPtrPos ();
|
||||
API MouGetNumButtons ();
|
||||
API MouReadEventQue ();
|
||||
typedef struct _NOPTRRECT {
|
||||
USHORT row;
|
||||
USHORT col;
|
||||
USHORT cRow;
|
||||
USHORT cCol;
|
||||
} NOPTRRECT;
|
||||
typedef struct _PTRLOC {
|
||||
USHORT row;
|
||||
USHORT col;
|
||||
} PTRLOC;
|
||||
typedef struct _MOUEVENTINFO {
|
||||
USHORT fs; /* Bit(s) Significance (if set) Mask ?
|
||||
0 mouse move, no buttons down MOUSE_MOTION
|
||||
1 mouse move, button 1 down MOUSE_MOTION_WITH_BN1_DOWN
|
||||
2 button 1 down MOUSE_BN1_DOWN
|
||||
3 mouse move, button 2 down MOUSE_MOTION_WITH_BN2_DOWN
|
||||
4 button 2 down MOUSE_BN2_DOWN
|
||||
5 mouse move, button 3 down MOUSE_MOTION_WITH_BN3_DOWN
|
||||
6 button 3 down MOUSE_BN3_DOWN
|
||||
7-15 reserved (0) */
|
||||
ULONG time;
|
||||
USHORT row;
|
||||
USHORT col;
|
||||
} MOUEVENTINFO;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* TODO: those should probably be in mouse.h */
|
||||
extern void hb_mouse_Init( void );
|
||||
extern void hb_mouse_Exit( void );
|
||||
extern BOOL hb_mouse_IsPresent( void );
|
||||
extern void hb_mouse_Show( void );
|
||||
extern void hb_mouse_Hide( void );
|
||||
extern int hb_mouse_Col( void );
|
||||
extern int hb_mouse_Row( void );
|
||||
extern void hb_mouse_SetPos( int, int );
|
||||
/* extern BOOL hb_mouse_GetCursor( void ); */ /* top level should do it */
|
||||
/* extern void hb_mouse_SetCursor( BOOL ); */ /* top level should do it */
|
||||
extern BOOL hb_mouse_IsButtonPressed( int );
|
||||
extern int hb_mouse_CountButton( void );
|
||||
extern void hb_mouse_SetBounds( int iTop, int iLeft, int iBottom, int iRight );
|
||||
extern void hb_mouse_GetBounds( int * piTop, int * piLeft, int * piBottom, int * piRight );
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static unsigned suMouHandle; /* mouse logical handle */
|
||||
/* static BOOL sbMouVisible = FALSE; */ /* is mouse cursor visible ? */
|
||||
|
||||
void hb_mouse_Init()
|
||||
{
|
||||
if ( MouOpen ( 0L, &suMouHandle ) ) /* try to open mouse */
|
||||
suMouHandle = 0; /* no mouse found */
|
||||
}
|
||||
|
||||
void hb_mouse_Exit(void)
|
||||
{
|
||||
if ( suMouHandle )
|
||||
{
|
||||
MouClose ( suMouHandle ); /* relese mouse handle */
|
||||
suMouHandle = 0;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL hb_mouse_IsPresent(void)
|
||||
{
|
||||
return ( suMouHandle != 0 );
|
||||
}
|
||||
|
||||
void hb_mouse_Show(void)
|
||||
{
|
||||
if ( suMouHandle )
|
||||
{
|
||||
MouDrawPtr ( suMouHandle );
|
||||
/* sbMouVisible = TRUE; */
|
||||
}
|
||||
}
|
||||
|
||||
void hb_mouse_Hide(void)
|
||||
{
|
||||
/*
|
||||
NOTE: mouse cursor always visible if not in full screen
|
||||
*/
|
||||
NOPTRRECT rect;
|
||||
if ( suMouHandle )
|
||||
{
|
||||
/*
|
||||
QUESTION: should I call the GT function ?
|
||||
pro: encapsulating of the GetScreen function
|
||||
con: calling function from another module, GT must be linked in
|
||||
con: VioGetMode is been called twice
|
||||
may be a just a call to MaxRow/Col would be enough
|
||||
*/
|
||||
rect.row = 0; /* x-coordinate upper left */
|
||||
rect.col = 0; /* y-coordinate upper left */
|
||||
rect.cRow = 20/*hb_gt_GetScreenHeight()*/; /* x-coordinate lower right */
|
||||
rect.cCol = 60/*hb_gt_GetScreenWidth()*/; /* y-coordinate lower right */
|
||||
MouRemovePtr ( &rect, suMouHandle );
|
||||
/* sbMouVisible = FALSE; */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
QUESTION: when getting mouse coordinate you normally need both
|
||||
row and column, we should think about using just one function
|
||||
hb_mouse_GetPos( &row, &col ) or something like that
|
||||
*/
|
||||
|
||||
int hb_mouse_Col(void)
|
||||
{
|
||||
PTRLOC pos;
|
||||
if ( suMouHandle )
|
||||
{
|
||||
MouGetPtrPos ( &pos, suMouHandle );
|
||||
}
|
||||
return ( (int)pos.col );
|
||||
}
|
||||
|
||||
int hb_mouse_Row(void)
|
||||
{
|
||||
PTRLOC pos;
|
||||
if ( suMouHandle )
|
||||
{
|
||||
MouGetPtrPos ( &pos, suMouHandle );
|
||||
}
|
||||
return ( (int)pos.row );
|
||||
}
|
||||
|
||||
void hb_mouse_SetPos( int row, int col )
|
||||
{
|
||||
PTRLOC pos;
|
||||
if ( suMouHandle )
|
||||
{
|
||||
pos.row = (USHORT)row;
|
||||
pos.col = (USHORT)col;
|
||||
MouSetPtrPos ( &pos, suMouHandle );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
NOTE: I think top level should handle that
|
||||
*/
|
||||
/*
|
||||
BOOL hb_mouse_GetCursor(void)
|
||||
{
|
||||
return ( sbMouVisible );
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
NOTE: I think top level should handle that
|
||||
*/
|
||||
/*
|
||||
void hb_mouse_SetCursor( BOOL bVisible )
|
||||
{
|
||||
if ( bVisible )
|
||||
hb_mouse_Show();
|
||||
else
|
||||
hb_mouse_Hide();
|
||||
return ( sbMouVisible );
|
||||
}
|
||||
*/
|
||||
|
||||
BOOL hb_mouse_IsButtonPressed( int iButton )
|
||||
{
|
||||
/*
|
||||
TODO: just a sample, a work should be done here !
|
||||
*/
|
||||
BOOL bPressed = FALSE;
|
||||
USHORT WaitOption = 0; /* 1 = wait until mouse event exist, 0 = don't */
|
||||
MOUEVENTINFO MouEvent;
|
||||
if ( suMouHandle )
|
||||
{
|
||||
MouReadEventQue ( &MouEvent, &WaitOption, suMouHandle );
|
||||
/*
|
||||
now MouEvent.fs contain the mask for the mouse event,
|
||||
what to do next?
|
||||
*/
|
||||
}
|
||||
return ( bPressed );
|
||||
}
|
||||
|
||||
int hb_mouse_CountButton(void)
|
||||
{
|
||||
USHORT usButtons = 0;
|
||||
if ( suMouHandle )
|
||||
{
|
||||
MouGetNumButtons ( &usButtons, suMouHandle );
|
||||
}
|
||||
return ( (int)usButtons );
|
||||
}
|
||||
|
||||
void hb_mouse_SetBounds( int iTop, int iLeft, int iBottom, int iRight )
|
||||
{
|
||||
/*
|
||||
NOTE: I don't know if the OS/2 got a function to do that,
|
||||
the old book I'm using does not have such.
|
||||
*/
|
||||
}
|
||||
|
||||
void hb_mouse_GetBounds( int * piTop, int * piLeft, int * piBottom, int * piRight )
|
||||
{
|
||||
/*
|
||||
NOTE: I don't know if the OS/2 got a function to do that,
|
||||
the old book I'm using does not have such.
|
||||
*/
|
||||
}
|
||||
129
harbour/source/rtl/mouse/mousetpl.c
Normal file
129
harbour/source/rtl/mouse/mousetpl.c
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
Harbour Project source code
|
||||
|
||||
Harbour mouse support
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
an executable, this does not by itself cause the resulting executable
|
||||
to be covered by the GNU General Public License. Your use of that
|
||||
executable is in no way restricted on account of linking the HRL
|
||||
and/or HVM code into it.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
their web site at http://www.gnu.org/).
|
||||
|
||||
|
||||
V 1.0 Luiz Rafael Initial Release
|
||||
|
||||
TODO:Everything!
|
||||
*/
|
||||
|
||||
/* Is there a mouse ? */
|
||||
int iMouse = 0;
|
||||
|
||||
/* Mouse buttons */
|
||||
int iButtons = 0;
|
||||
|
||||
/* Is mouse cursor visible ? */
|
||||
int iCursorVisible = 0;
|
||||
|
||||
/* Init mouse pos */
|
||||
int iInitCol = 0;
|
||||
int iInitRow = 0;
|
||||
|
||||
|
||||
void hb_MouseSetLanguage(int nLang)
|
||||
{
|
||||
}
|
||||
|
||||
int hb_MouseGetLanguage(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hb_MouseSetCoord(int nX, int nY)
|
||||
{
|
||||
nX*=8;
|
||||
nY*=8;
|
||||
|
||||
}
|
||||
|
||||
void hb_MouseDefCursor(int nCurType,int nScrMask,int nCurMask)
|
||||
{
|
||||
}
|
||||
|
||||
int hb_MouseGetPage()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hb_MouseSetPage(int iPage)
|
||||
{
|
||||
}
|
||||
|
||||
void hb_MouseInit( void )
|
||||
{
|
||||
}
|
||||
|
||||
int hb_MouseButton()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hb_MouseDone( void )
|
||||
{
|
||||
hb_MouseSetPos( iInitRow, iInitCol );
|
||||
hb_MouseSetBounds( 0, 0, hb_gtMaxCol(), hb_gtMaxRow() );
|
||||
}
|
||||
|
||||
int hb_MousePresent( void )
|
||||
{
|
||||
return( iMouse );
|
||||
}
|
||||
|
||||
void hb_MouseShow( void )
|
||||
{
|
||||
}
|
||||
|
||||
void hb_MouseHide( void )
|
||||
{
|
||||
}
|
||||
|
||||
int hb_MouseCol( void )
|
||||
{
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
int hb_MouseRow( void )
|
||||
{
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
void hb_MouseSetPos( int iRow, int iCol )
|
||||
{
|
||||
}
|
||||
|
||||
int hb_MouseSetCursor( int iVisible )
|
||||
{
|
||||
}
|
||||
|
||||
void hb_MouseSetBounds( int iTop, int iLeft, int iBottom, int iRight )
|
||||
{
|
||||
}
|
||||
|
||||
char *hb_MouseVersion(void)
|
||||
{
|
||||
}
|
||||
18
harbour/source/rtl/msxxx.c
Normal file
18
harbour/source/rtl/msxxx.c
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include "hbsetup.h"
|
||||
|
||||
#if defined(HARBOUR_USE_MSAPI)
|
||||
#if defined(HARBOUR_USE_DOS_MSAPI)
|
||||
#include "mouse/mousedos.c"
|
||||
#elif defined(HARBOUR_USE_OS2_MSAPI)
|
||||
#include "mouse/mouseos2.c"
|
||||
#elif defined(HARBOUR_USE_WIN_MSAPI)
|
||||
#include "mouse/mousewin.c"
|
||||
#else
|
||||
#error The MOUSE API platform was not specified via HARBOUR_USE_<platform>_MSAPI
|
||||
#error See include/hbsetup.h for details
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user