2008-08-08 02:18 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/make_deb.sh
  * harbour/make_tgz.sh
  * harbour/make_rpm.sh
  * harbour/make_rpmce.sh
  * harbour/make_rpmw32.sh
  * harbour/bin/pack_src.sh
    * force using BASH in all files which includes hb-func.sh

  * harbour/include/hbgtcore.h
  * harbour/include/hbapigt.h
  * harbour/include/hbextern.ch
  * harbour/source/rtl/hbgtcore.c
  * harbour/source/rtl/inkeyapi.c
  * harbour/source/rtl/inkey.c
    + added HB_KEYINS() which works like HB_KEYPUT() but numeric
      key values puts at the beginning of keyboard buffer.
      It does not clear keyboard buffer contents.
This commit is contained in:
Przemyslaw Czerpak
2008-08-08 00:19:01 +00:00
parent e3160e7258
commit beab897d85
13 changed files with 105 additions and 9 deletions

View File

@@ -8,6 +8,25 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-08-08 02:18 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/make_deb.sh
* harbour/make_tgz.sh
* harbour/make_rpm.sh
* harbour/make_rpmce.sh
* harbour/make_rpmw32.sh
* harbour/bin/pack_src.sh
* force using BASH in all files which includes hb-func.sh
* harbour/include/hbgtcore.h
* harbour/include/hbapigt.h
* harbour/include/hbextern.ch
* harbour/source/rtl/hbgtcore.c
* harbour/source/rtl/inkeyapi.c
* harbour/source/rtl/inkey.c
+ added HB_KEYINS() which works like HB_KEYPUT() but numeric
key values puts at the beginning of keyboard buffer.
It does not clear keyboard buffer contents.
2008-08-07 17:20 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/source/rtl/achoice.prg
- Removed K_MOUSEMOVE functionality.

View File

@@ -1,4 +1,5 @@
#!/bin/sh
[ "$BASH" ] || exec bash `which $0` ${1+"$@"}
#
# $Id$
#

View File

@@ -272,6 +272,7 @@ extern HB_EXPORT ERRCODE hb_gtSetBorder( HB_GT_RGB * color );
/* Harbour keyboard support functions */
extern HB_EXPORT int hb_inkey( BOOL bWait, double dSeconds, int iEvenMask ); /* Wait for keyboard input */
extern HB_EXPORT void hb_inkeyPut( int ch ); /* Inserts an inkey code into the keyboard buffer */
extern HB_EXPORT void hb_inkeyIns( int ch ); /* Inserts an inkey code into the keyboard buffer */
extern HB_EXPORT int hb_inkeyLast( int iEvenMask ); /* Return the value of the last key that was extracted */
extern HB_EXPORT int hb_inkeyNext( int iEvenMask ); /* Return the next key without extracting it */
extern HB_EXPORT void hb_inkeyPoll( void ); /* Poll the console keyboard to stuff the Harbour buffer */

View File

@@ -1049,6 +1049,7 @@ EXTERNAL HB_FCOMMIT
EXTERNAL HB_FTEMPCREATE
EXTERNAL HB_GCALL
EXTERNAL HB_KEYPUT
EXTERNAL HB_KEYINS
EXTERNAL HB_OEMTOANSI
EXTERNAL HB_OSERROR
EXTERNAL HB_OSDRIVESEPARATOR

View File

