See ChangeLog entry 2001-08-21 23:35 UTC-0400 David G. Holm <dholm@jsd-llc.com>

This commit is contained in:
David G. Holm
2001-08-21 03:37:26 +00:00
parent 35d2603255
commit 1f3fda11f1
12 changed files with 1280 additions and 880 deletions

View File

@@ -1,3 +1,22 @@
2001-08-21 23:35 UTC-0400 David G. Holm <dholm@jsd-llc.com>
* include/hbapigt.h
* source/rtl/gtapi.c
* source/rtl/gt_tpl/gt_tpl.c
* source/rtl/gtcgi/gtcgi.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
* Changed all row and column parameters for the box and line drawing
functions from USHORT to SHORT.
- Removed all box and line drawing boundary checks from gtapi.c
+ Added the appropriate box and line boundary checks to the various
GT API library sources to properly implement clipping.
2001-08-20 23:30 UTC-0400 David G. Holm <dholm@jsd-llc.com>
* source/rtl/set.c

View File

@@ -151,9 +151,9 @@ typedef enum
extern void hb_gtInit( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr );
extern void hb_gtExit( void );
extern void hb_gtAdjustPos( int iHandle, char * pStr, ULONG ulLen );
extern USHORT hb_gtBox( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame );
extern USHORT hb_gtBoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight );
extern USHORT hb_gtBoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight );
extern USHORT hb_gtBox( SHORT uiTop, SHORT uiLeft, SHORT uiBottom, SHORT uiRight, BYTE * pbyFrame );
extern USHORT hb_gtBoxD( SHORT uiTop, SHORT uiLeft, SHORT uiBottom, SHORT uiRight );
extern USHORT hb_gtBoxS( SHORT uiTop, SHORT uiLeft, SHORT uiBottom, SHORT uiRight );
extern USHORT hb_gtColorSelect( USHORT uiColorIndex );
extern USHORT hb_gtColorToN( char * szColorString );
extern USHORT hb_gtDispBegin( void );
@@ -221,9 +221,9 @@ extern USHORT hb_gtSetBorder( HB_GT_RGB * color );
extern void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr );
extern void hb_gt_Exit( void );
extern BOOL hb_gt_AdjustPos( BYTE * pStr, ULONG ulLen );
extern USHORT hb_gt_Box( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr );
extern USHORT hb_gt_BoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr );
extern USHORT hb_gt_BoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr );
extern USHORT hb_gt_Box( SHORT uiTop, SHORT uiLeft, SHORT uiBottom, SHORT uiRight, BYTE * pbyFrame, BYTE byAttr );
extern USHORT hb_gt_BoxD( SHORT uiTop, SHORT uiLeft, SHORT uiBottom, SHORT uiRight, BYTE * pbyFrame, BYTE byAttr );
extern USHORT hb_gt_BoxS( SHORT uiTop, SHORT uiLeft, SHORT uiBottom, SHORT uiRight, BYTE * pbyFrame, BYTE byAttr );
extern SHORT hb_gt_Col( void );
extern void hb_gt_DispBegin( void );
extern USHORT hb_gt_DispCount( void );
@@ -233,7 +233,7 @@ extern USHORT hb_gt_GetCursorStyle( void );
extern USHORT hb_gt_GetScreenHeight( void );
extern USHORT hb_gt_GetScreenWidth( void );
extern void hb_gt_GetText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyDst );
extern USHORT hb_gt_HorizLine( USHORT uiRow, USHORT uiLeft, USHORT uiRight, BYTE byChar, BYTE byAttr );
extern USHORT hb_gt_HorizLine( SHORT uiRow, SHORT uiLeft, SHORT uiRight, BYTE byChar, BYTE byAttr );
extern BOOL hb_gt_IsColor( void );
extern BOOL hb_gt_PreExt( void );
extern BOOL hb_gt_PostExt( void );
@@ -254,7 +254,7 @@ extern BOOL hb_gt_SetMode( USHORT uiRows, USHORT uiCols );
extern void hb_gt_SetPos( SHORT iRow, SHORT iCol, SHORT iMethod );
extern void hb_gt_Tone( double dFrequency, double dDuration );
extern char * hb_gt_Version( void );
extern USHORT hb_gt_VertLine( USHORT uiCol, USHORT uiTop, USHORT uiBottom, BYTE byChar, BYTE byAttr );
extern USHORT hb_gt_VertLine( SHORT uiCol, SHORT uiTop, SHORT uiBottom, BYTE byChar, BYTE byAttr );
/* Keyboard related declarations */

View File

@@ -411,53 +411,53 @@ void hb_gt_Replicate( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE byChar, ULON
hb_gt_xPutch( uiRow, uiCol++, byAttr, byChar );
}
USHORT hb_gt_Box( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
USHORT hb_gt_Box( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right,
BYTE * pbyFrame, BYTE byAttr )
{
HB_SYMBOL_UNUSED( uiTop );
HB_SYMBOL_UNUSED( uiLeft );
HB_SYMBOL_UNUSED( uiBottom );
HB_SYMBOL_UNUSED( uiRight );
HB_SYMBOL_UNUSED( Top );
HB_SYMBOL_UNUSED( Left );
HB_SYMBOL_UNUSED( Bottom );
HB_SYMBOL_UNUSED( Right );
HB_SYMBOL_UNUSED( pbyFrame );
HB_SYMBOL_UNUSED( byAttr );
return 0;
}
USHORT hb_gt_BoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
USHORT hb_gt_BoxD( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
return hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
}
USHORT hb_gt_BoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
USHORT hb_gt_BoxS( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
return hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
}
USHORT hb_gt_HorizLine( USHORT uiRow, USHORT uiLeft, USHORT uiRight, BYTE byChar, BYTE byAttr )
USHORT hb_gt_HorizLine( SHORT Row, SHORT Left, SHORT Right, BYTE byChar, BYTE byAttr )
{
if( uiLeft < uiRight )
hb_gt_Replicate( uiRow, uiLeft, byAttr, byChar, uiRight - uiLeft + 1 );
if( Left < Right )
hb_gt_Replicate( Row, Left, byAttr, byChar, Right - Left + 1 );
else
hb_gt_Replicate( uiRow, uiRight, byAttr, byChar, uiLeft - uiRight + 1 );
hb_gt_Replicate( Row, Right, byAttr, byChar, Left - Right + 1 );
return 0;
}
USHORT hb_gt_VertLine( USHORT uiCol, USHORT uiTop, USHORT uiBottom, BYTE byChar, BYTE byAttr )
USHORT hb_gt_VertLine( SHORT Col, SHORT Top, SHORT Bottom, BYTE byChar, BYTE byAttr )
{
USHORT uRow;
SHORT Row;
if( uiTop <= uiBottom )
uRow = uiTop;
if( Top <= Bottom )
Row = Top;
else
{
uRow = uiBottom;
uiBottom = uiTop;
Row = Bottom;
Bottom = Top;
}
while( uRow <= uiBottom )
hb_gt_xPutch( uRow++, uiCol, byAttr, byChar );
while( Row <= Bottom )
hb_gt_xPutch( Row++, Col, byAttr, byChar );
return 0;
}

View File

@@ -166,109 +166,76 @@ void hb_gtAdjustPos( int iHandle, char * pStr, ULONG ulLen )
}
}
USHORT hb_gtBox( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame )
USHORT hb_gtBox( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame )
{
USHORT uiMaxRow;
USHORT uiMaxCol;
USHORT Ret;
USHORT tmp;
BYTE cPadChar;
BYTE szBox[ 10 ];
HB_TRACE(HB_TR_DEBUG, ("hb_gtBox(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, pbyFrame));
HB_TRACE(HB_TR_DEBUG, ("hb_gtBox(%hd, %hd, %hd, %hd, %p)", Top, Left, Bottom, Right, pbyFrame));
uiMaxRow = hb_gt_GetScreenHeight();
uiMaxCol = hb_gt_GetScreenWidth();
/* NOTE: For full compatibility, pad box string with last char if too
short [vszakats] */
/* TODO: Would be better to support these cases, Clipper implementation was
quite messy, which can be considered as a bug. [vszakats] */
cPadChar = ' ';
for( tmp = 0; *pbyFrame && tmp < 9; tmp++ )
cPadChar = szBox[ tmp ] = *pbyFrame++;
while( tmp < 8 )
szBox[ tmp++ ] = cPadChar;
szBox[ tmp ] = '\0';
if( uiTop < uiMaxRow && uiBottom < uiMaxRow &&
uiLeft < uiMaxCol && uiRight < uiMaxCol )
if( Top != Bottom )
{
/* NOTE: For full compatibility, pad box string with last char if too
short [vszakats] */
USHORT tmp;
BYTE cPadChar;
BYTE szBox[ 10 ];
cPadChar = ' ';
for( tmp = 0; *pbyFrame && tmp < 9; tmp++ )
cPadChar = szBox[ tmp ] = *pbyFrame++;
while( tmp < 8 )
szBox[ tmp++ ] = cPadChar;
szBox[ tmp ] = '\0';
if( uiTop != uiBottom )
{
if( uiLeft != uiRight )
hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, szBox, ( BYTE ) s_pColor[ s_uiColorIndex ] );
else
hb_gt_VertLine( uiLeft, uiTop, uiBottom, szBox[ 3 ], ( BYTE ) s_pColor[ s_uiColorIndex ] );
}
if( Left != Right )
Ret = hb_gt_Box( Top, Left, Bottom, Right, szBox, ( BYTE ) s_pColor[ s_uiColorIndex ] );
else
hb_gt_HorizLine( uiTop, uiLeft, uiRight, szBox[ 1 ], ( BYTE ) s_pColor[ s_uiColorIndex ] );
hb_gtSetPosContext( uiTop + 1, uiLeft + 1, HB_GT_SET_POS_AFTER );
return 0;
Ret = hb_gt_VertLine( Left, Top, Bottom, szBox[ 3 ], ( BYTE ) s_pColor[ s_uiColorIndex ] );
}
else
return 1;
Ret = hb_gt_HorizLine( Top, Left, Right, szBox[ 1 ], ( BYTE ) s_pColor[ s_uiColorIndex ] );
hb_gtSetPosContext( HB_MAX(Top,0) + 1, HB_MAX(Left,0) + 1, HB_GT_SET_POS_AFTER );
return Ret;
}
USHORT hb_gtBoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight )
USHORT hb_gtBoxD( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right )
{
USHORT uiMaxRow;
USHORT uiMaxCol;
USHORT Ret;
uiMaxRow = hb_gt_GetScreenHeight();
uiMaxCol = hb_gt_GetScreenWidth();
if( uiTop < uiMaxRow && uiBottom < uiMaxRow &&
uiLeft < uiMaxCol && uiRight < uiMaxCol )
if( Top != Bottom )
{
if( uiTop != uiBottom )
{
if( uiLeft != uiRight )
hb_gt_BoxD( uiTop, uiLeft, uiBottom, uiRight, ( BYTE * ) _B_DOUBLE, ( BYTE ) s_pColor[ s_uiColorIndex ] );
else
hb_gt_VertLine( uiLeft, uiTop, uiBottom, HB_B_DOUBLE_V, ( BYTE ) s_pColor[ s_uiColorIndex ] );
}
if( Left != Right )
Ret = hb_gt_BoxD( Top, Left, Bottom, Right, ( BYTE * ) _B_DOUBLE, ( BYTE ) s_pColor[ s_uiColorIndex ] );
else
hb_gt_HorizLine( uiTop, uiLeft, uiRight, HB_B_DOUBLE_H, ( BYTE ) s_pColor[ s_uiColorIndex ] );
hb_gtSetPosContext( uiTop + 1, uiLeft + 1, HB_GT_SET_POS_AFTER );
return 0;
Ret = hb_gt_VertLine( Left, Top, Bottom, HB_B_DOUBLE_V, ( BYTE ) s_pColor[ s_uiColorIndex ] );
}
else
return 1;
Ret = hb_gt_HorizLine( Top, Left, Right, HB_B_DOUBLE_H, ( BYTE ) s_pColor[ s_uiColorIndex ] );
hb_gtSetPosContext( HB_MAX(Top,0) + 1, HB_MAX(Left,0) + 1, HB_GT_SET_POS_AFTER );
return Ret;
}
USHORT hb_gtBoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight )
USHORT hb_gtBoxS( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right )
{
USHORT uiMaxRow;
USHORT uiMaxCol;
USHORT Ret;
uiMaxRow = hb_gt_GetScreenHeight();
uiMaxCol = hb_gt_GetScreenWidth();
if( uiTop < uiMaxRow && uiBottom < uiMaxRow &&
uiLeft < uiMaxCol && uiRight < uiMaxCol )
if( Top != Bottom )
{
if( uiTop != uiBottom )
{
if( uiLeft != uiRight )
hb_gt_BoxS( uiTop, uiLeft, uiBottom, uiRight, ( BYTE * ) _B_SINGLE, ( BYTE ) s_pColor[ s_uiColorIndex ] );
else
hb_gt_VertLine( uiLeft, uiTop, uiBottom, HB_B_SINGLE_V, ( BYTE ) s_pColor[ s_uiColorIndex ] );
}
if( Left != Right )
Ret = hb_gt_BoxS( Top, Left, Bottom, Right, ( BYTE * ) _B_SINGLE, ( BYTE ) s_pColor[ s_uiColorIndex ] );
else
hb_gt_HorizLine( uiTop, uiLeft, uiRight, HB_B_SINGLE_H, ( BYTE ) s_pColor[ s_uiColorIndex ] );
hb_gtSetPosContext( uiTop + 1, uiLeft + 1, HB_GT_SET_POS_AFTER );
return 0;
Ret = hb_gt_VertLine( Left, Top, Bottom, HB_B_SINGLE_V, ( BYTE ) s_pColor[ s_uiColorIndex ] );
}
else
return 1;
Ret = hb_gt_HorizLine( Top, Left, Right, HB_B_SINGLE_H, ( BYTE ) s_pColor[ s_uiColorIndex ] );
hb_gtSetPosContext( HB_MAX(Top,0) + 1, HB_MAX(Left,0) + 1, HB_GT_SET_POS_AFTER );
return Ret;
}
USHORT hb_gtColorSelect( USHORT uiColorIndex )

