2007-08-09 02:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbgtinfo.ch
+ added GTI_KBD_INSERT
* harbour/common.mak
* harbour/include/hbgtcore.h
* harbour/source/rtl/Makefile
+ harbour/source/rtl/gtkbstat.c
+ added common for W32 GT drivers: hb_gt_w32_getKbdState() and
hb_gt_w32_setKbdState()
* harbour/source/rtl/gtgui/gtgui.c
* harbour/source/rtl/gtwvt/gtwvt.c
* harbour/source/rtl/gtwin/gtwin.c
* use hb_gt_w32_getKbdState() and hb_gt_w32_setKbdState() for
GTI_KBDSHIFTS
* harbour/source/rtl/gtdos/gtdos.c
+ added support for GTI_KBDSHIFTS
* harbour/contrib/libct/keyset.c
* use GTI_KBDSHIFTS to get/set keyboard flags
* harbour/contrib/libnf/prtscr.c
* harbour/contrib/libnf/numlock.c
* harbour/contrib/libnf/shift.c
* harbour/contrib/libnf/alt.c
* harbour/contrib/libnf/ctrl.c
* harbour/contrib/libnf/caplock.c
* use GTI_KBDSHIFTS to get/set keyboard flags
+ harbour/contrib/libnf/ftshadow.c
* harbour/contrib/libnf/makefile.bc
* harbour/contrib/libnf/makefile.vc
+ added missing file I forgot to add in previous commit
This commit is contained in:
@@ -8,6 +8,42 @@
|
||||
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2007-08-09 02:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbgtinfo.ch
|
||||
+ added GTI_KBD_INSERT
|
||||
|
||||
* harbour/common.mak
|
||||
* harbour/include/hbgtcore.h
|
||||
* harbour/source/rtl/Makefile
|
||||
+ harbour/source/rtl/gtkbstat.c
|
||||
+ added common for W32 GT drivers: hb_gt_w32_getKbdState() and
|
||||
hb_gt_w32_setKbdState()
|
||||
|
||||
* harbour/source/rtl/gtgui/gtgui.c
|
||||
* harbour/source/rtl/gtwvt/gtwvt.c
|
||||
* harbour/source/rtl/gtwin/gtwin.c
|
||||
* use hb_gt_w32_getKbdState() and hb_gt_w32_setKbdState() for
|
||||
GTI_KBDSHIFTS
|
||||
|
||||
* harbour/source/rtl/gtdos/gtdos.c
|
||||
+ added support for GTI_KBDSHIFTS
|
||||
|
||||
* harbour/contrib/libct/keyset.c
|
||||
* use GTI_KBDSHIFTS to get/set keyboard flags
|
||||
|
||||
* harbour/contrib/libnf/prtscr.c
|
||||
* harbour/contrib/libnf/numlock.c
|
||||
* harbour/contrib/libnf/shift.c
|
||||
* harbour/contrib/libnf/alt.c
|
||||
* harbour/contrib/libnf/ctrl.c
|
||||
* harbour/contrib/libnf/caplock.c
|
||||
* use GTI_KBDSHIFTS to get/set keyboard flags
|
||||
|
||||
+ harbour/contrib/libnf/ftshadow.c
|
||||
* harbour/contrib/libnf/makefile.bc
|
||||
* harbour/contrib/libnf/makefile.vc
|
||||
+ added missing file I forgot to add in previous commit
|
||||
|
||||
2007-08-08 16:31 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* include/hbcompat.ch
|
||||
* include/hbextern.ch
|
||||
|
||||
@@ -440,6 +440,7 @@ RTL_LIB_OBJS = \
|
||||
$(OBJ_DIR)\gtapiu$(OBJEXT) \
|
||||
$(OBJ_DIR)\gtclip$(OBJEXT) \
|
||||
$(OBJ_DIR)\gtfunc$(OBJEXT) \
|
||||
$(OBJ_DIR)\gtkbstat$(OBJEXT) \
|
||||
$(OBJ_DIR)\gtsys$(OBJEXT) \
|
||||
$(OBJ_DIR)\gttone$(OBJEXT) \
|
||||
$(OBJ_DIR)\gx$(OBJEXT) \
|
||||
|
||||
@@ -54,98 +54,38 @@
|
||||
*/
|
||||
|
||||
#include "ct.h"
|
||||
#include "hbapigt.h"
|
||||
|
||||
#if defined( HB_OS_DOS )
|
||||
|
||||
# if defined(__DJGPP__)
|
||||
# include "pc.h"
|
||||
# include "sys\exceptn.h"
|
||||
# include "sys\farptr.h"
|
||||
# elif defined(__MSC_VER)
|
||||
# include "signal.h"
|
||||
# elif defined(__BORLANDC__)
|
||||
# ifndef FAR
|
||||
# define FAR far /* Because FAR is not defined for Borland C 3.x */
|
||||
# endif
|
||||
# endif
|
||||
|
||||
|
||||
static void SetGet( unsigned char cKey )
|
||||
static void SetGet( int iFlag )
|
||||
{
|
||||
#if defined(__WATCOMC__) && defined(__386__)
|
||||
hb_retl( *( ( unsigned char * ) 0x0417 ) & cKey );
|
||||
#elif defined(__DJGPP__)
|
||||
hb_retl( _farpeekb( 0x0040, 0x0017 ) & cKey );
|
||||
#else
|
||||
hb_retl( *( ( unsigned char FAR * ) MK_FP( 0x0040, 0x0017 ) ) & cKey );
|
||||
#endif
|
||||
int iState = 0, iNewState;
|
||||
HB_GT_INFO gtInfo;
|
||||
|
||||
if( hb_pcount() >= 1 )
|
||||
gtInfo.pNewVal = gtInfo.pResult = NULL;
|
||||
|
||||
hb_gtInfo( GTI_KBDSHIFTS, >Info );
|
||||
if( gtInfo.pResult )
|
||||
{
|
||||
cKey = hb_parl( 1 ) * cKey;
|
||||
|
||||
#if defined(__WATCOMC__) && defined(__386__)
|
||||
*( ( unsigned char * ) 0x0417 ) = ( *( ( unsigned char * ) 0x0417 ) & ( !cKey ) ) | cKey;
|
||||
#elif defined(__DJGPP__)
|
||||
_farpokeb( 0x0040, 0x0017, ( _farpeekb( 0x0040, 0x0017 ) & ( !cKey ) ) | cKey );
|
||||
#else
|
||||
*( ( unsigned char FAR * ) MK_FP( 0x0040, 0x0017 ) ) =
|
||||
( *( ( unsigned char FAR * ) MK_FP( 0x0040, 0x0017 ) ) & ( !cKey ) ) | cKey;
|
||||
#endif
|
||||
iState = hb_itemGetNI( gtInfo.pResult );
|
||||
gtInfo.pNewVal = gtInfo.pResult;
|
||||
gtInfo.pResult = NULL;
|
||||
}
|
||||
|
||||
if( ISLOG( 1 ) )
|
||||
{
|
||||
iNewState = hb_parl( 1 ) ? ( iState | iFlag ) : ( iState & ~iFlag );
|
||||
gtInfo.pNewVal = hb_itemPutNI( gtInfo.pNewVal, iState );
|
||||
hb_gtInfo( GTI_KBDSHIFTS, >Info );
|
||||
}
|
||||
|
||||
if( gtInfo.pNewVal )
|
||||
hb_itemRelease( gtInfo.pNewVal );
|
||||
if( gtInfo.pResult )
|
||||
hb_itemRelease( gtInfo.pResult );
|
||||
|
||||
hb_retl( ( iState & iFlag ) != 0 );
|
||||
}
|
||||
|
||||
#elif defined( HB_OS_WIN_32 )
|
||||
|
||||
/*
|
||||
The following function ONLY works with GTWVT/GTWVW/GTALLEG.
|
||||
They will NOT WORK on pure CONSOLE mode
|
||||
*/
|
||||
# include "hbapi.h"
|
||||
# include <windows.h>
|
||||
|
||||
# define HB_VK_INSERT 0x2D
|
||||
# define HB_VK_CAPITAL 0x14
|
||||
# define HB_VK_NUMLOCK 0x90
|
||||
# define HB_VK_SCROLL 0x91
|
||||
|
||||
static void SetGet( unsigned char cKey )
|
||||
{
|
||||
BYTE kbBuffer[256];
|
||||
USHORT uKey = 0;
|
||||
|
||||
switch( cKey )
|
||||
{
|
||||
case 0x10:
|
||||
uKey = HB_VK_SCROLL;
|
||||
break;
|
||||
|
||||
case 0x20:
|
||||
uKey = HB_VK_NUMLOCK;
|
||||
break;
|
||||
|
||||
case 0x40:
|
||||
uKey = HB_VK_CAPITAL;
|
||||
break;
|
||||
|
||||
case 0x80:
|
||||
uKey = HB_VK_INSERT;
|
||||
break;
|
||||
}
|
||||
|
||||
GetKeyboardState( kbBuffer );
|
||||
hb_retl( ( kbBuffer[uKey] & 0x01 ) != 0 );
|
||||
|
||||
if( hb_pcount() >= 1 )
|
||||
{
|
||||
kbBuffer[uKey] = hb_parl( 1 ) ? 1 : 0;
|
||||
SetKeyboardState( kbBuffer );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined( HB_OS_DOS ) || defined( HB_OS_WIN_32 )
|
||||
|
||||
/* $DOC$
|
||||
* $FUNCNAME$
|
||||
@@ -174,7 +114,7 @@ static void SetGet( unsigned char cKey )
|
||||
|
||||
HB_FUNC( KSETINS )
|
||||
{
|
||||
SetGet( 0x80 );
|
||||
SetGet( GTI_KBD_INSERT );
|
||||
}
|
||||
|
||||
|
||||
@@ -205,7 +145,7 @@ HB_FUNC( KSETINS )
|
||||
|
||||
HB_FUNC( KSETCAPS )
|
||||
{
|
||||
SetGet( 0x40 );
|
||||
SetGet( GTI_KBD_CAPSLOCK );
|
||||
}
|
||||
|
||||
|
||||
@@ -236,7 +176,7 @@ HB_FUNC( KSETCAPS )
|
||||
|
||||
HB_FUNC( KSETNUM )
|
||||
{
|
||||
SetGet( 0x20 );
|
||||
SetGet( GTI_KBD_NUMLOCK );
|
||||
}
|
||||
|
||||
|
||||
@@ -267,7 +207,5 @@ HB_FUNC( KSETNUM )
|
||||
|
||||
HB_FUNC( KSETSCROLL )
|
||||
{
|
||||
SetGet( 0x10 );
|
||||
SetGet( GTI_KBD_SCROLOCK );
|
||||
}
|
||||
|
||||
#endif /* defined( HB_OS_DOS ) || defined( HB_OS_WIN_32 ) */
|
||||
|
||||
@@ -62,15 +62,16 @@
|
||||
* $END$
|
||||
*/
|
||||
|
||||
#include <hbapi.h>
|
||||
#include "hbapigt.h"
|
||||
#include "hbapiitm.h"
|
||||
|
||||
HB_FUNC(FT_ALT)
|
||||
HB_FUNC( FT_ALT )
|
||||
{
|
||||
#if defined(HB_OS_DOS)
|
||||
{
|
||||
hb_retl( ( int ) ( ( *( char * ) 0x00400017 ) & 0x8 ) );
|
||||
HB_GT_INFO gtInfo;
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
gtInfo.pNewVal = gtInfo.pResult = NULL;
|
||||
hb_gtInfo( GTI_KBDSHIFTS, >Info );
|
||||
hb_retl( ( hb_itemGetNI( gtInfo.pResult ) & GTI_KBD_ALT ) != 0 );
|
||||
if( gtInfo.pResult )
|
||||
hb_itemRelease( gtInfo.pResult );
|
||||
}
|
||||
|
||||
@@ -62,24 +62,35 @@
|
||||
* $END$
|
||||
*/
|
||||
|
||||
#include <hbapi.h>
|
||||
#include "hbapigt.h"
|
||||
#include "hbapiitm.h"
|
||||
|
||||
#define status_byte ( *( unsigned char * ) ( 0x00400017 ) )
|
||||
|
||||
HB_FUNC(FT_CAPLOCK)
|
||||
HB_FUNC( FT_CAPLOCK )
|
||||
{
|
||||
#if defined(HB_OS_DOS)
|
||||
{
|
||||
hb_retl( ( int ) ( status_byte & 0x40 ) );
|
||||
int iState = 0, iNewState;
|
||||
HB_GT_INFO gtInfo;
|
||||
|
||||
if ( hb_pcount() )
|
||||
gtInfo.pNewVal = gtInfo.pResult = NULL;
|
||||
hb_gtInfo( GTI_KBDSHIFTS, >Info );
|
||||
if( gtInfo.pResult )
|
||||
{
|
||||
if ( ISLOG(1) )
|
||||
status_byte = ( status_byte | ( unsigned char ) 0x40 );
|
||||
else
|
||||
status_byte = ( status_byte & ( unsigned char ) 0xBF );
|
||||
iState = hb_itemGetNI( gtInfo.pResult );
|
||||
gtInfo.pNewVal = gtInfo.pResult;
|
||||
gtInfo.pResult = NULL;
|
||||
}
|
||||
return;
|
||||
|
||||
if( ISLOG( 1 ) )
|
||||
{
|
||||
iNewState = hb_parl( 1 ) ? ( iState | GTI_KBD_CAPSLOCK ) :
|
||||
( iState & ~GTI_KBD_CAPSLOCK );
|
||||
gtInfo.pNewVal = hb_itemPutNI( gtInfo.pNewVal, iState );
|
||||
hb_gtInfo( GTI_KBDSHIFTS, >Info );
|
||||
}
|
||||
#endif
|
||||
|
||||
if( gtInfo.pNewVal )
|
||||
hb_itemRelease( gtInfo.pNewVal );
|
||||
if( gtInfo.pResult )
|
||||
hb_itemRelease( gtInfo.pResult );
|
||||
|
||||
hb_retl( ( iState & GTI_KBD_CAPSLOCK ) != 0 );
|
||||
}
|
||||
|
||||
@@ -59,15 +59,16 @@
|
||||
* $END$
|
||||
*/
|
||||
|
||||
#include <hbapi.h>
|
||||
#include "hbapigt.h"
|
||||
#include "hbapiitm.h"
|
||||
|
||||
HB_FUNC( FT_CTRL )
|
||||
{
|
||||
#if defined(HB_OS_DOS)
|
||||
{
|
||||
HB_GT_INFO gtInfo;
|
||||
|
||||
hb_retl( ( int ) ( ( *( char * ) 0x00400017 ) & 0x4 ) );
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
gtInfo.pNewVal = gtInfo.pResult = NULL;
|
||||
hb_gtInfo( GTI_KBDSHIFTS, >Info );
|
||||
hb_retl( ( hb_itemGetNI( gtInfo.pResult ) & GTI_KBD_CTRL ) != 0 );
|
||||
if( gtInfo.pResult )
|
||||
hb_itemRelease( gtInfo.pResult );
|
||||
}
|
||||
|
||||
68
harbour/contrib/libnf/ftshadow.c
Normal file
68
harbour/contrib/libnf/ftshadow.c
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* NF functions: FT_SHADOW(), FT_SETATTR()
|
||||
*
|
||||
* Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
|
||||
*
|
||||
* 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, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* 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 software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries 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 Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hbapi.h"
|
||||
#include "hbapigt.h"
|
||||
|
||||
HB_FUNC_EXTERN( HB_SHADOW );
|
||||
|
||||
HB_FUNC( FT_SHADOW )
|
||||
{
|
||||
HB_FUNC_EXEC( HB_SHADOW );
|
||||
}
|
||||
|
||||
HB_FUNC( FT_SETATTR )
|
||||
{
|
||||
hb_gtSetAttribute( hb_parni( 1 ), hb_parni( 2 ),
|
||||
hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) );
|
||||
}
|
||||
@@ -202,6 +202,7 @@ NANFOR_LIB_OBJ = \
|
||||
$(OBJ_DIR)\ftattr.obj \
|
||||
$(OBJ_DIR)\dispc.obj \
|
||||
$(OBJ_DIR)\fttext.obj \
|
||||
$(OBJ_DIR)\ftshadow.obj \
|
||||
$(OBJ_DIR)\putkey.obj
|
||||
|
||||
|
||||
@@ -935,6 +936,10 @@ $(OBJ_DIR)\fttext.obj : fttext.c
|
||||
$(CC) $(CLIBFLAGS) -o$@ $**
|
||||
tlib $(NANFOR_LIB) $(ARFLAGS) -+$@,,
|
||||
|
||||
$(OBJ_DIR)\ftshadow.obj : ftshadow.c
|
||||
$(CC) $(CLIBFLAGS) -o$@ $**
|
||||
tlib $(NANFOR_LIB) $(ARFLAGS) -+$@,,
|
||||
|
||||
$(OBJ_DIR)\putkey.obj : putkey.c
|
||||
$(CC) $(CLIBFLAGS) -o$@ $**
|
||||
tlib $(NANFOR_LIB) $(ARFLAGS) -+$@,,
|
||||
|
||||
@@ -133,6 +133,7 @@ TOOLS_LIB_OBJS = \
|
||||
$(OBJ_DIR)\ftattr.obj \
|
||||
$(OBJ_DIR)\dispc.obj \
|
||||
$(OBJ_DIR)\fttext.obj \
|
||||
$(OBJ_DIR)\ftshadow.obj \
|
||||
$(OBJ_DIR)\putkey.obj \
|
||||
\
|
||||
$(OBJ_DIR)\aading.obj \
|
||||
@@ -272,6 +273,7 @@ CLEAN:
|
||||
-@if exist $(OBJ_DIR)\ftattr.obj del $(OBJ_DIR)\ftattr.obj
|
||||
-@if exist $(OBJ_DIR)\dispc.obj del $(OBJ_DIR)\dispc.obj
|
||||
-@if exist $(OBJ_DIR)\fttext.obj del $(OBJ_DIR)\fttext.obj
|
||||
-@if exist $(OBJ_DIR)\ftshadow.obj del $(OBJ_DIR)\ftshadow.obj
|
||||
-@if exist $(OBJ_DIR)\putkey.obj del $(OBJ_DIR)\putkey.obj
|
||||
-@if exist $(OBJ_DIR)\aading.* del $(OBJ_DIR)\aading.*
|
||||
-@if exist $(OBJ_DIR)\aavg.* del $(OBJ_DIR)\aavg.*
|
||||
|
||||
@@ -73,24 +73,35 @@
|
||||
* $END$
|
||||
*/
|
||||
|
||||
#include <hbapi.h>
|
||||
#include "hbapigt.h"
|
||||
#include "hbapiitm.h"
|
||||
|
||||
#define status_byte ( *( char * ) ( 0x00400017 ) )
|
||||
|
||||
HB_FUNC(FT_NUMLOCK)
|
||||
HB_FUNC( FT_NUMLOCK )
|
||||
{
|
||||
#if defined(HB_OS_DOS)
|
||||
int iState = 0, iNewState;
|
||||
HB_GT_INFO gtInfo;
|
||||
|
||||
hb_retl( ( int ) ( status_byte & 0x20 ) );
|
||||
|
||||
if ( hb_pcount() )
|
||||
gtInfo.pNewVal = gtInfo.pResult = NULL;
|
||||
hb_gtInfo( GTI_KBDSHIFTS, >Info );
|
||||
if( gtInfo.pResult )
|
||||
{
|
||||
if ( ISLOG(1) )
|
||||
status_byte = ( status_byte | 0x20 );
|
||||
else
|
||||
status_byte = ( status_byte & 0xDF );
|
||||
iState = hb_itemGetNI( gtInfo.pResult );
|
||||
gtInfo.pNewVal = gtInfo.pResult;
|
||||
gtInfo.pResult = NULL;
|
||||
}
|
||||
return;
|
||||
|
||||
#endif
|
||||
if( ISLOG( 1 ) )
|
||||
{
|
||||
iNewState = hb_parl( 1 ) ? ( iState | GTI_KBD_NUMLOCK ) :
|
||||
( iState & ~GTI_KBD_NUMLOCK );
|
||||
gtInfo.pNewVal = hb_itemPutNI( gtInfo.pNewVal, iState );
|
||||
hb_gtInfo( GTI_KBDSHIFTS, >Info );
|
||||
}
|
||||
|
||||
if( gtInfo.pNewVal )
|
||||
hb_itemRelease( gtInfo.pNewVal );
|
||||
if( gtInfo.pResult )
|
||||
hb_itemRelease( gtInfo.pResult );
|
||||
|
||||
hb_retl( ( iState & GTI_KBD_NUMLOCK ) != 0 );
|
||||
}
|
||||
|
||||
@@ -61,11 +61,9 @@
|
||||
|
||||
#define pbyte *( ( char * ) 0x00400100 )
|
||||
|
||||
HB_FUNC(FT_PRTSCR)
|
||||
HB_FUNC( FT_PRTSCR )
|
||||
{
|
||||
#if defined(HB_OS_DOS)
|
||||
{
|
||||
|
||||
if ( hb_pcount() && ISLOG( 1 ) )
|
||||
{
|
||||
if ( hb_parl( 1 ) )
|
||||
@@ -78,8 +76,7 @@ HB_FUNC(FT_PRTSCR)
|
||||
hb_retl( FALSE );
|
||||
else
|
||||
hb_retl( TRUE );
|
||||
|
||||
return;
|
||||
}
|
||||
#else
|
||||
hb_retl( FALSE );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -59,16 +59,16 @@
|
||||
* $END$
|
||||
*/
|
||||
|
||||
#include <hbapi.h>
|
||||
#include "hbapigt.h"
|
||||
#include "hbapiitm.h"
|
||||
|
||||
HB_FUNC(FT_SHIFT )
|
||||
HB_FUNC( FT_SHIFT )
|
||||
{
|
||||
#if defined(HB_OS_DOS)
|
||||
{
|
||||
HB_GT_INFO gtInfo;
|
||||
|
||||
hb_retl( ( int ) ( ( *( char * ) 0x00400017 ) & 0x3 ) );
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
gtInfo.pNewVal = gtInfo.pResult = NULL;
|
||||
hb_gtInfo( GTI_KBDSHIFTS, >Info );
|
||||
hb_retl( ( hb_itemGetNI( gtInfo.pResult ) & GTI_KBD_SHIFT ) != 0 );
|
||||
if( gtInfo.pResult )
|
||||
hb_itemRelease( gtInfo.pResult );
|
||||
}
|
||||
|
||||
@@ -526,6 +526,8 @@ extern int hb_gt_chrmapinit( int *piTransTbl, const char *pszTerm, BOOL fSetACS
|
||||
extern void hb_gt_w32_Tone( double dFrequency, double dDuration );
|
||||
extern void hb_gt_w32_SetClipboard( UINT uFormat, char * szClipData, ULONG ulLen );
|
||||
extern BOOL hb_gt_w32_GetClipboard( UINT uFormat, char ** pszClipData, ULONG *pulLen );
|
||||
extern int hb_gt_w32_getKbdState( void );
|
||||
extern void hb_gt_w32_setKbdState( int kbdShifts );
|
||||
#endif /* HB_OS_WIN_32 */
|
||||
|
||||
|
||||
|
||||
@@ -148,6 +148,7 @@
|
||||
#define GTI_KBD_LWIN 8
|
||||
#define GTI_KBD_RWIN 16
|
||||
#define GTI_KBD_MENU 32
|
||||
#define GTI_KBD_INSERT 128
|
||||
#define GTI_KBD_SCROLOCK 256
|
||||
#define GTI_KBD_NUMLOCK 512
|
||||
#define GTI_KBD_CAPSLOCK 1024
|
||||
|
||||
@@ -44,9 +44,10 @@ C_SOURCES=\
|
||||
gtapi.c \
|
||||
gtchrmap.c \
|
||||
gtclip.c \
|
||||
gtfunc.c \
|
||||
gtkbstat.c \
|
||||
gtsys.c \
|
||||
gttone.c \
|
||||
gtfunc.c \
|
||||
gx.c \
|
||||
hardcr.c \
|
||||
hbadler.c \
|
||||
|
||||
@@ -114,8 +114,8 @@
|
||||
|
||||
#if defined(__DJGPP__)
|
||||
#include <pc.h>
|
||||
#include <sys\exceptn.h>
|
||||
#include <sys\farptr.h>
|
||||
#include <sys/exceptn.h>
|
||||
#include <sys/farptr.h>
|
||||
#include <dpmi.h>
|
||||
#elif defined(_MSC_VER) || defined(__WATCOMC__)
|
||||
#include <signal.h>
|
||||
@@ -138,6 +138,17 @@
|
||||
static unsigned char FAR * s_pScreenAddres;
|
||||
#endif
|
||||
|
||||
#if defined(__WATCOMC__) && defined(__386__)
|
||||
#define HB_PEEK_BYTE(s,o) ( *( ( UCHAR * ) ( ( (s) << 4 ) | (o) ) ) )
|
||||
#define HB_POKE_BYTE(s,o,b) *( ( UCHAR * ) ( ( (s) << 4 ) | (o) ) ) = (b)
|
||||
#elif defined(__DJGPP__)
|
||||
#define HB_PEEK_BYTE(s,o) _farpeekb( (s), (o) )
|
||||
#define HB_POKE_BYTE(s,o,b) _farpokeb( (s), (o), (b) )
|
||||
#else
|
||||
#define HB_PEEK_BYTE(s,o) ( *( ( UCHAR FAR * ) MK_FP( (s), (o) ) ) )
|
||||
#define HB_POKE_BYTE(s,o,b) *( ( UCHAR FAR * ) MK_FP( (s), (o) ) ) = (b)
|
||||
#endif
|
||||
|
||||
static HB_GT_FUNCS SuperTable;
|
||||
#define HB_GTSUPER (&SuperTable)
|
||||
|
||||
@@ -1451,6 +1462,52 @@ static void hb_gt_dos_Refresh( void )
|
||||
hb_gt_dos_SetCursorStyle( iStyle );
|
||||
}
|
||||
|
||||
#define HB_BIOS_LSHIFT 0x01
|
||||
#define HB_BIOS_RSHIFT 0x02
|
||||
#define HB_BIOS_CTRL 0x04
|
||||
#define HB_BIOS_ALT 0x08
|
||||
#define HB_BIOS_SHIFT ( HB_BIOS_LSHIFT | HB_BIOS_RSHIFT )
|
||||
#define HB_BIOS_SCROLL 0x10
|
||||
#define HB_BIOS_NUMLOCK 0x20
|
||||
#define HB_BIOS_CAPSLOCK 0x40
|
||||
#define HB_BIOS_INSERT 0x80
|
||||
|
||||
// #define HB_PEEK_BYTE(s,o) ( *( ( UCHAR * ) ( ( (s) << 4 ) | (o) ) ) )
|
||||
// #define HB_POKE_BYTE(s,o,b) *( ( UCHAR * ) ( ( (s) << 4 ) | (o) ) ) = (b)
|
||||
|
||||
static int hb_gt_dos_getKbdState( void )
|
||||
{
|
||||
int iKbdState = 0;
|
||||
UCHAR ucStat;
|
||||
|
||||
ucStat = HB_PEEK_BYTE( 0x0040, 0x0017 );
|
||||
|
||||
if( ucStat & HB_BIOS_SHIFT ) iKbdState |= GTI_KBD_SHIFT;
|
||||
if( ucStat & HB_BIOS_CTRL ) iKbdState |= GTI_KBD_CTRL;
|
||||
if( ucStat & HB_BIOS_ALT ) iKbdState |= GTI_KBD_ALT;
|
||||
if( ucStat & HB_BIOS_SCROLL ) iKbdState |= GTI_KBD_SCROLOCK;
|
||||
if( ucStat & HB_BIOS_NUMLOCK ) iKbdState |= GTI_KBD_NUMLOCK;
|
||||
if( ucStat & HB_BIOS_CAPSLOCK ) iKbdState |= GTI_KBD_CAPSLOCK;
|
||||
if( ucStat & HB_BIOS_INSERT ) iKbdState |= GTI_KBD_INSERT;
|
||||
|
||||
return iKbdState;
|
||||
}
|
||||
|
||||
static void hb_gt_dos_setKbdState( int iKbdState )
|
||||
{
|
||||
UCHAR ucStat = 0;
|
||||
|
||||
ucStat |= ( iKbdState & GTI_KBD_SHIFT ) ? HB_BIOS_SHIFT : 0;
|
||||
ucStat |= ( iKbdState & GTI_KBD_CTRL ) ? HB_BIOS_CTRL : 0;
|
||||
ucStat |= ( iKbdState & GTI_KBD_ALT ) ? HB_BIOS_ALT : 0;
|
||||
ucStat |= ( iKbdState & GTI_KBD_SCROLOCK ) ? HB_BIOS_SCROLL : 0;
|
||||
ucStat |= ( iKbdState & GTI_KBD_NUMLOCK ) ? HB_BIOS_NUMLOCK : 0;
|
||||
ucStat |= ( iKbdState & GTI_KBD_CAPSLOCK ) ? HB_BIOS_CAPSLOCK : 0;
|
||||
ucStat |= ( iKbdState & GTI_KBD_INSERT ) ? HB_BIOS_INSERT : 0;
|
||||
|
||||
HB_POKE_BYTE( 0x0040, 0x0017, ucStat );
|
||||
}
|
||||
|
||||
static BOOL hb_gt_dos_Info( int iType, PHB_GT_INFO pInfo )
|
||||
{
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_dos_Info(%d,%p)", iType, pInfo ) );
|
||||
@@ -1462,6 +1519,12 @@ static BOOL hb_gt_dos_Info( int iType, PHB_GT_INFO pInfo )
|
||||
pInfo->pResult = hb_itemPutL( pInfo->pResult, TRUE );
|
||||
break;
|
||||
|
||||
case GTI_KBDSHIFTS:
|
||||
pInfo->pResult = hb_itemPutNI( pInfo->pResult, hb_gt_dos_getKbdState() );
|
||||
if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
|
||||
hb_gt_dos_setKbdState( hb_itemGetNI( pInfo->pNewVal ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
return HB_GTSUPER_INFO( iType, pInfo );
|
||||
}
|
||||
|
||||
@@ -122,6 +122,12 @@ static BOOL hb_gt_gui_Info( int iType, PHB_GT_INFO pInfo )
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GTI_KBDSPECIAL:
|
||||
pInfo->pResult = hb_itemPutL( pInfo->pResult, s_bSpecialKeyHandling );
|
||||
if( hb_itemType( pInfo->pNewVal ) & HB_IT_LOGICAL )
|
||||
s_bSpecialKeyHandling = hb_itemGetL( pInfo->pNewVal );
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return HB_GTSUPER_INFO( iType, pInfo );
|
||||
|
||||
103
harbour/source/rtl/gtkbstat.c
Normal file
103
harbour/source/rtl/gtkbstat.c
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Low level keyboard shift state functions common to some GT drivers
|
||||
*
|
||||
* Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
|
||||
* 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, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* 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 software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries 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 Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* NOTE: User programs should never call this layer directly! */
|
||||
|
||||
#define HB_OS_WIN_32_USED
|
||||
#include "hbgtcore.h"
|
||||
|
||||
#if defined( HB_OS_WIN_32 )
|
||||
|
||||
int hb_gt_w32_getKbdState( void )
|
||||
{
|
||||
BYTE kbState[256];
|
||||
int iKbdState = 0;
|
||||
|
||||
GetKeyboardState( kbState );
|
||||
|
||||
if( kbState[VK_SHIFT ] & 0x80 ) iKbdState |= GTI_KBD_SHIFT;
|
||||
if( kbState[VK_CONTROL ] & 0x80 ) iKbdState |= GTI_KBD_CTRL;
|
||||
if( kbState[VK_MENU ] & 0x80 ) iKbdState |= GTI_KBD_ALT;
|
||||
if( kbState[VK_LWIN ] & 0x80 ) iKbdState |= GTI_KBD_LWIN;
|
||||
if( kbState[VK_RWIN ] & 0x80 ) iKbdState |= GTI_KBD_RWIN;
|
||||
if( kbState[VK_APPS ] & 0x80 ) iKbdState |= GTI_KBD_MENU;
|
||||
if( kbState[VK_SCROLL ] & 0x01 ) iKbdState |= GTI_KBD_SCROLOCK;
|
||||
if( kbState[VK_NUMLOCK ] & 0x01 ) iKbdState |= GTI_KBD_NUMLOCK;
|
||||
if( kbState[VK_CAPITAL ] & 0x01 ) iKbdState |= GTI_KBD_CAPSLOCK;
|
||||
if( kbState[VK_INSERT ] & 0x01 ) iKbdState |= GTI_KBD_INSERT;
|
||||
|
||||
return iKbdState;
|
||||
}
|
||||
|
||||
void hb_gt_w32_setKbdState( int iKbdState )
|
||||
{
|
||||
BYTE kbState[256];
|
||||
|
||||
GetKeyboardState( kbState );
|
||||
|
||||
kbState[VK_SHIFT ] = ( iKbdState & GTI_KBD_SHIFT ) ? 0x80 : 0;
|
||||
kbState[VK_CONTROL] = ( iKbdState & GTI_KBD_CTRL ) ? 0x80 : 0;
|
||||
kbState[VK_MENU ] = ( iKbdState & GTI_KBD_ALT ) ? 0x80 : 0;
|
||||
kbState[VK_LWIN ] = ( iKbdState & GTI_KBD_LWIN ) ? 0x80 : 0;
|
||||
kbState[VK_RWIN ] = ( iKbdState & GTI_KBD_RWIN ) ? 0x80 : 0;
|
||||
kbState[VK_APPS ] = ( iKbdState & GTI_KBD_MENU ) ? 0x80 : 0;
|
||||
kbState[VK_SCROLL ] = ( iKbdState & GTI_KBD_SCROLOCK ) ? 0x01 : 0;
|
||||
kbState[VK_NUMLOCK] = ( iKbdState & GTI_KBD_NUMLOCK ) ? 0x01 : 0;
|
||||
kbState[VK_CAPITAL] = ( iKbdState & GTI_KBD_CAPSLOCK ) ? 0x01 : 0;
|
||||
kbState[VK_INSERT ] = ( iKbdState & GTI_KBD_INSERT ) ? 0x01 : 0;
|
||||
|
||||
SetKeyboardState( kbState );
|
||||
}
|
||||
|
||||
|
||||
#endif /* HB_OS_WIN_32 */
|
||||
@@ -1565,23 +1565,6 @@ static BOOL hb_gt_win_SetKeyCP( char *pszTermCDP, char *pszHostCDP )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int kbdShiftsState( void )
|
||||
{
|
||||
int kbdShifts = 0;
|
||||
|
||||
if ( GetKeyState( VK_SHIFT ) & 0x80 ) kbdShifts |= GTI_KBD_SHIFT;
|
||||
if ( GetKeyState( VK_CONTROL ) & 0x80 ) kbdShifts |= GTI_KBD_CTRL;
|
||||
//if ( GetKeyState( VK_MENU ) & 0x80 ) kbdShifts |= GTI_KBD_ALT;
|
||||
if ( GetKeyState( VK_LWIN ) & 0x80 ) kbdShifts |= GTI_KBD_LWIN;
|
||||
if ( GetKeyState( VK_RWIN ) & 0x80 ) kbdShifts |= GTI_KBD_RWIN;
|
||||
if ( GetKeyState( VK_APPS ) & 0x80 ) kbdShifts |= GTI_KBD_MENU;
|
||||
if ( GetKeyState( VK_SCROLL ) & 0x01 ) kbdShifts |= GTI_KBD_SCROLOCK;
|
||||
if ( GetKeyState( VK_NUMLOCK ) & 0x01 ) kbdShifts |= GTI_KBD_NUMLOCK;
|
||||
if ( GetKeyState( VK_CAPITAL ) & 0x01 ) kbdShifts |= GTI_KBD_CAPSLOCK;
|
||||
|
||||
return kbdShifts;
|
||||
}
|
||||
|
||||
/* *********************************************************************** */
|
||||
|
||||
static BOOL hb_gt_win_Info( int iType, PHB_GT_INFO pInfo )
|
||||
@@ -1629,7 +1612,9 @@ static BOOL hb_gt_win_Info( int iType, PHB_GT_INFO pInfo )
|
||||
break;
|
||||
|
||||
case GTI_KBDSHIFTS:
|
||||
pInfo->pResult = hb_itemPutNI( pInfo->pResult, kbdShiftsState() );
|
||||
pInfo->pResult = hb_itemPutNI( pInfo->pResult, hb_gt_w32_getKbdState() );
|
||||
if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
|
||||
hb_gt_w32_setKbdState( hb_itemGetNI( pInfo->pNewVal ) );
|
||||
break;
|
||||
|
||||
case GTI_KBDSPECIAL:
|
||||
|
||||
@@ -895,26 +895,6 @@ static BOOL hb_gt_wvt_KeyEvent( HWND hWnd, UINT message, WPARAM wParam, LPARAM l
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int kbdShiftsState( void )
|
||||
{
|
||||
BYTE kbBuffer[ 256 ];
|
||||
int kbdShifts;
|
||||
|
||||
kbdShifts = 0;
|
||||
GetKeyboardState( kbBuffer );
|
||||
if ( kbBuffer[ VK_SHIFT ] & 0x080 ) kbdShifts += GTI_KBD_SHIFT;
|
||||
if ( kbBuffer[ VK_CONTROL ] & 0x080 ) kbdShifts += GTI_KBD_CTRL;
|
||||
if ( kbBuffer[ VK_MENU ] & 0x080 ) kbdShifts += GTI_KBD_ALT;
|
||||
if ( kbBuffer[ VK_LWIN ] & 0x080 ) kbdShifts += GTI_KBD_LWIN;
|
||||
if ( kbBuffer[ VK_RWIN ] & 0x080 ) kbdShifts += GTI_KBD_RWIN;
|
||||
if ( kbBuffer[ VK_APPS ] & 0x080 ) kbdShifts += GTI_KBD_MENU;
|
||||
if ( kbBuffer[ VK_SCROLL ] & 0x001 ) kbdShifts += GTI_KBD_SCROLOCK;
|
||||
if ( kbBuffer[ VK_NUMLOCK ] & 0x001 ) kbdShifts += GTI_KBD_NUMLOCK;
|
||||
if ( kbBuffer[ VK_CAPITAL ] & 0x001 ) kbdShifts += GTI_KBD_CAPSLOCK;
|
||||
|
||||
return kbdShifts;
|
||||
}
|
||||
|
||||
/*
|
||||
* hb_gt_wvt_TextOut converts col and row to x and y ( pixels ) and calls
|
||||
* the Windows function TextOut with the expected coordinates
|
||||
@@ -1724,7 +1704,10 @@ static BOOL hb_gt_wvt_Info( int iType, PHB_GT_INFO pInfo )
|
||||
break;
|
||||
|
||||
case GTI_KBDSHIFTS:
|
||||
return kbdShiftsState();
|
||||
pInfo->pResult = hb_itemPutNI( pInfo->pResult, hb_gt_w32_getKbdState() );
|
||||
if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
|
||||
hb_gt_w32_setKbdState( hb_itemGetNI( pInfo->pNewVal ) );
|
||||
break;
|
||||
|
||||
case GTI_CLIPBOARDDATA:
|
||||
if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
|
||||
|
||||
Reference in New Issue
Block a user