diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 778bf48ec7..c44cff3f10 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,12 @@ +19990620-15:50 CET Victor Szel + * hb_gtBox() rewritten. + It's now 100% Clipper compatible, fill character + supported, undocumented frame string padding supported. + Leaves the cursor at the same place as Clipper does. + Handling of empty or short frame string parameter + fixed. Bit slower. + source/compiler/gtapi.c + 19990620-02:40 Ryszard Glab * config/bin.cf diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 6e6bb40b96..9567eee4b8 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -28,54 +28,66 @@ void hb_gtInit(void) gtInit(); } -int hb_gtBox(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * fpBoxString) +int hb_gtBox (USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char* pbyFrame) { - int iCount; + BYTE pszBox [10]; + BYTE cPadChar; - if(uiTop > hb_gtMaxRow() || uiBottom > hb_gtMaxRow() || - uiLeft > hb_gtMaxCol() || uiRight > hb_gtMaxCol() || - uiTop > uiBottom || uiLeft > uiRight) + USHORT uiRow = uiTop; + USHORT uiCol = uiLeft; + USHORT tmp; + + if (uiTop > hb_gtMaxRow() || uiBottom > hb_gtMaxRow() || + uiLeft > hb_gtMaxCol() || uiRight > hb_gtMaxCol() || + uiTop > uiBottom || uiLeft > uiRight) { - return(1); + return 1; } + /* For full compatibility, pad box string with last char if too short */ + + cPadChar = ' '; + for (tmp = 0; *pbyFrame && tmp < 9; tmp++) cPadChar = pszBox[tmp] = *pbyFrame++; + while (tmp < 8) pszBox[tmp++] = cPadChar; + pszBox[tmp] = '\0'; + hb_gtDispBegin(); - /* upper left corner */ - hb_gtSetPos(uiTop, uiLeft); - hb_gtWrite(&fpBoxString[0], 1); + hb_gtWriteAt(uiRow, uiCol, pszBox + 0, sizeof(BYTE)); + hb_gtWriteAt(uiRow, uiRight, pszBox + 2, sizeof(BYTE)); + hb_gtWriteAt(uiBottom, uiCol, pszBox + 6, sizeof(BYTE)); + hb_gtWriteAt(uiBottom, uiRight, pszBox + 4, sizeof(BYTE)); - /* top line */ - hb_gtRepChar(uiTop, uiLeft+1, fpBoxString[1], uiRight-uiLeft-1); - - /* upper right corner */ - hb_gtSetPos(uiTop, uiRight); - hb_gtWrite(&fpBoxString[2], 1); - - /* left and right sides */ - for(iCount = uiTop + 1; iCount