View File

@@ -209,7 +209,7 @@ void hb_gt_SetPos( SHORT iRow, SHORT iCol, SHORT iMethod )
out_newline();
s_iCol = 0;
}
if( s_iCol < iCol ) while( ++s_iCol < iCol ) out_stdout( " ", 1 );
if( s_iCol < iCol ) while( s_iCol++ < iCol ) out_stdout( " ", 1 );
}
s_iRow = iRow;
@@ -396,127 +396,177 @@ void hb_gt_Replicate( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE byChar, ULON
hb_gt_xPutch( uiRow, uiCol++, byAttr, byChar );
}
USHORT hb_gt_Box( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
BYTE *szBox, BYTE byAttr )
USHORT hb_gt_Box( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right,
BYTE * szBox, BYTE byAttr )
{
USHORT uiRow;
USHORT uiCol;
USHORT uiHeight;
USHORT uiWidth;
USHORT ret = 1;
SHORT Row;
SHORT Col;
SHORT Height;
SHORT Width;
/* Ensure that box is drawn from top left to bottom right. */
if( uiTop > uiBottom )
if( Left >= 0 || Left < hb_gt_GetScreenWidth()
|| Right >= 0 || Right < hb_gt_GetScreenWidth()
|| Top >= 0 || Top < hb_gt_GetScreenHeight()
|| Bottom >= 0 || Bottom < hb_gt_GetScreenHeight() )
{
USHORT tmp = uiTop;
uiTop = uiBottom;
uiBottom = tmp;
}
if( uiLeft > uiRight )
{
USHORT tmp = uiLeft;
uiLeft = uiRight;
uiRight = tmp;
}
uiRow = uiTop;
uiCol = uiLeft;
/* Draw the box or line as specified */
uiHeight = uiBottom - uiTop + 1;
uiWidth = uiRight - uiLeft + 1;
hb_gt_DispBegin();
if( uiHeight > 1 && uiWidth > 1 )
hb_gt_xPutch( uiRow, uiCol, byAttr, szBox[ 0 ] ); /* Upper left corner */
uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft );
if( uiCol <= uiRight )
hb_gt_Replicate( uiRow, uiCol, byAttr, szBox[ 1 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Top line */
if( uiHeight > 1 && uiWidth > 1 )
{
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 2 ] ); /* Upper right corner */
}
if( szBox[ 8 ] && uiHeight > 2 && uiWidth > 2 )
{
for( uiRow = uiTop + 1; uiRow < uiBottom; uiRow++ )
/* Ensure that box is drawn from top left to bottom right. */
if( Top > Bottom )
{
uiCol = uiLeft;
hb_gt_xPutch( uiRow, uiCol++, byAttr, szBox[ 7 ] ); /* Left side */
hb_gt_Replicate( uiRow, uiCol, byAttr, szBox[ 8 ], uiRight - uiLeft - 1 ); /* Fill */
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */
SHORT tmp = Top;
Top = Bottom;
Bottom = tmp;
}
}
else
{
for( uiRow = ( uiWidth > 1 ? uiTop + 1 : uiTop ); uiRow < ( uiWidth > 1 ? uiBottom : uiBottom + 1 ); uiRow++ )
if( Left > Right )
{
hb_gt_xPutch( uiRow, uiLeft, byAttr, szBox[ 7 ] ); /* Left side */
if( uiWidth > 1 )
SHORT tmp = Left;
Left = Right;
Right = tmp;
}
/* Draw the box or line as specified */
Height = Bottom - Top + 1;
Width = Right - Left + 1;
hb_gt_DispBegin();
if( Height > 1 && Width > 1 && Top >= 0 && Top < hb_gt_GetScreenHeight() && Left >= 0 && Left < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Top, Left, byAttr, szBox[ 0 ] ); /* Upper left corner */
Col = ( Height > 1 ? Left + 1 : Left );
if(Col < 0 )
{
Width += Col;
Col = 0;
}
if( Right >= hb_gt_GetScreenWidth() )
{
Width -= Right - hb_gt_GetScreenWidth() + 1;
}
if( Col <= Right && Col < hb_gt_GetScreenWidth() && Top >= 0 && Top < hb_gt_GetScreenHeight() )
hb_gt_Replicate( Top, Col, byAttr, szBox[ 1 ], Width + ( (Right - Left) > 1 ? -2 : 0 ) ); /* Top line */
if( Height > 1 && (Right - Left) > 1 && Right < hb_gt_GetScreenWidth() && Top >= 0 && Top < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Top, Right, byAttr, szBox[ 2 ] ); /* Upper right corner */
if( szBox[ 8 ] && Height > 2 && Width > 2 )
{
for( Row = Top + 1; Row < Bottom; Row++ )
{
hb_gt_Replicate( uiRow, uiCol, byAttr, ' ', uiWidth - 2 );
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
Col = Left;
if( Col < 0 )
Col = 0; // The width was corrected earlier.
else
hb_gt_xPutch( Row, Col++, byAttr, szBox[ 7 ] ); /* Left side */
hb_gt_Replicate( Row, Col, byAttr, szBox[ 8 ], Width - 2 ); /* Fill */
if( Right < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Right, byAttr, szBox[ 3 ] ); /* Right side */
}
}
}
else
{
for( Row = ( Width > 1 ? Top + 1 : Top ); Row < ( (Right - Left ) > 1 ? Bottom : Bottom + 1 ); Row++ )
{
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
if( Left >= 0 && Left < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Left, byAttr, szBox[ 7 ] ); /* Left side */
if( ( Width > 1 || Left < 0 ) && Right < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Right, byAttr, szBox[ 3 ] ); /* Right side */
}
}
}
if( Height > 1 && Width > 1 )
{
if( Left >= 0 && Bottom < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Bottom, Left, byAttr, szBox[ 6 ] ); /* Bottom left corner */
Col = Left + 1;
if( Col < 0 )
Col = 0; // And use the width that was calculated earlier.
if( Col <= Right && Bottom < hb_gt_GetScreenHeight() )
hb_gt_Replicate( Bottom, Col, byAttr, szBox[ 5 ], Width - 2 ); /* Bottom line */
if( Right < hb_gt_GetScreenWidth() && Bottom < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Bottom, Right, byAttr, szBox[ 4 ] ); /* Bottom right corner */
}
hb_gt_DispEnd();
ret = 0;
}
if( uiHeight > 1 && uiWidth > 1 )
return ret;
}
USHORT hb_gt_BoxD( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
}
USHORT hb_gt_BoxS( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
}
USHORT hb_gt_HorizLine( SHORT Row, SHORT Left, SHORT Right, BYTE byChar, BYTE byAttr )
{
USHORT ret = 1;
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
hb_gt_xPutch( uiBottom, uiLeft, byAttr, szBox[ 6 ] ); /* Bottom left corner */
if( Left < 0 )
Left = 0;
else if( Left >= hb_gt_GetScreenWidth() )
Left = hb_gt_GetScreenWidth() - 1;
if( Right < 0 )
Right = 0;
else if( Right >= hb_gt_GetScreenWidth() )
Right = hb_gt_GetScreenWidth() - 1;
uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft );
if( uiCol <= uiRight && uiHeight > 1 )
hb_gt_Replicate( uiBottom, uiCol, byAttr, szBox[ 5 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Bottom line */
hb_gt_xPutch( uiBottom, uiRight, byAttr, szBox[ 4 ] ); /* Bottom right corner */
if( Left < Right )
hb_gt_Replicate( Row, Left, byAttr, byChar, Right - Left + 1 );
else
hb_gt_Replicate( Row, Right, byAttr, byChar, Left - Right + 1 );
ret = 0;
}
hb_gt_DispEnd();
return 0;
return ret;
}
USHORT hb_gt_BoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
USHORT hb_gt_VertLine( SHORT Col, SHORT Top, SHORT Bottom, BYTE byChar, BYTE byAttr )
{
return hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
}
USHORT ret = 1;
USHORT Row;
USHORT hb_gt_BoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
}
USHORT hb_gt_HorizLine( USHORT uiRow, USHORT uiLeft, USHORT uiRight, BYTE byChar, BYTE byAttr )
{
if( uiLeft < uiRight )
hb_gt_Replicate( uiRow, uiLeft, byAttr, byChar, uiRight - uiLeft + 1 );
else
hb_gt_Replicate( uiRow, uiRight, byAttr, byChar, uiLeft - uiRight + 1 );
return 0;
}
USHORT hb_gt_VertLine( USHORT uiCol, USHORT uiTop, USHORT uiBottom, BYTE byChar, BYTE byAttr )
{
USHORT uRow;
if( uiTop <= uiBottom )
uRow = uiTop;
else
if( Col >= 0 && Col < hb_gt_GetScreenWidth() )
{
uRow = uiBottom;
uiBottom = uiTop;
if( Top < 0 )
Top = 0;
else if( Top >= hb_gt_GetScreenHeight() )
Top = hb_gt_GetScreenHeight() - 1;
if( Bottom < 0 )
Bottom = 0;
else if( Bottom >= hb_gt_GetScreenHeight() )
Bottom = hb_gt_GetScreenHeight() - 1;
if( Top <= Bottom )
Row = Top;
else
{
Row = Bottom;
Bottom = Top;
}
while( Row <= Bottom )
hb_gt_xPutch( Row++, Col, byAttr, byChar );
ret = 0;
}
while( uRow <= uiBottom )
hb_gt_xPutch( uRow++, uiCol, byAttr, byChar );
return 0;
return ret;
}
BOOL hb_gt_PreExt()

