diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 98ec925fed..7cf408b9a0 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,19 @@ +19990908-05:05 EDT Paul Tucker + * source/rtl/inkey.c + - remove extra #define INCL_DOSPROCESS + + add #define INCL_NOPMAPI + * source/rtl/gtapi.c + simplified hb_gtScroll() to a function call. + The code from this function was moved to gt/gtdos.c hb_gt_scroll() + I currently can't compile a dos version so need a tester! + * source/rtl/gt/gtos2.c + - remove #define INCL_KBD since no keyboard functions are used + + add #define INCL_NOPMAPI since PMAPI is not needed. + * source/rtl/gt/gtdos.c + * active hb_gt_scroll source. + needs test. + * most of this reported by Chen Kedem + 19990908-03:05 EDT Paul Tucker * source/rtl/gt/gtos2.c + hb_gt_scroll by Chen Kedem diff --git a/harbour/source/rtl/gt/gtdos.c b/harbour/source/rtl/gt/gtdos.c index 856d389a4d..ec8b569f88 100644 --- a/harbour/source/rtl/gt/gtdos.c +++ b/harbour/source/rtl/gt/gtdos.c @@ -455,6 +455,62 @@ char hb_gt_Row(void) #endif } +void hb_gt_Scroll( char cTop, char cLeft, char cBottom, char cRight, char attribute, char vert, char horiz ) +{ + USHORT uiRow, uiCol, uiSize; + int iLength = ( uiRight - uiLeft ) + 1; + int iCount, iColOld, iColNew, iColSize; + + hb_gtGetPos( &uiRow, &uiCol ); + + if( hb_gtRectSize( uiTop, uiLeft, uiBottom, uiRight, &uiSize ) == 0 ) + { + char * fpBlank = ( char * ) hb_xgrab( iLength ); + char * fpBuff = ( char * ) hb_xgrab( iLength * 2 ); + if( fpBlank && fpBuff ) + { + memset( fpBlank, ' ', iLength ); + + iColOld = iColNew = uiLeft; + if( iCols >= 0 ) + { + iColOld += iCols; + iColSize = uiRight - uiLeft; + iColSize -= iCols; + } + else + { + iColNew -= iCols; + iColSize = uiRight - uiLeft; + iColSize += iCols; + } + + for( iCount = ( iRows >= 0 ? uiTop : uiBottom ); + ( iRows >= 0 ? iCount <= uiBottom : iCount >= uiTop ); + ( iRows >= 0 ? iCount++ : iCount-- ) ) + { + int iRowPos = iCount + iRows; + + /* Blank the scroll region in the current row */ + hb_gt_Puts( iCount, uiLeft, attr, fpBlank, iLength ); + + if( ( iRows || iCols ) && iRowPos <= uiBottom && iRowPos >= uiTop ) + { + /* Read the text to be scrolled into the current row */ + hb_gt_GetText( iRowPos, iColOld, iRowPos, iColOld + iColSize, fpBuff ); + + /* Write the scrolled text to the current row */ + hb_gt_PutText ( iCount, iColNew, iCount, iColNew + iColSize, fpBuff ); + } + } + } + if( fpBlank ) hb_xfree( fpBlank ); + if( fpBuff ) hb_xfree( fpBuff ); + } + + hb_gtSetPos( uiRow, uiCol ); +} + void hb_gt_DispBegin(void) { /* ptucker */ diff --git a/harbour/source/rtl/gt/gtos2.c b/harbour/source/rtl/gt/gtos2.c index 32ac8f3a3b..cda0fec140 100644 --- a/harbour/source/rtl/gt/gtos2.c +++ b/harbour/source/rtl/gt/gtos2.c @@ -11,9 +11,8 @@ * User programs should never call this layer directly! */ -#define INCL_KBD #define INCL_VIO -#define INCL_DOSPROCESS +#define INCL_NOPMAPI #include #include diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index b668f2ab7d..1504e84878 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -691,6 +691,8 @@ int hb_gtWrite( char * fpStr, ULONG length ) char attr = s_Color[ s_uiColorIndex ] & 0xff, *fpPointer = fpStr; + /* TODO: this is doing more work than needed */ + /* Determine where the cursor is going to end up */ iRow = s_uiCurrentRow; iCol = s_uiCurrentCol; @@ -700,7 +702,7 @@ int hb_gtWrite( char * fpStr, ULONG length ) length = ( length < iMaxCol-iCol+1 ) ? length : iMaxCol - iCol + 1; size = length; -#ifndef HARBOUR_USE_WIN_GTAPI + if( iCol + size > iMaxCol ) { /* Calculate eventual row position and the remainder size for the column adjust */ @@ -741,17 +743,13 @@ int hb_gtWrite( char * fpStr, ULONG length ) iRow = iMaxRow; } else size = length; -#endif + /* Now the text string can be displayed */ hb_gt_Puts( s_uiCurrentRow, s_uiCurrentCol, attr, fpPointer, size ); -#ifdef HARBOUR_USE_WIN_GTAPI - /* yeah yeah, looks weird */ - hb_gtSetPos( iRow, iCol + size ); -#else /* Finally, save the new cursor position */ hb_gtSetPos( iRow, iCol ); -#endif + return 0; } @@ -855,64 +853,7 @@ int hb_gtWriteCon( char * fpStr, ULONG length ) int hb_gtScroll( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, SHORT iRows, SHORT iCols ) { -#ifdef HARBOUR_USE_WIN_GTAPI hb_gt_Scroll( uiTop, uiLeft, uiBottom, uiRight, s_Color[ s_uiColorIndex ], iRows, iCols ); -#else - - USHORT uiRow = s_uiCurrentRow, uiCol = s_uiCurrentCol, uiSize; - int iLength = ( uiRight - uiLeft ) + 1; - int iCount, iColOld, iColNew, iColSize; - - if( hb_gtRectSize( uiTop, uiLeft, uiBottom, uiRight, &uiSize ) == 0 ) - { - char * fpBlank = ( char * ) hb_xgrab( iLength ); - char * fpBuff = ( char * ) hb_xgrab( iLength * 2 ); - if( fpBlank && fpBuff ) - { - char attr = s_Color[ s_uiColorIndex ] & 0xff; - - memset( fpBlank, ' ', iLength ); - - iColOld = iColNew = uiLeft; - if( iCols >= 0 ) - { - iColOld += iCols; - iColSize = uiRight - uiLeft; - iColSize -= iCols; - } - else - { - iColNew -= iCols; - iColSize = uiRight - uiLeft; - iColSize += iCols; - } - - for( iCount = ( iRows >= 0 ? uiTop : uiBottom ); - ( iRows >= 0 ? iCount <= uiBottom : iCount >= uiTop ); - ( iRows >= 0 ? iCount++ : iCount-- ) ) - { - int iRowPos = iCount + iRows; - - /* Blank the scroll region in the current row */ - hb_gt_Puts( iCount, uiLeft, attr, fpBlank, iLength ); - - if( ( iRows || iCols ) && iRowPos <= uiBottom && iRowPos >= uiTop ) - { - /* Read the text to be scrolled into the current row */ - hb_gt_GetText( iRowPos, iColOld, iRowPos, iColOld + iColSize, fpBuff ); - - /* Write the scrolled text to the current row */ - hb_gt_PutText ( iCount, iColNew, iCount, iColNew + iColSize, fpBuff ); - } - } - } - if( fpBlank ) hb_xfree( fpBlank ); - if( fpBuff ) hb_xfree( fpBuff ); - } - s_uiCurrentRow = uiRow; - s_uiCurrentCol = uiCol; -#endif - return 0; } diff --git a/harbour/source/rtl/inkey.c b/harbour/source/rtl/inkey.c index 910e002c42..8b250d0e0c 100644 --- a/harbour/source/rtl/inkey.c +++ b/harbour/source/rtl/inkey.c @@ -52,6 +52,7 @@ */ #ifdef __IBMCPP__ #define INCL_DOSPROCESS + #define INCL_NOPMAPI #endif #include "extend.h" @@ -70,7 +71,6 @@ #elif defined(HARBOUR_GCC_OS2) #include #elif defined(__IBMCPP__) - #define INCL_DOSPROCESS #include #include #elif defined(__CYGWIN__)