2009-07-10 03:43 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* source/rtl/gtwin/gtwin.c
  * source/rtl/gtwvt/gtwvt.h
  * source/rtl/gtwvt/gtwvt.c
    * Updated to use ints instead of [U]SHORTs internally.
    ; Please review me and correct any possible mistakes.

  * contrib/xhb/xhbscr.c
    % Deleted explicit casts.
This commit is contained in:
Viktor Szakats
2009-07-10 01:44:29 +00:00
parent e08ab48f90
commit f85d360181
5 changed files with 110 additions and 102 deletions

View File

@@ -17,6 +17,16 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-07-10 03:43 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* source/rtl/gtwin/gtwin.c
* source/rtl/gtwvt/gtwvt.h
* source/rtl/gtwvt/gtwvt.c
* Updated to use ints instead of [U]SHORTs internally.
; Please review me and correct any possible mistakes.
* contrib/xhb/xhbscr.c
% Deleted explicit casts.
2009-07-10 03:17 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapigt.h
* harbour/source/rtl/gtapi.c

View File

@@ -57,10 +57,10 @@
HB_FUNC( SCROLLFIXED )
{
hb_gtScroll( ( USHORT ) hb_parni( 1 ),
( USHORT ) hb_parni( 2 ),
( USHORT ) hb_parni( 3 ),
( USHORT ) hb_parni( 4 ),
( SHORT ) hb_parni( 5 ), /* Defaults to zero on bad type */
( SHORT ) hb_parni( 6 ) ); /* Defaults to zero on bad type */
hb_gtScroll( hb_parni( 1 ),
hb_parni( 2 ),
hb_parni( 3 ),
hb_parni( 4 ),
hb_parni( 5 ), /* Defaults to zero on bad type */
hb_parni( 6 ) ); /* Defaults to zero on bad type */
}

View File