View File

@@ -614,99 +614,117 @@ void hb_gt_Replicate( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE byChar, ULON
hb_gt_xPutch( uiRow, uiCol++, byAttr, byChar );
}
USHORT hb_gt_Box( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
BYTE *szBox, BYTE byAttr )
USHORT hb_gt_Box( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right,
BYTE * szBox, BYTE byAttr )
{
USHORT uiRow;
USHORT uiCol;
USHORT uiHeight;
USHORT uiWidth;
USHORT ret = 1;
SHORT Row;
SHORT Col;
SHORT Height;
SHORT Width;
/* Ensure that box is drawn from top left to bottom right. */
if( uiTop > uiBottom )
if( Left >= 0 || Left < hb_gt_GetScreenWidth()
|| Right >= 0 || Right < hb_gt_GetScreenWidth()
|| Top >= 0 || Top < hb_gt_GetScreenHeight()
|| Bottom >= 0 || Bottom < hb_gt_GetScreenHeight() )
{
USHORT tmp = uiTop;
uiTop = uiBottom;
uiBottom = tmp;
}
if( uiLeft > uiRight )
{
USHORT tmp = uiLeft;
uiLeft = uiRight;
uiRight = tmp;
}
if( s_under_xterm )
{
/* enable temporarily for box drawing
NOTE: under xterm characcters with ASCII code 96 - 124 are
used for special characters
*/
s_alternate_char_set = A_ALTCHARSET;
}
uiRow = uiTop;
uiCol = uiLeft;
/* Draw the box or line as specified */
uiHeight = uiBottom - uiTop + 1;
uiWidth = uiRight - uiLeft + 1;
hb_gt_DispBegin();
if( uiHeight > 1 && uiWidth > 1 )
hb_gt_xPutch( uiRow, uiCol, byAttr, szBox[ 0 ] ); /* Upper left corner */
uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft );
if( uiCol <= uiRight )
hb_gt_Replicate( uiRow, uiCol, byAttr, szBox[ 1 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Top line */
if( uiHeight > 1 && uiWidth > 1 )
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 2 ] ); /* Upper right corner */
if( szBox[ 8 ] && uiHeight > 2 && uiWidth > 2 )
{
for( uiRow = uiTop + 1; uiRow < uiBottom; uiRow++ )
/* Ensure that box is drawn from top left to bottom right. */
if( Top > Bottom )
{
uiCol = uiLeft;
hb_gt_xPutch( uiRow, uiCol++, byAttr, szBox[ 7 ] ); /* Left side */
hb_gt_Replicate( uiRow, uiCol, byAttr, szBox[ 8 ], uiRight - uiLeft - 1 ); /* Fill */
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */
SHORT tmp = Top;
Top = Bottom;
Bottom = tmp;
}
}
else
{
for( uiRow = ( uiWidth > 1 ? uiTop + 1 : uiTop ); uiRow < ( uiWidth > 1 ? uiBottom : uiBottom + 1 ); uiRow++ )
if( Left > Right )
{
hb_gt_xPutch( uiRow, uiLeft, byAttr, szBox[ 7 ] ); /* Left side */
if( uiWidth > 1 )
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */
SHORT tmp = Left;
Left = Right;
Right = tmp;
}
/* Draw the box or line as specified */
Height = Bottom - Top + 1;
Width = Right - Left + 1;
hb_gt_DispBegin();
if( Height > 1 && Width > 1 && Top >= 0 && Top < hb_gt_GetScreenHeight() && Left >= 0 && Left < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Top, Left, byAttr, szBox[ 0 ] ); /* Upper left corner */
Col = ( Height > 1 ? Left + 1 : Left );
if(Col < 0 )
{
Width += Col;
Col = 0;
}
if( Right >= hb_gt_GetScreenWidth() )
{
Width -= Right - hb_gt_GetScreenWidth() + 1;
}
if( Col <= Right && Col < hb_gt_GetScreenWidth() && Top >= 0 && Top < hb_gt_GetScreenHeight() )
hb_gt_Replicate( Top, Col, byAttr, szBox[ 1 ], Width + ( (Right - Left) > 1 ? -2 : 0 ) ); /* Top line */
if( Height > 1 && (Right - Left) > 1 && Right < hb_gt_GetScreenWidth() && Top >= 0 && Top < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Top, Right, byAttr, szBox[ 2 ] ); /* Upper right corner */
if( szBox[ 8 ] && Height > 2 && Width > 2 )
{
for( Row = Top + 1; Row < Bottom; Row++ )
{
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
Col = Left;
if( Col < 0 )
Col = 0; // The width was corrected earlier.
else
hb_gt_xPutch( Row, Col++, byAttr, szBox[ 7 ] ); /* Left side */
hb_gt_Replicate( Row, Col, byAttr, szBox[ 8 ], Width - 2 ); /* Fill */
if( Right < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Right, byAttr, szBox[ 3 ] ); /* Right side */
}
}
}
else
{
for( Row = ( Width > 1 ? Top + 1 : Top ); Row < ( (Right - Left ) > 1 ? Bottom : Bottom + 1 ); Row++ )
{
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
if( Left >= 0 && Left < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Left, byAttr, szBox[ 7 ] ); /* Left side */
if( ( Width > 1 || Left < 0 ) && Right < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Right, byAttr, szBox[ 3 ] ); /* Right side */
}
}
}
if( Height > 1 && Width > 1 )
{
if( Left >= 0 && Bottom < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Bottom, Left, byAttr, szBox[ 6 ] ); /* Bottom left corner */
Col = Left + 1;
if( Col < 0 )
Col = 0; // And use the width that was calculated earlier.
if( Col <= Right && Bottom < hb_gt_GetScreenHeight() )
hb_gt_Replicate( Bottom, Col, byAttr, szBox[ 5 ], Width - 2 ); /* Bottom line */
if( Right < hb_gt_GetScreenWidth() && Bottom < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Bottom, Right, byAttr, szBox[ 4 ] ); /* Bottom right corner */
}
hb_gt_DispEnd();
ret = 0;
}
if( uiHeight > 1 && uiWidth > 1 )
{
hb_gt_xPutch( uiBottom, uiLeft, byAttr, szBox[ 6 ] ); /* Bottom left corner */
uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft );
if( uiCol <= uiRight && uiHeight > 1 )
hb_gt_Replicate( uiBottom, uiCol, byAttr, szBox[ 5 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Bottom line */
hb_gt_xPutch( uiBottom, uiRight, byAttr, szBox[ 4 ] ); /* Bottom right corner */
}
hb_gt_DispEnd();
if( s_under_xterm )
s_alternate_char_set = 0; /* restore default setting */
return 0;
return ret;
}
USHORT hb_gt_BoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
USHORT hb_gt_BoxD( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
USHORT ret;
if( s_under_xterm )
{
/* Under xterm use hard-coded box drawing characters */
@@ -714,16 +732,17 @@ USHORT hb_gt_BoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
s_alternate_char_set = A_ALTCHARSET;
}
hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
ret = hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
if( s_under_xterm )
s_alternate_char_set = 0; /* restore default setting */
return 0;
return ret;
}
USHORT hb_gt_BoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
USHORT hb_gt_BoxS( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
USHORT ret;
if( s_under_xterm )
{
/* Under xterm use hard-coded box drawing characters */
@@ -731,46 +750,46 @@ USHORT hb_gt_BoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
s_alternate_char_set = A_ALTCHARSET;
}
hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
ret = hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
if( s_under_xterm )
s_alternate_char_set = 0; /* restore default setting */
return 0;
return ret;
}
USHORT hb_gt_HorizLine( USHORT uiRow, USHORT uiLeft, USHORT uiRight, BYTE byChar, BYTE byAttr )
USHORT hb_gt_HorizLine( SHORT Row, SHORT Left, SHORT Right, BYTE byChar, BYTE byAttr )
{
if( s_under_xterm )
byChar = ACS_HLINE;
if( uiLeft < uiRight )
mvhline( uiRow, uiLeft, byChar | A_ALTCHARSET | s_attribmap_table[ byAttr ],
uiRight - uiLeft + 1 );
if( Left < Right )
mvhline( Row, Left, byChar | A_ALTCHARSET | s_attribmap_table[ byAttr ],
Right - Left + 1 );
else
mvhline( uiRow, uiRight, byChar | A_ALTCHARSET | s_attribmap_table[ byAttr ],
uiLeft - uiRight + 1 );
mvhline( Row, Right, byChar | A_ALTCHARSET | s_attribmap_table[ byAttr ],
Left - Right + 1 );
return 0;
}
USHORT hb_gt_VertLine( USHORT uiCol, USHORT uiTop, USHORT uiBottom, BYTE byChar, BYTE byAttr )
USHORT hb_gt_VertLine( SHORT Col, SHORT Top, SHORT Bottom, BYTE byChar, BYTE byAttr )
{
USHORT uRow;
SHORT Row;
if( uiTop <= uiBottom )
uRow = uiTop;
if( Top <= Bottom )
Row = Top;
else
{
uRow = uiBottom;
uiBottom = uiTop;
uRow = Bottom;
Bottom = Top;
}
if( s_under_xterm )
byChar = ACS_VLINE;
mvvline( uRow, uiCol, byChar | A_ALTCHARSET | s_attribmap_table[ byAttr ],
uiBottom - uRow + 1 );
mvvline( uRow, Col, byChar | A_ALTCHARSET | s_attribmap_table[ byAttr ],
Bottom - Row + 1 );
return 0;
}

View File

