2008-10-10 00:14 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbapigt.h
  * harbour/source/rtl/gtapi.c
    + added hb_gtPutText() C function

  * harbour/source/rtl/console.c
    + added HB_DISPOUTAT() which works like DISPOUTAT but does not change
      cursor position. xBase++ users can use
         #xtranslate DispOutAt( <x,...> ) => hb_dispOutAt( <x> )
      for xBase++ compatible code
This commit is contained in:
Przemyslaw Czerpak
2008-10-09 22:15:01 +00:00
parent af1e261b5b
commit 15054c311b
4 changed files with 64 additions and 0 deletions

View File

@@ -8,6 +8,17 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2008-10-10 00:14 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapigt.h
* harbour/source/rtl/gtapi.c
+ added hb_gtPutText() C function
* harbour/source/rtl/console.c
+ added HB_DISPOUTAT() which works like DISPOUTAT but does not change
cursor position. xBase++ users can use
#xtranslate DispOutAt( <x,...> ) => hb_dispOutAt( <x> )
for xBase++ compatible code
2008-10-09 20:51 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/common.mak
* harbour/source/rtl/Makefile

View File

@@ -186,6 +186,7 @@ extern HB_EXPORT ERRCODE hb_gtTone( double dFrequency, double dDuration );
extern HB_EXPORT ERRCODE hb_gtWrite( BYTE * pbyStr, ULONG ulLen );
extern HB_EXPORT ERRCODE hb_gtWriteAt( USHORT uiRow, USHORT uiCol, BYTE * pbyStr, ULONG ulLen );
extern HB_EXPORT ERRCODE hb_gtWriteCon( BYTE * pbyStr, ULONG ulLen );
extern HB_EXPORT ERRCODE hb_gtPutText( USHORT uiRow, USHORT uiCol, BYTE * pStr, ULONG ulLength );
extern HB_EXPORT const char * hb_gtVersion( int iType );
extern HB_EXPORT ERRCODE hb_gtOutStd( BYTE * pbyStr, ULONG ulLen );
extern HB_EXPORT ERRCODE hb_gtOutErr( BYTE * pbyStr, ULONG ulLen );

View File

@@ -570,6 +570,41 @@ HB_FUNC( DISPOUTAT ) /* writes a single value to the screen at speficic position
}
}
/* Harbour extension, works like DISPOUTAT but does not change cursor position */
HB_FUNC( HB_DISPOUTAT )
{
char * pszString;
ULONG ulLen;
BOOL bFreeReq;
if( ISCHAR( 4 ) )
{
char szOldColor[ HB_CLRSTR_LEN ];
hb_gtGetColorStr( szOldColor );
hb_gtSetColorStr( hb_parc( 4 ) );
pszString = hb_itemStringCon( hb_param( 3, HB_IT_ANY ), &ulLen, &bFreeReq );
hb_gtPutText( ( USHORT ) hb_parni( 1 ), ( USHORT ) hb_parni( 2 ), ( BYTE * ) pszString, ulLen );
if( bFreeReq )
hb_xfree( pszString );
hb_gtSetColorStr( szOldColor );
}
else if( hb_pcount() >= 3 )
{
pszString = hb_itemStringCon( hb_param( 3, HB_IT_ANY ), &ulLen, &bFreeReq );
hb_gtPutText( ( USHORT ) hb_parni( 1 ), ( USHORT ) hb_parni( 2 ), ( BYTE * ) pszString, ulLen );
if( bFreeReq )
hb_xfree( pszString );
}
}
HB_FUNC( HB_GETSTDIN ) /* Return Handel for STDIN */
{

View File

@@ -714,6 +714,23 @@ HB_EXPORT ERRCODE hb_gtSetMode( USHORT uiRows, USHORT uiCols )
return errCode;
}
HB_EXPORT ERRCODE hb_gtPutText( USHORT uiRow, USHORT uiCol, BYTE * pStr, ULONG ulLength )
{
PHB_GT pGT;
HB_TRACE(HB_TR_DEBUG, ("hb_gtPutText(%hu, %hu, %p, %lu)", uiRow, uiCol, pStr, ulLength));
pGT = hb_gt_Base();
if( pGT )
{
HB_GTSELF_PUTTEXT( pGT, uiRow, uiCol, HB_GTSELF_GETCOLOR( pGT ), pStr, ulLength );
HB_GTSELF_FLUSH( pGT );
hb_gt_BaseFree( pGT );
return SUCCESS;
}
return FAILURE;
}
HB_EXPORT ERRCODE hb_gtWriteAt( USHORT uiRow, USHORT uiCol, BYTE * pStr, ULONG ulLength )
{
PHB_GT pGT;