See ChangeLog entry 19990601-23:50 EDT David G. Holm <dholm@jsd-llc.com>
This commit is contained in:
@@ -1,3 +1,17 @@
|
||||
19990601-23:50 EDT David G. Holm <dholm@jsd-llc.com>
|
||||
* makefile.b31
|
||||
- Made progress on GT API, so put USE_GTAPI back in as default.
|
||||
* source/rtl/console.c
|
||||
- Cleaned up synchronization between GT API and dev_row, dev_col
|
||||
* source/rtl/gtapi.c
|
||||
- Initialize starting row and column to 0 instead of 1
|
||||
- _gtMaxCol() and _gtMaxRow() are 0-based in Clipper, so subtract 1
|
||||
from the device width and height
|
||||
- Removed call to strlen() in _gtSave(), because Clipper does not appear
|
||||
to require the screen buffer to be initialized, just allocated
|
||||
- Changed _gtWrite() to deal with writing multiple rows of text
|
||||
- Wrote _gtScroll(), which is needed by _gtWritePos() and _gtWrite().
|
||||
|
||||
19990601-21:35 CET Eddie Runia
|
||||
* tests/working/multinh.prg, source/rtl/classes.c, source/rtl/tclass.prg
|
||||
first step to multiple inheritance
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
.path.obj = obj
|
||||
.path.prg = source\rtl
|
||||
|
||||
#c_opt = -mh -O2 -I.\include -DUSE_GTAPI
|
||||
c_opt = -mh -O2 -I.\include
|
||||
c_opt = -mh -O2 -I.\include -DUSE_GTAPI
|
||||
#c_opt = -mh -O2 -I.\include
|
||||
|
||||
PROJECT: harbour.lib hbtools.lib terminal.lib libs\win16\terminal.lib harbour.exe
|
||||
|
||||
|
||||
@@ -15,11 +15,15 @@
|
||||
#include <gtapi.h>
|
||||
#endif
|
||||
|
||||
static unsigned short dev_row = 0;
|
||||
static unsigned short dev_col = 0;
|
||||
static unsigned short dev_row;
|
||||
static unsigned short dev_col;
|
||||
static char CrLf [3];
|
||||
|
||||
void InitializeConsole( void )
|
||||
{
|
||||
CrLf [0] = 13;
|
||||
CrLf [1] = 10;
|
||||
CrLf [2] = 0;
|
||||
#ifdef USE_GTAPI
|
||||
dev_row = gtWhereY();
|
||||
dev_col = gtWhereX();
|
||||
@@ -110,8 +114,7 @@ static void hb_outstd( char * fpStr, WORD uiLen )
|
||||
#ifdef USE_GTAPI
|
||||
if( isatty( fileno( stdout ) ) )
|
||||
{
|
||||
dev_col += uiLen;
|
||||
_gtSetPos( dev_row, dev_col );
|
||||
_gtGetPos( &dev_row, &dev_col );
|
||||
}
|
||||
#endif;
|
||||
}
|
||||
@@ -126,8 +129,7 @@ static void hb_outerr( char * fpStr, WORD uiLen )
|
||||
#ifdef USE_GTAPI
|
||||
if( isatty( fileno( stdout ) ) )
|
||||
{
|
||||
dev_col += uiLen;
|
||||
_gtSetPos( dev_row, dev_col );
|
||||
_gtGetPos( &dev_row, &dev_col );
|
||||
}
|
||||
#endif;
|
||||
}
|
||||
@@ -140,10 +142,7 @@ static void hb_altout( char * fpStr, WORD uiLen )
|
||||
#ifdef USE_GTAPI
|
||||
_gtWriteCon( fpStr, uiLen );
|
||||
if( stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) || hb_set_printhan < 0 )
|
||||
{
|
||||
_gtGetPos( &dev_row, &dev_col );
|
||||
_gtSetPos( dev_row, dev_col );
|
||||
}
|
||||
#else
|
||||
WORD uiCount;
|
||||
for( uiCount = 0; uiCount < uiLen; uiCount++ )
|
||||
@@ -172,11 +171,7 @@ static void hb_devout( char * fpStr, WORD uiLen )
|
||||
#ifdef USE_GTAPI
|
||||
/* Otherwise, display to console */
|
||||
_gtWrite( fpStr, uiLen );
|
||||
if( stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) || hb_set_printhan < 0 )
|
||||
{
|
||||
_gtGetPos( &dev_row, &dev_col );
|
||||
_gtSetPos( dev_row, dev_col );
|
||||
}
|
||||
_gtGetPos( &dev_row, &dev_col );
|
||||
#else
|
||||
WORD uiCount;
|
||||
for( uiCount = 0; uiCount < uiLen; uiCount++ )
|
||||
@@ -197,7 +192,7 @@ void hb_devpos( int row, int col )
|
||||
write( hb_set_printhan, "\x0C", 1 );
|
||||
dev_row = dev_col = 0;
|
||||
}
|
||||
for( count = dev_row; count < row; count++ ) write( hb_set_printhan, "\r\n", 2 );
|
||||
for( count = dev_row; count < row; count++ ) write( hb_set_printhan, CrLf, strlen (CrLf) );
|
||||
if( row > dev_row ) dev_col = 0;
|
||||
for( count = dev_col; count < col; count++ ) write( hb_set_printhan, " ", 1 );
|
||||
dev_row = row;
|
||||
@@ -248,7 +243,7 @@ HARBOUR QOUT( void )
|
||||
#ifdef WINDOWS
|
||||
MessageBox( 0, _parc( 1 ), "Harbour", 0 );
|
||||
#else
|
||||
hb_altout( "\r\n", 2 );
|
||||
hb_altout( CrLf, strlen (CrLf) );
|
||||
QQOUT();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ int _gtSetBlink(BOOL bBlink);
|
||||
int _gtSetMode(USHORT uiRows, USHORT uiCols);
|
||||
*/
|
||||
|
||||
static USHORT s_uiCurrentRow = 1;
|
||||
static USHORT s_uiCurrentCol = 1;
|
||||
static USHORT s_uiCurrentRow = 0;
|
||||
static USHORT s_uiCurrentCol = 0;
|
||||
static USHORT s_uiDispCount = 0;
|
||||
static USHORT s_uiColorIndex = 0;
|
||||
static char s_szColorStr[CLR_STRLEN] = {"W/N, N/W, N/N, N/N, N/W"};
|
||||
@@ -185,12 +185,12 @@ BOOL _gtIsColor(void)
|
||||
|
||||
USHORT _gtMaxCol(void)
|
||||
{
|
||||
return(gtGetScreenWidth());
|
||||
return(gtGetScreenWidth() - 1);
|
||||
}
|
||||
|
||||
USHORT _gtMaxRow(void)
|
||||
{
|
||||
return(gtGetScreenHeight());
|
||||
return(gtGetScreenHeight() - 1);
|
||||
}
|
||||
|
||||
int _gtPostExt(void)
|
||||
@@ -234,7 +234,7 @@ int _gtRepChar(USHORT uiRow, USHORT uiCol, USHORT uiChar, USHORT uiCount)
|
||||
|
||||
int _gtRest(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * vlpScrBuff)
|
||||
{
|
||||
gtPutText(uiLeft, uiTop, uiRight - uiLeft, uiBottom - uiTop, vlpScrBuff);
|
||||
gtPutText(uiLeft, uiTop, uiRight, uiBottom, vlpScrBuff);
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -249,12 +249,7 @@ int _gtSave(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char *
|
||||
return(rc);
|
||||
}
|
||||
|
||||
if(strlen(vlpScrBuff) < bufsiz)
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
||||
gtGetText(uiLeft, uiTop, uiRight - uiLeft, uiBottom - uiTop, vlpScrBuff);
|
||||
gtGetText(uiLeft, uiTop, uiRight, uiBottom, vlpScrBuff);
|
||||
|
||||
return(0);
|
||||
}
|
||||
@@ -267,11 +262,6 @@ int _gtScrDim(USHORT * uipHeight, USHORT * uipWidth)
|
||||
return(0);
|
||||
}
|
||||
|
||||
int _gtScroll(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, SHORT iRows, SHORT iCols)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
int _gtSetBlink(BOOL bBlink)
|
||||
{
|
||||
return(0);
|
||||
@@ -327,24 +317,59 @@ int _gtWrite(char * fpStr, USHORT uiLen)
|
||||
/* TODO: need to get current color setting from s_szColorString and
|
||||
s_uiColorIndex
|
||||
*/
|
||||
int iRow, iCol, iMaxCol;
|
||||
char attr=7;
|
||||
|
||||
gtPuts(s_uiCurrentCol, s_uiCurrentRow, attr, fpStr, uiLen);
|
||||
int iRow, iCol, iMaxCol, iMaxRow, iSize, iTemp;
|
||||
char attr=7, *fpPointer = fpStr;
|
||||
|
||||
/* Determine where the cursor is going to end up */
|
||||
iRow = s_uiCurrentRow;
|
||||
iCol = s_uiCurrentCol;
|
||||
iMaxCol = _gtMaxCol();
|
||||
iMaxRow = _gtMaxRow();
|
||||
iSize = uiLen;
|
||||
if (iCol + iSize > iMaxCol)
|
||||
{
|
||||
/* Calculate eventual row position and the remainder size for the column adjust */
|
||||
iRow += (iSize / (iMaxCol + 1));
|
||||
iSize = iSize % (iMaxCol + 1);
|
||||
}
|
||||
iCol += iSize;
|
||||
if (iCol > iMaxCol)
|
||||
{
|
||||
/* Column movement overflows onto next row */
|
||||
iRow++;
|
||||
iCol = 0;
|
||||
}
|
||||
/* If needed, prescroll the display to the new position and adjust the current row
|
||||
position to account for the prescroll */
|
||||
if (iRow > iMaxRow)
|
||||
{
|
||||
_gtScroll(0, 0, iMaxRow, iMaxCol, iRow - iMaxRow, 0);
|
||||
iTemp = s_uiCurrentRow - (iRow - iMaxRow);
|
||||
if (iTemp < 0)
|
||||
{
|
||||
/* The string is too long to fit on the screen. Only display part of it. */
|
||||
fpPointer += iMaxCol * abs (iTemp);
|
||||
iTemp = 0;
|
||||
if (s_uiCurrentCol > 0)
|
||||
{
|
||||
/* Ensure that the truncated text will fill the screen */
|
||||
fpPointer -= s_uiCurrentCol;
|
||||
s_uiCurrentCol = 0;
|
||||
}
|
||||
}
|
||||
else iSize = uiLen;
|
||||
|
||||
if(iCol + uiLen > iMaxCol)
|
||||
{
|
||||
s_uiCurrentCol=(iRow + uiLen) - iMaxCol;
|
||||
s_uiCurrentRow++;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_uiCurrentCol += uiLen;
|
||||
/* Save the new starting row and the new ending row */
|
||||
s_uiCurrentRow = iTemp;
|
||||
iRow = iMaxRow;
|
||||
}
|
||||
else iSize = uiLen;
|
||||
|
||||
/* Now the text string can be displayed */
|
||||
gtPuts(s_uiCurrentCol, s_uiCurrentRow, attr, fpPointer, iSize);
|
||||
|
||||
/* Finally, save the new cursor position */
|
||||
_gtSetPos (iRow, iCol);
|
||||
|
||||
return(0);
|
||||
}
|
||||
@@ -361,43 +386,47 @@ int _gtWriteAt(USHORT uiRow, USHORT uiCol, char * fpStr, USHORT uiLen)
|
||||
|
||||
int _gtWriteCon(char * fpStr, USHORT uiLen)
|
||||
{
|
||||
int rc;
|
||||
USHORT count;
|
||||
int rc = 0;
|
||||
USHORT uiCount, uiRow = s_uiCurrentRow, uiCol = s_uiCurrentCol;
|
||||
char ch[2];
|
||||
|
||||
ch[1] = 0;
|
||||
for(count = 0; count < uiLen; count++)
|
||||
for(uiCount = 0; uiCount < uiLen; uiCount++)
|
||||
{
|
||||
*ch = fpStr[count];
|
||||
switch(*ch)
|
||||
ch [0] = fpStr[uiCount];
|
||||
switch(ch [0])
|
||||
{
|
||||
case 7:
|
||||
break;
|
||||
case 8:
|
||||
if(s_uiCurrentCol > 0) s_uiCurrentCol--;
|
||||
else if(s_uiCurrentRow > 0)
|
||||
if(uiRow > 0) uiCol--;
|
||||
else if(uiRow > 0)
|
||||
{
|
||||
s_uiCurrentRow--;
|
||||
s_uiCurrentCol=_gtMaxCol();
|
||||
uiRow--;
|
||||
uiCol=_gtMaxCol();
|
||||
}
|
||||
else
|
||||
{
|
||||
_gtScroll(0, 0, _gtMaxRow(), _gtMaxCol(), -1, 0);
|
||||
s_uiCurrentCol=_gtMaxCol();
|
||||
uiCol=_gtMaxCol();
|
||||
}
|
||||
_gtSetPos (uiRow, uiCol);
|
||||
break;
|
||||
case 10:
|
||||
if(s_uiCurrentRow < _gtMaxRow()) s_uiCurrentRow++;
|
||||
if(uiRow < _gtMaxRow()) uiRow++;
|
||||
else
|
||||
{
|
||||
_gtScroll(0, 0, _gtMaxRow(), _gtMaxCol(), 1, 0);
|
||||
}
|
||||
_gtSetPos (uiRow, uiCol);
|
||||
break;
|
||||
case 13:
|
||||
s_uiCurrentCol = 0;
|
||||
uiCol = 0;
|
||||
_gtSetPos (uiRow, uiCol);
|
||||
break;
|
||||
default:
|
||||
rc = _gtWrite(ch, 1);
|
||||
_gtGetPos (&uiRow, &uiCol);
|
||||
}
|
||||
if(rc)
|
||||
return(rc);
|
||||
@@ -405,6 +434,64 @@ int _gtWriteCon(char * fpStr, USHORT uiLen)
|
||||
return(0);
|
||||
}
|
||||
|
||||
int _gtScroll(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, SHORT iRows, SHORT iCols)
|
||||
{
|
||||
USHORT uiRow = s_uiCurrentRow, uiCol = s_uiCurrentCol, uiSize;
|
||||
int iLength = (uiRight - uiLeft) + 1;
|
||||
int iCount, iColOld, iColNew, iColSize;
|
||||
|
||||
if (_gtRectSize (uiTop, uiLeft, uiBottom, uiRight, &uiSize) == 0)
|
||||
{
|
||||
char * fpBlank = (char *)_xgrab (iLength);
|
||||
char * fpBuff = (char *)_xgrab (iLength * 2);
|
||||
if (fpBlank && fpBuff)
|
||||
{
|
||||
for (iCount = 0; iCount < iLength; iCount++)
|
||||
fpBlank [iCount] = 0;
|
||||
if (iCols >= 0)
|
||||
{
|
||||
iColOld = iColNew = uiLeft;
|
||||
iColOld += iCols;
|
||||
iColSize = uiRight - uiLeft;
|
||||
iColSize -= iCols;
|
||||
}
|
||||
else
|
||||
{
|
||||
iColOld = iColNew = uiLeft;
|
||||
iColNew -= iCols;
|
||||
iColSize = uiRight - uiLeft;
|
||||
iColSize += iCols;
|
||||
}
|
||||
for (iCount = (iRows >= 0 ? uiTop : uiBottom);
|
||||
(iRows >= 0 ? iCount <= uiBottom : iCount >= uiTop);
|
||||
(iRows >= 0 ? iCount++ : iCount--))
|
||||
{
|
||||
/* TODO: need to get current color setting from s_szColorString and
|
||||
s_uiColorIndex
|
||||
*/
|
||||
int iRowPos = iCount + iRows;
|
||||
char attr=7;
|
||||
/* Blank the scroll region in the current row */
|
||||
gtPuts (uiLeft, iCount, attr, fpBlank, iLength);
|
||||
|
||||
if ((iRows || iCols) && iRowPos <= uiBottom && iRowPos >= uiTop)
|
||||
{
|
||||
/* Read the text to be scrolled into the current row */
|
||||
gtGetText (iColOld, iRowPos, iColOld + iColSize, iRowPos, fpBuff);
|
||||
|
||||
/* Write the scrolled text to the current row */
|
||||
gtPutText (iColNew, iCount, iColNew + iColSize, iCount, fpBuff);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fpBlank) _xfree (fpBlank);
|
||||
if (fpBuff) _xfree (fpBuff);
|
||||
}
|
||||
s_uiCurrentRow = uiRow;
|
||||
s_uiCurrentCol = uiCol;
|
||||
return(0);
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
void main(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user