@@ -1086,118 +1086,177 @@ void hb_gt_Replicate( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE byChar, ULON
#endif
}
USHORT hb_gt_Box( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
BYTE *szBox, BYTE byAttr )
USHORT hb_gt_Box( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right,
BYTE * szBox, BYTE byAttr )
{
USHORT uiRow;
USHORT uiCol;
USHORT uiHeight;
USHORT uiWidth;
USHORT ret = 1;
SHORT Row;
SHORT Col;
SHORT Height;
SHORT Width;
/* Ensure that box is drawn from top left to bottom right. */
if( uiTop > uiBottom )
if( Left >= 0 || Left < hb_gt_GetScreenWidth()
|| Right >= 0 || Right < hb_gt_GetScreenWidth()
|| Top >= 0 || Top < hb_gt_GetScreenHeight()
|| Bottom >= 0 || Bottom < hb_gt_GetScreenHeight() )
{
USHORT tmp = uiTop;
uiTop = uiBottom;
uiBottom = tmp;
}
if( uiLeft > uiRight )
{
USHORT tmp = uiLeft;
uiLeft = uiRight;
uiRight = tmp;
}
uiRow = uiTop;
uiCol = uiLeft;
/* Draw the box or line as specified */
uiHeight = uiBottom - uiTop + 1;
uiWidth = uiRight - uiLeft + 1;
hb_gt_DispBegin();
if( uiHeight > 1 && uiWidth > 1 )
hb_gt_xPutch( uiRow, uiCol, byAttr, szBox[ 0 ] ); /* Upper left corner */
uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft );
if( uiCol <= uiRight )
hb_gt_Replicate( uiRow, uiCol, byAttr, szBox[ 1 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Top line */
if( uiHeight > 1 && uiWidth > 1 )
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 2 ] ); /* Upper right corner */
if( szBox[ 8 ] && uiHeight > 2 && uiWidth > 2 )
{
for( uiRow = uiTop + 1; uiRow < uiBottom; uiRow++ )
/* Ensure that box is drawn from top left to bottom right. */
if( Top > Bottom )
{
uiCol = uiLeft;
hb_gt_xPutch( uiRow, uiCol++, byAttr, szBox[ 7 ] ); /* Left side */
hb_gt_Replicate( uiRow, uiCol, byAttr, szBox[ 8 ], uiRight - uiLeft - 1 ); /* Fill */
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */
SHORT tmp = Top;
Top = Bottom;
Bottom = tmp;
}
}
else
{
for( uiRow = ( uiWidth > 1 ? uiTop + 1 : uiTop ); uiRow < ( uiWidth > 1 ? uiBottom : uiBottom + 1 ); uiRow++ )
if( Left > Right )
{
hb_gt_xPutch( uiRow, uiLeft, byAttr, szBox[ 7 ] ); /* Left side */
if( uiWidth > 1 )
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */
SHORT tmp = Left;
Left = Right;
Right = tmp;
}
/* Draw the box or line as specified */
Height = Bottom - Top + 1;
Width = Right - Left + 1;
hb_gt_DispBegin();
if( Height > 1 && Width > 1 && Top >= 0 && Top < hb_gt_GetScreenHeight() && Left >= 0 && Left < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Top, Left, byAttr, szBox[ 0 ] ); /* Upper left corner */
Col = ( Height > 1 ? Left + 1 : Left );
if(Col < 0 )
{
Width += Col;
Col = 0;
}
if( Right >= hb_gt_GetScreenWidth() )
{
Width -= Right - hb_gt_GetScreenWidth() + 1;
}
if( Col <= Right && Col < hb_gt_GetScreenWidth() && Top >= 0 && Top < hb_gt_GetScreenHeight() )
hb_gt_Replicate( Top, Col, byAttr, szBox[ 1 ], Width + ( (Right - Left) > 1 ? -2 : 0 ) ); /* Top line */
if( Height > 1 && (Right - Left) > 1 && Right < hb_gt_GetScreenWidth() && Top >= 0 && Top < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Top, Right, byAttr, szBox[ 2 ] ); /* Upper right corner */
if( szBox[ 8 ] && Height > 2 && Width > 2 )
{
for( Row = Top + 1; Row < Bottom; Row++ )
{
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
Col = Left;
if( Col < 0 )
Col = 0; // The width was corrected earlier.
else
hb_gt_xPutch( Row, Col++, byAttr, szBox[ 7 ] ); /* Left side */
hb_gt_Replicate( Row, Col, byAttr, szBox[ 8 ], Width - 2 ); /* Fill */
if( Right < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Right, byAttr, szBox[ 3 ] ); /* Right side */
}
}
}
else
{
for( Row = ( Width > 1 ? Top + 1 : Top ); Row < ( (Right - Left ) > 1 ? Bottom : Bottom + 1 ); Row++ )
{
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
if( Left >= 0 && Left < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Left, byAttr, szBox[ 7 ] ); /* Left side */
if( ( Width > 1 || Left < 0 ) && Right < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Right, byAttr, szBox[ 3 ] ); /* Right side */
}
}
}
if( Height > 1 && Width > 1 )
{
if( Left >= 0 && Bottom < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Bottom, Left, byAttr, szBox[ 6 ] ); /* Bottom left corner */
Col = Left + 1;
if( Col < 0 )
Col = 0; // And use the width that was calculated earlier.
if( Col <= Right && Bottom < hb_gt_GetScreenHeight() )
hb_gt_Replicate( Bottom, Col, byAttr, szBox[ 5 ], Width - 2 ); /* Bottom line */
if( Right < hb_gt_GetScreenWidth() && Bottom < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Bottom, Right, byAttr, szBox[ 4 ] ); /* Bottom right corner */
}
hb_gt_DispEnd();
ret = 0;
}
if( uiHeight > 1 && uiWidth > 1 )
return ret;
}
USHORT hb_gt_BoxD( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
}
USHORT hb_gt_BoxS( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
}
USHORT hb_gt_HorizLine( SHORT Row, SHORT Left, SHORT Right, BYTE byChar, BYTE byAttr )
{
USHORT ret = 1;
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
hb_gt_xPutch( uiBottom, uiLeft, byAttr, szBox[ 6 ] ); /* Bottom left corner */
if( Left < 0 )
Left = 0;
else if( Left >= hb_gt_GetScreenWidth() )
Left = hb_gt_GetScreenWidth() - 1;
if( Right < 0 )
Right = 0;
else if( Right >= hb_gt_GetScreenWidth() )
Right = hb_gt_GetScreenWidth() - 1;
uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft );
if( uiCol <= uiRight && uiHeight > 1 )
hb_gt_Replicate( uiBottom, uiCol, byAttr, szBox[ 5 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Bottom line */
hb_gt_xPutch( uiBottom, uiRight, byAttr, szBox[ 4 ] ); /* Bottom right corner */
if( Left < Right )
hb_gt_Replicate( Row, Left, byAttr, byChar, Right - Left + 1 );
else
hb_gt_Replicate( Row, Right, byAttr, byChar, Left - Right + 1 );
ret = 0;
}
hb_gt_DispEnd();
return 0;
return ret;
}
USHORT hb_gt_BoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
USHORT hb_gt_VertLine( SHORT Col, SHORT Top, SHORT Bottom, BYTE byChar, BYTE byAttr )
{
return hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
}
USHORT ret = 1;
SHORT Row;
USHORT hb_gt_BoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
}
USHORT hb_gt_HorizLine( USHORT uiRow, USHORT uiLeft, USHORT uiRight, BYTE byChar, BYTE byAttr )
{
if( uiLeft < uiRight )
hb_gt_Replicate( uiRow, uiLeft, byAttr, byChar, uiRight - uiLeft + 1 );
else
hb_gt_Replicate( uiRow, uiRight, byAttr, byChar, uiLeft - uiRight + 1 );
return 0;
}
USHORT hb_gt_VertLine( USHORT uiCol, USHORT uiTop, USHORT uiBottom, BYTE byChar, BYTE byAttr )
{
USHORT uRow;
if( uiTop <= uiBottom )
uRow = uiTop;
else
if( Col >= 0 && Col < hb_gt_GetScreenWidth() )
{
uRow = uiBottom;
uiBottom = uiTop;
if( Top < 0 )
Top = 0;
else if( Top >= hb_gt_GetScreenHeight() )
Top = hb_gt_GetScreenHeight() - 1;
if( Bottom < 0 )
Bottom = 0;
else if( Bottom >= hb_gt_GetScreenHeight() )
Bottom = hb_gt_GetScreenHeight() - 1;
if( Top <= Bottom )
Row = Top;
else
{
Row = Bottom;
Bottom = Top;
}
while( Row <= Bottom )
hb_gt_xPutch( Row++, Col, byAttr, byChar );
ret = 0;
}
while( uRow <= uiBottom )
hb_gt_xPutch( uRow++, uiCol, byAttr, byChar );
return 0;
return ret;
}
/* some definitions */

View File

