ChangeLog 20000416-13:05 GMT+1
This commit is contained in:
@@ -1,3 +1,33 @@
|
||||
20000416-13:05 GMT+1 Ryszard Glab <rglab@imid.med.pl>
|
||||
|
||||
*config/linux/gcc.cf
|
||||
*fixed to automatically select a proper screen library
|
||||
|
||||
*include/hbapigt.h
|
||||
*source/rtl/gtapi.c
|
||||
*source/rtl/gt_tpl/gt_tpl.c
|
||||
*source/rtl/gtcrs/gtcrs.c
|
||||
*source/rtl/gtdos/gtdos.c
|
||||
*source/rtl/gtos2/gtos2.c
|
||||
*source/rtl/gtpca/gtpca.c
|
||||
*source/rtl/gtsln/gtsln.c
|
||||
*source/rtl/gtstd/gtstd.c
|
||||
*source/rtl/gtwin/gtwin.c
|
||||
*number of bytes required for a given rectangle size is
|
||||
calculated in the lowest level function
|
||||
hb_gt_RectSize( rows, cols ) - some screen drivers can
|
||||
store screen image in more complex method then byte+byte
|
||||
|
||||
*source/rtl/gtcrs/gtcrs.c
|
||||
*full support for scrolling was added
|
||||
*full ASCII character set enabled including box drawing characters
|
||||
(however this don't work under xterm)
|
||||
*save/restore screen are available
|
||||
|
||||
*source/rdd/dbfcdx/dbfcdx1.c
|
||||
* fixed NULL into 0 for string termination character (NULL in gcc
|
||||
compiler is defined as a pointer)
|
||||
|
||||
20000416-12:34 GMT+1 Victor Szakats <info@szelvesz.hu>
|
||||
|
||||
* source/lang/msgfr.c
|
||||
|
||||
@@ -13,7 +13,7 @@ CC = gcc
|
||||
CC_IN = -c
|
||||
CC_OUT = -o
|
||||
CPPFLAGS = -I. -I$(HB_INC_COMPILE)
|
||||
CFLAGS = -Wall
|
||||
CFLAGS = -Wall -g
|
||||
|
||||
LD = gcc
|
||||
LD_OUT = -o
|
||||
@@ -40,8 +40,13 @@ LINKLIBS += -l$(HB_GT_LIB)
|
||||
endif
|
||||
|
||||
# HB_SCREEN_LIB: empty, or one of ncurses, slang
|
||||
HB_SCREEN_LIB=ncurses
|
||||
# HB_SCREEN_LIB=slang
|
||||
ifeq ($(HB_GT_LIB),gtcrs)
|
||||
HB_SCREEN_LIB:=ncurses
|
||||
else
|
||||
ifeq ($(HB_GT_LIB),gtsln)
|
||||
HB_SCREEN_LIB:=slang
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(HB_SCREEN_LIB),)
|
||||
LINKLIBS += -l$(HB_SCREEN_LIB)
|
||||
|
||||
@@ -164,6 +164,7 @@ extern BOOL hb_gt_IsColor( void );
|
||||
extern void hb_gt_Puts( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE * pbyStr, ULONG ulLen );
|
||||
extern void hb_gt_PutText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbySrc );
|
||||
extern int hb_gt_ReadKey( HB_inkey_enum eventmask );
|
||||
extern int hb_gt_RectSize( USHORT rows, USHORT cols );
|
||||
extern void hb_gt_Replicate( BYTE byChar, ULONG ulLen );
|
||||
extern SHORT hb_gt_Row( void );
|
||||
extern void hb_gt_Scroll( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE byAttr, SHORT iRows, SHORT iCols );
|
||||
|
||||
@@ -922,7 +922,7 @@ static void hb_cdxTagKeyAdd( LPTAGINFO pTag, LPKEYINFO pKey )
|
||||
while( pNewKey->pItem->item.asString.length > 0 &&
|
||||
pNewKey->pItem->item.asString.value[ pNewKey->pItem->item.asString.length - 1 ] == ' ' )
|
||||
pNewKey->pItem->item.asString.length--;
|
||||
pNewKey->pItem->item.asString.value[ pNewKey->pItem->item.asString.length ] = NULL;
|
||||
pNewKey->pItem->item.asString.value[ pNewKey->pItem->item.asString.length ] = 0;
|
||||
}
|
||||
pTag->TagBOF = pTag->TagEOF = FALSE;
|
||||
iSeek = hb_cdxPageSeekKey( pTag->RootPage, pNewKey->Tag, pNewKey, TRUE );
|
||||
@@ -1155,7 +1155,7 @@ static void hb_cdxTagExtNodeBuild( LPTAGINFO pTag, LPCDXDATA pData, LPPAGEINFO P
|
||||
if( pTag->KeyLength - d - t > 0 )
|
||||
memcpy( &szBuffer[ d ], &pData->cdxu.External.ExtData[ k ],
|
||||
pTag->KeyLength - d - t );
|
||||
szBuffer[ pTag->KeyLength - t ] = NULL;
|
||||
szBuffer[ pTag->KeyLength - t ] = 0;
|
||||
pKey = hb_cdxKeyNew();
|
||||
pKey->Tag = r;
|
||||
pKey->Xtra = r;
|
||||
@@ -1227,7 +1227,7 @@ static void hb_cdxTagTagLoad( LPTAGINFO pTag )
|
||||
break;
|
||||
}
|
||||
|
||||
if( pHeader.KeyPool[ strlen( pTag->KeyExpr ) + 1 ] == NULL )
|
||||
if( pHeader.KeyPool[ strlen( pTag->KeyExpr ) + 1 ] == 0 )
|
||||
return;
|
||||
pTag->ForExpr = ( char * ) hb_xgrab( CDX_MAX_KEY + 1 );
|
||||
hb_strncpyUpper( pTag->ForExpr, ( const char * ) pHeader.KeyPool +
|
||||
@@ -1371,7 +1371,7 @@ static void hb_cdxTagIntNodeBuild( LPTAGINFO pTag, LPCDXDATA pData, LPPAGEINFO p
|
||||
{
|
||||
v = i * ( pTag->KeyLength + 8 );
|
||||
memmove( szBuffer, pData->cdxu.Internal.IntData + v, pTag->KeyLength );
|
||||
szBuffer[ pTag->KeyLength ] = NULL;
|
||||
szBuffer[ pTag->KeyLength ] = 0;
|
||||
v += pTag->KeyLength;
|
||||
memcpy( &r, &pData->cdxu.Internal.IntData[ v ], 4 );
|
||||
r = hb_cdxSwapBytes( r );
|
||||
@@ -1383,7 +1383,7 @@ static void hb_cdxTagIntNodeBuild( LPTAGINFO pTag, LPCDXDATA pData, LPPAGEINFO p
|
||||
v = strlen( szBuffer );
|
||||
while( v > 0 && szBuffer[ v - 1 ] == 32 )
|
||||
v--;
|
||||
szBuffer[ v ] = NULL;
|
||||
szBuffer[ v ] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1424,7 +1424,7 @@ static LONG hb_cdxTagKeyFind( LPTAGINFO pTag, LPKEYINFO pKey )
|
||||
while( stot->pItem->item.asString.length > 0 &&
|
||||
stot->pItem->item.asString.value[ stot->pItem->item.asString.length - 1 ] == ' ' )
|
||||
stot->pItem->item.asString.length--;
|
||||
stot->pItem->item.asString.value[ stot->pItem->item.asString.length ] = NULL;
|
||||
stot->pItem->item.asString.value[ stot->pItem->item.asString.length ] = 0;
|
||||
}
|
||||
pTag->TagBOF = pTag->TagEOF = FALSE;
|
||||
K = hb_cdxPageSeekKey( pTag->RootPage, stot->Tag, stot, FALSE );
|
||||
@@ -2037,7 +2037,7 @@ static void hb_cdxSortFree( LPSORTINFO pSort )
|
||||
{
|
||||
for( usCount = 0; usCount < pSort->ChunkLimit; usCount++ )
|
||||
{
|
||||
if( pSort->ChunkList[ usCount ] != NULL )
|
||||
if( pSort->ChunkList[ usCount ] != 0 )
|
||||
hb_xfree( ( BYTE * ) pSort->ChunkList[ usCount ] );
|
||||
}
|
||||
hb_xfree( pSort->ChunkList );
|
||||
@@ -2108,7 +2108,7 @@ static void hb_cdxSortInsertWord( LPSORTINFO pSort, LONG Tag, char * Value )
|
||||
}
|
||||
while( v >= 0 && pSort->WPch[ v ] == ' ' )
|
||||
{
|
||||
pSort->WPch[ v ] = NULL;
|
||||
pSort->WPch[ v ] = 0;
|
||||
v--;
|
||||
}
|
||||
v++;
|
||||
@@ -2118,7 +2118,7 @@ static void hb_cdxSortInsertWord( LPSORTINFO pSort, LONG Tag, char * Value )
|
||||
s[ 0 ] = ( char ) strlen( s + 1 );
|
||||
memcpy( &pSort->WPch[ v ], s, s[ 0 ] + 1 );
|
||||
v += ( SHORT ) ( s[ 0 ] + 1 );
|
||||
pSort->WPch[ v ] = NULL;
|
||||
pSort->WPch[ v ] = 0;
|
||||
}
|
||||
pSort->LevelPtr = pSort->RootLink;
|
||||
pSort->PriorPtr = 0;
|
||||
@@ -2135,7 +2135,7 @@ static void hb_cdxSortInsertWord( LPSORTINFO pSort, LONG Tag, char * Value )
|
||||
EOK++;
|
||||
memcpy( &pSort->WPch[ EOK ], s, s[ 0 ] + 1 );
|
||||
v = EOK + s[ 0 ] + 1;
|
||||
pSort->WPch[ v ] = NULL;
|
||||
pSort->WPch[ v ] = 0;
|
||||
do
|
||||
hb_cdxSortStuffKey( pSort, &wx );
|
||||
while( pSort->WPch[ pSort->WCur ] != 0 );
|
||||
@@ -2204,7 +2204,7 @@ static void hb_cdxSortGetNode( LPSORTINFO pSort, char Character, LONG * NewLink
|
||||
px = hb_cdxSortLinkGet( pSort, p );
|
||||
px->sortu.A.Character = px->sortu.B.ChrStack[ 0 ];
|
||||
memmove( &px->sortu.B.ChrStack[ 0 ], &px->sortu.B.ChrStack[ 1 ], 3 );
|
||||
px->sortu.B.ChrStack[ 3 ] = NULL;
|
||||
px->sortu.B.ChrStack[ 3 ] = 0;
|
||||
if( px->sortu.C.ChrFill != 0 )
|
||||
px->sortu.A.NUse = SORT_STACK_OF_CHAR;
|
||||
else
|
||||
@@ -2237,7 +2237,7 @@ static void hb_cdxSortGetNode( LPSORTINFO pSort, char Character, LONG * NewLink
|
||||
px = hb_cdxSortLinkGet( pSort, p );
|
||||
px->sortu.A.Character = px->sortu.B.ChrStack[ 0 ];
|
||||
memmove( &px->sortu.B.ChrStack[ 0 ], &px->sortu.B.ChrStack[ 1 ], 3 );
|
||||
px->sortu.B.ChrStack[ 3 ] = NULL;
|
||||
px->sortu.B.ChrStack[ 3 ] = 0;
|
||||
if( px->sortu.C.ChrFill != 0 )
|
||||
px->sortu.A.NUse = SORT_STACK_OF_CHAR;
|
||||
else
|
||||
@@ -2296,7 +2296,7 @@ static LPSORTDATA hb_cdxSortLinkGet( LPSORTINFO pSort, LONG Value )
|
||||
|
||||
static void hb_cdxSortDisplayWord( LPSORTINFO pSort )
|
||||
{
|
||||
pSort->WPch[ 0 ] = NULL;
|
||||
pSort->WPch[ 0 ] = 0;
|
||||
hb_cdxSortRecurseDict( pSort, pSort->RootLink, 0 );
|
||||
}
|
||||
|
||||
@@ -2311,12 +2311,12 @@ static void hb_cdxSortRecurseDict( LPSORTINFO pSort, LONG WPtr, LONG WBgn )
|
||||
if( pSort->WAdr->sortu.A.Character != 0 )
|
||||
{
|
||||
pSort->WPch[ WCnt ] = pSort->WAdr->sortu.A.Character;
|
||||
pSort->WPch[ WCnt + 1 ] = NULL;
|
||||
pSort->WPch[ WCnt + 1 ] = 0;
|
||||
}
|
||||
if( pSort->WAdr->sortu.A.NUse == SORT_STACK_OF_CHAR )
|
||||
{
|
||||
memcpy( &pSort->WPch[ strlen( pSort->WPch ) ], pSort->WAdr->sortu.B.ChrStack, 4 );
|
||||
pSort->WPch[ WCnt + 5 ] = NULL;
|
||||
pSort->WPch[ WCnt + 5 ] = 0;
|
||||
}
|
||||
if( pSort->WAdr->sortu.A.NUse == SORT_END_OF_WORD )
|
||||
hb_cdxSortSendWord( pSort, pSort->WPch );
|
||||
@@ -2326,7 +2326,7 @@ static void hb_cdxSortRecurseDict( LPSORTINFO pSort, LONG WPtr, LONG WBgn )
|
||||
hb_cdxSortRecurseDict( pSort, pSort->WAdr->sortu.A.WordArray, WBgn );
|
||||
pSort->WAdr = hb_cdxSortLinkGet( pSort, WPtr );
|
||||
}
|
||||
pSort->WPch[ WCnt ] = NULL;
|
||||
pSort->WPch[ WCnt ] = 0;
|
||||
if( pSort->WAdr->sortu.A.LevelLink != 0 && pSort->WAdr->sortu.A.NUse != SORT_STACK_OF_CHAR )
|
||||
hb_cdxSortRecurseDict( pSort, pSort->WAdr->sortu.A.LevelLink, WCnt );
|
||||
}
|
||||
@@ -2342,7 +2342,7 @@ static void hb_cdxSortSendWord( LPSORTINFO pSort, char * Value )
|
||||
pce--;
|
||||
Tag = atol( pce + 1 );
|
||||
OldByte = pce[ 0 ];
|
||||
pce[ 0 ] = NULL;
|
||||
pce[ 0 ] = 0;
|
||||
hb_cdxSortOutputWord( pSort, Tag, Value );
|
||||
pce[ 0 ] = OldByte;
|
||||
}
|
||||
@@ -2996,7 +2996,7 @@ static ERRCODE cdxOrderCreate( AREAP pArea, LPDBORDERCREATEINFO pOrderInfo )
|
||||
uiCount = strlen( szTagName );
|
||||
while( uiCount > 0 && szTagName[ uiCount - 1 ] == ' ' )
|
||||
uiCount--;
|
||||
szTagName[ uiCount ] = NULL;
|
||||
szTagName[ uiCount ] = 0;
|
||||
hb_cdxIndexAddTag( pIndex, szTagName, pOrderInfo->abExpr->item.asString.value,
|
||||
pKeyExp, bType, uiLen, ( char * ) ( pArea->lpdbOrdCondInfo ? pArea->lpdbOrdCondInfo->abFor :
|
||||
NULL ), pForExp, pArea->lpdbOrdCondInfo ?
|
||||
|
||||
@@ -236,6 +236,11 @@ void hb_gt_Puts( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE * pbyStr, ULONG u
|
||||
HB_SYMBOL_UNUSED( ulLen );
|
||||
}
|
||||
|
||||
int hb_gt_RectSize( USHORT rows, USHORT cols )
|
||||
{
|
||||
return rows * cols * 2;
|
||||
}
|
||||
|
||||
void hb_gt_GetText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyDst )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetText(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, pbyDst));
|
||||
|
||||
@@ -716,7 +716,7 @@ USHORT hb_gtRectSize( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRig
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gtRectSize(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, uipBuffSize));
|
||||
|
||||
*uipBuffSize = ( uiBottom - uiTop + 1 ) * ( uiRight - uiLeft + 1 ) * 2;
|
||||
*uipBuffSize = hb_gt_RectSize( uiBottom - uiTop + 1, uiRight - uiLeft + 1 );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
*/
|
||||
|
||||
#include <curses.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "hbapigt.h"
|
||||
#include "hbinit.h"
|
||||
@@ -62,14 +63,11 @@ struct key_map_struc
|
||||
|
||||
static struct key_map_struc *s_keymap_table = NULL;
|
||||
static unsigned s_attribmap_table[ 256 ]; /* mapping from DOS style attributes */
|
||||
static BOOL s_under_buggy_xterm;
|
||||
static int s_alternate_char_set;
|
||||
|
||||
void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr )
|
||||
static void hb_gt_Initialize_Terminal( void )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Init()"));
|
||||
|
||||
s_uiDispCount = 0;
|
||||
|
||||
initscr();
|
||||
if( has_colors() )
|
||||
{
|
||||
int i;
|
||||
@@ -99,7 +97,7 @@ void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr )
|
||||
start_color();
|
||||
for( backg=0; backg<COLORS; backg++ )
|
||||
for( foreg=0; foreg<COLORS; foreg++ )
|
||||
init_pair( backg*COLORS+foreg, color_map[foreg], color_map[backg] );
|
||||
init_pair( backg*COLORS+foreg, color_map[foreg], color_map[backg] );
|
||||
|
||||
for( i=0; i<256; i++ )
|
||||
{
|
||||
@@ -113,6 +111,49 @@ void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr )
|
||||
}
|
||||
}
|
||||
|
||||
cbreak();
|
||||
noecho();
|
||||
nodelay( stdscr, 1 );
|
||||
scrollok( stdscr, TRUE );
|
||||
raw();
|
||||
keypad( stdscr, FALSE );
|
||||
|
||||
s_under_buggy_xterm = !strncmp( getenv("TERM"), "xterm", 5 );
|
||||
/* NOTE: using A_ALTCHARSET attribute is causing that small letters
|
||||
a-z are not printed under xterm (at least xterm from Linux
|
||||
RedHat 6.1 distribution)
|
||||
*/
|
||||
if( s_under_buggy_xterm )
|
||||
{
|
||||
char * str;
|
||||
|
||||
str = tigetstr( "enacs" ); /* enable alt character set */
|
||||
if( (str != NULL) && (str != (char *)-1) )
|
||||
write( fileno(stdout), str, strlen(str) );
|
||||
|
||||
str = tigetstr( "smacs" ); /* start alt characters set */
|
||||
if( (str != NULL) && (str != (char *)-1) )
|
||||
write( fileno(stdout), str, strlen(str) );
|
||||
|
||||
s_alternate_char_set = 0;
|
||||
}
|
||||
else
|
||||
s_alternate_char_set = A_ALTCHARSET;
|
||||
|
||||
bkgdset( ' ' );
|
||||
ripoffline( 0, NULL );
|
||||
|
||||
}
|
||||
|
||||
void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Init()"));
|
||||
|
||||
s_uiDispCount = 0;
|
||||
|
||||
initscr();
|
||||
hb_gt_Initialize_Terminal();
|
||||
|
||||
hb_gt_Add_terminfo_keymap( K_ENTER, "kent" );
|
||||
hb_gt_Add_terminfo_keymap( K_ENTER, "ind" );
|
||||
hb_gt_Add_terminfo_keymap( K_TAB, "ht" );
|
||||
@@ -224,11 +265,6 @@ void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr )
|
||||
hb_gt_Add_keymap( K_ALT_ENTER, "\033\n" );
|
||||
hb_gt_Add_keymap( K_ALT_EQUALS, "\033=" );
|
||||
|
||||
cbreak();
|
||||
noecho();
|
||||
nodelay( stdscr, 1 );
|
||||
raw();
|
||||
keypad( stdscr, FALSE );
|
||||
}
|
||||
|
||||
void hb_gt_Exit( void )
|
||||
@@ -246,7 +282,7 @@ void hb_gt_Exit( void )
|
||||
{
|
||||
s_keymap_table = s_keymap_table->Next;
|
||||
hb_xfree( tmp );
|
||||
tmp = s_keymap_table;
|
||||
tmp = s_keymap_table;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -278,7 +314,7 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask )
|
||||
if( ch == 3 )
|
||||
{
|
||||
/* Ctrl-C was pressed */
|
||||
ch = HB_BREAK_FLAG;
|
||||
ch = HB_BREAK_FLAG;
|
||||
}
|
||||
else if( s_keymap_table )
|
||||
{
|
||||
@@ -453,27 +489,43 @@ void hb_gt_Puts( USHORT uiRow,
|
||||
ULONG ulLen )
|
||||
{
|
||||
ULONG i;
|
||||
int attr;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Puts(%hu, %hu, %d, %p, %lu)", uiRow, uiCol, (int) byAttr, pbyStr, ulLen));
|
||||
|
||||
attr = s_alternate_char_set | s_attribmap_table[ byAttr ];
|
||||
move( uiRow, uiCol );
|
||||
attron( s_attribmap_table[ byAttr ] );
|
||||
for( i = 0; i < ulLen; ++i )
|
||||
addch( pbyStr[ i ] );
|
||||
attroff( s_attribmap_table[ byAttr ] );
|
||||
addch( pbyStr[ i ] | attr );
|
||||
if( s_uiDispCount == 0 )
|
||||
refresh();
|
||||
}
|
||||
|
||||
int hb_gt_RectSize( USHORT rows, USHORT cols )
|
||||
{
|
||||
return rows * cols * sizeof( chtype );
|
||||
}
|
||||
|
||||
void hb_gt_GetText( USHORT uiTop,
|
||||
USHORT uiLeft,
|
||||
USHORT uiBottom,
|
||||
USHORT uiRight,
|
||||
BYTE * pbyDst )
|
||||
{
|
||||
int i;
|
||||
chtype *pBuffer = (chtype *)pbyDst;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetText(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, pbyDst));
|
||||
|
||||
/* TODO */
|
||||
if( s_uiDispCount == 0 )
|
||||
refresh();
|
||||
|
||||
while( uiTop <= uiBottom )
|
||||
{
|
||||
for( i=uiLeft; i<=uiRight; i++, pBuffer++ )
|
||||
*pBuffer = mvinch( uiTop, i );
|
||||
++uiTop;
|
||||
}
|
||||
}
|
||||
|
||||
void hb_gt_PutText( USHORT uiTop,
|
||||
@@ -482,9 +534,20 @@ void hb_gt_PutText( USHORT uiTop,
|
||||
USHORT uiRight,
|
||||
BYTE * pbySrc )
|
||||
{
|
||||
int Cols;
|
||||
chtype *pBuffer = (chtype *)pbySrc;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_PutText(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, pbySrc));
|
||||
|
||||
/* TODO */
|
||||
Cols = uiRight - uiLeft + 1;
|
||||
while( uiTop <= uiBottom )
|
||||
{
|
||||
mvaddchnstr( uiTop, uiLeft, pBuffer, Cols );
|
||||
pBuffer +=Cols;
|
||||
++uiTop;
|
||||
}
|
||||
if( s_uiDispCount == 0 )
|
||||
refresh();
|
||||
}
|
||||
|
||||
void hb_gt_SetAttribute( USHORT uiTop,
|
||||
@@ -493,12 +556,18 @@ void hb_gt_SetAttribute( USHORT uiTop,
|
||||
USHORT uiRight,
|
||||
BYTE byAttr )
|
||||
{
|
||||
int Count = uiRight - uiLeft + 1;
|
||||
int newAttr = s_attribmap_table[ byAttr ];
|
||||
short newColor;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetAttribute(%hu, %hu, %hu, %hu, %d)", uiTop, uiLeft, uiBottom, uiRight, (int) byAttr));
|
||||
|
||||
/* TODO: we want to take a screen that is say bright white on blue,
|
||||
and change the attributes only for a section of the screen
|
||||
to white on black.
|
||||
*/
|
||||
newColor = PAIR_NUMBER( newAttr );
|
||||
newAttr &= A_ATTRIBUTES; /* extract attributes only */
|
||||
while( uiTop <= uiBottom )
|
||||
mvchgat( uiTop++, uiLeft, Count, newAttr, newColor, NULL );
|
||||
if( s_uiDispCount == 0 )
|
||||
refresh();
|
||||
}
|
||||
|
||||
void hb_gt_Scroll( USHORT uiTop,
|
||||
@@ -509,17 +578,83 @@ void hb_gt_Scroll( USHORT uiTop,
|
||||
SHORT iRows,
|
||||
SHORT iCols )
|
||||
{
|
||||
WINDOW *subw;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_Scroll(%hu, %hu, %hu, %hu, %d, %hd, %hd)", uiTop, uiLeft, uiBottom, uiRight, (int) byAttr, iRows, iCols));
|
||||
|
||||
/* TODO: scrolling left-right */
|
||||
subw = subwin( stdscr, uiBottom-uiTop+1, uiRight-uiLeft+1, uiTop, uiLeft );
|
||||
scrollok( subw, TRUE );
|
||||
wscrl( subw, iRows );
|
||||
if( s_uiDispCount == 0 )
|
||||
if( iRows == 0 && iCols == 0 )
|
||||
{
|
||||
/* Clear the specified rectangle */
|
||||
WINDOW *subw;
|
||||
|
||||
subw = subwin( stdscr, uiBottom-uiTop+1, uiRight-uiLeft+1, uiTop, uiLeft );
|
||||
wbkgdset( subw, ' ' | s_attribmap_table[ byAttr ] );
|
||||
wclear( subw );
|
||||
touchwin( stdscr );
|
||||
delwin( subw );
|
||||
wrefresh( subw );
|
||||
delwin( subw );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( iRows != 0 )
|
||||
{
|
||||
WINDOW *subw;
|
||||
|
||||
subw = subwin( stdscr, uiBottom-uiTop+1, uiRight-uiLeft+1, uiTop, uiLeft );
|
||||
wbkgdset( subw, ' ' | s_attribmap_table[ byAttr ] );
|
||||
scrollok( subw, TRUE );
|
||||
wscrl( subw, iRows );
|
||||
delwin( subw );
|
||||
}
|
||||
|
||||
if( iCols != 0 )
|
||||
{
|
||||
chtype *pScreen, *pTmp;
|
||||
int memsize;
|
||||
int RowCount, ColCount;
|
||||
int i, j;
|
||||
int newAttr;
|
||||
|
||||
refresh();
|
||||
|
||||
RowCount = uiBottom - uiTop + 1;
|
||||
ColCount = uiRight - uiLeft + 1;
|
||||
newAttr = ' ' | s_attribmap_table[ byAttr ];
|
||||
|
||||
memsize = hb_gt_RectSize( RowCount, ColCount );
|
||||
pScreen = (chtype *) hb_xgrab( memsize );
|
||||
hb_gt_GetText( uiTop, uiLeft, uiBottom, uiRight, (BYTE *)pScreen );
|
||||
|
||||
if( iCols > 0 )
|
||||
{
|
||||
pTmp = pScreen;
|
||||
for( i=0; i<RowCount; i++ )
|
||||
{
|
||||
for( j=ColCount - 1; j>=iCols; j-- )
|
||||
pTmp[ j ] = pTmp[ j-1 ];
|
||||
for( j=0; j<iCols; j++ )
|
||||
pTmp[ j ] = newAttr;
|
||||
pTmp += ColCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int ColMove = ColCount + iCols;
|
||||
|
||||
pTmp = pScreen;
|
||||
for( i=0; i<RowCount; i++ )
|
||||
{
|
||||
for( j=0; j<ColMove; j++ )
|
||||
pTmp[ j ] = pTmp[ j-iCols ];
|
||||
for( j=ColMove; j<ColCount; j++ )
|
||||
pTmp[ j ] = newAttr;
|
||||
pTmp += ColCount;
|
||||
}
|
||||
}
|
||||
hb_gt_PutText( uiTop, uiLeft, uiBottom, uiRight, (BYTE *)pScreen );
|
||||
hb_xfree( (BYTE *)pScreen );
|
||||
}
|
||||
}
|
||||
if( s_uiDispCount == 0 )
|
||||
refresh();
|
||||
}
|
||||
|
||||
void hb_gt_DispBegin( void )
|
||||
@@ -539,10 +674,19 @@ void hb_gt_DispEnd()
|
||||
|
||||
BOOL hb_gt_SetMode( USHORT uiRows, USHORT uiCols )
|
||||
{
|
||||
BOOL success;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetMode(%hu, %hu)", uiRows, uiCols));
|
||||
|
||||
/* TODO: How to change the size of the screen? */
|
||||
return TRUE;
|
||||
/* NOTE: Not tested!!!
|
||||
Use it on your own risk!
|
||||
*/
|
||||
endwin();
|
||||
success = ( ( resizeterm( uiRows, uiCols) == OK) ? TRUE : FALSE );
|
||||
initscr();
|
||||
hb_gt_Initialize_Terminal();
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void hb_gt_Replicate( BYTE byChar, ULONG ulLen )
|
||||
@@ -586,6 +730,7 @@ void hb_gt_Tone( double dFrequency, double dDuration )
|
||||
|
||||
HB_SYMBOL_UNUSED( dFrequency );
|
||||
HB_SYMBOL_UNUSED( dDuration );
|
||||
beep();
|
||||
}
|
||||
|
||||
static void gt_GetMaxRC(int* r, int* c)
|
||||
@@ -613,7 +758,7 @@ static void gt_SetRC(int r, int c)
|
||||
|
||||
char * hb_gt_Version( void )
|
||||
{
|
||||
return "Harbour Terminal: Curses";
|
||||
return "Harbour Terminal: ncurses (Linux console)";
|
||||
}
|
||||
|
||||
USHORT hb_gt_DispCount()
|
||||
|
||||
@@ -681,6 +681,11 @@ void hb_gt_Puts( USHORT cRow, USHORT cCol, BYTE attr, BYTE *str, ULONG len )
|
||||
#endif
|
||||
}
|
||||
|
||||
int hb_gt_RectSize( USHORT rows, USHORT cols )
|
||||
{
|
||||
return rows * cols * 2;
|
||||
}
|
||||
|
||||
void hb_gt_GetText( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE * dest )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetText(%hu, %hu, %hu, %hu, %p", usTop, usLeft, usBottom, usRight, dest));
|
||||
|
||||
@@ -626,6 +626,11 @@ void hb_gt_Puts( USHORT usRow, USHORT usCol, BYTE attr, BYTE * str, ULONG len )
|
||||
}
|
||||
}
|
||||
|
||||
int hb_gt_RectSize( USHORT rows, USHORT cols )
|
||||
{
|
||||
return rows * cols * 2;
|
||||
}
|
||||
|
||||
void hb_gt_GetText( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE *dest )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetText(%hu, %hu, %hu, %hu, %p)", usTop, usLeft, usBottom, usRigth, dest));
|
||||
|
||||
@@ -317,6 +317,11 @@ void hb_gt_Puts( USHORT usRow, USHORT usCol, BYTE attr, BYTE * str, ULONG len )
|
||||
if( s_usCol > s_usMaxCol ) s_usCol = s_usMaxCol;
|
||||
}
|
||||
|
||||
int hb_gt_RectSize( USHORT rows, USHORT cols )
|
||||
{
|
||||
return rows * cols * 2;
|
||||
}
|
||||
|
||||
void hb_gt_GetText( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE *dest )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetText(%hu, %hu, %hu, %hu, %p)", usTop, usLeft, usBottom, usRight, dest));
|
||||
|
||||
@@ -236,6 +236,11 @@ void hb_gt_Puts( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE * pbyStr, ULONG u
|
||||
SLsmg_write_nchars(pbyStr, ulLen);
|
||||
}
|
||||
|
||||
int hb_gt_RectSize( USHORT rows, USHORT cols )
|
||||
{
|
||||
return rows * cols * 2;
|
||||
}
|
||||
|
||||
void hb_gt_GetText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyDst )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetText(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, pbyDst));
|
||||
|
||||
@@ -243,6 +243,11 @@ void hb_gt_Puts( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE * pbyStr, ULONG u
|
||||
HB_SYMBOL_UNUSED( ulLen );
|
||||
}
|
||||
|
||||
int hb_gt_RectSize( USHORT rows, USHORT cols )
|
||||
{
|
||||
return rows * cols * 2;
|
||||
}
|
||||
|
||||
void hb_gt_GetText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyDst )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_gt_GetText(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, pbyDst));
|
||||
|
||||
@@ -812,6 +812,11 @@ void hb_gt_Puts( USHORT uiRow, USHORT uiCol, BYTE attr, BYTE * str, ULONG len )
|
||||
WriteConsoleOutputCharacterA( s_HOutput, ( char * ) str, ( DWORD ) len, coord, &dwWritten );
|
||||
}
|
||||
|
||||
int hb_gt_RectSize( USHORT rows, USHORT cols )
|
||||
{
|
||||
return rows * cols * 2;
|
||||
}
|
||||
|
||||
void hb_gt_GetText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * dest )
|
||||
{
|
||||
LPWORD pwattr;
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
Copyright 1999 David G. Holm <dholm@jsd-llc.com>
|
||||
See doc/hdr_tpl.txt, Version 1.2 or later, for licensing terms.
|
||||
*/
|
||||
#include "box.ch"
|
||||
|
||||
function main()
|
||||
local ct
|
||||
|
||||
DEVPOS(MAXROW(),0)
|
||||
DispBegin()
|
||||
@@ -22,7 +24,10 @@ function main()
|
||||
?
|
||||
DispEnd()
|
||||
Pause()
|
||||
|
||||
SET COLOR TO "GR+/RB"
|
||||
CLS
|
||||
@ 0,0,14,45 BOX B_SINGLE
|
||||
@ 0,0 SAY "01234567890123456789012345678901"
|
||||
@ 1,0 SAY "01234567890123456789012345678901"
|
||||
@ 2,0 SAY "01234567890123456789012345678901"
|
||||
@@ -36,7 +41,14 @@ function main()
|
||||
@ 10,0 SAY "01234567890123456789012345678901"
|
||||
@ 11,0 SAY "01234567890123456789012345678901"
|
||||
@ 12,0 SAY "01234567890123456789012345678901"
|
||||
@ 13,0 SAY "0 1 2 3 "
|
||||
Pause()
|
||||
|
||||
//save/restore test
|
||||
cT := SAVESCREEN( 0,0, 13, 31 )
|
||||
RESTSCREEN( 10,40, 23, 71, cT )
|
||||
pause()
|
||||
|
||||
Scroll (1, 1, 11, 30, -2, -5)
|
||||
pause()
|
||||
Scroll (1, 1, 11, 30, 2, 5)
|
||||
@@ -45,7 +57,8 @@ function main()
|
||||
pause()
|
||||
Scroll (1, 1, 11, 30, 7, -12)
|
||||
pause()
|
||||
Scroll (1, 1, 11, 30)
|
||||
SET COLOR TO "W+/R"
|
||||
Scroll (1, 1, 11, 30, 0, 0 )
|
||||
pause()
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user