From 434f94a4ce7241e6449dba5a49ed6fd35b342dbf Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 27 Aug 1999 04:13:31 +0000 Subject: [PATCH] 19990826-06:00 GMT+1 --- harbour/ChangeLog | 17 +++ harbour/include/mouseapi.h | 2 + harbour/source/rtl/mouse/mousedos.c | 173 +++++++++++++++++++++++++--- harbour/source/rtl/mouseapi.c | 2 + 4 files changed, 180 insertions(+), 14 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bbdf2d23c6..c2cf6f5392 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,20 @@ +19990826-06:00 GMT+1 Victor Szel + + * include/mouseapi.h + source/rtl/mouseapi.c + source/rtl/mouse/mousedos.c + + Copyright info corrected. + + Added original (BorlandC) implementation (MOUSE.ZIP) by + Jose Lalin . + Luiz Rafael Culik . + + The OS/2 implementation is thanks to + Chen Kedem + + Please note that these files have not been tested yet, Borland + users should comment out the #define BORLANDC line in mousedos.c. + Non-GNU make file users should add the new files source/rtl/mouseapi.c + and source/rtl/mouse/mousedos.c file to their make system. + 19990826-05:00 GMT+1 Victor Szel * include/Makefile diff --git a/harbour/include/mouseapi.h b/harbour/include/mouseapi.h index b6f0640543..b4a1f34c16 100644 --- a/harbour/include/mouseapi.h +++ b/harbour/include/mouseapi.h @@ -10,6 +10,8 @@ Copyright 1999 Victor Szel www - http://www.harbour-project.org + API interface proposal mainly by Jose Lalin . + 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 diff --git a/harbour/source/rtl/mouse/mousedos.c b/harbour/source/rtl/mouse/mousedos.c index bbf6959db4..0216beb0b9 100644 --- a/harbour/source/rtl/mouse/mousedos.c +++ b/harbour/source/rtl/mouse/mousedos.c @@ -7,7 +7,8 @@ Harbour Mouse Subsystem for DOS - Copyright 1999 ???????????????? + Copyright 1999 Jose Lalin . + Luiz Rafael Culik . www - http://www.harbour-project.org This program is free software; you can redistribute it and/or modify @@ -34,57 +35,165 @@ */ +/* TOFIX: Change this to something better */ +/* #define BORLANDC */ + +#ifdef BORLANDC + #pragma inline + + #include + #include +#endif + #include "mouseapi.h" +#include "gtapi.h" /* C callable low-level interface */ +BOOL s_bPresent = FALSE; /* Is there a mouse ? */ +int s_iButtons = 0; /* Mouse buttons */ +int s_iCursorVisible = 0; /* Is mouse cursor visible ? */ +int s_iInitCol = 0; /* Init mouse pos */ +int s_iInitRow = 0; /* Init mouse pos */ + void hb_mouse_Init( void ) { /* TODO: */ + +#ifdef BORLANDC + asm + { + xor ax, ax + int MOUSE_INTERRUPT + mov s_bPresent, ax + mov s_iButtons, bx + } + + if( s_bPresent ) + { + s_iInitCol = hb_mouse_Col(); + s_iInitRow = hb_mouse_Row(); + } +#endif } void hb_mouse_Exit( void ) { - /* TODO: */ + hb_mouse_SetPos( s_iInitRow, s_iInitCol ); + hb_mouse_SetBounds( 0, 0, hb_gtMaxCol(), hb_gtMaxRow() ); } BOOL hb_mouse_IsPresent( void ) { - /* TODO: */ - - return 0; + return s_bPresent; } void hb_mouse_Show( void ) { /* TODO: */ + + if( s_bPresent ) + { +#ifdef BORLANDC + asm + { + mov ax, 1 + int MOUSE_INTERRUPT + } + + s_iCursorVisible = TRUE; +#endif + } + } void hb_mouse_Hide( void ) { /* TODO: */ + + if( s_bPresent ) + { +#ifdef BORLANDC + asm + { + mov ax, 2 + int MOUSE_INTERRUPT + } + + s_iCursorVisible = FALSE; +#endif + } } int hb_mouse_Col( void ) { /* TODO: */ - return 0; + if( s_bPresent ) + { +#ifdef BORLANDC + int iCol; + + asm + { + mov ax, 3 + int MOUSE_INTERRUPT + mov iCol, cx + } + + return iCol / 8; +#else + return 0; +#endif + } + + return -1; } int hb_mouse_Row( void ) { /* TODO: */ - return 0; + if( s_bPresent ) + { +#ifdef BORLANDC + int iRow; + + asm + { + + mov ax, 3 + int MOUSE_INTERRUPT + mov iRow, dx + } + return iRow / 8; +#else + return 0; +#endif + } + + return -1; } void hb_mouse_SetPos( int iRow, int iCol ) { /* TODO: */ - HB_SYMBOL_UNUSED( iRow ); - HB_SYMBOL_UNUSED( iCol ); + if( s_bPresent ) + { +#ifdef BORLANDC + iRow *= 8; + iCol *= 8; + + asm + { + mov ax, 4 + mov cx, iRow + mov dx, iCol + int MOUSE_INTERRUPT + } +#endif + } } BOOL hb_mouse_IsButtonPressed( int iButton ) @@ -100,17 +209,53 @@ int hb_mouse_CountButton( void ) { /* TODO: */ - return 0; + int iButton = 0; + + if( s_bPresent ) + { +#ifdef BORLANDC + asm + { + mov ax,3 + int MOUSE_INTERRUPT + mov iButton,bx + } +#endif + } + + return iButton; } void hb_mouse_SetBounds( int iTop, int iLeft, int iBottom, int iRight ) { /* TODO: */ - HB_SYMBOL_UNUSED( iTop ); - HB_SYMBOL_UNUSED( iLeft ); - HB_SYMBOL_UNUSED( iBottom ); - HB_SYMBOL_UNUSED( iRight ); + if( s_bPresent ) + { +#ifdef BORLANDC + 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 + } +#endif + } } void hb_mouse_GetBounds( int * piTop, int * piLeft, int * piBottom, int * piRight ) diff --git a/harbour/source/rtl/mouseapi.c b/harbour/source/rtl/mouseapi.c index 45207c1f47..ecf4cace1c 100644 --- a/harbour/source/rtl/mouseapi.c +++ b/harbour/source/rtl/mouseapi.c @@ -10,6 +10,8 @@ Copyright 1999 Victor Szel www - http://www.harbour-project.org + API interface proposal mainly by Jose Lalin . + 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