@@ -878,118 +878,177 @@ void hb_gt_Replicate( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE byChar, ULON
}
}
USHORT hb_gt_Box( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
BYTE *szBox, BYTE byAttr )
USHORT hb_gt_Box( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right,
BYTE * szBox, BYTE byAttr )
{
USHORT uiRow;
USHORT uiCol;
USHORT uiHeight;
USHORT uiWidth;
USHORT ret = 1;
SHORT Row;
SHORT Col;
SHORT Height;
SHORT Width;
/* Ensure that box is drawn from top left to bottom right. */
if( uiTop > uiBottom )
if( Left >= 0 || Left < hb_gt_GetScreenWidth()
|| Right >= 0 || Right < hb_gt_GetScreenWidth()
|| Top >= 0 || Top < hb_gt_GetScreenHeight()
|| Bottom >= 0 || Bottom < hb_gt_GetScreenHeight() )
{
USHORT tmp = uiTop;
uiTop = uiBottom;
uiBottom = tmp;
}
if( uiLeft > uiRight )
{
USHORT tmp = uiLeft;
uiLeft = uiRight;
uiRight = tmp;
}
uiRow = uiTop;
uiCol = uiLeft;
/* Draw the box or line as specified */
uiHeight = uiBottom - uiTop + 1;
uiWidth = uiRight - uiLeft + 1;
hb_gt_DispBegin();
if( uiHeight > 1 && uiWidth > 1 )
hb_gt_xPutch( uiRow, uiCol, byAttr, szBox[ 0 ] ); /* Upper left corner */
uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft );
if( uiCol <= uiRight )
hb_gt_Replicate( uiRow, uiCol, byAttr, szBox[ 1 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Top line */
if( uiHeight > 1 && uiWidth > 1 )
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 2 ] ); /* Upper right corner */
if( szBox[ 8 ] && uiHeight > 2 && uiWidth > 2 )
{
for( uiRow = uiTop + 1; uiRow < uiBottom; uiRow++ )
/* Ensure that box is drawn from top left to bottom right. */
if( Top > Bottom )
{
uiCol = uiLeft;
hb_gt_xPutch( uiRow, uiCol++, byAttr, szBox[ 7 ] ); /* Left side */
hb_gt_Replicate( uiRow, uiCol, byAttr, szBox[ 8 ], uiRight - uiLeft - 1 ); /* Fill */
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */
SHORT tmp = Top;
Top = Bottom;
Bottom = tmp;
}
}
else
{
for( uiRow = ( uiWidth > 1 ? uiTop + 1 : uiTop ); uiRow < ( uiWidth > 1 ? uiBottom : uiBottom + 1 ); uiRow++ )
if( Left > Right )
{
hb_gt_xPutch( uiRow, uiLeft, byAttr, szBox[ 7 ] ); /* Left side */
if( uiWidth > 1 )
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */
SHORT tmp = Left;
Left = Right;
Right = tmp;
}
/* Draw the box or line as specified */
Height = Bottom - Top + 1;
Width = Right - Left + 1;
hb_gt_DispBegin();
if( Height > 1 && Width > 1 && Top >= 0 && Top < hb_gt_GetScreenHeight() && Left >= 0 && Left < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Top, Left, byAttr, szBox[ 0 ] ); /* Upper left corner */
Col = ( Height > 1 ? Left + 1 : Left );
if(Col < 0 )
{
Width += Col;
Col = 0;
}
if( Right >= hb_gt_GetScreenWidth() )
{
Width -= Right - hb_gt_GetScreenWidth() + 1;
}
if( Col <= Right && Col < hb_gt_GetScreenWidth() && Top >= 0 && Top < hb_gt_GetScreenHeight() )
hb_gt_Replicate( Top, Col, byAttr, szBox[ 1 ], Width + ( (Right - Left) > 1 ? -2 : 0 ) ); /* Top line */
if( Height > 1 && (Right - Left) > 1 && Right < hb_gt_GetScreenWidth() && Top >= 0 && Top < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Top, Right, byAttr, szBox[ 2 ] ); /* Upper right corner */
if( szBox[ 8 ] && Height > 2 && Width > 2 )
{
for( Row = Top + 1; Row < Bottom; Row++ )
{
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
Col = Left;
if( Col < 0 )
Col = 0; // The width was corrected earlier.
else
hb_gt_xPutch( Row, Col++, byAttr, szBox[ 7 ] ); /* Left side */
hb_gt_Replicate( Row, Col, byAttr, szBox[ 8 ], Width - 2 ); /* Fill */
if( Right < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Right, byAttr, szBox[ 3 ] ); /* Right side */
}
}
}
else
{
for( Row = ( Width > 1 ? Top + 1 : Top ); Row < ( (Right - Left ) > 1 ? Bottom : Bottom + 1 ); Row++ )
{
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
if( Left >= 0 && Left < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Left, byAttr, szBox[ 7 ] ); /* Left side */
if( ( Width > 1 || Left < 0 ) && Right < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Right, byAttr, szBox[ 3 ] ); /* Right side */
}
}
}
if( Height > 1 && Width > 1 )
{
if( Left >= 0 && Bottom < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Bottom, Left, byAttr, szBox[ 6 ] ); /* Bottom left corner */
Col = Left + 1;
if( Col < 0 )
Col = 0; // And use the width that was calculated earlier.
if( Col <= Right && Bottom < hb_gt_GetScreenHeight() )
hb_gt_Replicate( Bottom, Col, byAttr, szBox[ 5 ], Width - 2 ); /* Bottom line */
if( Right < hb_gt_GetScreenWidth() && Bottom < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Bottom, Right, byAttr, szBox[ 4 ] ); /* Bottom right corner */
}
hb_gt_DispEnd();
ret = 0;
}
if( uiHeight > 1 && uiWidth > 1 )
return ret;
}
USHORT hb_gt_BoxD( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
}
USHORT hb_gt_BoxS( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
}
USHORT hb_gt_HorizLine( SHORT Row, SHORT Left, SHORT Right, BYTE byChar, BYTE byAttr )
{
USHORT ret = 1;
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
hb_gt_xPutch( uiBottom, uiLeft, byAttr, szBox[ 6 ] ); /* Bottom left corner */
if( Left < 0 )
Left = 0;
else if( Left >= hb_gt_GetScreenWidth() )
Left = hb_gt_GetScreenWidth() - 1;
if( Right < 0 )
Right = 0;
else if( Right >= hb_gt_GetScreenWidth() )
Right = hb_gt_GetScreenWidth() - 1;
uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft );
if( uiCol <= uiRight && uiHeight > 1 )
hb_gt_Replicate( uiBottom, uiCol, byAttr, szBox[ 5 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Bottom line */
hb_gt_xPutch( uiBottom, uiRight, byAttr, szBox[ 4 ] ); /* Bottom right corner */
if( Left < Right )
hb_gt_Replicate( Row, Left, byAttr, byChar, Right - Left + 1 );
else
hb_gt_Replicate( Row, Right, byAttr, byChar, Left - Right + 1 );
ret = 0;
}
hb_gt_DispEnd();
return 0;
return ret;
}
USHORT hb_gt_BoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
USHORT hb_gt_VertLine( SHORT Col, SHORT Top, SHORT Bottom, BYTE byChar, BYTE byAttr )
{
return hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
}
USHORT ret = 1;
SHORT Row;
USHORT hb_gt_BoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
}
USHORT hb_gt_HorizLine( USHORT uiRow, USHORT uiLeft, USHORT uiRight, BYTE byChar, BYTE byAttr )
{
if( uiLeft < uiRight )
hb_gt_Replicate( uiRow, uiLeft, byAttr, byChar, uiRight - uiLeft + 1 );
else
hb_gt_Replicate( uiRow, uiRight, byAttr, byChar, uiLeft - uiRight + 1 );
return 0;
}
USHORT hb_gt_VertLine( USHORT uiCol, USHORT uiTop, USHORT uiBottom, BYTE byChar, BYTE byAttr )
{
USHORT uRow;
if( uiTop <= uiBottom )
uRow = uiTop;
else
if( Col >= 0 && Col < hb_gt_GetScreenWidth() )
{
uRow = uiBottom;
uiBottom = uiTop;
if( Top < 0 )
Top = 0;
else if( Top >= hb_gt_GetScreenHeight() )
Top = hb_gt_GetScreenHeight() - 1;
if( Bottom < 0 )
Bottom = 0;
else if( Bottom >= hb_gt_GetScreenHeight() )
Bottom = hb_gt_GetScreenHeight() - 1;
if( Top <= Bottom )
Row = Top;
else
{
Row = Bottom;
Bottom = Top;
}
while( Row <= Bottom )
hb_gt_xPutch( Row++, Col, byAttr, byChar );
ret = 0;
}
while( uRow <= uiBottom )
hb_gt_xPutch( uRow++, uiCol, byAttr, byChar );
return 0;
return ret;
}
BOOL hb_gt_PreExt()

View File

@@ -479,118 +479,177 @@ void hb_gt_Replicate( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE byChar, ULON
}
}
USHORT hb_gt_Box( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
BYTE *szBox, BYTE byAttr )
USHORT hb_gt_Box( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right,
BYTE * szBox, BYTE byAttr )
{
USHORT uiRow;
USHORT uiCol;
USHORT uiHeight;
USHORT uiWidth;
USHORT ret = 1;
SHORT Row;
SHORT Col;
SHORT Height;
SHORT Width;
/* Ensure that box is drawn from top left to bottom right. */
if( uiTop > uiBottom )
if( Left >= 0 || Left < hb_gt_GetScreenWidth()
|| Right >= 0 || Right < hb_gt_GetScreenWidth()
|| Top >= 0 || Top < hb_gt_GetScreenHeight()
|| Bottom >= 0 || Bottom < hb_gt_GetScreenHeight() )
{
USHORT tmp = uiTop;
uiTop = uiBottom;
uiBottom = tmp;
}
if( uiLeft > uiRight )
{
USHORT tmp = uiLeft;
uiLeft = uiRight;
uiRight = tmp;
}
uiRow = uiTop;
uiCol = uiLeft;
/* Draw the box or line as specified */
uiHeight = uiBottom - uiTop + 1;
uiWidth = uiRight - uiLeft + 1;
hb_gt_DispBegin();
if( uiHeight > 1 && uiWidth > 1 )
hb_gt_xPutch( uiRow, uiCol, byAttr, szBox[ 0 ] ); /* Upper left corner */
uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft );
if( uiCol <= uiRight )
hb_gt_Replicate( uiRow, uiCol, byAttr, szBox[ 1 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Top line */
if( uiHeight > 1 && uiWidth > 1 )
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 2 ] ); /* Upper right corner */
if( szBox[ 8 ] && uiHeight > 2 && uiWidth > 2 )
{
for( uiRow = uiTop + 1; uiRow < uiBottom; uiRow++ )
/* Ensure that box is drawn from top left to bottom right. */
if( Top > Bottom )
{
uiCol = uiLeft;
hb_gt_xPutch( uiRow, uiCol++, byAttr, szBox[ 7 ] ); /* Left side */
hb_gt_Replicate( uiRow, uiCol, byAttr, szBox[ 8 ], uiRight - uiLeft - 1 ); /* Fill */
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */
SHORT tmp = Top;
Top = Bottom;
Bottom = tmp;
}
}
else
{
for( uiRow = ( uiWidth > 1 ? uiTop + 1 : uiTop ); uiRow < ( uiWidth > 1 ? uiBottom : uiBottom + 1 ); uiRow++ )
if( Left > Right )
{
hb_gt_xPutch( uiRow, uiLeft, byAttr, szBox[ 7 ] ); /* Left side */
if( uiWidth > 1 )
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */
SHORT tmp = Left;
Left = Right;
Right = tmp;
}
/* Draw the box or line as specified */
Height = Bottom - Top + 1;
Width = Right - Left + 1;
hb_gt_DispBegin();
if( Height > 1 && Width > 1 && Top >= 0 && Top < hb_gt_GetScreenHeight() && Left >= 0 && Left < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Top, Left, byAttr, szBox[ 0 ] ); /* Upper left corner */
Col = ( Height > 1 ? Left + 1 : Left );
if(Col < 0 )
{
Width += Col;
Col = 0;
}
if( Right >= hb_gt_GetScreenWidth() )
{
Width -= Right - hb_gt_GetScreenWidth() + 1;
}
if( Col <= Right && Col < hb_gt_GetScreenWidth() && Top >= 0 && Top < hb_gt_GetScreenHeight() )
hb_gt_Replicate( Top, Col, byAttr, szBox[ 1 ], Width + ( (Right - Left) > 1 ? -2 : 0 ) ); /* Top line */
if( Height > 1 && (Right - Left) > 1 && Right < hb_gt_GetScreenWidth() && Top >= 0 && Top < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Top, Right, byAttr, szBox[ 2 ] ); /* Upper right corner */
if( szBox[ 8 ] && Height > 2 && Width > 2 )
{
for( Row = Top + 1; Row < Bottom; Row++ )
{
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
Col = Left;
if( Col < 0 )
Col = 0; // The width was corrected earlier.
else
hb_gt_xPutch( Row, Col++, byAttr, szBox[ 7 ] ); /* Left side */
hb_gt_Replicate( Row, Col, byAttr, szBox[ 8 ], Width - 2 ); /* Fill */
if( Right < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Right, byAttr, szBox[ 3 ] ); /* Right side */
}
}
}
else
{
for( Row = ( Width > 1 ? Top + 1 : Top ); Row < ( (Right - Left ) > 1 ? Bottom : Bottom + 1 ); Row++ )
{
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
if( Left >= 0 && Left < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Left, byAttr, szBox[ 7 ] ); /* Left side */
if( ( Width > 1 || Left < 0 ) && Right < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Right, byAttr, szBox[ 3 ] ); /* Right side */
}
}
}
if( Height > 1 && Width > 1 )
{
if( Left >= 0 && Bottom < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Bottom, Left, byAttr, szBox[ 6 ] ); /* Bottom left corner */
Col = Left + 1;
if( Col < 0 )
Col = 0; // And use the width that was calculated earlier.
if( Col <= Right && Bottom < hb_gt_GetScreenHeight() )
hb_gt_Replicate( Bottom, Col, byAttr, szBox[ 5 ], Width - 2 ); /* Bottom line */
if( Right < hb_gt_GetScreenWidth() && Bottom < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Bottom, Right, byAttr, szBox[ 4 ] ); /* Bottom right corner */
}
hb_gt_DispEnd();
ret = 0;
}
if( uiHeight > 1 && uiWidth > 1 )
return ret;
}
USHORT hb_gt_BoxD( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
}
USHORT hb_gt_BoxS( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
}
USHORT hb_gt_HorizLine( SHORT Row, SHORT Left, SHORT Right, BYTE byChar, BYTE byAttr )
{
USHORT ret = 1;
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
hb_gt_xPutch( uiBottom, uiLeft, byAttr, szBox[ 6 ] ); /* Bottom left corner */
if( Left < 0 )
Left = 0;
else if( Left >= hb_gt_GetScreenWidth() )
Left = hb_gt_GetScreenWidth() - 1;
if( Right < 0 )
Right = 0;
else if( Right >= hb_gt_GetScreenWidth() )
Right = hb_gt_GetScreenWidth() - 1;
uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft );
if( uiCol <= uiRight && uiHeight > 1 )
hb_gt_Replicate( uiBottom, uiCol, byAttr, szBox[ 5 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Bottom line */
hb_gt_xPutch( uiBottom, uiRight, byAttr, szBox[ 4 ] ); /* Bottom right corner */
if( Left < Right )
hb_gt_Replicate( Row, Left, byAttr, byChar, Right - Left + 1 );
else
hb_gt_Replicate( Row, Right, byAttr, byChar, Left - Right + 1 );
ret = 0;
}
hb_gt_DispEnd();
return 0;
return ret;
}
USHORT hb_gt_BoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
USHORT hb_gt_VertLine( SHORT Col, SHORT Top, SHORT Bottom, BYTE byChar, BYTE byAttr )
{
return hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
}
USHORT ret = 1;
SHORT Row;
USHORT hb_gt_BoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
}
USHORT hb_gt_HorizLine( USHORT uiRow, USHORT uiLeft, USHORT uiRight, BYTE byChar, BYTE byAttr )
{
if( uiLeft < uiRight )
hb_gt_Replicate( uiRow, uiLeft, byAttr, byChar, uiRight - uiLeft + 1 );
else
hb_gt_Replicate( uiRow, uiRight, byAttr, byChar, uiLeft - uiRight + 1 );
return 0;
}
USHORT hb_gt_VertLine( USHORT uiCol, USHORT uiTop, USHORT uiBottom, BYTE byChar, BYTE byAttr )
{
USHORT uRow;
if( uiTop <= uiBottom )
uRow = uiTop;
else
if( Col >= 0 && Col < hb_gt_GetScreenWidth() )
{
uRow = uiBottom;
uiBottom = uiTop;
if( Top < 0 )
Top = 0;
else if( Top >= hb_gt_GetScreenHeight() )
Top = hb_gt_GetScreenHeight() - 1;
if( Bottom < 0 )
Bottom = 0;
else if( Bottom >= hb_gt_GetScreenHeight() )
Bottom = hb_gt_GetScreenHeight() - 1;
if( Top <= Bottom )
Row = Top;
else
{
Row = Bottom;
Bottom = Top;
}
while( Row <= Bottom )
hb_gt_xPutch( Row++, Col, byAttr, byChar );
ret = 0;
}
while( uRow <= uiBottom )
hb_gt_xPutch( uRow++, uiCol, byAttr, byChar );
return 0;
return ret;
}
BOOL hb_gt_PreExt()