@@ -153,15 +153,14 @@ static BOOL s_bSpecialKeyHandling;
static BOOL s_bAltKeyHandling;
static DWORD s_dwAltGrBits; /* JC: used to verify ALT+GR on different platforms */
static BOOL s_bBreak; /* Used to signal Ctrl+Break to hb_inkeyPoll() */
static USHORT s_uiDispCount;
static USHORT s_usCursorStyle;
static USHORT s_usOldCurStyle;
static SHORT s_sCurRow;
static SHORT s_sCurCol;
static USHORT s_usUpdtTop;
static USHORT s_usUpdtBottom;
static USHORT s_usUpdtLeft;
static USHORT s_usUpdtRight;
static int s_iCursorStyle;
static int s_iOldCurStyle;
static int s_iCurRow;
static int s_iCurCol;
static int s_iUpdtTop;
static int s_iUpdtBottom;
static int s_iUpdtLeft;
static int s_iUpdtRight;
static CHAR_INFO * s_pCharInfoScreen = NULL;
static ULONG s_ulScreenBuffSize = 0;
@@ -434,8 +433,8 @@ static void hb_gt_win_xSetCursorPos( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_win_xSetCursorPos()"));
s_csbi.dwCursorPosition.Y = s_sCurRow;
s_csbi.dwCursorPosition.X = s_sCurCol;
s_csbi.dwCursorPosition.Y = ( SHORT ) s_iCurRow;
s_csbi.dwCursorPosition.X = ( SHORT ) s_iCurCol;
SetConsoleCursorPosition( s_HOutput, s_csbi.dwCursorPosition );
}
@@ -447,7 +446,7 @@ static void hb_gt_win_xSetCursorStyle( void )
HB_TRACE(HB_TR_DEBUG, ("hb_gt_win_xSetCursorStyle()"));
switch( s_usCursorStyle )
switch( s_iCursorStyle )
{
case SC_NONE:
cci.bVisible = FALSE;
@@ -477,7 +476,7 @@ static void hb_gt_win_xSetCursorStyle( void )
cci.dwSize = 13;
break;
}
s_usOldCurStyle = s_usCursorStyle;
s_iOldCurStyle = s_iCursorStyle;
SetConsoleCursorInfo( s_HOutput, &cci );
}
@@ -489,23 +488,23 @@ static void hb_gt_win_xScreenUpdate( void )
if( s_pCharInfoScreen )
{
if( s_uiDispCount == 0 && s_usUpdtTop <= s_usUpdtBottom )
if( s_iUpdtTop <= s_iUpdtBottom )
{
COORD coDest, coSize;
SMALL_RECT srWin;
coSize.Y = _GetScreenHeight();
coSize.X = _GetScreenWidth();
coDest.Y = s_usUpdtTop;
coDest.X = s_usUpdtLeft;
srWin.Top = ( SHORT ) s_usUpdtTop;
srWin.Left = ( SHORT ) s_usUpdtLeft;
srWin.Bottom = ( SHORT ) s_usUpdtBottom;
srWin.Right = ( SHORT ) s_usUpdtRight;
coSize.Y = _GetScreenHeight();
coSize.X = _GetScreenWidth();
coDest.Y = ( SHORT ) s_iUpdtTop;
coDest.X = ( SHORT ) s_iUpdtLeft;
srWin.Top = ( SHORT ) s_iUpdtTop;
srWin.Left = ( SHORT ) s_iUpdtLeft;
srWin.Bottom = ( SHORT ) s_iUpdtBottom;
srWin.Right = ( SHORT ) s_iUpdtRight;
s_usUpdtTop = _GetScreenHeight();
s_usUpdtLeft = _GetScreenWidth();
s_usUpdtBottom = s_usUpdtRight = 0;
s_iUpdtTop = _GetScreenHeight();
s_iUpdtLeft = _GetScreenWidth();
s_iUpdtBottom = s_iUpdtRight = 0;
WriteConsoleOutput( s_HOutput, /* output handle */
s_pCharInfoScreen, /* data to write */
@@ -514,31 +513,31 @@ static void hb_gt_win_xScreenUpdate( void )
&srWin ); /* screen buffer rect to write data to */
}
if( s_usOldCurStyle != s_usCursorStyle &&
( s_uiDispCount == 0 || s_usCursorStyle == SC_NONE ) )
if( s_iOldCurStyle != s_iCursorStyle &&
s_iCursorStyle == SC_NONE )
hb_gt_win_xSetCursorStyle();
if( s_usCursorStyle != SC_NONE && s_uiDispCount == 0 &&
( s_csbi.dwCursorPosition.Y != s_sCurRow ||
s_csbi.dwCursorPosition.X != s_sCurCol ) )
if( s_iCursorStyle != SC_NONE &&
( s_csbi.dwCursorPosition.Y != s_iCurRow ||
s_csbi.dwCursorPosition.X != s_iCurCol ) )
hb_gt_win_xSetCursorPos();
}
}
/* *********************************************************************** */
static void hb_gt_win_xUpdtSet( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight )
static void hb_gt_win_xUpdtSet( int iTop, int iLeft, int iBottom, int iRight )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_win_xUpdtSet(%hu, %hu, %hu, %hu)", usTop, usLeft, usBottom, usRight));
HB_TRACE(HB_TR_DEBUG, ("hb_gt_win_xUpdtSet(%d, %d, %d, %d)", iTop, iLeft, iBottom, iRight));
if( usTop < s_usUpdtTop )
s_usUpdtTop = usTop;
if( usLeft < s_usUpdtLeft )
s_usUpdtLeft = usLeft;
if( usBottom > s_usUpdtBottom )
s_usUpdtBottom = HB_MIN( usBottom, ( USHORT ) _GetScreenHeight() - 1 );
if( usRight > s_usUpdtRight )
s_usUpdtRight = HB_MIN( usRight, ( USHORT ) _GetScreenWidth() - 1 );
if( iTop < s_iUpdtTop )
s_iUpdtTop = iTop;
if( iLeft < s_iUpdtLeft )
s_iUpdtLeft = iLeft;
if( iBottom > s_iUpdtBottom )
s_iUpdtBottom = HB_MIN( iBottom, ( int ) _GetScreenHeight() - 1 );
if( iRight > s_iUpdtRight )
s_iUpdtRight = HB_MIN( iRight, ( int ) _GetScreenWidth() - 1 );
}
/* *********************************************************************** */
@@ -618,11 +617,11 @@ static void hb_gt_win_xInitScreenParam( PHB_GT pGT )
s_pCharInfoScreen = ( CHAR_INFO * ) hb_xgrab( s_ulScreenBuffSize );
}
s_sCurRow = s_csbi.dwCursorPosition.Y;
s_sCurCol = s_csbi.dwCursorPosition.X;
s_usUpdtTop = s_csbi.dwSize.Y;
s_usUpdtLeft = s_csbi.dwSize.X;
s_usUpdtBottom = s_usUpdtRight = 0;
s_iCurRow = s_csbi.dwCursorPosition.Y;
s_iCurCol = s_csbi.dwCursorPosition.X;
s_iUpdtTop = s_csbi.dwSize.Y;
s_iUpdtLeft = s_csbi.dwSize.X;
s_iUpdtBottom = s_iUpdtRight = 0;
/*
* Unfortunatelly Windows refuse to read to big area :-(
@@ -654,7 +653,7 @@ static void hb_gt_win_xInitScreenParam( PHB_GT pGT )
{
hb_gt_win_xGetScreenContents( pGT, &srWin );
}
HB_GTSELF_SETPOS( pGT, s_sCurRow, s_sCurCol );
HB_GTSELF_SETPOS( pGT, s_iCurRow, s_iCurCol );
}
else if( s_pCharInfoScreen )
{
@@ -688,8 +687,7 @@ static void hb_gt_win_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil
s_bBreak = FALSE;
s_cNumRead = 0;
s_cNumIndex = 0;
s_uiDispCount = 0;
s_usOldCurStyle = s_usCursorStyle = SC_NORMAL;
s_iOldCurStyle = s_iCursorStyle = SC_NORMAL;
s_bSpecialKeyHandling = FALSE;
s_bAltKeyHandling = TRUE;
@@ -768,8 +766,8 @@ static void hb_gt_win_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil
memcpy( &s_origCsbi, &s_csbi, sizeof( s_csbi ) );
s_csbi.srWindow.Top = s_csbi.srWindow.Left = 0;
s_csbi.srWindow.Right = HB_MIN( s_csbi.srWindow.Right, _GetScreenWidth()-1 );
s_csbi.srWindow.Bottom = HB_MIN( s_csbi.srWindow.Bottom, _GetScreenHeight()-1 );
s_csbi.srWindow.Right = HB_MIN( s_csbi.srWindow.Right, _GetScreenWidth() - 1 );
s_csbi.srWindow.Bottom = HB_MIN( s_csbi.srWindow.Bottom, _GetScreenHeight() - 1 );
SetConsoleWindowInfo( s_HOutput, TRUE, &s_csbi.srWindow );
SetConsoleScreenBufferSize( s_HOutput, s_csbi.dwSize );
@@ -1769,12 +1767,12 @@ static void hb_gt_win_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize )
{
if( !HB_GTSELF_GETSCRCHAR( pGT, iRow, iCol++, &bColor, &bAttr, &usChar ) )
break;
s_pCharInfoScreen[i].Char.AsciiChar = ( CHAR ) s_charTrans[ usChar & 0xFF ];
s_pCharInfoScreen[i].Attributes = ( WORD ) ( bColor & 0xFF );
s_pCharInfoScreen[ i ].Char.AsciiChar = ( CHAR ) s_charTrans[ usChar & 0xFF ];
s_pCharInfoScreen[ i ].Attributes = ( WORD ) ( bColor & 0xFF );
++i;
}
hb_gt_win_xUpdtSet( ( USHORT ) iRow, ( USHORT ) iFirst, ( USHORT ) iRow, ( USHORT ) iCol - 1 );
hb_gt_win_xUpdtSet( iRow, iFirst, iRow, iCol - 1 );
}
}
@@ -1792,18 +1790,18 @@ static void hb_gt_win_Refresh( PHB_GT pGT )
HB_GTSELF_GETSCRCURSOR( pGT, &iRow, &iCol, &iStyle );
s_sCurRow = ( SHORT ) iRow;
s_sCurCol = ( SHORT ) iCol;
s_iCurRow = iRow;
s_iCurCol = iCol;
if( iRow < 0 || iCol < 0 ||
iRow >= ( int ) _GetScreenHeight() ||
iCol >= ( int ) _GetScreenWidth() )
{
s_usCursorStyle = SC_NONE;
s_iCursorStyle = SC_NONE;
}
else
{
s_usCursorStyle = ( USHORT ) iStyle;
s_iCursorStyle = iStyle;
}
hb_gt_win_xScreenUpdate();

View File

@@ -395,7 +395,7 @@ static HFONT hb_gt_wvt_GetFont( const char * pszFace, int iHeight, int iWidth, i
return ( HFONT ) GetStockObject( OEM_FIXED_FONT /* SYSTEM_FIXED_FONT */ );
}
static POINT hb_gt_wvt_GetXYFromColRow( PHB_GTWVT pWVT, USHORT col, USHORT row )
static POINT hb_gt_wvt_GetXYFromColRow( PHB_GTWVT pWVT, int col, int row )
{
POINT xy;
@@ -467,7 +467,7 @@ static void hb_gt_wvt_UpdateCaret( PHB_GTWVT pWVT )
if( pWVT->CaretExist )
{
POINT xy;
xy = hb_gt_wvt_GetXYFromColRow( pWVT, ( SHORT ) iCol, ( SHORT ) iRow );
xy = hb_gt_wvt_GetXYFromColRow( pWVT, iCol, iRow );
SetCaretPos( xy.x, pWVT->CaretSize < 0 ?
xy.y : xy.y + pWVT->PTEXTSIZE.y - pWVT->CaretSize );
ShowCaret( pWVT->hWnd );
@@ -596,7 +596,7 @@ static void hb_gt_wvt_FitRows( PHB_GTWVT pWVT )
{
BOOL bOldCentre = pWVT->CentreWindow;
pWVT->CentreWindow = pWVT->bMaximized ? TRUE : FALSE;
HB_GTSELF_SETMODE( pWVT->pGT, ( USHORT ) ( maxHeight / pWVT->PTEXTSIZE.y ), ( USHORT ) ( maxWidth / pWVT->PTEXTSIZE.x ) );
HB_GTSELF_SETMODE( pWVT->pGT, ( maxHeight / pWVT->PTEXTSIZE.y ), ( maxWidth / pWVT->PTEXTSIZE.x ) );
pWVT->CentreWindow = bOldCentre;
}
}
@@ -703,8 +703,8 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT )
for( n = 0; n < pWVT->COLS; n++ )
pWVT->FixedSize[ n ] = pWVT->PTEXTSIZE.x;
width = ( ( USHORT ) ( pWVT->PTEXTSIZE.x * pWVT->COLS ) ) + borderWidth;
height = ( ( USHORT ) ( pWVT->PTEXTSIZE.y * pWVT->ROWS ) ) + borderHeight;
width = ( ( int ) ( pWVT->PTEXTSIZE.x * pWVT->COLS ) ) + borderWidth;
height = ( ( int ) ( pWVT->PTEXTSIZE.y * pWVT->ROWS ) ) + borderHeight;
if( pWVT->bMaximized )
{
@@ -722,8 +722,8 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT )
}
else
{
width = ( ( USHORT ) ( pWVT->PTEXTSIZE.x * pWVT->COLS ) ) + borderWidth;
height = ( ( USHORT ) ( pWVT->PTEXTSIZE.y * pWVT->ROWS ) ) + borderHeight;
width = ( ( int ) ( pWVT->PTEXTSIZE.x * pWVT->COLS ) ) + borderWidth;
height = ( ( int ) ( pWVT->PTEXTSIZE.y * pWVT->ROWS ) ) + borderHeight;
SetWindowPos( pWVT->hWnd, NULL, 0, 0, width, height, SWP_NOZORDER | SWP_NOMOVE );
}
@@ -762,7 +762,7 @@ static void hb_gt_wvt_ResetWindowSize( PHB_GTWVT pWVT )
{
HDC hdc;
HFONT hFont, hOldFont;
USHORT height, width;
int height, width;
RECT wi, ci;
TEXTMETRIC tm;
RECT rcWorkArea;
@@ -828,11 +828,11 @@ static void hb_gt_wvt_ResetWindowSize( PHB_GTWVT pWVT )
GetWindowRect( pWVT->hWnd, &wi );
GetClientRect( pWVT->hWnd, &ci );
height = ( USHORT ) ( pWVT->PTEXTSIZE.y * pWVT->ROWS );
width = ( USHORT ) ( pWVT->PTEXTSIZE.x * pWVT->COLS );
height = ( int ) ( pWVT->PTEXTSIZE.y * pWVT->ROWS );
width = ( int ) ( pWVT->PTEXTSIZE.x * pWVT->COLS );
width += ( USHORT ) ( wi.right - wi.left - ci.right );
height += ( USHORT ) ( wi.bottom - wi.top - ci.bottom );
width += ( int ) ( wi.right - wi.left - ci.right );
height += ( int ) ( wi.bottom - wi.top - ci.bottom );
/* Center the window within the CLIENT area on the screen
but only if pWVT->CentreWindow == TRUE */
@@ -855,11 +855,11 @@ static void hb_gt_wvt_ResetWindowSize( PHB_GTWVT pWVT )
GetWindowRect( pWVT->hWnd, &wi );
GetClientRect( pWVT->hWnd, &ci );
height = ( USHORT ) ( pWVT->PTEXTSIZE.y * pWVT->ROWS );
width = ( USHORT ) ( pWVT->PTEXTSIZE.x * pWVT->COLS );
height = ( int ) ( pWVT->PTEXTSIZE.y * pWVT->ROWS );
width = ( int ) ( pWVT->PTEXTSIZE.x * pWVT->COLS );
width += ( USHORT ) ( wi.right - wi.left - ci.right );
height += ( USHORT ) ( wi.bottom - wi.top - ci.bottom );
width += ( int ) ( wi.right - wi.left - ci.right );
height += ( int ) ( wi.bottom - wi.top - ci.bottom );
/* Center the window within the CLIENT area on the screen
but only if pWVT->CentreWindow == TRUE */
@@ -907,8 +907,8 @@ static BOOL hb_gt_wvt_SetWindowSize( PHB_GTWVT pWVT, int iRow, int iCol )
{
if( HB_GTSELF_RESIZE( pWVT->pGT, iRow, iCol ) )
{
pWVT->ROWS = ( USHORT ) iRow;
pWVT->COLS = ( USHORT ) iCol;
pWVT->ROWS = iRow;
pWVT->COLS = iCol;
return TRUE;
}
@@ -928,7 +928,7 @@ static BOOL hb_gt_wvt_InitWindow( PHB_GTWVT pWVT, int iRow, int iCol )
* get the row and column from xy pixel client coordinates
* This works because we are using the FIXED system font
*/
static POINT hb_gt_wvt_GetColRowFromXY( PHB_GTWVT pWVT, USHORT x, USHORT y )
static POINT hb_gt_wvt_GetColRowFromXY( PHB_GTWVT pWVT, LONG x, LONG y )
{
POINT colrow;
@@ -954,8 +954,8 @@ static RECT hb_gt_wvt_GetColRowFromXYRect( PHB_GTWVT pWVT, RECT xy )
static void hb_gt_wvt_SetMousePos( PHB_GTWVT pWVT, int iRow, int iCol )
{
pWVT->MousePos.y = ( SHORT ) iRow;
pWVT->MousePos.x = ( SHORT ) iCol;
pWVT->MousePos.y = iRow;
pWVT->MousePos.x = iCol;
}
static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, LPARAM lParam )
@@ -971,7 +971,7 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L
xy.x = LOWORD( lParam );
xy.y = HIWORD( lParam );
colrow = hb_gt_wvt_GetColRowFromXY( pWVT, ( USHORT ) xy.x, ( USHORT ) xy.y );
colrow = hb_gt_wvt_GetColRowFromXY( pWVT, xy.x, xy.y );
hb_gt_wvt_SetMousePos( pWVT, colrow.y, colrow.x );
switch( message )
@@ -1515,7 +1515,7 @@ static BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, LPA
* hb_gt_wvt_TextOut converts col and row to x and y ( pixels ) and calls
* the Windows function TextOut with the expected coordinates
*/
static BOOL hb_gt_wvt_TextOut( PHB_GTWVT pWVT, HDC hdc, USHORT col, USHORT row, BYTE attr, LPCTSTR lpString, USHORT cbString )
static BOOL hb_gt_wvt_TextOut( PHB_GTWVT pWVT, HDC hdc, int col, int row, BYTE attr, LPCTSTR lpString, USHORT cbString )
{
POINT xy;
RECT rClip;
@@ -1569,7 +1569,7 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect )
}
else if( bColor != bOldColor )
{
hb_gt_wvt_TextOut( pWVT, hdc, ( USHORT ) startCol, ( USHORT ) iRow, bOldColor, text, ( USHORT ) len );
hb_gt_wvt_TextOut( pWVT, hdc, startCol, iRow, bOldColor, text, ( USHORT ) len );
bOldColor = bColor;
startCol = iCol;
len = 0;
@@ -1584,7 +1584,7 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect )
}
else if( bColor != bOldColor || bAttr != bOldAttr )
{
hb_gt_wvt_TextOut( pWVT, hdc, ( USHORT ) startCol, ( USHORT ) iRow, bOldColor, text, ( USHORT ) len );
hb_gt_wvt_TextOut( pWVT, hdc, startCol, iRow, bOldColor, text, ( USHORT ) len );
if( bAttr != bOldAttr )
{
SelectObject( hdc, ( bAttr & HB_GT_ATTR_BOX ) ? pWVT->hFontBox : pWVT->hFont );
@@ -1599,7 +1599,7 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect )
iCol++;
}
if( len > 0 )
hb_gt_wvt_TextOut( pWVT, hdc, ( USHORT ) startCol, ( USHORT ) iRow, bOldColor, text, ( USHORT ) len );
hb_gt_wvt_TextOut( pWVT, hdc, startCol, iRow, bOldColor, text, ( USHORT ) len );
}
EndPaint( pWVT->hWnd, &ps );
@@ -1776,14 +1776,14 @@ static BOOL hb_gt_wvt_ValidWindowSize( HWND hWnd, int rows, int cols, HFONT hFon
{
HDC hdc;
HFONT hOldFont;
USHORT width, height, maxWidth, maxHeight;
int width, height, maxWidth, maxHeight;
TEXTMETRIC tm;
RECT rcWorkArea;
SystemParametersInfo( SPI_GETWORKAREA,0, &rcWorkArea, 0 );
maxWidth = ( USHORT ) ( rcWorkArea.right - rcWorkArea.left );
maxHeight = ( USHORT ) ( rcWorkArea.bottom - rcWorkArea.top );
maxWidth = ( int ) ( rcWorkArea.right - rcWorkArea.left );
maxHeight = ( int ) ( rcWorkArea.bottom - rcWorkArea.top );
hdc = GetDC( hWnd );
hOldFont = ( HFONT ) SelectObject( hdc, hFont );
@@ -1791,8 +1791,8 @@ static BOOL hb_gt_wvt_ValidWindowSize( HWND hWnd, int rows, int cols, HFONT hFon
SelectObject( hdc, hOldFont ); /* Put old font back */
ReleaseDC( hWnd, hdc );
width = ( USHORT ) ( iWidth < 0 ? -iWidth : tm.tmAveCharWidth * cols ); /* Total pixel width this setting would take */
height = ( USHORT ) ( tm.tmHeight * rows ); /* Total pixel height this setting would take */
width = ( int ) ( iWidth < 0 ? -iWidth : tm.tmAveCharWidth * cols ); /* Total pixel width this setting would take */
height = ( int ) ( tm.tmHeight * rows ); /* Total pixel height this setting would take */
return ( width <= maxWidth ) && ( height <= maxHeight );
}
@@ -2249,7 +2249,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
iVal = hb_itemGetNI( pInfo->pNewVal );
if( iVal > 0 )
{
HB_GTSELF_SETMODE( pGT, ( USHORT ) ( iVal / pWVT->PTEXTSIZE.y ), pWVT->COLS );
HB_GTSELF_SETMODE( pGT, ( iVal / pWVT->PTEXTSIZE.y ), pWVT->COLS );
}
break;
@@ -2258,7 +2258,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
iVal = hb_itemGetNI( pInfo->pNewVal );
if( iVal > 0 )
{
HB_GTSELF_SETMODE( pGT, pWVT->ROWS, ( USHORT ) ( iVal / pWVT->PTEXTSIZE.x ) );
HB_GTSELF_SETMODE( pGT, pWVT->ROWS, ( iVal / pWVT->PTEXTSIZE.x ) );
}
break;
@@ -2531,7 +2531,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
{
BOOL bOldCentre = pWVT->CentreWindow;
pWVT->CentreWindow = pWVT->bMaximized ? TRUE : FALSE;
HB_GTSELF_SETMODE( pGT, ( USHORT ) ( iY / pWVT->PTEXTSIZE.y ), ( USHORT ) ( iX / pWVT->PTEXTSIZE.x ) );
HB_GTSELF_SETMODE( pGT, ( iY / pWVT->PTEXTSIZE.y ), ( iX / pWVT->PTEXTSIZE.x ) );
pWVT->CentreWindow = bOldCentre;
}
}
@@ -2897,9 +2897,9 @@ static void hb_gt_wvt_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize )
{
RECT rect;
rect.top = rect.bottom = ( SHORT ) iRow;
rect.left = ( SHORT ) iCol;
rect.right = ( SHORT ) ( iCol + iSize - 1 );
rect.top = rect.bottom = iRow;
rect.left = iCol;
rect.right = iCol + iSize - 1;
rect = hb_gt_wvt_GetXYFromColRowRect( pWVT, rect );

View File

@@ -119,8 +119,8 @@ typedef struct
HINSTANCE hInstance; /* parent window instance */
int iCmdShow;
USHORT ROWS; /* number of displayable rows in window */
USHORT COLS; /* number of displayable columns in window */
int ROWS; /* number of displayable rows in window */
int COLS; /* number of displayable columns in window */
COLORREF COLORS[ 16 ]; /* colors */