@@ -202,6 +202,7 @@ typedef struct
int (* InkeyGet) ( HB_GT_PTR, BOOL fWait, double dSeconds, int iEventMask );
void (* InkeyPut) ( HB_GT_PTR, int iKey );
void (* InkeyIns) ( HB_GT_PTR, int iKey );
int (* InkeyLast) ( HB_GT_PTR, int iEventMask );
int (* InkeyNext) ( HB_GT_PTR, int iEventMask );
void (* InkeyPoll) ( HB_GT_PTR );
@@ -437,6 +438,7 @@ extern PHB_GT hb_gt_Base( void );
#define HB_GTSELF_READKEY(g,m) (g)->pFuncTable->ReadKey(g,m)
#define HB_GTSELF_INKEYGET(g,w,d,m) (g)->pFuncTable->InkeyGet(g,w,d,m)
#define HB_GTSELF_INKEYPUT(g,k) (g)->pFuncTable->InkeyPut(g,k)
#define HB_GTSELF_INKEYINS(g,k) (g)->pFuncTable->InkeyIns(g,k)
#define HB_GTSELF_INKEYLAST(g,m) (g)->pFuncTable->InkeyLast(g,m)
#define HB_GTSELF_INKEYNEXT(g,m) (g)->pFuncTable->InkeyNext(g,m)
#define HB_GTSELF_INKEYPOLL(g) (g)->pFuncTable->InkeyPoll(g)
@@ -551,6 +553,7 @@ extern PHB_GT hb_gt_Base( void );
#define HB_GTSUPER_READKEY(g,m) (HB_GTSUPER)->ReadKey(g,m)
#define HB_GTSUPER_INKEYGET(g,w,d,m) (HB_GTSUPER)->InkeyGet(g,w,d,m)
#define HB_GTSUPER_INKEYPUT(g,k) (HB_GTSUPER)->InkeyPut(g,k)
#define HB_GTSUPER_INKEYINS(g,k) (HB_GTSUPER)->InkeyIns(g,k)
#define HB_GTSUPER_INKEYLAST(g,m) (HB_GTSUPER)->InkeyLast(g,m)
#define HB_GTSUPER_INKEYNEXT(g,m) (HB_GTSUPER)->InkeyNext(g,m)
#define HB_GTSUPER_INKEYPOLL(g) (HB_GTSUPER)->InkeyPoll(g)

View File

@@ -1,4 +1,5 @@
#!/bin/sh
[ "$BASH" ] || exec bash `which $0` ${1+"$@"}
#
# $Id$
#

View File

@@ -1,4 +1,5 @@
#!/bin/sh
[ "$BASH" ] || exec bash `which $0` ${1+"$@"}
#
# $Id$
#

View File

@@ -1,4 +1,5 @@
#!/bin/sh
[ "$BASH" ] || exec bash `which $0` ${1+"$@"}
#
# $Id$
#

View File

@@ -1,4 +1,5 @@
#!/bin/sh
[ "$BASH" ] || exec bash `which $0` ${1+"$@"}
#
# $Id$
#

View File