View File

@@ -849,154 +849,216 @@ void hb_gt_Replicate( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE byChar, ULON
/* *********************************************************************** */
USHORT hb_gt_Box( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
BYTE *szBox, BYTE byAttr )
USHORT hb_gt_Box( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right,
BYTE * szBox, BYTE byAttr )
{
USHORT uiRow;
USHORT uiCol;
USHORT uiHeight;
USHORT uiWidth;
USHORT ret = 1;
SHORT Row;
SHORT Col;
SHORT Height;
SHORT Width;
/* a box drawing hack */
BOOL SaveUseAltChar = s_bUse_Alt_Char_Hack;
/* a box drawing hack */
s_bUse_Alt_Char_Hack = TRUE;
/* Ensure that box is drawn from top left to bottom right. */
if( uiTop > uiBottom )
if( Left >= 0 || Left < hb_gt_GetScreenWidth()
|| Right >= 0 || Right < hb_gt_GetScreenWidth()
|| Top >= 0 || Top < hb_gt_GetScreenHeight()
|| Bottom >= 0 || Bottom < hb_gt_GetScreenHeight() )
{
USHORT tmp = uiTop;
uiTop = uiBottom;
uiBottom = tmp;
}
if( uiLeft > uiRight )
{
USHORT tmp = uiLeft;
uiLeft = uiRight;
uiRight = tmp;
}
uiRow = uiTop;
uiCol = uiLeft;
/* Draw the box or line as specified */
uiHeight = uiBottom - uiTop + 1;
uiWidth = uiRight - uiLeft + 1;
hb_gt_DispBegin();
if( uiHeight > 1 && uiWidth > 1 )
hb_gt_xPutch( uiRow, uiCol, byAttr, szBox[ 0 ] ); /* Upper left corner */
uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft );
if( uiCol <= uiRight )
hb_gt_Replicate( uiRow, uiCol, byAttr, szBox[ 1 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Top line */
if( uiHeight > 1 && uiWidth > 1 )
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 2 ] ); /* Upper right corner */
if( szBox[ 8 ] && uiHeight > 2 && uiWidth > 2 )
for( uiRow = uiTop + 1; uiRow < uiBottom; uiRow++ )
/* Ensure that box is drawn from top left to bottom right. */
if( Top > Bottom )
{
uiCol = uiLeft;
hb_gt_xPutch( uiRow, uiCol++, byAttr, szBox[ 7 ] ); /* Left side */
hb_gt_Replicate( uiRow, uiCol, byAttr, szBox[ 8 ], uiRight - uiLeft - 1 ); /* Fill */
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */
SHORT tmp = Top;
Top = Bottom;
Bottom = tmp;
}
else
for( uiRow = ( uiWidth > 1 ? uiTop + 1 : uiTop ); uiRow < ( uiWidth > 1 ? uiBottom : uiBottom + 1 ); uiRow++ )
if( Left > Right )
{
hb_gt_xPutch( uiRow, uiLeft, byAttr, szBox[ 7 ] ); /* Left side */
if( uiWidth > 1 )
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */
SHORT tmp = Left;
Left = Right;
Right = tmp;
}
if( uiHeight > 1 && uiWidth > 1 )
{
hb_gt_xPutch( uiBottom, uiLeft, byAttr, szBox[ 6 ] ); /* Bottom left corner */
/* Draw the box or line as specified */
Height = Bottom - Top + 1;
Width = Right - Left + 1;
uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft );
hb_gt_DispBegin();
if( uiCol <= uiRight && uiHeight > 1 )
hb_gt_Replicate( uiBottom, uiCol, byAttr, szBox[ 5 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Bottom line */
if( Height > 1 && Width > 1 && Top >= 0 && Top < hb_gt_GetScreenHeight() && Left >= 0 && Left < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Top, Left, byAttr, szBox[ 0 ] ); /* Upper left corner */
hb_gt_xPutch( uiBottom, uiRight, byAttr, szBox[ 4 ] ); /* Bottom right corner */
Col = ( Height > 1 ? Left + 1 : Left );
if(Col < 0 )
{
Width += Col;
Col = 0;
}
if( Right >= hb_gt_GetScreenWidth() )
{
Width -= Right - hb_gt_GetScreenWidth() + 1;
}
if( Col <= Right && Col < hb_gt_GetScreenWidth() && Top >= 0 && Top < hb_gt_GetScreenHeight() )
hb_gt_Replicate( Top, Col, byAttr, szBox[ 1 ], Width + ( (Right - Left) > 1 ? -2 : 0 ) ); /* Top line */
if( Height > 1 && (Right - Left) > 1 && Right < hb_gt_GetScreenWidth() && Top >= 0 && Top < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Top, Right, byAttr, szBox[ 2 ] ); /* Upper right corner */
if( szBox[ 8 ] && Height > 2 && Width > 2 )
{
for( Row = Top + 1; Row < Bottom; Row++ )
{
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
Col = Left;
if( Col < 0 )
Col = 0; // The width was corrected earlier.
else
hb_gt_xPutch( Row, Col++, byAttr, szBox[ 7 ] ); /* Left side */
hb_gt_Replicate( Row, Col, byAttr, szBox[ 8 ], Width - 2 ); /* Fill */
if( Right < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Right, byAttr, szBox[ 3 ] ); /* Right side */
}
}
}
else
{
for( Row = ( Width > 1 ? Top + 1 : Top ); Row < ( (Right - Left ) > 1 ? Bottom : Bottom + 1 ); Row++ )
{
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
if( Left >= 0 && Left < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Left, byAttr, szBox[ 7 ] ); /* Left side */
if( ( Width > 1 || Left < 0 ) && Right < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Right, byAttr, szBox[ 3 ] ); /* Right side */
}
}
}
if( Height > 1 && Width > 1 )
{
if( Left >= 0 && Bottom < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Bottom, Left, byAttr, szBox[ 6 ] ); /* Bottom left corner */
Col = Left + 1;
if( Col < 0 )
Col = 0; // And use the width that was calculated earlier.
if( Col <= Right && Bottom < hb_gt_GetScreenHeight() )
hb_gt_Replicate( Bottom, Col, byAttr, szBox[ 5 ], Width - 2 ); /* Bottom line */
if( Right < hb_gt_GetScreenWidth() && Bottom < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Bottom, Right, byAttr, szBox[ 4 ] ); /* Bottom right corner */
}
hb_gt_DispEnd();
/* NOTE : enable this if problems with cursor positioning occur */
/* SLsmg_gotorc( uiTop + 1, uiLeft + 1 ); */
hb_gt_DispEnd();
/* a box drawing hack */
s_bUse_Alt_Char_Hack = SaveUseAltChar;
ret = 0;
}
/* NOTE : enable this if problems with cursor positioning occur */
/* SLsmg_gotorc( uiTop + 1, uiLeft + 1 ); */
hb_gt_DispEnd();
/* a box drawing hack */
s_bUse_Alt_Char_Hack = SaveUseAltChar;
return 0;
return ret;
}
/* *********************************************************************** */
USHORT hb_gt_BoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
USHORT hb_gt_BoxD( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
return hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
}
/* *********************************************************************** */
USHORT hb_gt_BoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
USHORT hb_gt_BoxS( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
return hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
}
/* *********************************************************************** */
USHORT hb_gt_HorizLine( USHORT uiRow, USHORT uiLeft, USHORT uiRight, BYTE byChar, BYTE byAttr )
USHORT hb_gt_HorizLine( SHORT Row, SHORT Left, SHORT Right, BYTE byChar, BYTE byAttr )
{
USHORT ret = 1;
BOOL SaveUseAltChar = s_bUse_Alt_Char_Hack;
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
/* a box drawing hack */
s_bUse_Alt_Char_Hack = TRUE;
/* a box drawing hack */
s_bUse_Alt_Char_Hack = TRUE;
if( uiLeft < uiRight )
hb_gt_Replicate( uiRow, uiLeft, byAttr, byChar, uiRight - uiLeft + 1 );
else
hb_gt_Replicate( uiRow, uiRight, byAttr, byChar, uiLeft - uiRight + 1 );
if( Left < 0 )
Left = 0;
else if( Left >= hb_gt_GetScreenWidth() )
Left = hb_gt_GetScreenWidth() - 1;
if( Right < 0 )
Right = 0;
else if( Right >= hb_gt_GetScreenWidth() )
Right = hb_gt_GetScreenWidth() - 1;
/* a box drawing hack */
s_bUse_Alt_Char_Hack = SaveUseAltChar;
if( Left < Right )
hb_gt_Replicate( Row, Left, byAttr, byChar, Right - Left + 1 );
else
hb_gt_Replicate( Row, Right, byAttr, byChar, Left - Right + 1 );
return 0;
/* a box drawing hack */
s_bUse_Alt_Char_Hack = SaveUseAltChar;
ret = 0;
}
return ret;
}
/* *********************************************************************** */
USHORT hb_gt_VertLine( USHORT uiCol, USHORT uiTop, USHORT uiBottom, BYTE byChar, BYTE byAttr )
USHORT hb_gt_VertLine( SHORT Col, SHORT Top, SHORT Bottom, BYTE byChar, BYTE byAttr )
{
USHORT ret = 1;
USHORT uRow;
BOOL SaveUseAltChar = s_bUse_Alt_Char_Hack;
if( uiTop <= uiBottom )
uRow = uiTop;
else
if( Col >= 0 && Col < hb_gt_GetScreenWidth() )
{
uRow = uiBottom;
uiBottom = uiTop;
/* a box drawing hack */
s_bUse_Alt_Char_Hack = TRUE;
if( Top < 0 )
Top = 0;
else if( Top >= hb_gt_GetScreenHeight() )
Top = hb_gt_GetScreenHeight() - 1;
if( Bottom < 0 )
Bottom = 0;
else if( Bottom >= hb_gt_GetScreenHeight() )
Bottom = hb_gt_GetScreenHeight() - 1;
if( Top <= Bottom )
uRow = Top;
else
{
uRow = Bottom;
Bottom = Top;
}
while( uRow <= Bottom )
hb_gt_xPutch( uRow++, Col, byAttr, byChar );
/* a box drawing hack */
s_bUse_Alt_Char_Hack = SaveUseAltChar;
hb_gt_SetPos( Bottom + 1, Col, HB_GT_SET_POS_AFTER );
ret = 0;
}
/* a box drawing hack */
s_bUse_Alt_Char_Hack = TRUE;
while( uRow <= uiBottom )
hb_gt_xPutch( uRow++, uiCol, byAttr, byChar );
/* a box drawing hack */
s_bUse_Alt_Char_Hack = SaveUseAltChar;
hb_gt_SetPos( uiBottom + 1, uiCol, HB_GT_SET_POS_AFTER );
return 0;
return ret;
}
/* *********************************************************************** */

