diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ca8b8b6bb0..e987e913ca 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,33 @@ +2000-07-27 18:30 UTC-0400 David G. Holm + + * source/rtl/gtstd/gtstd.c + * This has become the standard terminal library for CGI programs. + * The MAXROW() and MAXCOL() values are both 32767. + * The row and column positions are maintained independently from + the actual device position. + * If the device scrolls earlier than the GTSTD driver, this will + not be reflected in the GTSTD driver cursor position. + * The column position is maintained if all output is in left to + right order, but will get messed up for any reverse position. + * The row position is maintained if all output is in left to + right and top to bottom order, but the device will only be + scrolled by one line, regardless of row position change. + * All console output goes to stdout and positioning works + within the above limitations. + * The various BOX() functions work to a limited extent (the row + position is ignored, but the column position is honored). + * The on-screen cursor is only set when the cursor position is + being set before text has been displayed, because it is not + possible to set the device cursor without changing it. + + * source/rtl/gtapi.c + * source/rtl/gt*/gt*.c + * The hb_gtSetPos() and hb_gt_SetPos functions now takes a third + parameter that tells if the cursor position is changing before + or after text was displayed. This feature is required by the + GTSTD driver, because it can't set the device position without + actually changing it. + 2000-07-28 00:10 UTC+0200 JfL & RaC * source/rtl/tclass.prg * Some minor modifs I forget to identify before diff --git a/harbour/include/hbapigt.h b/harbour/include/hbapigt.h index 67bdaa70cb..6e6374ada2 100644 --- a/harbour/include/hbapigt.h +++ b/harbour/include/hbapigt.h @@ -85,6 +85,12 @@ extern "C" { #define HB_B_DOUBLE_V 'º' #define HB_B_DOUBLE_H 'Í' +/* Used to tell hb_gt_SetPos() when the cursor position + is being set. Before or after text is or was displayed. +*/ +#define HB_GT_SET_POS_AFTER 1 +#define HB_GT_SET_POS_BEFORE 0 + /* Keyboard filters */ typedef enum @@ -145,7 +151,7 @@ extern USHORT hb_gtSetBlink( BOOL bBlink ); extern USHORT hb_gtSetColorStr( char * pszColorString ); extern USHORT hb_gtSetCursor( USHORT uiCursorShape ); extern USHORT hb_gtSetMode( USHORT uiRows, USHORT uiCols ); -extern USHORT hb_gtSetPos( SHORT iRow, SHORT iCol ); +extern USHORT hb_gtSetPos( SHORT iRow, SHORT iCol, SHORT iMode ); extern USHORT hb_gtSetSnowFlag( BOOL bNoSnow ); extern void hb_gtTone( double dFrequency, double dDuration ); extern USHORT hb_gtWrite( BYTE * pbyStr, ULONG ulLen ); @@ -211,7 +217,7 @@ extern void hb_gt_SetAttribute( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, extern void hb_gt_SetBlink( BOOL bBlink ); extern void hb_gt_SetCursorStyle( USHORT uiCursorShape ); extern BOOL hb_gt_SetMode( USHORT uiRows, USHORT uiCols ); -extern void hb_gt_SetPos( SHORT iRow, SHORT iCol ); +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 ); diff --git a/harbour/source/rtl/console.c b/harbour/source/rtl/console.c index 3af388b698..9fd31b5316 100644 --- a/harbour/source/rtl/console.c +++ b/harbour/source/rtl/console.c @@ -397,7 +397,7 @@ static void hb_conDevPos( SHORT iRow, SHORT iCol ) hb_fsSetError( uiErrorOld ); /* Restore last user file error code */ } else - hb_gtSetPos( iRow, iCol ); + hb_gtSetPos( iRow, iCol, HB_GT_SET_POS_BEFORE ); } /* NOTE: This should be placed after the hb_devpos() definition. */ diff --git a/harbour/source/rtl/gt_tpl/gt_tpl.c b/harbour/source/rtl/gt_tpl/gt_tpl.c index ce9dd45fa0..f61fc76fc5 100644 --- a/harbour/source/rtl/gt_tpl/gt_tpl.c +++ b/harbour/source/rtl/gt_tpl/gt_tpl.c @@ -115,7 +115,7 @@ BOOL hb_gt_AdjustPos( BYTE * pStr, ULONG ulLen ) } } - hb_gt_SetPos( row, col ); + hb_gt_SetPos( row, col, HB_GT_SET_POS_AFTER ); return TRUE; } @@ -144,10 +144,12 @@ USHORT hb_gt_GetScreenHeight( void ) return 0; } -void hb_gt_SetPos( SHORT iRow, SHORT iCol ) +void hb_gt_SetPos( SHORT iRow, SHORT iCol, SHORT iMethod ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetPos(%hd, %hd)", iRow, iCol)); + HB_SYMBOL_UNUSED( iMethod ); + /* TODO: How to reposition the cursor? */ HB_SYMBOL_UNUSED( iRow ); diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 637ac1dd07..a545662dd2 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -191,7 +191,7 @@ USHORT hb_gtBox( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, B else hb_gt_HorizLine( uiTop, uiLeft, uiRight, szBox[ 1 ], ( BYTE ) s_pColor[ s_uiColorIndex ] ); - hb_gtSetPos( uiTop + 1, uiLeft + 1 ); + hb_gtSetPos( uiTop + 1, uiLeft + 1, HB_GT_SET_POS_AFTER ); return 0; } @@ -220,7 +220,7 @@ USHORT hb_gtBoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight ) else hb_gt_HorizLine( uiTop, uiLeft, uiRight, HB_B_DOUBLE_V, ( BYTE ) s_pColor[ s_uiColorIndex ] ); - hb_gtSetPos( uiTop + 1, uiLeft + 1 ); + hb_gtSetPos( uiTop + 1, uiLeft + 1, HB_GT_SET_POS_AFTER ); return 0; } @@ -249,7 +249,7 @@ USHORT hb_gtBoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight ) else hb_gt_HorizLine( uiTop, uiLeft, uiRight, HB_B_SINGLE_H, ( BYTE ) s_pColor[ s_uiColorIndex ] ); - hb_gtSetPos( uiTop + 1, uiLeft + 1 ); + hb_gtSetPos( uiTop + 1, uiLeft + 1, HB_GT_SET_POS_AFTER ); return 0; } @@ -647,12 +647,12 @@ USHORT hb_gtGetPos( SHORT * piRow, SHORT * piCol ) return 0; } -USHORT hb_gtSetPos( SHORT iRow, SHORT iCol ) +USHORT hb_gtSetPos( SHORT iRow, SHORT iCol, SHORT iMethod ) { USHORT uiMaxRow; USHORT uiMaxCol; - HB_TRACE(HB_TR_DEBUG, ("hb_gtSetPos(%hd, %hd)", iRow, iCol)); + HB_TRACE(HB_TR_DEBUG, ("hb_gtSetPos(%hd, %hd, %hd)", iRow, iCol, iMethod)); uiMaxRow = hb_gt_GetScreenHeight(); uiMaxCol = hb_gt_GetScreenWidth(); @@ -661,7 +661,7 @@ USHORT hb_gtSetPos( SHORT iRow, SHORT iCol ) if( iRow >= 0 && iRow < uiMaxRow && iCol >= 0 && iCol < uiMaxCol ) { - hb_gt_SetPos( iRow, iCol ); + hb_gt_SetPos( iRow, iCol, iMethod ); /* If cursor was out bounds, now enable it */ if( s_iRow < 0 || s_iRow >= uiMaxRow || @@ -801,7 +801,7 @@ USHORT hb_gtWrite( BYTE * pStr, ULONG ulLength ) } /* Finally, save the new cursor position, even if off-screen */ - hb_gtSetPos( s_iRow, s_iCol + ( SHORT ) ulLength ); + hb_gtSetPos( s_iRow, s_iCol + ( SHORT ) ulLength, HB_GT_SET_POS_AFTER ); return 0; } @@ -824,7 +824,7 @@ USHORT hb_gtWriteAt( USHORT uiRow, USHORT uiCol, BYTE * pStr, ULONG ulLength ) } /* Finally, save the new cursor position, even if off-screen */ - hb_gtSetPos( uiRow, uiCol + ( SHORT ) ulLength ); + hb_gtSetPos( uiRow, uiCol + ( SHORT ) ulLength, HB_GT_SET_POS_AFTER ); return 0; } @@ -854,7 +854,7 @@ USHORT hb_gtWriteCon( BYTE * pStr, ULONG ulLength ) iCol = ( s_iCol <= iMaxCol ) ? s_iCol : iMaxCol; if( iRow != s_iRow || iCol != s_iCol ) - hb_gtSetPos( iRow, iCol ); + hb_gtSetPos( iRow, iCol, HB_GT_SET_POS_BEFORE ); while( ulLength-- ) { @@ -940,7 +940,7 @@ USHORT hb_gtWriteCon( BYTE * pStr, ULONG ulLength ) and cursor off top edge of display */ hb_gtScroll( 0, 0, iMaxRow, iMaxCol, 1, 0 ); } - hb_gtSetPos( iRow, iCol ); + hb_gtSetPos( iRow, iCol, HB_GT_SET_POS_AFTER ); bDisp = FALSE; bNewLine = FALSE; } diff --git a/harbour/source/rtl/gtcrs/gtcrs.c b/harbour/source/rtl/gtcrs/gtcrs.c index 83c875f68e..65000606c5 100644 --- a/harbour/source/rtl/gtcrs/gtcrs.c +++ b/harbour/source/rtl/gtcrs/gtcrs.c @@ -235,10 +235,12 @@ USHORT hb_gt_GetScreenHeight( void ) return r; } -void hb_gt_SetPos( SHORT iRow, SHORT iCol ) +void hb_gt_SetPos( SHORT iRow, SHORT iCol, SHORT iMethod ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetPos(%hd, %hd)", iRow, iCol)); + HB_SYMBOL_UNUSED( iMethod ); + gt_SetRC( iRow, iCol ); } diff --git a/harbour/source/rtl/gtdos/gtdos.c b/harbour/source/rtl/gtdos/gtdos.c index cf77728ed4..46a8900e30 100644 --- a/harbour/source/rtl/gtdos/gtdos.c +++ b/harbour/source/rtl/gtdos/gtdos.c @@ -499,12 +499,14 @@ USHORT hb_gt_GetScreenHeight( void ) #endif } -void hb_gt_SetPos( SHORT iRow, SHORT iCol ) +void hb_gt_SetPos( SHORT iRow, SHORT iCol, SHORT iMethod ) { union REGS regs; HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetPos(%hd, %hd)", iRow, iCol)); + HB_SYMBOL_UNUSED( iMethod ); + regs.h.ah = 0x02; regs.h.bh = 0; regs.h.dh = ( BYTE ) iRow; diff --git a/harbour/source/rtl/gtos2/gtos2.c b/harbour/source/rtl/gtos2/gtos2.c index 318a679d19..37189de052 100644 --- a/harbour/source/rtl/gtos2/gtos2.c +++ b/harbour/source/rtl/gtos2/gtos2.c @@ -338,10 +338,12 @@ USHORT hb_gt_GetScreenHeight( void ) return vi.row; } -void hb_gt_SetPos( SHORT iRow, SHORT iCol ) +void hb_gt_SetPos( SHORT iRow, SHORT iCol, SHORT iMethod ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetPos(%hd, %hd)", iRow, iCol)); + HB_SYMBOL_UNUSED( iMethod ); + VioSetCurPos( ( USHORT ) iRow, ( USHORT ) iCol, 0 ); } diff --git a/harbour/source/rtl/gtpca/gtpca.c b/harbour/source/rtl/gtpca/gtpca.c index 2eff8dc7d9..ae74a4b1e6 100644 --- a/harbour/source/rtl/gtpca/gtpca.c +++ b/harbour/source/rtl/gtpca/gtpca.c @@ -181,7 +181,7 @@ BOOL hb_gt_AdjustPos( BYTE * pStr, ULONG ulLen ) } } } - hb_gt_SetPos( row, col ); + hb_gt_SetPos( row, col, HB_GT_SET_POS_AFTER ); return TRUE; } @@ -218,9 +218,12 @@ USHORT hb_gt_GetScreenHeight( void ) return s_usMaxRow + 1; } -void hb_gt_SetPos( SHORT iRow, SHORT iCol ) +void hb_gt_SetPos( SHORT iRow, SHORT iCol, SHORT iMethod ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetPos(%hd, %hd)", iRow, iCol)); + + HB_SYMBOL_UNUSED( iMethod ); + if( iRow < 0 ) iRow = 0; else if( iRow > s_usMaxRow ) iRow = s_usMaxRow; if( iCol < 0 ) iCol = 0; diff --git a/harbour/source/rtl/gtsln/gtsln.c b/harbour/source/rtl/gtsln/gtsln.c index 24fadf93e7..52e12b0668 100644 --- a/harbour/source/rtl/gtsln/gtsln.c +++ b/harbour/source/rtl/gtsln/gtsln.c @@ -260,7 +260,7 @@ BOOL hb_gt_AdjustPos( BYTE * pStr, ULONG ulLen ) } } } - hb_gt_SetPos( row, col ); + hb_gt_SetPos( row, col, HB_GT_SET_POS_AFTER ); return TRUE; } @@ -285,10 +285,12 @@ USHORT hb_gt_GetScreenHeight( void ) return SLtt_Screen_Rows; } -void hb_gt_SetPos( SHORT iRow, SHORT iCol ) +void hb_gt_SetPos( SHORT iRow, SHORT iCol, SHORT iMethod ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetPos(%hd, %hd)", iRow, iCol)); + HB_SYMBOL_UNUSED( iMethod ); + SLsmg_gotorc(iRow, iCol); } diff --git a/harbour/source/rtl/gtstd/gtstd.c b/harbour/source/rtl/gtstd/gtstd.c index 9531805059..9e64fb81f1 100644 --- a/harbour/source/rtl/gtstd/gtstd.c +++ b/harbour/source/rtl/gtstd/gtstd.c @@ -40,11 +40,6 @@ #include "hbapifs.h" #include "hbapigt.h" -#if defined( OS_UNIX_COMPATIBLE ) - #include /* read() function requires it */ - #include -#endif - static SHORT s_iRow; static SHORT s_iCol; static USHORT s_uiMaxRow; @@ -53,10 +48,8 @@ static USHORT s_uiCursorStyle; static BOOL s_bBlink; static int s_iFilenoStdout; static USHORT s_uiDispCount; - -#if defined( OS_UNIX_COMPATIBLE ) -static struct termios startup_attributes; -#endif +static char * s_szCrLf; +static ULONG s_ulCrLf; void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr ) { @@ -65,36 +58,19 @@ void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr ) HB_SYMBOL_UNUSED( iFilenoStdin ); HB_SYMBOL_UNUSED( iFilenoStderr ); -#if defined( OS_UNIX_COMPATIBLE ) - { - struct termios ta; - - tcgetattr( STDIN_FILENO, &startup_attributes ); -// atexit( restore_input_mode ); - - tcgetattr( STDIN_FILENO, &ta ); - ta.c_lflag &= ~( ICANON | ECHO ); - ta.c_iflag &= ~ICRNL; - ta.c_cc[ VMIN ] = 0; - ta.c_cc[ VTIME ] = 0; - tcsetattr( STDIN_FILENO, TCSAFLUSH, &ta ); - } -#endif - s_uiDispCount = 0; s_iRow = 0; s_iCol = 0; -#if defined(OS_UNIX_COMPATIBLE) - s_uiMaxRow = 24; -#else - s_uiMaxRow = 25; -#endif - s_uiMaxCol = 80; + s_uiMaxRow = 32767; + s_uiMaxCol = 32767; s_uiCursorStyle = SC_NORMAL; s_bBlink = FALSE; s_iFilenoStdout = iFilenoStdout; hb_fsSetDevMode( s_iFilenoStdout, FD_BINARY ); + + s_szCrLf = hb_conNewLine(); + s_ulCrLf = strlen( s_szCrLf ); hb_mouse_Init(); } @@ -104,9 +80,18 @@ void hb_gt_Exit( void ) HB_TRACE(HB_TR_DEBUG, ("hb_gt_Exit()")); hb_mouse_Exit(); -#if defined( OS_UNIX_COMPATIBLE ) - tcsetattr( STDIN_FILENO, TCSANOW, &startup_attributes ); -#endif +} + +static void out_stdout( char * pStr, ULONG ulLen ) +{ + unsigned uiErrorOld = hb_fsError(); /* Save current user file error code */ + hb_fsWriteLarge( s_iFilenoStdout, ( BYTE * ) pStr, ulLen ); + hb_fsSetError( uiErrorOld ); /* Restore last user file error code */ +} + +static void out_newline( void ) +{ + out_stdout( s_szCrLf, s_ulCrLf ); } int hb_gt_ReadKey( HB_inkey_enum eventmask ) @@ -117,16 +102,7 @@ int hb_gt_ReadKey( HB_inkey_enum eventmask ) HB_SYMBOL_UNUSED( eventmask ); -#if defined(OS_UNIX_COMPATIBLE) - if( ! read( STDIN_FILENO, &ch, 1 ) ) - ch = 0; -#else - ch = 0; -#endif - - /* TODO: */ - - return ch; + return 13; } BOOL hb_gt_AdjustPos( BYTE * pStr, ULONG ulLen ) @@ -175,7 +151,7 @@ BOOL hb_gt_AdjustPos( BYTE * pStr, ULONG ulLen ) } } } - hb_gt_SetPos( row, col ); + hb_gt_SetPos( row, col, HB_GT_SET_POS_AFTER ); return TRUE; } @@ -200,31 +176,22 @@ USHORT hb_gt_GetScreenHeight( void ) return s_uiMaxRow; } -void hb_gt_SetPos( SHORT iRow, SHORT iCol ) +void hb_gt_SetPos( SHORT iRow, SHORT iCol, SHORT iMethod ) { - SHORT iCount; - SHORT iDevRow = s_iRow; - SHORT iDevCol = s_iCol; + HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetPos(%hd, %hd, %hd)", iRow, iCol, iMethod)); - char * szCrLf = hb_conNewLine(); - - HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetPos(%hd, %hd)", iRow, iCol)); - - if( iRow < iDevRow || iCol < iDevCol ) + if( iMethod == HB_GT_SET_POS_BEFORE ) { - fputs( szCrLf, stdout ); - iDevCol = 0; - iDevRow++; + /* Only set the screen position when the cursor + position is changed BEFORE text is displayed. + */ + if( iRow != s_iRow ) + { + out_newline(); + s_iCol = 0; + } + if( s_iCol < iCol ) while( ++s_iCol < iCol ) out_stdout( " ", 1 ); } - else if( iRow > iDevRow ) - iDevCol = 0; - - for( iCount = iDevRow; iCount < iRow; iCount++ ) - fputs( szCrLf, stdout ); - for( iCount = iDevCol; iCount < iCol; iCount++ ) - fputc( ' ', stdout ); - - fflush( stdout ); s_iRow = iRow; s_iCol = iCol; @@ -260,27 +227,32 @@ void hb_gt_SetCursorStyle( USHORT uiCursorStyle ) static void hb_gt_xPutch( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE byChar ) { + char szBuffer[ 2 ]; + HB_TRACE(HB_TR_DEBUG, ("hb_gt_xPutch(%hu, %hu, %d, %i)", uiRow, uiCol, (int) byAttr, byAttr)); - /* TODO: */ - - HB_SYMBOL_UNUSED( uiRow ); - HB_SYMBOL_UNUSED( uiCol ); HB_SYMBOL_UNUSED( byAttr ); - HB_SYMBOL_UNUSED( byChar ); + + hb_gt_SetPos( uiRow, uiCol, HB_GT_SET_POS_BEFORE ); + + szBuffer[ 0 ] = byChar; + szBuffer[ 1 ] = '\0'; + out_stdout( szBuffer, 1 ); + + hb_gt_AdjustPos( szBuffer, 1 ); } void hb_gt_Puts( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE * pbyStr, ULONG ulLen ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_Puts(%hu, %hu, %d, %p, %lu)", uiRow, uiCol, (int) byAttr, pbyStr, ulLen)); - /* TODO: */ - - HB_SYMBOL_UNUSED( uiRow ); - HB_SYMBOL_UNUSED( uiCol ); HB_SYMBOL_UNUSED( byAttr ); - HB_SYMBOL_UNUSED( pbyStr ); - HB_SYMBOL_UNUSED( ulLen ); + + hb_gt_SetPos( uiRow, uiCol, HB_GT_SET_POS_BEFORE ); + + out_stdout( pbyStr, ulLen ); + + hb_gt_AdjustPos( pbyStr, ulLen ); } int hb_gt_RectSize( USHORT rows, USHORT cols ) @@ -303,8 +275,6 @@ void hb_gt_PutText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight { HB_TRACE(HB_TR_DEBUG, ("hb_gt_PutText(%hu, %hu, %hu, %hu, %p)", uiTop, uiLeft, uiBottom, uiRight, pbySrc)); - /* TODO: */ - HB_SYMBOL_UNUSED( uiTop ); HB_SYMBOL_UNUSED( uiLeft ); HB_SYMBOL_UNUSED( uiBottom ); @@ -327,25 +297,18 @@ void hb_gt_Scroll( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, { HB_TRACE(HB_TR_DEBUG, ("hb_gt_Scroll(%hu, %hu, %hu, %hu, %d, %hu, %hu)", uiTop, uiLeft, uiBottom, uiRight, (int) byAttr, iRows, iCols)); + HB_SYMBOL_UNUSED( uiTop ); + HB_SYMBOL_UNUSED( uiLeft ); + HB_SYMBOL_UNUSED( uiBottom ); + HB_SYMBOL_UNUSED( uiRight ); HB_SYMBOL_UNUSED( byAttr ); + HB_SYMBOL_UNUSED( iRows ); + HB_SYMBOL_UNUSED( iCols ); - /* TODO: */ + out_newline(); - if( uiTop == 0 && - uiBottom == s_uiMaxRow && - uiLeft == 0 && - uiRight == s_uiMaxCol && - iRows == 0 && - iCols == 0 ) - { - for( ; uiBottom; uiBottom-- ) - fputs( hb_conNewLine(), stdout ); - - fflush( stdout ); - - s_iRow = 0; - s_iCol = 0; - } + s_iRow = 0; + s_iRow = 0; } void hb_gt_DispBegin( void ) @@ -392,8 +355,6 @@ void hb_gt_Tone( double dFrequency, double dDuration ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_Tone(%lf, %lf)", dFrequency, dDuration)); - /* TODO: Implement this */ - HB_SYMBOL_UNUSED( dFrequency ); HB_SYMBOL_UNUSED( dDuration ); } @@ -419,10 +380,10 @@ 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 uiRow; - USHORT uiCol; - USHORT uiHeight; - USHORT uiWidth; + USHORT uiRow; + USHORT uiCol; + USHORT uiHeight; + USHORT uiWidth; /* Ensure that box is drawn from top left to bottom right. */ if( uiTop > uiBottom ) @@ -457,7 +418,9 @@ USHORT hb_gt_Box( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT 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 ) { @@ -475,7 +438,10 @@ USHORT hb_gt_Box( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, { hb_gt_xPutch( uiRow, uiLeft, byAttr, szBox[ 7 ] ); /* Left side */ if( uiWidth > 1 ) + { + hb_gt_Replicate( uiRow, uiCol, byAttr, ' ', uiWidth - 2 ); hb_gt_xPutch( uiRow, uiRight, byAttr, szBox[ 3 ] ); /* Right side */ + } } } diff --git a/harbour/source/rtl/gtwin/gtwin.c b/harbour/source/rtl/gtwin/gtwin.c index 0c1958d72e..2db90f7446 100644 --- a/harbour/source/rtl/gtwin/gtwin.c +++ b/harbour/source/rtl/gtwin/gtwin.c @@ -675,7 +675,7 @@ BOOL hb_gt_AdjustPos( BYTE * pStr, ULONG ulLen ) GetConsoleScreenBufferInfo( s_HActive, &csbi ); - hb_gtSetPos( csbi.dwCursorPosition.Y, csbi.dwCursorPosition.X ); + hb_gtSetPos( csbi.dwCursorPosition.Y, csbi.dwCursorPosition.X, HB_GT_SET_POS_AFTER ); return TRUE; } @@ -712,12 +712,14 @@ USHORT hb_gt_GetScreenHeight( void ) return HB_MAX( csbi.dwSize.Y, 25 ); } -void hb_gt_SetPos( SHORT iRow, SHORT iCol ) +void hb_gt_SetPos( SHORT iRow, SHORT iCol, SHORT iMethod ) { COORD dwCursorPosition; HB_TRACE(HB_TR_DEBUG, ("hb_gt_SetPos(%hd, %hd)", iRow, iCol)); + HB_SYMBOL_UNUSED( iMethod ); + dwCursorPosition.X = iCol; dwCursorPosition.Y = iRow; diff --git a/harbour/source/rtl/oldclear.c b/harbour/source/rtl/oldclear.c index f926c2ee30..e8332477c2 100644 --- a/harbour/source/rtl/oldclear.c +++ b/harbour/source/rtl/oldclear.c @@ -41,7 +41,7 @@ HB_FUNC( __ATCLEAR ) { if( hb_pcount() == 4 ) { - hb_gtSetPos( hb_parni( 1 ), hb_parni( 2 ) ); + hb_gtSetPos( hb_parni( 1 ), hb_parni( 2 ), HB_GT_SET_POS_BEFORE ); hb_gtScroll( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), 0, 0 ); } } @@ -49,7 +49,7 @@ HB_FUNC( __ATCLEAR ) HB_FUNC( __CLEAR ) { hb_gtScroll( 0, 0, hb_gtMaxRow(), hb_gtMaxCol(), 0, 0 ); - hb_gtSetPos( 0, 0 ); + hb_gtSetPos( 0, 0, HB_GT_SET_POS_AFTER ); } #endif diff --git a/harbour/source/rtl/setpos.c b/harbour/source/rtl/setpos.c index a6c829ea86..f88c0308e0 100644 --- a/harbour/source/rtl/setpos.c +++ b/harbour/source/rtl/setpos.c @@ -50,7 +50,7 @@ HB_FUNC( SETPOS ) /* Sets the screen position */ { if( ISNUM( 1 ) && ISNUM( 2 ) ) - hb_gtSetPos( hb_parni( 1 ), hb_parni( 2 ) ); + hb_gtSetPos( hb_parni( 1 ), hb_parni( 2 ), HB_GT_SET_POS_BEFORE ); } HB_FUNC( ROW ) /* Return the current screen row position (zero origin) */ diff --git a/harbour/source/rtl/setposbs.c b/harbour/source/rtl/setposbs.c index 020c4c70cb..0045d9908e 100644 --- a/harbour/source/rtl/setposbs.c +++ b/harbour/source/rtl/setposbs.c @@ -47,6 +47,6 @@ HB_FUNC( SETPOSBS ) /* Move the screen position to the right by one column */ [vszakats] */ hb_gtGetPos( &iRow, &iCol ); - hb_gtSetPos( iRow, iCol + 1 ); + hb_gtSetPos( iRow, iCol + 1, HB_GT_SET_POS_AFTER ); } diff --git a/harbour/source/rtl/xsavescr.c b/harbour/source/rtl/xsavescr.c index 702a4d4500..7a29e3679b 100644 --- a/harbour/source/rtl/xsavescr.c +++ b/harbour/source/rtl/xsavescr.c @@ -91,7 +91,7 @@ HB_FUNC( __XRESTSCREEN ) hb_xfree( s_pBuffer ); s_pBuffer = NULL; - hb_gtSetPos( s_iRow, s_iCol ); + hb_gtSetPos( s_iRow, s_iCol, HB_GT_SET_POS_AFTER ); } }