*** empty log message ***
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
19990915-23:35 EDT Paul Tucker <ptucker@sympatico.ca>
|
||||
* source/rtl/gt/gtos2.c
|
||||
source/rtl/gt/gtwin.c
|
||||
source/rtl/gt/gtdos.c
|
||||
include/gtapi.h
|
||||
* converted a number of parameters to USHORT, SHORT or BYTE
|
||||
|
||||
19990916-05:30 GMT+1 Victor Szel <info@szelvesz.hu>
|
||||
|
||||
* source/compiler/harbour.y
|
||||
|
||||
@@ -85,19 +85,19 @@ extern int hb_gtWriteCon( char * fpStr, ULONG length );
|
||||
extern void hb_gt_Init( void );
|
||||
extern int hb_gt_IsColor( void );
|
||||
extern void hb_gt_Done( void );
|
||||
extern char hb_gt_GetScreenWidth( void );
|
||||
extern char hb_gt_GetScreenHeight( void );
|
||||
extern void hb_gt_SetPos( char cRow, char cCol );
|
||||
extern char hb_gt_Col( void );
|
||||
extern char hb_gt_Row( void );
|
||||
extern void hb_gt_Scroll( char cTop, char cLeft, char cBottom, char cRight, char attribute, char vert, char horiz );
|
||||
extern USHORT hb_gt_GetScreenWidth( void );
|
||||
extern USHORT hb_gt_GetScreenHeight( void );
|
||||
extern void hb_gt_SetPos( USHORT cRow, USHORT cCol );
|
||||
extern USHORT hb_gt_Col( void );
|
||||
extern USHORT hb_gt_Row( void );
|
||||
extern void hb_gt_Scroll( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr, SHORT vert, SHORT horiz );
|
||||
extern void hb_gt_SetCursorStyle( int style );
|
||||
extern int hb_gt_GetCursorStyle( void );
|
||||
extern void hb_gt_Puts( char cRow, char cCol, char attr, char *str, int len );
|
||||
extern void hb_gt_GetText( char cTop, char cLeft, char cBottom, char cRight, char *dest );
|
||||
extern void hb_gt_PutText( char cTop, char cLeft, char cBottom, char cRight, char *srce );
|
||||
extern void hb_gt_SetAttribute( char cTop, char cLeft, char cBottom, char cRight, char attribute );
|
||||
extern void hb_gt_DrawShadow( char cTop, char cLeft, char cBottom, char cRight, char attribute );
|
||||
extern void hb_gt_Puts( USHORT cRow, USHORT cCol, BYTE attr, char *str, int len );
|
||||
extern void hb_gt_GetText( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, char *dest );
|
||||
extern void hb_gt_PutText( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, char *srce );
|
||||
extern void hb_gt_SetAttribute( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr );
|
||||
extern void hb_gt_DrawShadow( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr );
|
||||
extern void hb_gt_DispBegin( void );
|
||||
extern void hb_gt_DispEnd( void );
|
||||
extern BOOL hb_gt_SetMode( USHORT uiRows, USHORT uiCols );
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static void hb_gt_xGetXY(char cRow, char cCol, char *attr, char *ch);
|
||||
static void hb_gt_xPutch(char cRow, char cCol, char attr, char ch);
|
||||
static void hb_gt_xGetXY(USHORT cRow, USHORT cCol, BYTE *attr, char *ch);
|
||||
static void hb_gt_xPutch(USHORT cRow, USHORT cCol, BYTE attr, char ch);
|
||||
|
||||
static char hb_gt_GetScreenMode(void);
|
||||
static void hb_gt_SetCursorSize(char start, char end);
|
||||
@@ -99,7 +99,7 @@ static char FAR *hb_gt_ScreenAddress()
|
||||
#endif
|
||||
|
||||
#ifndef __DJGPP__
|
||||
char FAR *hb_gt_ScreenPtr(char cRow, char cCol)
|
||||
char FAR *hb_gt_ScreenPtr(USHORT cRow, USHORT cCol)
|
||||
{
|
||||
return scrnPtr + (cRow * hb_gt_GetScreenWidth() * 2) + (cCol * 2);
|
||||
}
|
||||
@@ -116,31 +116,36 @@ static char hb_gt_GetScreenMode(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
char hb_gt_GetScreenWidth(void)
|
||||
USHORT hb_gt_GetScreenWidth(void)
|
||||
{
|
||||
#if defined(__WATCOMC__) && defined(__386__)
|
||||
return *((char *)0x044a);
|
||||
return (USHORT)*((char *)0x044a);
|
||||
#elif defined(__DJGPP__)
|
||||
return _farpeekb( 0x0040, 0x004a );
|
||||
return (USHORT)_farpeekb( 0x0040, 0x004a );
|
||||
#else
|
||||
return *((char FAR *)MK_FP(0x0040, 0x004a));
|
||||
return (USHORT)*((char FAR *)MK_FP(0x0040, 0x004a));
|
||||
#endif
|
||||
}
|
||||
|
||||
char hb_gt_GetScreenHeight(void)
|
||||
USHORT hb_gt_GetScreenHeight(void)
|
||||
{
|
||||
#if defined(__WATCOMC__) && defined(__386__)
|
||||
return (char)(*((char *)0x0484) + 1);
|
||||
return (USHORT)(char)(*((char *)0x0484) + 1);
|
||||
#elif defined(__DJGPP__)
|
||||
return _farpeekb( 0x0040, 0x0084 ) + 1;
|
||||
return (USHORT)_farpeekb( 0x0040, 0x0084 ) + 1;
|
||||
#else
|
||||
return (char)(*((char FAR *)MK_FP(0x0040, 0x0084)) + 1);
|
||||
return (USHORT)((char)(*((char FAR *)MK_FP(0x0040, 0x0084)) + 1));
|
||||
#endif
|
||||
}
|
||||
|
||||
void hb_gt_SetPos(char cRow, char cCol)
|
||||
void hb_gt_SetPos(USHORT usRow, USHORT usCol)
|
||||
{
|
||||
#if defined(__TURBOC__)
|
||||
BYTE cRow, cCol;
|
||||
|
||||
cRow = (BYTE)usRow;
|
||||
cCol = (BYTE)usCol;
|
||||
|
||||
_AH = 0x02;
|
||||
_BH = 0;
|
||||
_DH = cRow;
|
||||
@@ -150,8 +155,8 @@ void hb_gt_SetPos(char cRow, char cCol)
|
||||
union REGS regs;
|
||||
regs.h.ah = 0x02;
|
||||
regs.h.bh = 0;
|
||||
regs.h.dh = (unsigned char)(cRow);
|
||||
regs.h.dl = (unsigned char)(cCol);
|
||||
regs.h.dh = (BYTE)(usRow);
|
||||
regs.h.dl = (BYTE)(usCol);
|
||||
#if defined(__WATCOMC__) && defined(__386__)
|
||||
int386(0x10, ®s, ®s);
|
||||
#else
|
||||
@@ -266,7 +271,7 @@ void hb_gt_SetCursorStyle(int style)
|
||||
}
|
||||
}
|
||||
|
||||
static void hb_gt_xGetXY(char cRow, char cCol, char *attr, char *ch)
|
||||
static void hb_gt_xGetXY(USHORT cRow, USHORT cCol, BYTE *attr, char *ch)
|
||||
{
|
||||
#ifdef __DJGPP__
|
||||
short ch_attr;
|
||||
@@ -282,7 +287,7 @@ static void hb_gt_xGetXY(char cRow, char cCol, char *attr, char *ch)
|
||||
#endif
|
||||
}
|
||||
|
||||
void hb_gt_xPutch(char cRow, char cCol, char attr, char ch)
|
||||
void hb_gt_xPutch(USHORT cRow, USHORT cCol, BYTE attr, char ch)
|
||||
{
|
||||
#ifdef __DJGPP__
|
||||
long ch_attr = ( ch << 8 ) | attr;
|
||||
@@ -296,7 +301,7 @@ void hb_gt_xPutch(char cRow, char cCol, char attr, char ch)
|
||||
#endif
|
||||
}
|
||||
|
||||
void hb_gt_Puts(char cRow, char cCol, char attr, char *str, int len)
|
||||
void hb_gt_Puts(USHORT cRow, USHORT cCol, BYTE attr, char *str, int len)
|
||||
{
|
||||
#ifdef __DJGPP__
|
||||
int i = len;
|
||||
@@ -343,16 +348,16 @@ void hb_gt_Puts(char cRow, char cCol, char attr, char *str, int len)
|
||||
#endif
|
||||
}
|
||||
|
||||
void hb_gt_GetText(char cTop, char cLeft, char cBottom, char cRight, char *dest)
|
||||
void hb_gt_GetText(USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, char *dest)
|
||||
{
|
||||
#ifdef __DJGPP__
|
||||
gettext( cLeft + 1, cTop + 1, cRight + 1, cBottom + 1, dest );
|
||||
gettext( usLeft + 1, usTop + 1, usRight + 1, usBottom + 1, dest );
|
||||
#else
|
||||
char x, y;
|
||||
USHORT x, y;
|
||||
|
||||
for (y = cTop; y <= cBottom; y++ )
|
||||
for (y = usTop; y <= usBottom; y++ )
|
||||
{
|
||||
for (x = cLeft; x <= cRight; x++)
|
||||
for (x = usLeft; x <= usRight; x++)
|
||||
{
|
||||
hb_gt_xGetXY(y, x, dest + 1, dest);
|
||||
dest += 2;
|
||||
@@ -361,16 +366,16 @@ void hb_gt_GetText(char cTop, char cLeft, char cBottom, char cRight, char *dest)
|
||||
#endif
|
||||
}
|
||||
|
||||
void hb_gt_PutText(char cTop, char cLeft, char cBottom, char cRight, char *srce)
|
||||
void hb_gt_PutText(USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, char *srce)
|
||||
{
|
||||
#ifdef __DJGPP__
|
||||
puttext( cLeft + 1, cTop + 1, cRight + 1, cBottom + 1, srce );
|
||||
puttext( usLeft + 1, usTop + 1, usRight + 1, usBottom + 1, srce );
|
||||
#else
|
||||
char x, y;
|
||||
USHORT x, y;
|
||||
|
||||
for (y = cTop; y <= cBottom; y++)
|
||||
for (y = usTop; y <= usBottom; y++)
|
||||
{
|
||||
for (x = cLeft; x <= cRight; x++)
|
||||
for (x = usLeft; x <= usRight; x++)
|
||||
{
|
||||
hb_gt_xPutch(y, x, *(srce + 1), *srce);
|
||||
srce += 2;
|
||||
@@ -379,43 +384,45 @@ void hb_gt_PutText(char cTop, char cLeft, char cBottom, char cRight, char *srce)
|
||||
#endif
|
||||
}
|
||||
|
||||
void hb_gt_SetAttribute( char cTop, char cLeft, char cBottom, char cRight, char attribute )
|
||||
void hb_gt_SetAttribute( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr )
|
||||
{
|
||||
char x, y;
|
||||
char attr, ch;
|
||||
USHORT x, y;
|
||||
BYTE scratchattr;
|
||||
char ch;
|
||||
|
||||
for (y = cTop; y <= cBottom; y++)
|
||||
for (y = usTop; y <= usBottom; y++)
|
||||
{
|
||||
for (x = cLeft; x <= cRight; x++)
|
||||
for (x = usLeft; x <= usRight; x++)
|
||||
{
|
||||
hb_gt_xGetXY( y, x, &attr, &ch );
|
||||
hb_gt_xPutch( y, x, attribute, ch);
|
||||
hb_gt_xGetXY( y, x, &scratchattr, &ch );
|
||||
hb_gt_xPutch( y, x, attr, ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void hb_gt_DrawShadow( char cTop, char cLeft, char cBottom, char cRight, char attribute )
|
||||
void hb_gt_DrawShadow( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr )
|
||||
{
|
||||
char x, y;
|
||||
char attr, ch;
|
||||
USHORT x, y;
|
||||
BYTE scratchattr;
|
||||
char ch;
|
||||
|
||||
for (y = cTop; y <= cBottom; y++)
|
||||
for (y = usTop; y <= usBottom; y++)
|
||||
{
|
||||
|
||||
hb_gt_xGetXY( y, cRight, &attr, &ch );
|
||||
hb_gt_xPutch( y, cRight, attribute, ch);
|
||||
hb_gt_xGetXY( y, usRight, &scratchattr, &ch );
|
||||
hb_gt_xPutch( y, usRight, attr, ch);
|
||||
|
||||
if( y == cBottom )
|
||||
for (x = cLeft; x <= cRight; x++)
|
||||
if( y == usBottom )
|
||||
for (x = usLeft; x <= usRight; x++)
|
||||
{
|
||||
hb_gt_xGetXY( y, x, &attr, &ch );
|
||||
hb_gt_xPutch( y, x, attribute, ch );
|
||||
hb_gt_xGetXY( y, x, &scratchattr, &ch );
|
||||
hb_gt_xPutch( y, x, attr, ch );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
char hb_gt_Col(void)
|
||||
USHORT hb_gt_Col(void)
|
||||
{
|
||||
#if defined(__TURBOC__)
|
||||
_AH = 0x03;
|
||||
@@ -435,7 +442,7 @@ char hb_gt_Col(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
char hb_gt_Row(void)
|
||||
USHORT hb_gt_Row(void)
|
||||
{
|
||||
#if defined(__TURBOC__)
|
||||
_AH = 0x03;
|
||||
@@ -455,21 +462,18 @@ char hb_gt_Row(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void hb_gt_Scroll( char cTop, char cLeft, char cBottom, char cRight, char attr, char vert, char horiz )
|
||||
void hb_gt_Scroll( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr, SHORT sVert, SHORT sHoriz )
|
||||
{
|
||||
/* Convert the "low-level" parameters back to the same types they
|
||||
had when the following code used to be in gtapi.c */
|
||||
USHORT uiTop = cTop, uiLeft = cLeft, uiBottom = cBottom, uiRight = cRight;
|
||||
int iRows = vert, iCols = horiz;
|
||||
/* End of parameter conversion */
|
||||
int iRows = sVert, iCols = sHoriz;
|
||||
|
||||
USHORT uiRow, uiCol, uiSize;
|
||||
int iLength = ( uiRight - uiLeft ) + 1;
|
||||
USHORT usRow, usCol;
|
||||
int uiSize; /* gtRectSize returns int */
|
||||
int iLength = ( usRight - usLeft ) + 1;
|
||||
int iCount, iColOld, iColNew, iColSize;
|
||||
|
||||
hb_gtGetPos( &uiRow, &uiCol );
|
||||
hb_gtGetPos( &usRow, &usCol );
|
||||
|
||||
if( hb_gtRectSize( uiTop, uiLeft, uiBottom, uiRight, &uiSize ) == 0 )
|
||||
if( hb_gtRectSize( usTop, usLeft, usBottom, usRight, &uiSize ) == 0 )
|
||||
{
|
||||
char * fpBlank = ( char * ) hb_xgrab( iLength );
|
||||
char * fpBuff = ( char * ) hb_xgrab( iLength * 2 );
|
||||
@@ -477,30 +481,30 @@ void hb_gt_Scroll( char cTop, char cLeft, char cBottom, char cRight, char attr,
|
||||
{
|
||||
memset( fpBlank, ' ', iLength );
|
||||
|
||||
iColOld = iColNew = uiLeft;
|
||||
iColOld = iColNew = usLeft;
|
||||
if( iCols >= 0 )
|
||||
{
|
||||
iColOld += iCols;
|
||||
iColSize = uiRight - uiLeft;
|
||||
iColSize = (int) (usRight - usLeft);
|
||||
iColSize -= iCols;
|
||||
}
|
||||
else
|
||||
{
|
||||
iColNew -= iCols;
|
||||
iColSize = uiRight - uiLeft;
|
||||
iColSize = (int) (usRight - usLeft);
|
||||
iColSize += iCols;
|
||||
}
|
||||
|
||||
for( iCount = ( iRows >= 0 ? uiTop : uiBottom );
|
||||
( iRows >= 0 ? iCount <= uiBottom : iCount >= uiTop );
|
||||
for( iCount = ( iRows >= 0 ? usTop : usBottom );
|
||||
( iRows >= 0 ? iCount <= usBottom : iCount >= usTop );
|
||||
( iRows >= 0 ? iCount++ : iCount-- ) )
|
||||
{
|
||||
int iRowPos = iCount + iRows;
|
||||
|
||||
/* Blank the scroll region in the current row */
|
||||
hb_gt_Puts( iCount, uiLeft, attr, fpBlank, iLength );
|
||||
hb_gt_Puts( iCount, usLeft, attr, fpBlank, iLength );
|
||||
|
||||
if( ( iRows || iCols ) && iRowPos <= uiBottom && iRowPos >= uiTop )
|
||||
if( ( iRows || iCols ) && iRowPos <= usBottom && iRowPos >= usTop )
|
||||
{
|
||||
/* Read the text to be scrolled into the current row */
|
||||
hb_gt_GetText( iRowPos, iColOld, iRowPos, iColOld + iColSize, fpBuff );
|
||||
@@ -514,7 +518,7 @@ void hb_gt_Scroll( char cTop, char cLeft, char cBottom, char cRight, char attr,
|
||||
if( fpBuff ) hb_xfree( fpBuff );
|
||||
}
|
||||
|
||||
hb_gtSetPos( uiRow, uiCol );
|
||||
hb_gtSetPos( usRow, usCol );
|
||||
}
|
||||
|
||||
void hb_gt_DispBegin(void)
|
||||
@@ -556,9 +560,9 @@ void hb_gt_DispEnd(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOL hb_gt_SetMode( USHORT uiRows, USHORT uiCols )
|
||||
BOOL hb_gt_SetMode( USHORT usRows, USHORT usCols )
|
||||
{
|
||||
uiRows=uiCols=0;
|
||||
usRows=usCols=0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,12 +60,12 @@ char hb_gt_GetScreenHeight(void)
|
||||
return vi.row;
|
||||
}
|
||||
|
||||
void hb_gt_SetPos(char cRow, char cCol)
|
||||
void hb_gt_SetPos(USHORT nRow, USHORT nCol)
|
||||
{
|
||||
VioSetCurPos((USHORT) cRow, (USHORT) cCol, 0);
|
||||
VioSetCurPos(nRow, nCol, 0);
|
||||
}
|
||||
|
||||
char hb_gt_Row(void)
|
||||
USHORT hb_gt_Row(void)
|
||||
{
|
||||
USHORT x, y;
|
||||
|
||||
@@ -73,7 +73,7 @@ char hb_gt_Row(void)
|
||||
return y;
|
||||
}
|
||||
|
||||
char hb_gt_Col(void)
|
||||
USHORT hb_gt_Col(void)
|
||||
{
|
||||
USHORT x, y;
|
||||
|
||||
@@ -82,17 +82,16 @@ char hb_gt_Col(void)
|
||||
}
|
||||
|
||||
|
||||
void hb_gt_Scroll( char cTop, char cLeft, char cBottom, char cRight, char attribute, char cRows, char cCols )
|
||||
void hb_gt_Scroll( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr, SHORT sVert, SHORT sHoriz )
|
||||
{
|
||||
/* Chen Kedem <niki@actcom.co.il> */
|
||||
|
||||
USHORT usTop = cTop, usLeft = cLeft, usBottom = cBottom, usRight = cRight;
|
||||
SHORT sVert = cRows, sHoriz = cCols;
|
||||
BYTE bCell[ 2 ]; /* character/attribute pair */
|
||||
|
||||
if( sVert > 128 ) sVert = sVert - 256;
|
||||
if( sHoriz > 128 ) sHoriz = sHoriz - 256;
|
||||
bCell [ 0 ] = ' ';
|
||||
bCell [ 1 ] = (BYTE)attribute;
|
||||
bCell [ 1 ] = attr;
|
||||
if ( (sVert | sHoriz) == 0 ) /* both zero, clear region */
|
||||
VioScrollUp ( usTop, usLeft, usBottom, usRight, 0xFFFF, bCell, 0 );
|
||||
else
|
||||
@@ -228,65 +227,60 @@ void hb_gt_SetCursorStyle(int style)
|
||||
}
|
||||
}
|
||||
|
||||
void hb_gt_Puts(char cRow, char cCol, char attr, char *str, int len)
|
||||
void hb_gt_Puts(USHORT usRow, USHORT usCol, BYTE attr, char *str, int len)
|
||||
{
|
||||
VioWrtCharStrAtt(str, (USHORT) len, (USHORT) cRow, (USHORT) cCol, (BYTE *) &attr, 0);
|
||||
VioWrtCharStrAtt(str, (USHORT) len, usRow, usCol, (BYTE *) &attr, 0);
|
||||
}
|
||||
|
||||
void hb_gt_GetText(char cTop, char cLeft, char cBottom, char cRight, char *dest)
|
||||
void hb_gt_GetText(USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, char *dest)
|
||||
{
|
||||
USHORT width;
|
||||
char y;
|
||||
USHORT width, y;
|
||||
|
||||
width = (USHORT) ((cRight - cLeft + 1) * 2);
|
||||
for (y = cTop; y <= cBottom; y++)
|
||||
width = (USHORT) ((usRight - usLeft + 1) * 2);
|
||||
for (y = usTop; y <= usBottom; y++)
|
||||
{
|
||||
VioReadCellStr((BYTE *) dest, &width, (USHORT) y, (USHORT) cLeft, 0);
|
||||
VioReadCellStr((BYTE *) dest, &width, y, usLeft, 0);
|
||||
dest += width;
|
||||
}
|
||||
}
|
||||
|
||||
void hb_gt_PutText(char cTop, char cLeft, char cBottom, char cRight, char *srce)
|
||||
void hb_gt_PutText(USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, char *srce)
|
||||
{
|
||||
USHORT width;
|
||||
char y;
|
||||
USHORT width, y;
|
||||
|
||||
width = (USHORT) ((cRight - cLeft + 1) * 2);
|
||||
for (y = cTop; y <= cBottom; y++)
|
||||
width = (USHORT) ((usRight - usLeft + 1) * 2);
|
||||
for (y = usTop; y <= usBottom; y++)
|
||||
{
|
||||
VioWrtCellStr((BYTE *) srce, width, (USHORT) y, (USHORT) cLeft, 0);
|
||||
VioWrtCellStr((BYTE *) srce, width, y, usLeft, 0);
|
||||
srce += width;
|
||||
}
|
||||
}
|
||||
|
||||
void hb_gt_SetAttribute( char cTop, char cLeft, char cBottom, char cRight, char attribute )
|
||||
void hb_gt_SetAttribute( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr )
|
||||
{
|
||||
/* Chen Kedem <niki@actcom.co.il> */
|
||||
/*
|
||||
TODO: work with DispBegin DispEnd
|
||||
NOTE: type of attribute should be change from char to unsigned char to
|
||||
allow the >127 attributes (sames goes for hb_gt_DrawShadow)
|
||||
*/
|
||||
|
||||
USHORT width;
|
||||
char y;
|
||||
USHORT width, y
|
||||
|
||||
/*
|
||||
assume top level check that coordinate are all valid and fall
|
||||
within visible screen, else if width cannot be fit on current line
|
||||
it is going to warp to the next line
|
||||
*/
|
||||
width = (USHORT) (cRight - cLeft + 1);
|
||||
for (y = cTop; y <= cBottom; y++)
|
||||
VioWrtNAttr( &attribute, width, y, (USHORT) cLeft, 0);
|
||||
width = (USHORT) (usRight - usLeft + 1);
|
||||
for (y = usTop; y <= usBottom; y++)
|
||||
VioWrtNAttr( &attr, width, y, usLeft, 0);
|
||||
}
|
||||
|
||||
void hb_gt_DrawShadow( char cTop, char cLeft, char cBottom, char cRight, char attribute )
|
||||
void hb_gt_DrawShadow( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr )
|
||||
{
|
||||
/* Chen Kedem <niki@actcom.co.il> */
|
||||
|
||||
hb_gt_SetAttribute( cBottom+1, cLeft+1, cBottom+1, cRight+1, attribute );
|
||||
hb_gt_SetAttribute( cTop+1, cRight+1, cBottom+1, cRight+1, attribute );
|
||||
hb_gt_SetAttribute( usBottom+1, usLeft+1, usBottom+1, usRight+1, attr );
|
||||
hb_gt_SetAttribute( usTop+1, usRight+1, usBottom+1, usRight+1, attr );
|
||||
}
|
||||
|
||||
void hb_gt_DispBegin(void)
|
||||
|
||||
@@ -30,10 +30,13 @@ typedef WORD far *LPWORD;
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
static BOOL hb_gt_SetScreenBuffer( HANDLE HNew, HANDLE HOld );
|
||||
|
||||
static HANDLE HInput = INVALID_HANDLE_VALUE;
|
||||
static HANDLE HOutput = INVALID_HANDLE_VALUE;
|
||||
static HANDLE HStealth = INVALID_HANDLE_VALUE; /* DispBegin buffer */
|
||||
static HANDLE HOsave;
|
||||
static HANDLE HSsave;
|
||||
static HANDLE HDOutput = INVALID_HANDLE_VALUE;
|
||||
static HANDLE HDStealth = INVALID_HANDLE_VALUE;
|
||||
static HANDLE HInput = INVALID_HANDLE_VALUE;
|
||||
static HANDLE HOutput = INVALID_HANDLE_VALUE;
|
||||
static HANDLE HStealth = INVALID_HANDLE_VALUE; /* DispBegin buffer */
|
||||
static HANDLE HOriginal; /* used to restore before quit */
|
||||
static HANDLE HCursor; /* When DispBegin is in effect, all cursor related
|
||||
functions must refer to the active handle!
|
||||
@@ -98,29 +101,29 @@ int hb_gt_IsColor(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char hb_gt_GetScreenWidth(void)
|
||||
USHORT hb_gt_GetScreenWidth(void)
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
|
||||
LOG("GetScreenWidth");
|
||||
GetConsoleScreenBufferInfo(HOutput, &csbi);
|
||||
/* return (char)csbi.dwMaximumWindowSize.X; */
|
||||
/* return (char)max(csbi.srWindow.Right - csbi.srWindow.Left +1,40); */
|
||||
return (char)max(csbi.dwSize.X,40);
|
||||
/* return csbi.dwMaximumWindowSize.X; */
|
||||
/* return max(csbi.srWindow.Right - csbi.srWindow.Left +1,40); */
|
||||
return max(csbi.dwSize.X,40);
|
||||
}
|
||||
|
||||
char hb_gt_GetScreenHeight(void)
|
||||
USHORT hb_gt_GetScreenHeight(void)
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
|
||||
LOG("GetScreenHeight");
|
||||
GetConsoleScreenBufferInfo(HOutput, &csbi);
|
||||
/* return (char)csbi.dwMaximumWindowSize.Y; */
|
||||
/* return (char)max(csbi.srWindow.Bottom - csbi.srWindow.Top +1,25); */
|
||||
return (char)max(csbi.dwSize.Y,25);
|
||||
/* return csbi.dwMaximumWindowSize.Y; */
|
||||
/* return max(csbi.srWindow.Bottom - csbi.srWindow.Top +1,25); */
|
||||
return max(csbi.dwSize.Y,25);
|
||||
}
|
||||
|
||||
void hb_gt_SetPos(char cRow, char cCol)
|
||||
void hb_gt_SetPos(USHORT cRow, USHORT cCol)
|
||||
{
|
||||
COORD dwCursorPosition;
|
||||
|
||||
@@ -208,7 +211,7 @@ void hb_gt_SetCursorStyle(int style)
|
||||
|
||||
}
|
||||
|
||||
void hb_gt_Puts(char cRow, char cCol, char attr, char *str, int len)
|
||||
void hb_gt_Puts(USHORT cRow, USHORT cCol, BYTE attr, char *str, int len)
|
||||
{
|
||||
DWORD dwlen;
|
||||
COORD coord;
|
||||
@@ -217,18 +220,19 @@ void hb_gt_Puts(char cRow, char cCol, char attr, char *str, int len)
|
||||
coord.X = (DWORD) (cCol);
|
||||
coord.Y = (DWORD) (cRow);
|
||||
WriteConsoleOutputCharacterA(HOutput, str, (DWORD)len, coord, &dwlen);
|
||||
FillConsoleOutputAttribute(HOutput, (WORD)((unsigned char)attr&0xff), (DWORD)len, coord, &dwlen);
|
||||
FillConsoleOutputAttribute(HOutput, (WORD)(attr&0xff), (DWORD)len, coord, &dwlen);
|
||||
}
|
||||
|
||||
void hb_gt_GetText(char cTop, char cLeft, char cBottom, char cRight, char *dest)
|
||||
void hb_gt_GetText(USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, char *dest)
|
||||
{
|
||||
DWORD i, len, width;
|
||||
DWORD len;
|
||||
COORD coord;
|
||||
LPWORD pwattr;
|
||||
char y, *pstr;
|
||||
char * pstr;
|
||||
USHORT width, i, y;
|
||||
|
||||
LOG("GetText");
|
||||
width = (cRight - cLeft + 1);
|
||||
width = (usRight - usLeft + 1);
|
||||
pwattr = (LPWORD) hb_xgrab(width * sizeof(*pwattr));
|
||||
if (!pwattr)
|
||||
{
|
||||
@@ -240,9 +244,9 @@ void hb_gt_GetText(char cTop, char cLeft, char cBottom, char cRight, char *dest)
|
||||
hb_xfree(pwattr);
|
||||
return;
|
||||
}
|
||||
for (y = cTop; y <= cBottom; y++)
|
||||
for (y = usTop; y <= usBottom; y++)
|
||||
{
|
||||
coord.X = (DWORD) (cLeft);
|
||||
coord.X = (DWORD) (usLeft);
|
||||
coord.Y = (DWORD) (y);
|
||||
ReadConsoleOutputCharacterA(HOutput, pstr, width, coord, &len);
|
||||
ReadConsoleOutputAttribute(HOutput, pwattr, width, coord, &len);
|
||||
@@ -258,15 +262,16 @@ void hb_gt_GetText(char cTop, char cLeft, char cBottom, char cRight, char *dest)
|
||||
hb_xfree(pstr);
|
||||
}
|
||||
|
||||
void hb_gt_PutText(char cTop, char cLeft, char cBottom, char cRight, char *srce)
|
||||
void hb_gt_PutText(USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, char *srce)
|
||||
{
|
||||
DWORD i, len, width;
|
||||
DWORD len;
|
||||
COORD coord;
|
||||
LPWORD pwattr;
|
||||
char y, *pstr;
|
||||
char *pstr;
|
||||
USHORT width, i, y;
|
||||
|
||||
LOG("PutText");
|
||||
width = (cRight - cLeft + 1);
|
||||
width = (usRight - usLeft + 1);
|
||||
pwattr = (LPWORD) hb_xgrab(width * sizeof(*pwattr));
|
||||
if (!pwattr)
|
||||
{
|
||||
@@ -278,7 +283,7 @@ void hb_gt_PutText(char cTop, char cLeft, char cBottom, char cRight, char *srce)
|
||||
hb_xfree(pwattr);
|
||||
return;
|
||||
}
|
||||
for (y = cTop; y <= cBottom; y++)
|
||||
for (y = usTop; y <= usBottom; y++)
|
||||
{
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
@@ -287,7 +292,7 @@ void hb_gt_PutText(char cTop, char cLeft, char cBottom, char cRight, char *srce)
|
||||
*(pwattr + i) = ((WORD)((unsigned char)*srce)&0xff);
|
||||
srce++;
|
||||
}
|
||||
coord.X = (DWORD) (cLeft);
|
||||
coord.X = (DWORD) (usLeft);
|
||||
coord.Y = (DWORD) (y);
|
||||
WriteConsoleOutputAttribute(HOutput, pwattr, width, coord, &len);
|
||||
WriteConsoleOutputCharacterA(HOutput, pstr, width, coord, &len);
|
||||
@@ -296,41 +301,45 @@ void hb_gt_PutText(char cTop, char cLeft, char cBottom, char cRight, char *srce)
|
||||
hb_xfree(pstr);
|
||||
}
|
||||
|
||||
void hb_gt_SetAttribute( char cTop, char cLeft, char cBottom, char cRight, char attribute )
|
||||
void hb_gt_SetAttribute( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr )
|
||||
{
|
||||
/* ptucker */
|
||||
|
||||
DWORD len, y, width;
|
||||
DWORD len;
|
||||
COORD coord;
|
||||
width = (cRight - cLeft + 1);
|
||||
USHORT width, y;
|
||||
|
||||
coord.X = (DWORD) (cLeft);
|
||||
width = (usRight - usLeft + 1);
|
||||
|
||||
for( y=cTop;y<=cBottom;y++)
|
||||
coord.X = (DWORD) (usLeft);
|
||||
|
||||
for (y = usTop; y <= usBottom; y++)
|
||||
{
|
||||
coord.Y = y;
|
||||
FillConsoleOutputAttribute(HOutput, (WORD)((unsigned char)attribute)&0xff, width, coord, &len);
|
||||
FillConsoleOutputAttribute(HOutput, (WORD)(attr&0xff), width, coord, &len);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void hb_gt_DrawShadow( char cTop, char cLeft, char cBottom, char cRight, char attribute )
|
||||
void hb_gt_DrawShadow( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr )
|
||||
{
|
||||
/* ptucker */
|
||||
|
||||
DWORD len, width;
|
||||
DWORD len;
|
||||
COORD coord;
|
||||
width = (cRight - cLeft + 1);
|
||||
USHORT width;
|
||||
|
||||
coord.X = (DWORD) (cLeft);
|
||||
coord.Y = (DWORD) (cBottom);
|
||||
width = (usRight - usLeft + 1);
|
||||
|
||||
FillConsoleOutputAttribute(HOutput, (WORD)((unsigned char)attribute)&0xff, width, coord, &len);
|
||||
hb_gt_SetAttribute( cTop, cRight, cBottom, cRight, attribute );
|
||||
coord.X = (DWORD) (usLeft);
|
||||
coord.Y = (DWORD) (usBottom);
|
||||
|
||||
FillConsoleOutputAttribute(HOutput, (WORD)(attr&0xff), width, coord, &len);
|
||||
hb_gt_SetAttribute( usTop, usRight, usBottom, usRight, attr );
|
||||
|
||||
}
|
||||
|
||||
char hb_gt_Col(void)
|
||||
USHORT hb_gt_Col(void)
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
|
||||
@@ -339,7 +348,7 @@ char hb_gt_Col(void)
|
||||
return csbi.dwCursorPosition.X;
|
||||
}
|
||||
|
||||
char hb_gt_Row(void)
|
||||
USHORT hb_gt_Row(void)
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
|
||||
@@ -348,7 +357,7 @@ char hb_gt_Row(void)
|
||||
return csbi.dwCursorPosition.Y;
|
||||
}
|
||||
|
||||
void hb_gt_Scroll( char cTop, char cLeft, char cBottom, char cRight, char attribute, char vert, char horiz )
|
||||
void hb_gt_Scroll( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr, SHORT sVert, SHORT sHoriz )
|
||||
{
|
||||
/* ptucker */
|
||||
|
||||
@@ -356,25 +365,25 @@ void hb_gt_Scroll( char cTop, char cLeft, char cBottom, char cRight, char attrib
|
||||
COORD Target;
|
||||
CHAR_INFO FillChar;
|
||||
|
||||
Source.Top = cTop;
|
||||
Source.Left = cLeft;
|
||||
Source.Bottom = cBottom;
|
||||
Source.Right = cRight;
|
||||
Source.Top = usTop;
|
||||
Source.Left = usLeft;
|
||||
Source.Bottom = usBottom;
|
||||
Source.Right = usRight;
|
||||
|
||||
memcpy( &Clip, &Source, sizeof(Clip) );
|
||||
|
||||
if( (horiz | vert) == 0 ) /* both zero? */
|
||||
if( (sHoriz | sVert) == 0 ) /* both zero? */
|
||||
{
|
||||
Target.Y = cBottom+1; /* set outside the clipping region */
|
||||
Target.X = cRight+1;
|
||||
Target.Y = usBottom+1; /* set outside the clipping region */
|
||||
Target.X = usRight+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Target.Y = cTop-vert;
|
||||
Target.X = cLeft-horiz;
|
||||
Target.Y = usTop-sVert;
|
||||
Target.X = usLeft-sHoriz;
|
||||
}
|
||||
FillChar.Char.AsciiChar = ' ';
|
||||
FillChar.Attributes = (WORD)((unsigned char)attribute)&0xff;
|
||||
FillChar.Attributes = (WORD)(attr&0xff);
|
||||
|
||||
ScrollConsoleScreenBuffer(HOutput, &Source, &Clip, Target, &FillChar);
|
||||
}
|
||||
@@ -527,3 +536,31 @@ void hb_gt_SetBlink( BOOL bBlink )
|
||||
bBlink = FALSE;
|
||||
}
|
||||
|
||||
void hb_gt_DebugScreen( BOOL activate )
|
||||
{
|
||||
if( activate )
|
||||
{
|
||||
if( HDOutput == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
HDOutput = CreateConsoleScreenBuffer(
|
||||
GENERIC_READ | GENERIC_WRITE, /* Access flag */
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE, /* Buffer share mode */
|
||||
NULL, /* Security attribute */
|
||||
CONSOLE_TEXTMODE_BUFFER, /* Type of buffer */
|
||||
NULL); /* reserved */
|
||||
|
||||
hb_gt_SetScreenBuffer( HDOutput, HOutput );
|
||||
}
|
||||
HOsave = HOutput;
|
||||
HOutput = HCursor = HDOutput;
|
||||
hb_gtDispBegin();
|
||||
hb_gtDispEnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
HOutput = HOsave;
|
||||
HCursor = HOriginal;
|
||||
}
|
||||
SetConsoleActiveScreenBuffer( HOutput );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user