View File

@@ -574,127 +574,177 @@ void hb_gt_Replicate( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE byChar, ULON
hb_gt_xPutch( uiRow, uiCol++, byAttr, byChar );
}
USHORT hb_gt_Box( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
BYTE *szBox, BYTE byAttr )
USHORT hb_gt_Box( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right,
BYTE * szBox, BYTE byAttr )
{
USHORT uiRow;
USHORT uiCol;
USHORT uiHeight;
USHORT uiWidth;
USHORT ret = 1;
SHORT Row;
SHORT Col;
SHORT Height;
SHORT Width;
/* Ensure that box is drawn from top left to bottom right. */
if( uiTop > uiBottom )
if( Left >= 0 || Left < hb_gt_GetScreenWidth()
|| Right >= 0 || Right < hb_gt_GetScreenWidth()
|| Top >= 0 || Top < hb_gt_GetScreenHeight()
|| Bottom >= 0 || Bottom < hb_gt_GetScreenHeight() )
{
USHORT tmp = uiTop;
uiTop = uiBottom;
uiBottom = tmp;
}
if( uiLeft > uiRight )
{
USHORT tmp = uiLeft;
uiLeft = uiRight;
uiRight = tmp;
}
uiRow = uiTop;
uiCol = uiLeft;
/* Draw the box or line as specified */
uiHeight = uiBottom - uiTop + 1;
uiWidth = uiRight - uiLeft + 1;
hb_gt_DispBegin();
if( uiHeight > 1 && uiWidth > 1 )
hb_gt_xPutch( uiRow, uiCol, byAttr, szBox[ 0 ] ); /* Upper left corner */
uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft );
if( uiCol <= uiRight )
hb_gt_Replicate( uiRow, uiCol, byAttr, szBox[ 1 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Top line */
if( uiHeight > 1 && uiWidth > 1 )
{
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 2 ] ); /* Upper right corner */
}
if( szBox[ 8 ] && uiHeight > 2 && uiWidth > 2 )
{
for( uiRow = uiTop + 1; uiRow < uiBottom; uiRow++ )
/* Ensure that box is drawn from top left to bottom right. */
if( Top > Bottom )
{
uiCol = uiLeft;
hb_gt_xPutch( uiRow, uiCol++, byAttr, szBox[ 7 ] ); /* Left side */
hb_gt_Replicate( uiRow, uiCol, byAttr, szBox[ 8 ], uiRight - uiLeft - 1 ); /* Fill */
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */
SHORT tmp = Top;
Top = Bottom;
Bottom = tmp;
}
}
else
{
for( uiRow = ( uiWidth > 1 ? uiTop + 1 : uiTop ); uiRow < ( uiWidth > 1 ? uiBottom : uiBottom + 1 ); uiRow++ )
if( Left > Right )
{
hb_gt_xPutch( uiRow, uiLeft, byAttr, szBox[ 7 ] ); /* Left side */
if( uiWidth > 1 )
SHORT tmp = Left;
Left = Right;
Right = tmp;
}
/* Draw the box or line as specified */
Height = Bottom - Top + 1;
Width = Right - Left + 1;
hb_gt_DispBegin();
if( Height > 1 && Width > 1 && Top >= 0 && Top < hb_gt_GetScreenHeight() && Left >= 0 && Left < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Top, Left, byAttr, szBox[ 0 ] ); /* Upper left corner */
Col = ( Height > 1 ? Left + 1 : Left );
if(Col < 0 )
{
Width += Col;
Col = 0;
}
if( Right >= hb_gt_GetScreenWidth() )
{
Width -= Right - hb_gt_GetScreenWidth() + 1;
}
if( Col <= Right && Col < hb_gt_GetScreenWidth() && Top >= 0 && Top < hb_gt_GetScreenHeight() )
hb_gt_Replicate( Top, Col, byAttr, szBox[ 1 ], Width + ( (Right - Left) > 1 ? -2 : 0 ) ); /* Top line */
if( Height > 1 && (Right - Left) > 1 && Right < hb_gt_GetScreenWidth() && Top >= 0 && Top < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Top, Right, byAttr, szBox[ 2 ] ); /* Upper right corner */
if( szBox[ 8 ] && Height > 2 && Width > 2 )
{
for( Row = Top + 1; Row < Bottom; Row++ )
{
hb_gt_Replicate( uiRow, uiCol, byAttr, ' ', uiWidth - 2 );
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
Col = Left;
if( Col < 0 )
Col = 0; // The width was corrected earlier.
else
hb_gt_xPutch( Row, Col++, byAttr, szBox[ 7 ] ); /* Left side */
hb_gt_Replicate( Row, Col, byAttr, szBox[ 8 ], Width - 2 ); /* Fill */
if( Right < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Right, byAttr, szBox[ 3 ] ); /* Right side */
}
}
}
else
{
for( Row = ( Width > 1 ? Top + 1 : Top ); Row < ( (Right - Left ) > 1 ? Bottom : Bottom + 1 ); Row++ )
{
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
if( Left >= 0 && Left < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Left, byAttr, szBox[ 7 ] ); /* Left side */
if( ( Width > 1 || Left < 0 ) && Right < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Right, byAttr, szBox[ 3 ] ); /* Right side */
}
}
}
if( Height > 1 && Width > 1 )
{
if( Left >= 0 && Bottom < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Bottom, Left, byAttr, szBox[ 6 ] ); /* Bottom left corner */
Col = Left + 1;
if( Col < 0 )
Col = 0; // And use the width that was calculated earlier.
if( Col <= Right && Bottom < hb_gt_GetScreenHeight() )
hb_gt_Replicate( Bottom, Col, byAttr, szBox[ 5 ], Width - 2 ); /* Bottom line */
if( Right < hb_gt_GetScreenWidth() && Bottom < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Bottom, Right, byAttr, szBox[ 4 ] ); /* Bottom right corner */
}
hb_gt_DispEnd();
ret = 0;
}
if( uiHeight > 1 && uiWidth > 1 )
return ret;
}
USHORT hb_gt_BoxD( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
}
USHORT hb_gt_BoxS( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
}
USHORT hb_gt_HorizLine( SHORT Row, SHORT Left, SHORT Right, BYTE byChar, BYTE byAttr )
{
USHORT ret = 1;
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
hb_gt_xPutch( uiBottom, uiLeft, byAttr, szBox[ 6 ] ); /* Bottom left corner */
if( Left < 0 )
Left = 0;
else if( Left >= hb_gt_GetScreenWidth() )
Left = hb_gt_GetScreenWidth() - 1;
if( Right < 0 )
Right = 0;
else if( Right >= hb_gt_GetScreenWidth() )
Right = hb_gt_GetScreenWidth() - 1;
uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft );
if( uiCol <= uiRight && uiHeight > 1 )
hb_gt_Replicate( uiBottom, uiCol, byAttr, szBox[ 5 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Bottom line */
hb_gt_xPutch( uiBottom, uiRight, byAttr, szBox[ 4 ] ); /* Bottom right corner */
if( Left < Right )
hb_gt_Replicate( Row, Left, byAttr, byChar, Right - Left + 1 );
else
hb_gt_Replicate( Row, Right, byAttr, byChar, Left - Right + 1 );
ret = 0;
}
hb_gt_DispEnd();
return 0;
return ret;
}
USHORT hb_gt_BoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
USHORT hb_gt_VertLine( SHORT Col, SHORT Top, SHORT Bottom, BYTE byChar, BYTE byAttr )
{
return hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
}
USHORT ret = 1;
SHORT Row;
USHORT hb_gt_BoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
}
USHORT hb_gt_HorizLine( USHORT uiRow, USHORT uiLeft, USHORT uiRight, BYTE byChar, BYTE byAttr )
{
if( uiLeft < uiRight )
hb_gt_Replicate( uiRow, uiLeft, byAttr, byChar, uiRight - uiLeft + 1 );
else
hb_gt_Replicate( uiRow, uiRight, byAttr, byChar, uiLeft - uiRight + 1 );
return 0;
}
USHORT hb_gt_VertLine( USHORT uiCol, USHORT uiTop, USHORT uiBottom, BYTE byChar, BYTE byAttr )
{
USHORT uRow;
if( uiTop <= uiBottom )
uRow = uiTop;
else
if( Col >= 0 && Col < hb_gt_GetScreenWidth() )
{
uRow = uiBottom;
uiBottom = uiTop;
if( Top < 0 )
Top = 0;
else if( Top >= hb_gt_GetScreenHeight() )
Top = hb_gt_GetScreenHeight() - 1;
if( Bottom < 0 )
Bottom = 0;
else if( Bottom >= hb_gt_GetScreenHeight() )
Bottom = hb_gt_GetScreenHeight() - 1;
if( Top <= Bottom )
Row = Top;
else
{
Row = Bottom;
Bottom = Top;
}
while( Row <= Bottom )
hb_gt_xPutch( Row++, Col, byAttr, byChar );
ret = 0;
}
while( uRow <= uiBottom )
hb_gt_xPutch( uRow++, uiCol, byAttr, byChar );
return 0;
return ret;
}
BOOL hb_gt_PreExt()