@@ -1,4 +1,5 @@
#!/bin/sh
[ "$BASH" ] || exec bash `which $0` ${1+"$@"}
#
# $Id$
#
@@ -308,6 +309,7 @@ if [ -n "${hb_instfile}" ]; then
# if $TAR exists in the installation environment
cat > "${hb_instfile}" <<EOF
#!/bin/sh
[ "\$BASH" ] || exec bash \`which \$0\` \${1+"\$@"}
if [ "\$1" = "--extract" ]; then
sed -e '1,/^HB_INST_EOF\$/ d' "\$0" > "${hb_archfile}"
exit

View File

@@ -2243,6 +2243,26 @@ static void hb_gt_def_InkeyPut( PHB_GT pGT, int iKey )
pGT->inkeyHead = iHead;
}
/* Inset the key into head of keyboard buffer */
static void hb_gt_def_InkeyIns( PHB_GT pGT, int iKey )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_def_InkeyIns(%p,%d)", pGT, iKey));
if( --pGT->inkeyTail < 0 )
pGT->inkeyTail = pGT->inkeyBufferSize -1;
pGT->inkeyBuffer[ pGT->inkeyTail ] = iKey;
/* When the buffer is full new event overwrite the last one
* in the buffer. [druzus]
*/
if( pGT->inkeyHead == pGT->inkeyTail )
{
if( --pGT->inkeyHead < 0 )
pGT->inkeyHead = pGT->inkeyBufferSize -1;
}
}
/* helper internal function */
static BOOL hb_gt_def_InkeyNextCheck( PHB_GT pGT, int iEventMask, int * iKey )
{
@@ -2836,15 +2856,16 @@ static HB_GT_FUNCS s_gtCoreFunc =
SetDispCP : hb_gt_def_SetDispCP ,
SetKeyCP : hb_gt_def_SetKeyCP ,
ReadKey : hb_gt_def_ReadKey ,
InkeyGet : hb_gt_def_InkeyGet ,
InkeyPut : hb_gt_def_InkeyPut ,
InkeyLast : hb_gt_def_InkeyLast ,
InkeyNext : hb_gt_def_InkeyNext ,
InkeyPoll : hb_gt_def_InkeyPoll ,
InkeySetText : hb_gt_def_InkeySetText ,
InkeySetLast : hb_gt_def_InkeySetLast ,
InkeyReset : hb_gt_def_InkeyReset ,
InkeyExit : hb_gt_def_InkeyExit ,
InkeyGet : hb_gt_def_InkeyGet ,
InkeyPut : hb_gt_def_InkeyPut ,
InkeyIns : hb_gt_def_InkeyIns ,
InkeyLast : hb_gt_def_InkeyLast ,
InkeyNext : hb_gt_def_InkeyNext ,
InkeyPoll : hb_gt_def_InkeyPoll ,
InkeySetText : hb_gt_def_InkeySetText ,
InkeySetLast : hb_gt_def_InkeySetLast ,
InkeyReset : hb_gt_def_InkeyReset ,
InkeyExit : hb_gt_def_InkeyExit ,
MouseInit : hb_gt_def_MouseInit ,
MouseExit : hb_gt_def_MouseExit ,
MouseIsPresent : hb_gt_def_MouseIsPresent ,
@@ -2955,6 +2976,7 @@ static HB_GT_FUNCS s_gtCoreFunc =
hb_gt_def_ReadKey ,
hb_gt_def_InkeyGet ,
hb_gt_def_InkeyPut ,
hb_gt_def_InkeyIns ,
hb_gt_def_InkeyLast ,
hb_gt_def_InkeyNext ,
hb_gt_def_InkeyPoll ,

View File

@@ -224,6 +224,38 @@ HB_FUNC( HB_KEYPUT )
}
}
HB_FUNC( HB_KEYINS )
{
if( ISNUM( 1 ) )
{
hb_inkeyIns( hb_parni( 1 ) );
}
else if( ISCHAR( 1 ) )
{
hb_inkeySetText( hb_parc( 1 ), hb_parclen( 1 ) );
}
else if( ISARRAY( 1 ) )
{
PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
ULONG ulIndex;
ULONG ulElements = hb_arrayLen( pArray );
for( ulIndex = 1; ulIndex <= ulElements; ulIndex++ )
{
PHB_ITEM pItem = hb_arrayGetItemPtr( pArray, ulIndex );
if( HB_IS_NUMBER( pItem ) )
{
hb_inkeyIns( hb_itemGetNI( pItem ) );
}
else if( HB_IS_STRING( pItem ) )
{
hb_inkeySetText( ( const char * ) hb_itemGetCPtr( pItem ), hb_itemGetCLen( pItem ) );
}
}
}
}
HB_FUNC( NEXTKEY )
{
hb_retni( hb_inkeyNext( ISNUM( 1 ) ? hb_parni( 1 ) : hb_set.HB_SET_EVENTMASK ) );

View File

@@ -73,6 +73,17 @@ HB_EXPORT void hb_inkeyPut( int iKey )
HB_GTSELF_INKEYPUT( pGT, iKey );
}
HB_EXPORT void hb_inkeyIns( int iKey )
{
PHB_GT pGT;
HB_TRACE(HB_TR_DEBUG, ("hb_inkeyIns(%d)", iKey));
pGT = hb_gt_Base();
if( pGT )
HB_GTSELF_INKEYINS( pGT, iKey );
}
HB_EXPORT int hb_inkeyLast( int iEventMask )
{
PHB_GT pGT;