View File

@@ -1191,121 +1191,177 @@ USHORT hb_gt_DispCount()
return s_uiDispCount;
}
USHORT hb_gt_Box( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
USHORT hb_gt_Box( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right,
BYTE * szBox, BYTE byAttr )
{
USHORT uiRow;
USHORT uiCol;
USHORT uiHeight;
USHORT uiWidth;
USHORT ret = 1;
SHORT Row;
SHORT Col;
SHORT Height;
SHORT Width;
/* Ensure that box is drawn from top left to bottom right. */
if( uiTop > uiBottom )
if( Left >= 0 || Left < hb_gt_GetScreenWidth()
|| Right >= 0 || Right < hb_gt_GetScreenWidth()
|| Top >= 0 || Top < hb_gt_GetScreenHeight()
|| Bottom >= 0 || Bottom < hb_gt_GetScreenHeight() )
{
USHORT tmp = uiTop;
uiTop = uiBottom;
uiBottom = tmp;
}
if( uiLeft > uiRight )
{
USHORT tmp = uiLeft;
uiLeft = uiRight;
uiRight = tmp;
}
uiRow = uiTop;
uiCol = uiLeft;
/* Draw the box or line as specified */
uiHeight = uiBottom - uiTop + 1;
uiWidth = uiRight - uiLeft + 1;
hb_gt_DispBegin();
if( uiHeight > 1 && uiWidth > 1 )
hb_gt_xPutch( uiRow, uiCol, byAttr, szBox[ 0 ] ); /* Upper left corner */
uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft );
if( uiCol <= uiRight )
hb_gt_Replicate( uiRow, uiCol, byAttr, szBox[ 1 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Top line */
if( uiHeight > 1 && uiWidth > 1 )
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 2 ] ); /* Upper right corner */
if( szBox[ 8 ] && uiHeight > 2 && uiWidth > 2 )
{
for( uiRow = uiTop + 1; uiRow < uiBottom; uiRow++ )
/* Ensure that box is drawn from top left to bottom right. */
if( Top > Bottom )
{
uiCol = uiLeft;
hb_gt_xPutch( uiRow, uiCol++, byAttr, szBox[ 7 ] ); /* Left side */
hb_gt_Replicate( uiRow, uiCol, byAttr, szBox[ 8 ], uiRight - uiLeft - 1 ); /* Fill */
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */
SHORT tmp = Top;
Top = Bottom;
Bottom = tmp;
}
}
else
{
for( uiRow = ( uiWidth > 1 ? uiTop + 1 : uiTop ); uiRow < ( uiWidth > 1 ? uiBottom : uiBottom + 1 ); uiRow++ )
if( Left > Right )
{
hb_gt_xPutch( uiRow, uiLeft, byAttr, szBox[ 7 ] ); /* Left side */
if( uiWidth > 1 )
hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */
SHORT tmp = Left;
Left = Right;
Right = tmp;
}
/* Draw the box or line as specified */
Height = Bottom - Top + 1;
Width = Right - Left + 1;
hb_gt_DispBegin();
if( Height > 1 && Width > 1 && Top >= 0 && Top < hb_gt_GetScreenHeight() && Left >= 0 && Left < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Top, Left, byAttr, szBox[ 0 ] ); /* Upper left corner */
Col = ( Height > 1 ? Left + 1 : Left );
if(Col < 0 )
{
Width += Col;
Col = 0;
}
if( Right >= hb_gt_GetScreenWidth() )
{
Width -= Right - hb_gt_GetScreenWidth() + 1;
}
if( Col <= Right && Col < hb_gt_GetScreenWidth() && Top >= 0 && Top < hb_gt_GetScreenHeight() )
hb_gt_Replicate( Top, Col, byAttr, szBox[ 1 ], Width + ( (Right - Left) > 1 ? -2 : 0 ) ); /* Top line */
if( Height > 1 && (Right - Left) > 1 && Right < hb_gt_GetScreenWidth() && Top >= 0 && Top < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Top, Right, byAttr, szBox[ 2 ] ); /* Upper right corner */
if( szBox[ 8 ] && Height > 2 && Width > 2 )
{
for( Row = Top + 1; Row < Bottom; Row++ )
{
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
Col = Left;
if( Col < 0 )
Col = 0; // The width was corrected earlier.
else
hb_gt_xPutch( Row, Col++, byAttr, szBox[ 7 ] ); /* Left side */
hb_gt_Replicate( Row, Col, byAttr, szBox[ 8 ], Width - 2 ); /* Fill */
if( Right < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Right, byAttr, szBox[ 3 ] ); /* Right side */
}
}
}
else
{
for( Row = ( Width > 1 ? Top + 1 : Top ); Row < ( (Right - Left ) > 1 ? Bottom : Bottom + 1 ); Row++ )
{
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
if( Left >= 0 && Left < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Left, byAttr, szBox[ 7 ] ); /* Left side */
if( ( Width > 1 || Left < 0 ) && Right < hb_gt_GetScreenWidth() )
hb_gt_xPutch( Row, Right, byAttr, szBox[ 3 ] ); /* Right side */
}
}
}
if( Height > 1 && Width > 1 )
{
if( Left >= 0 && Bottom < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Bottom, Left, byAttr, szBox[ 6 ] ); /* Bottom left corner */
Col = Left + 1;
if( Col < 0 )
Col = 0; // And use the width that was calculated earlier.
if( Col <= Right && Bottom < hb_gt_GetScreenHeight() )
hb_gt_Replicate( Bottom, Col, byAttr, szBox[ 5 ], Width - 2 ); /* Bottom line */
if( Right < hb_gt_GetScreenWidth() && Bottom < hb_gt_GetScreenHeight() )
hb_gt_xPutch( Bottom, Right, byAttr, szBox[ 4 ] ); /* Bottom right corner */
}
hb_gt_DispEnd();
ret = 0;
}
if( uiHeight > 1 && uiWidth > 1 )
return ret;
}
USHORT hb_gt_BoxD( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
}
USHORT hb_gt_BoxS( SHORT Top, SHORT Left, SHORT Bottom, SHORT Right, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( Top, Left, Bottom, Right, pbyFrame, byAttr );
}
USHORT hb_gt_HorizLine( SHORT Row, SHORT Left, SHORT Right, BYTE byChar, BYTE byAttr )
{
USHORT ret = 1;
if( Row >= 0 && Row < hb_gt_GetScreenHeight() )
{
hb_gt_xPutch( uiBottom, uiLeft, byAttr, szBox[ 6 ] ); /* Bottom left corner */
if( Left < 0 )
Left = 0;
else if( Left >= hb_gt_GetScreenWidth() )
Left = hb_gt_GetScreenWidth() - 1;
if( Right < 0 )
Right = 0;
else if( Right >= hb_gt_GetScreenWidth() )
Right = hb_gt_GetScreenWidth() - 1;
uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft );
if( uiCol <= uiRight && uiHeight > 1 )
hb_gt_Replicate( uiBottom, uiCol, byAttr, szBox[ 5 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Bottom line */
hb_gt_xPutch( uiBottom, uiRight, byAttr, szBox[ 4 ] ); /* Bottom right corner */
if( Left < Right )
hb_gt_Replicate( Row, Left, byAttr, byChar, Right - Left + 1 );
else
hb_gt_Replicate( Row, Right, byAttr, byChar, Left - Right + 1 );
ret = 0;
}
hb_gt_DispEnd();
return 0;
return ret;
}
USHORT hb_gt_BoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
USHORT hb_gt_VertLine( SHORT Col, SHORT Top, SHORT Bottom, BYTE byChar, BYTE byAttr )
{
return hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
}
USHORT ret = 1;
USHORT Row;
USHORT hb_gt_BoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame, BYTE byAttr )
{
return hb_gt_Box( uiTop, uiLeft, uiBottom, uiRight, pbyFrame, byAttr );
}
USHORT hb_gt_HorizLine( USHORT uiRow, USHORT uiLeft, USHORT uiRight, BYTE byChar, BYTE byAttr )
{
if( uiLeft < uiRight )
hb_gt_Replicate( uiRow, uiLeft, byAttr, byChar, uiRight - uiLeft + 1 );
else
hb_gt_Replicate( uiRow, uiRight, byAttr, byChar, uiLeft - uiRight + 1 );
return 0;
}
USHORT hb_gt_VertLine( USHORT uiCol, USHORT uiTop, USHORT uiBottom, BYTE byChar, BYTE byAttr )
{
USHORT uRow;
if( uiTop <= uiBottom )
uRow = uiTop;
else
if( Col >= 0 && Col < hb_gt_GetScreenWidth() )
{
uRow = uiBottom;
uiBottom = uiTop;
if( Top < 0 )
Top = 0;
else if( Top >= hb_gt_GetScreenHeight() )
Top = hb_gt_GetScreenHeight() - 1;
if( Bottom < 0 )
Bottom = 0;
else if( Bottom >= hb_gt_GetScreenHeight() )
Bottom = hb_gt_GetScreenHeight() - 1;
if( Top <= Bottom )
Row = Top;
else
{
Row = Bottom;
Bottom = Top;
}
while( Row <= Bottom )
hb_gt_xPutch( Row++, Col, byAttr, byChar );
ret = 0;
}
while( uRow <= uiBottom )
hb_gt_xPutch( uRow++, uiCol, byAttr, byChar );
return 0;
return ret;
}
BOOL hb_gt_PreExt()