2011-06-09 22:50 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* src/rtl/gtwvt/gtwvt.h
  * src/rtl/gtwvt/gtwvt.c
  * tests/wvtext.prg
    + Massive GTWVT patch from Heinz V. Bergen. Thank you very much.
      Details:
      - fixed Alt-Enter for full screen, will no longer send the
        K_ENTER to the Input queue.
      - HB_K_RESIZE only sent if the Rows/Cols size actually changed.
      - Clicking Maximize (top right corner) button, will maximize window
        and change to Restore button, then clicking Restore button will
        restore the window to its previous size.
      - Dbl-clicking Title-Bar will maximize, then Dbl-Clicking Title
        bar again will restore.
      - Resizing window when in RESIZEMODE_FONT, will dynamically display
        the resulting size changes in real time.
      - All Maximize / Restore / Sizing works in RESIZEMODE_ROWS as would
        be expected.
      - Windows 7, dragging Window (Title-Bar) to top of screen will maximize,
        then dragging maximized window's Title bar down will Restore
        to previous size.
      - Windows 7, dragging Window (Title-Bar) left or right until mouse
        pointer hits the edge of the screen will size and dock to the left
        or right half of the screen, then dragging title bar away from docked
        position will restore the Window to its previous size.
      - Windows 7, resizing top or bottom until edge of screen hit
        (or dbl-clicking) will resize for maximum height. Then dragging
        title bar away will restore to previous size.
      - Before, depending on monitor's resolution, and when using
        Courier New or Terminal font, maximizing would fail due to Font
        metrics being incompatible with the Window's size or maybe due to
        math issues, I was able to resolve by slightly adjusting the Font's
        width or height down and then trying again until successful.
      - Pressing Alt-Enter (when enabled) for full screen mode and then
        pressing Alt-Enter again will restore Window to previous
        non-maximized size.
      - extended GT test app
    ; Please make test and report any experiences on devel list
This commit is contained in:
Viktor Szakats
2011-06-09 20:51:42 +00:00
parent 4bebbd6ac3
commit 1ad759fbb5
4 changed files with 765 additions and 393 deletions

View File

@@ -16,6 +16,45 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-06-09 22:50 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* src/rtl/gtwvt/gtwvt.h
* src/rtl/gtwvt/gtwvt.c
* tests/wvtext.prg
+ Massive GTWVT patch from Heinz V. Bergen. Thank you very much.
Details:
- fixed Alt-Enter for full screen, will no longer send the
K_ENTER to the Input queue.
- HB_K_RESIZE only sent if the Rows/Cols size actually changed.
- Clicking Maximize (top right corner) button, will maximize window
and change to Restore button, then clicking Restore button will
restore the window to its previous size.
- Dbl-clicking Title-Bar will maximize, then Dbl-Clicking Title
bar again will restore.
- Resizing window when in RESIZEMODE_FONT, will dynamically display
the resulting size changes in real time.
- All Maximize / Restore / Sizing works in RESIZEMODE_ROWS as would
be expected.
- Windows 7, dragging Window (Title-Bar) to top of screen will maximize,
then dragging maximized window's Title bar down will Restore
to previous size.
- Windows 7, dragging Window (Title-Bar) left or right until mouse
pointer hits the edge of the screen will size and dock to the left
or right half of the screen, then dragging title bar away from docked
position will restore the Window to its previous size.
- Windows 7, resizing top or bottom until edge of screen hit
(or dbl-clicking) will resize for maximum height. Then dragging
title bar away will restore to previous size.
- Before, depending on monitor's resolution, and when using
Courier New or Terminal font, maximizing would fail due to Font
metrics being incompatible with the Window's size or maybe due to
math issues, I was able to resolve by slightly adjusting the Font's
width or height down and then trying again until successful.
- Pressing Alt-Enter (when enabled) for full screen mode and then
pressing Alt-Enter again will restore Window to previous
non-maximized size.
- extended GT test app
; Please make test and report any experiences on devel list
2011-06-09 15:31 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapifs.h
* harbour/src/rtl/filesys.c

View File

@@ -595,39 +595,34 @@ static int hb_gt_wvt_key_ansi_to_oem( int c )
static void hb_gt_wvt_FitRows( PHB_GTWVT pWVT )
{
RECT wi;
RECT ci;
int maxWidth;
int maxHeight;
int borderWidth;
int borderHeight;
int irows = pWVT->ROWS;
int icols = pWVT->COLS;
if( IsZoomed( pWVT->hWnd ) )
pWVT->bMaximized = HB_TRUE;
else
pWVT->bMaximized = HB_FALSE;
GetClientRect( pWVT->hWnd, &ci );
GetWindowRect( pWVT->hWnd, &wi );
borderWidth = ( wi.right - wi.left - ( ci.right - ci.left ) );
borderHeight = ( wi.bottom - wi.top - ( ci.bottom - ci.top ) );
if( pWVT->bMaximized )
{
SystemParametersInfo( SPI_GETWORKAREA, 0, &wi, 0 );
maxHeight = wi.bottom - wi.top - borderHeight;
maxWidth = wi.right - wi.left - borderWidth;
}
else
{
maxWidth = ci.right - ci.left;
maxHeight = ci.bottom - ci.top;
}
maxWidth = ci.right;
maxHeight = ci.bottom;
if( maxHeight > 0 )
{
HB_BOOL bOldCentre = pWVT->CentreWindow;
pWVT->bResizing = HB_TRUE;
pWVT->CentreWindow = pWVT->bMaximized ? HB_TRUE : HB_FALSE;
HB_GTSELF_SETMODE( pWVT->pGT, ( maxHeight / pWVT->PTEXTSIZE.y ), ( maxWidth / pWVT->PTEXTSIZE.x ) );
pWVT->CentreWindow = bOldCentre;
pWVT->bResizing = HB_FALSE;
pWVT->bAlreadySizing = HB_FALSE;
}
if( irows != pWVT->ROWS || icols != pWVT->COLS )
hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_RESIZE );
}
static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT )
@@ -640,31 +635,27 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT )
int borderHeight;
int left;
int top;
int i = 0;
int j = 0;
int iCalcWidth = 0;
int iCalcHeight = 0;
if( IsZoomed( pWVT->hWnd ) )
pWVT->bMaximized = HB_TRUE;
else
pWVT->bMaximized = HB_FALSE;
GetClientRect( pWVT->hWnd, &ci );
GetWindowRect( pWVT->hWnd, &wi );
borderWidth = ( wi.right - wi.left - ( ci.right - ci.left ) );
borderHeight = ( wi.bottom - wi.top - ( ci.bottom - ci.top ) );
borderWidth = ( wi.right - wi.left ) - ci.right;
borderHeight = ( wi.bottom - wi.top ) - ci.bottom;
if( pWVT->bMaximized )
{
SystemParametersInfo( SPI_GETWORKAREA, 0, &wi, 0 );
maxWidth = ci.right;
maxHeight = ci.bottom;
maxHeight = wi.bottom - wi.top - borderHeight;
maxWidth = wi.right - wi.left - borderWidth;
left = 0;
top = 0;
}
else
{
maxHeight = ci.bottom - ci.top;
maxWidth = ci.right - ci.left;
left = wi.left;
top = wi.top;
}
left = wi.left;
top = wi.top;
{
HFONT hOldFont;
@@ -676,125 +667,133 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT )
fontHeight = maxHeight / pWVT->ROWS;
fontWidth = maxWidth / pWVT->COLS;
hFont = hb_gt_wvt_GetFont( pWVT->fontFace, fontHeight, fontWidth, pWVT->fontWeight, pWVT->fontQuality, pWVT->CodePage );
if( hFont )
for( ;; )
{
HDC hdc;
int width;
int height;
TEXTMETRIC tm;
hdc = GetDC( pWVT->hWnd );
hOldFont = ( HFONT ) SelectObject( hdc, hFont );
SetTextCharacterExtra( hdc, 0 );
GetTextMetrics( hdc, &tm );
SelectObject( hdc, hOldFont );
ReleaseDC( pWVT->hWnd, hdc );
width = tm.tmAveCharWidth * pWVT->COLS;
height = tm.tmHeight * pWVT->ROWS;
if( width <= maxWidth &&
height <= maxHeight &&
tm.tmAveCharWidth >= 3 &&
tm.tmHeight >= 4 )
hFont = hb_gt_wvt_GetFont( pWVT->fontFace, fontHeight, fontWidth, pWVT->fontWeight, pWVT->fontQuality, pWVT->CodePage );
if( hFont )
{
#if ! defined( UNICODE )
if( pWVT->hFontBox && pWVT->hFontBox != pWVT->hFont )
DeleteObject( pWVT->hFontBox );
HDC hdc;
int width;
int height;
TEXTMETRIC tm;
if( pWVT->CodePage == pWVT->boxCodePage )
pWVT->hFontBox = hFont;
else
hdc = GetDC( pWVT->hWnd );
hOldFont = ( HFONT ) SelectObject( hdc, hFont );
SetTextCharacterExtra( hdc, 0 );
GetTextMetrics( hdc, &tm );
SelectObject( hdc, hOldFont );
ReleaseDC( pWVT->hWnd, hdc );
width = tm.tmAveCharWidth * pWVT->COLS;
height = tm.tmHeight * pWVT->ROWS;
if( width <= maxWidth &&
height <= maxHeight &&
tm.tmAveCharWidth >= 4 &&
tm.tmHeight >= 8 )
{
pWVT->hFontBox = hb_gt_wvt_GetFont( pWVT->fontFace, fontHeight, fontWidth, pWVT->fontWeight, pWVT->fontQuality, pWVT->boxCodePage );
if( !pWVT->hFontBox )
#if ! defined( UNICODE )
if( pWVT->hFontBox && pWVT->hFontBox != pWVT->hFont )
DeleteObject( pWVT->hFontBox );
if( pWVT->CodePage == pWVT->boxCodePage )
pWVT->hFontBox = hFont;
}
else
{
pWVT->hFontBox = hb_gt_wvt_GetFont( pWVT->fontFace, fontHeight, fontWidth, pWVT->fontWeight, pWVT->fontQuality, pWVT->boxCodePage );
if( !pWVT->hFontBox )
pWVT->hFontBox = hFont;
}
#endif
if( pWVT->hFont )
DeleteObject( pWVT->hFont );
if( pWVT->hFont )
DeleteObject( pWVT->hFont );
pWVT->hFont = hFont;
pWVT->fontHeight = tm.tmHeight;
pWVT->fontWidth = tm.tmAveCharWidth;
pWVT->PTEXTSIZE.x = tm.tmAveCharWidth;
pWVT->PTEXTSIZE.y = tm.tmHeight;
pWVT->hFont = hFont;
pWVT->fontHeight = tm.tmHeight;
pWVT->fontWidth = tm.tmAveCharWidth;
pWVT->PTEXTSIZE.x = tm.tmAveCharWidth;
pWVT->PTEXTSIZE.y = tm.tmHeight;
#if defined( HB_OS_WIN_CE )
pWVT->FixedFont = HB_FALSE;
pWVT->FixedFont = HB_FALSE;
#else
pWVT->FixedFont = !pWVT->Win9X && pWVT->fontWidth >= 0 &&
( tm.tmPitchAndFamily & TMPF_FIXED_PITCH ) == 0 &&
( pWVT->PTEXTSIZE.x == tm.tmMaxCharWidth );
pWVT->FixedFont = !pWVT->Win9X && pWVT->fontWidth >= 0 &&
( tm.tmPitchAndFamily & TMPF_FIXED_PITCH ) == 0 &&
( pWVT->PTEXTSIZE.x == tm.tmMaxCharWidth );
#endif
for( n = 0; n < pWVT->COLS; n++ )
pWVT->FixedSize[ n ] = pWVT->PTEXTSIZE.x;
for( n = 0; n < pWVT->COLS; n++ )
pWVT->FixedSize[ n ] = pWVT->PTEXTSIZE.x;
width = ( ( int ) ( pWVT->PTEXTSIZE.x * pWVT->COLS ) ) + borderWidth;
height = ( ( int ) ( 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 )
{
left = ( ( wi.right - width ) / 2 );
top = ( ( wi.bottom - height ) / 2 );
if( pWVT->bMaximized )
{
pWVT->MarginLeft = ( wi.right - wi.left - width ) / 2;
pWVT->MarginTop = ( wi.bottom - wi.top - height ) / 2;
}
else
{
pWVT->MarginLeft = 0;
pWVT->MarginTop = 0;
SetWindowPos( pWVT->hWnd, NULL, left, top, width, height, SWP_NOZORDER );
}
left = ( left < 0 ? 0 : left );
top = ( top < 0 ? 0 : top );
if( pWVT->CaretExist && !pWVT->CaretHidden )
hb_gt_wvt_UpdateCaret( pWVT );
}
if( !pWVT->bFullScreen )
SetWindowPos( pWVT->hWnd, NULL, left, top, width, height, SWP_NOZORDER );
else
{
pWVT->MarginLeft = ( wi.right - wi.left - width ) / 2;
pWVT->MarginTop = ( wi.bottom - wi.top - height ) / 2;
/* there were some problems with repainting earlier, i hope they won't come back
* InvalidateRect( pWVT->hWnd, NULL, TRUE );
* UpdateWindow( pWVT->hWnd );
*/
/* I did it this way, so that "Courier New" would size and maximize as expected.
* "Courier New" appears to not scale linearily, sometimes by just decreasing the
* font width by one with some font heights makes it all work out?
* This code never seems to get executed with "Lucida Console"
* Width scaling with some Heights is an issue with Courier New and Terminal
* Height scaling with some Widths is an issue with Consolas and Terminal
* but this code lets us adjust it here and try creating the font again. [HVB] */
if( iCalcWidth == 0 && iCalcHeight == 0 )
{
iCalcWidth = fontWidth;
iCalcHeight = fontHeight;
}
if( i == j )
{
j = 0;
i++;
}
else if( i > j )
{
j++;
if( j == i )
i = 0;
}
else
i++;
fontWidth = iCalcWidth - i;
fontHeight = iCalcHeight - j;
if( fontWidth < 4 || fontHeight < 8 )
{
width = ( ( int ) ( pWVT->PTEXTSIZE.x * pWVT->COLS ) ) + borderWidth;
height = ( ( int ) ( pWVT->PTEXTSIZE.y * pWVT->ROWS ) ) + borderHeight;
SetWindowPos( pWVT->hWnd, NULL, left, top, width, height, SWP_NOZORDER );
break;
}
continue;
}
if( pWVT->CaretExist && !pWVT->CaretHidden )
hb_gt_wvt_UpdateCaret( pWVT );
}
else
{
width = ( ( int ) ( pWVT->PTEXTSIZE.x * pWVT->COLS ) ) + borderWidth;
height = ( ( int ) ( pWVT->PTEXTSIZE.y * pWVT->ROWS ) ) + borderHeight;
if( !pWVT->bFullScreen )
SetWindowPos( pWVT->hWnd, NULL, 0, 0, width, height, SWP_NOZORDER | SWP_NOMOVE );
if( width > maxWidth || height > maxHeight )
hb_gt_wvt_FitRows( pWVT );
HB_GTSELF_EXPOSEAREA( pWVT->pGT, 0, 0, pWVT->ROWS, pWVT->COLS );
}
HB_GTSELF_EXPOSEAREA( pWVT->pGT, 0, 0, pWVT->ROWS, pWVT->COLS );
break;
}
}
}
static void hb_gt_wvt_Maximize( PHB_GTWVT pWVT )
{
pWVT->bMaximized = HB_TRUE;
if( pWVT->ResizeMode == HB_GTI_RESIZEMODE_FONT )
hb_gt_wvt_FitSize( pWVT );
else
hb_gt_wvt_FitRows( pWVT );
/* Disable "maximize" button */
SetWindowLongPtr( pWVT->hWnd, GWL_STYLE, _WVT_WS_MAXED );
SetWindowPos( pWVT->hWnd, NULL, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DEFERERASE );
ShowWindow( pWVT->hWnd, SW_HIDE );
ShowWindow( pWVT->hWnd, SW_NORMAL );
if( pWVT->ResizeMode == HB_GTI_RESIZEMODE_ROWS )
hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_RESIZE );
}
static void hb_gt_wvt_ResetWindowSize( PHB_GTWVT pWVT, HFONT hFont )
{
HDC hdc;
@@ -802,7 +801,6 @@ static void hb_gt_wvt_ResetWindowSize( PHB_GTWVT pWVT, HFONT hFont )
int height, width;
RECT wi, ci;
TEXTMETRIC tm;
RECT rcWorkArea;
int n;
if( !pWVT->hFont || hFont )
@@ -871,41 +869,41 @@ static void hb_gt_wvt_ResetWindowSize( PHB_GTWVT pWVT, HFONT hFont )
/* Center the window within the CLIENT area on the screen
but only if pWVT->CentreWindow == HB_TRUE */
if( pWVT->CentreWindow && SystemParametersInfo( SPI_GETWORKAREA, 0, &rcWorkArea, 0 ) )
if( pWVT->bMaximized )
{
wi.left = rcWorkArea.left + ( ( rcWorkArea.right - rcWorkArea.left - width ) / 2 );
wi.top = rcWorkArea.top + ( ( rcWorkArea.bottom - rcWorkArea.top - height ) / 2 );
pWVT->MarginLeft = ( wi.right - wi.left - width ) / 2;
pWVT->MarginTop = ( wi.bottom - wi.top - height ) / 2;
}
if( wi.left < 0 || wi.top < 0 )
else if( pWVT->CentreWindow )
{
pWVT->bMaximized = HB_TRUE;
if( pWVT->ResizeMode == HB_GTI_RESIZEMODE_FONT )
hb_gt_wvt_FitSize( pWVT );
else
hb_gt_wvt_FitRows( pWVT );
/* resize the window to get the specified number of rows and columns */
GetWindowRect( pWVT->hWnd, &wi );
GetClientRect( pWVT->hWnd, &ci );
height = ( int ) ( pWVT->PTEXTSIZE.y * pWVT->ROWS );
width = ( int ) ( pWVT->PTEXTSIZE.x * pWVT->COLS );
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 == HB_TRUE */
if( pWVT->CentreWindow && SystemParametersInfo( SPI_GETWORKAREA, 0, &rcWorkArea, 0 ) )
RECT rcWorkArea;
if( SystemParametersInfo( SPI_GETWORKAREA, 0, &rcWorkArea, 0 ) && wi.left >= rcWorkArea.left && wi.right <= rcWorkArea.right && wi.top >= rcWorkArea.top && wi.bottom <= rcWorkArea.bottom )
{
/* Window was within the primary monitor's workspace, center it there. */
wi.left = rcWorkArea.left + ( ( rcWorkArea.right - rcWorkArea.left - width ) / 2 );
wi.top = rcWorkArea.top + ( ( rcWorkArea.bottom - rcWorkArea.top - height ) / 2 );
if( wi.top < rcWorkArea.top )
wi.top = rcWorkArea.top; /* Force window's title bar within the workarea. */
}
else
{
/* Not sure where current window is, or user's intention, will just resize it in place.
* This results in a Zoom / Implode effect at its current location, depending on size change.
* Window may be on a different monitor.
* Program's intention may be to size across more than one monitor?
* Programmer can always implicitly postion the window as desired.
*/
wi.left += ( ( wi.right - wi.left - width ) / 2 );
wi.top += ( ( wi.bottom - wi.top - height ) / 2 );
}
}
SetWindowPos( pWVT->hWnd, NULL, wi.left, wi.top, width, height, SWP_NOZORDER );
if( !pWVT->bMaximized )
{
pWVT->MarginLeft = 0;
pWVT->MarginTop = 0;
SetWindowPos( pWVT->hWnd, NULL, wi.left, wi.top, width, height, SWP_NOZORDER );
}
HB_GTSELF_EXPOSEAREA( pWVT->pGT, 0, 0, pWVT->ROWS, pWVT->COLS );
@@ -959,7 +957,7 @@ static RECT hb_gt_wvt_GetColRowFromXYRect( PHB_GTWVT pWVT, RECT xy )
{
RECT colrow;
if( pWVT->bFullScreen )
if( pWVT->bMaximized )
{
if( xy.left >= pWVT->MarginLeft )
xy.left = xy.left - pWVT->MarginLeft;
@@ -1245,8 +1243,8 @@ static HB_BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam,
/* in WM_CHAR i was unable to read Alt key state */
if( bAlt && pWVT->bAltEnter )
{
hb_gt_wvt_FullScreen( pWVT->pGT );
pWVT->IgnoreWM_SYSCHAR = HB_TRUE;
pWVT->IgnoreWM_SYSCHAR = HB_TRUE; /* this must be FIRST, otherwise some process in hb_gt_wvt_FullScreen posts the ENTER key to the InputQueue */
hb_gt_wvt_FullScreen( pWVT->pGT ); /* this must be last, otherwise some process in hb_gt_wvt_FullScreen posts the ENTER key to the InputQueue */
}
break;
case VK_LEFT:
@@ -1586,11 +1584,12 @@ static HB_BOOL hb_gt_wvt_TextOut( PHB_GTWVT pWVT, HDC hdc, int col, int row, int
lpString, cbString, pWVT->FixedFont ? NULL : pWVT->FixedSize );
}
static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect )
static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT )
{
PAINTSTRUCT ps;
HDC hdc;
RECT rcRect;
HBRUSH hBrush = CreateSolidBrush( pWVT->COLORS[ 0 ] );
int iRow, iCol, startCol, len;
int iColor, iOldColor = 0;
HB_BYTE bAttr;
@@ -1606,15 +1605,66 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect )
/* for sure there is a better method for repainting not used screen area
* ExcludeClipRect()?
*/
if( pWVT->bFullScreen )
FillRect( hdc, &updateRect, CreateSolidBrush( pWVT->COLORS[ 0 ] ) );
if( pWVT->bMaximized )
{
RECT ciNew = ps.rcPaint;
RECT ciTemp = ps.rcPaint;
if( pWVT->MarginLeft > 0 )
{
ciTemp.right = pWVT->MarginLeft;
FillRect( hdc, &ciTemp, hBrush );
ciTemp.right = ciNew.right;
ciTemp.left = ciTemp.right - pWVT->MarginLeft;
FillRect( hdc, &ciTemp, hBrush );
ciTemp.left = ciNew.left;
}
if( pWVT->MarginTop > 0 )
{
ciTemp.bottom = pWVT->MarginTop;
FillRect( hdc, &ciTemp, hBrush );
ciTemp.bottom = ciNew.bottom;
ciTemp.top = ciTemp.bottom - pWVT->MarginTop;
FillRect( hdc, &ciTemp, hBrush );
}
/*FillRect( hdc, &ps.rcPaint, hBrush);
* ^^^ this was previous code, caused entire window/screen to be erased on every
* WM_PAINT message which caused a Browse scroll to flicker badly under XP.
* Now, only repaints the margin areas as required.
*/
}
else if( pWVT->bAlreadySizing )
{
/* This code solves issue with XP when resizing with mouse on window borders,
* only applicable when ResizeMode is by ROWS, depending on Windows settings
* to "Show window content while dragging." would cause border artifacts or
* content smearing when sizing. Now will paint new area black until mouse
* button is released, much like Windows 7 behaviour.
* One issue here is that I need a static variable RECT ciLast to store the
* Client area coordinates before Window sized, this is set in the WM_ENTERSIZEMOVE
* message and then used here to calculate the size changed areas to paint black.
*/
RECT ciNew = ps.rcPaint;
RECT ciTemp = ps.rcPaint;
if( ciNew.bottom > pWVT->ciLast.bottom )
{
ciTemp.top = pWVT->ciLast.bottom;
FillRect( hdc, &ciTemp, hBrush );
ciTemp.top = ciNew.top;
}
if( ciNew.right > pWVT->ciLast.right )
{
ciTemp.left = pWVT->ciLast.right;
FillRect( hdc, &ciTemp, hBrush );
}
}
#if defined( UNICODE )
SelectObject( hdc, pWVT->hFont );
hostCDP = pWVT->hostCDP ? pWVT->hostCDP : hb_vmCDP();
#endif
rcRect = hb_gt_wvt_GetColRowFromXYRect( pWVT, updateRect );
rcRect = hb_gt_wvt_GetColRowFromXYRect( pWVT, ps.rcPaint );
for( iRow = rcRect.top; iRow <= rcRect.bottom; ++iRow )
{
@@ -1674,8 +1724,8 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect )
if( len > 0 )
hb_gt_wvt_TextOut( pWVT, hdc, startCol, iRow, iOldColor, pWVT->TextLine, ( UINT ) len );
}
EndPaint( pWVT->hWnd, &ps );
DeleteObject( hBrush );
}
static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
@@ -1704,10 +1754,9 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara
case WM_PAINT:
{
RECT updateRect;
if( GetUpdateRect( hWnd, &updateRect, FALSE ) )
hb_gt_wvt_PaintText( pWVT, updateRect );
if( GetUpdateRect( hWnd, NULL, FALSE ) )
hb_gt_wvt_PaintText( pWVT );
return 0;
}
@@ -1775,58 +1824,40 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara
return 0;
case WM_ENTERSIZEMOVE:
if( pWVT->bMaximized )
{
pWVT->bMaximized = HB_FALSE;
/* Enable "maximize" button */
SetWindowLongPtr( pWVT->hWnd, GWL_STYLE, _WVT_WS_DEF );
SetWindowPos( pWVT->hWnd, NULL, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DEFERERASE );
ShowWindow( pWVT->hWnd, SW_HIDE );
ShowWindow( pWVT->hWnd, SW_NORMAL );
}
GetClientRect( pWVT->hWnd, &pWVT->ciLast ); /* need in Paint function, client area before sizing started */
pWVT->bResizing = HB_TRUE;
return 0;
case WM_EXITSIZEMOVE:
pWVT->bResizing = HB_FALSE;
if( pWVT->ResizeMode == HB_GTI_RESIZEMODE_ROWS )
hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_RESIZE );
return 0;
case WM_SIZE:
if( pWVT->bResizing )
if( pWVT->bAlreadySizing )
/* user was resizing as opposed to moving window */
{
if( ! pWVT->bAlreadySizing )
{
pWVT->bAlreadySizing = HB_TRUE;
if( pWVT->ResizeMode == HB_GTI_RESIZEMODE_FONT )
hb_gt_wvt_FitSize( pWVT );
else
hb_gt_wvt_FitRows( pWVT );
}
hb_gt_wvt_FitRows( pWVT );
pWVT->bAlreadySizing = HB_FALSE;
}
return 0;
#if ! defined( HB_OS_WIN_CE )
case WM_NCLBUTTONDBLCLK:
if( ! pWVT->bMaximized )
hb_gt_wvt_Maximize( pWVT );
case WM_SIZE:
if( ! pWVT->bFullScreen )
{
if( pWVT->bResizing && pWVT->ResizeMode == HB_GTI_RESIZEMODE_ROWS )
pWVT->bAlreadySizing = HB_TRUE;
else if( pWVT->ResizeMode == HB_GTI_RESIZEMODE_FONT )
{
if( !pWVT->bAlreadySizing )
hb_gt_wvt_FitSize( pWVT );
}
else
/* resize came from Maximize, Restore, other than mouse resizing... */
hb_gt_wvt_FitRows( pWVT );
}
return 0;
#endif
case WM_SYSCOMMAND:
switch( wParam )
{
case SC_MAXIMIZE:
{
hb_gt_wvt_Maximize( pWVT );
return 0;
}
case SYS_EV_MARK:
{
@@ -1852,30 +1883,6 @@ static WPARAM hb_gt_wvt_ProcessMessages( void )
return msg.wParam;
}
static HB_BOOL hb_gt_wvt_ValidWindowSize( HWND hWnd, int rows, int cols, HFONT hFont, int iWidth )
{
HDC hdc;
HFONT hOldFont;
int width, height, maxWidth, maxHeight;
TEXTMETRIC tm;
RECT rcWorkArea;
SystemParametersInfo( SPI_GETWORKAREA, 0, &rcWorkArea, 0 );
maxWidth = ( int ) ( rcWorkArea.right - rcWorkArea.left );
maxHeight = ( int ) ( rcWorkArea.bottom - rcWorkArea.top );
hdc = GetDC( hWnd );
hOldFont = ( HFONT ) SelectObject( hdc, hFont );
GetTextMetrics( hdc, &tm );
SelectObject( hdc, hOldFont ); /* Put old font back */
ReleaseDC( hWnd, hdc );
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 );
}
static void hb_gt_wvt_CreateWindow( PHB_GTWVT pWVT )
{
@@ -1942,6 +1949,8 @@ static HB_BOOL hb_gt_wvt_FullScreen( PHB_GT pGT )
RECT rt;
DWORD dwStyle;
DWORD dwExtendedStyle;
/*Don't need this as Windows automatically maximizes to nearest [HVB]
#ifdef MONITOR_DEFAULTTONEAREST
HMONITOR mon;
MONITORINFO mi;
@@ -1950,7 +1959,7 @@ static HB_BOOL hb_gt_wvt_FullScreen( PHB_GT pGT )
P_MFW pMonitorFromWindow;
P_GMI pGetMonitorInfo;
#endif
*/
pWVT = HB_GTWVT_GET( pGT );
dwStyle = GetWindowLongPtr( pWVT->hWnd, GWL_STYLE );
@@ -1972,8 +1981,6 @@ static HB_BOOL hb_gt_wvt_FullScreen( PHB_GT pGT )
{
dwStyle &= ~( WS_CAPTION | WS_BORDER | WS_THICKFRAME );
dwExtendedStyle &= ~WS_EX_TOPMOST;
pWVT->bMaximized = HB_FALSE;
pWVT->bFullScreen = HB_TRUE;
}
@@ -1982,16 +1989,20 @@ static HB_BOOL hb_gt_wvt_FullScreen( PHB_GT pGT )
if( !pWVT->bFullScreen )
{
ShowWindow( pWVT->hWnd, SW_MAXIMIZE );
hb_gt_wvt_Maximize( pWVT );
ShowWindow( pWVT->hWnd, SW_RESTORE );
return HB_FALSE;
}
rt.left = 0;
rt.top = 0;
rt.right = 0;
rt.bottom = 0;
if( !pWVT->bMaximized )
ShowWindow( pWVT->hWnd, SW_SHOWMAXIMIZED );
/* Don't need as Windows automatically maximizes to nearest.
* That is as long as we use the RECT that Windows provides
* and don't handle WM_MINMAXWINDOW or other related messages
* and don't change the RECT coordinates (may have negative
* numbers for top or left depending on how user configured
* monitors relationship and which on is the primary). [HVB]
*
#ifdef MONITOR_DEFAULTTONEAREST
pMonitorFromWindow = ( P_MFW ) GetProcAddress( GetModuleHandle( TEXT( "user32.dll" ) ),
"MonitorFromWindow" );
@@ -2011,6 +2022,9 @@ static HB_BOOL hb_gt_wvt_FullScreen( PHB_GT pGT )
#else
GetClientRect( GetDesktopWindow(), &rt );
#endif
*/
GetClientRect( GetDesktopWindow(), &rt );
SetWindowPos( pWVT->hWnd, HWND_TOP, rt.left, rt.top,
rt.right - rt.left,
@@ -2087,26 +2101,28 @@ static HB_BOOL hb_gt_wvt_SetMode( PHB_GT pGT, int iRow, int iCol )
if( pWVT->hWnd ) /* Is the window already open? */
{
if( pWVT->bResizable && ! pWVT->bFullScreen )
if( pWVT->bResizable && ! pWVT->bMaximized )
{
fResult = hb_gt_wvt_InitWindow( pWVT, iRow, iCol, NULL );
HB_GTSELF_REFRESH( pGT );
}
else
{
HFONT hFont = hb_gt_wvt_GetFont( pWVT->fontFace, pWVT->fontHeight, pWVT->fontWidth,
/* We're Maximized, Fullscreen or in an unsizable window
* Change Font size to fit new mode settings into the window
*/
HFONT hFont = hb_gt_wvt_GetFont( pWVT->fontFace, (pWVT->fontHeight * pWVT->ROWS)/iRow, (pWVT->fontWidth * pWVT->COLS)/iCol,
pWVT->fontWeight, pWVT->fontQuality, pWVT->CodePage );
if( hFont )
{
/*
* make sure that the mode selected along with the current
* font settings will fit in the window
*/
if( hb_gt_wvt_ValidWindowSize( pWVT->hWnd, iRow, iCol, hFont, pWVT->fontWidth ) )
fResult = hb_gt_wvt_InitWindow( pWVT, iRow, iCol, hFont );
else
DeleteObject( hFont );
fResult = hb_gt_wvt_InitWindow( pWVT, iRow, iCol, hFont );
hb_gt_wvt_FitSize( pWVT );
if( pWVT->bMaximized )
{
/* Window size not changed, but Margins may have changed, repaint the client area [HVB] */
InvalidateRect( pWVT->hWnd, NULL, TRUE );
UpdateWindow( pWVT->hWnd );
}
HB_GTSELF_REFRESH( pGT );
}
@@ -2418,15 +2434,37 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
case HB_GTI_SCREENHEIGHT:
pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->PTEXTSIZE.y * pWVT->ROWS );
iVal = hb_itemGetNI( pInfo->pNewVal );
if( iVal > 0 )
HB_GTSELF_SETMODE( pGT, ( iVal / pWVT->PTEXTSIZE.y ), pWVT->COLS );
if( iVal > 0 && !pWVT->bMaximized ) /* Don't allow if Maximized or FullScreen */
{
/* Now conforms to pWVT->ResizeMode setting, resize by FONT or ROWS as applicable [HVB] */
RECT ci;
GetClientRect( pWVT->hWnd, &ci );
if( ci.bottom != iVal )
{
RECT wi;
GetWindowRect( pWVT->hWnd, &wi );
iVal += wi.bottom - wi.top - ci.bottom;
SetWindowPos( pWVT->hWnd, NULL, wi.left, wi.top, wi.right - wi.left, iVal, SWP_NOZORDER );
}
}
break;
case HB_GTI_SCREENWIDTH:
pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->PTEXTSIZE.x * pWVT->COLS );
iVal = hb_itemGetNI( pInfo->pNewVal );
if( iVal > 0 )
HB_GTSELF_SETMODE( pGT, pWVT->ROWS, ( iVal / pWVT->PTEXTSIZE.x ) );
if( iVal > 0 && !pWVT->bMaximized ) /* Don't allow if Maximized or FullScreen */
{
/* Now conforms to pWVT->ResizeMode setting, resize by FONT or ROWS as applicable [HVB] */
RECT ci;
GetClientRect( pWVT->hWnd, &ci );
if( ci.right != iVal )
{
RECT wi;
GetWindowRect( pWVT->hWnd, &wi );
iVal += wi.right - wi.left - ci.right;
SetWindowPos( pWVT->hWnd, NULL, wi.left, wi.top, iVal, wi.bottom - wi.top, SWP_NOZORDER );
}
}
break;
case HB_GTI_DESKTOPWIDTH:
@@ -2689,12 +2727,19 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
iY = hb_arrayGetNI( pInfo->pNewVal, 2 );
iX = hb_arrayGetNI( pInfo->pNewVal, 1 );
if( iY > 0 )
if( iY > 0 && iX > 0 && !pWVT->bMaximized) /* Don't allow if Maximized or FullScreen */
{
HB_BOOL bOldCentre = pWVT->CentreWindow;
pWVT->CentreWindow = pWVT->bMaximized ? HB_TRUE : HB_FALSE;
HB_GTSELF_SETMODE( pGT, ( iY / pWVT->PTEXTSIZE.y ), ( iX / pWVT->PTEXTSIZE.x ) );
pWVT->CentreWindow = bOldCentre;
/* Now conforms to pWVT->ResizeMode setting, resize by FONT or ROWS as applicable [HVB] */
RECT ci;
GetClientRect( pWVT->hWnd, &ci );
if( ci.right != iX || ci.bottom != iY )
{
RECT wi;
GetWindowRect( pWVT->hWnd, &wi );
iX += wi.right - wi.left - ci.right;
iY += wi.bottom - wi.top - ci.bottom;
SetWindowPos( pWVT->hWnd, NULL, wi.left, wi.top, iX, iY, SWP_NOZORDER );
}
}
}
break;
@@ -2818,31 +2863,69 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
case HB_GTI_SETPOS_XY:
case HB_GTI_SETPOS_ROWCOL:
if( pWVT->hWnd && ( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC ) &&
( hb_itemType( pInfo->pNewVal2 ) & HB_IT_NUMERIC ) )
{
if( pWVT->hWnd )
{
int x, y;
RECT rect = { 0,0,0,0 };
GetWindowRect( pWVT->hWnd, &rect );
int x, y;
RECT wi = { 0,0,0,0 };
GetWindowRect( pWVT->hWnd, &wi );
if( ! pInfo->pResult )
pInfo->pResult = hb_itemNew( NULL );
if( iType == HB_GTI_SETPOS_ROWCOL )
{
y = hb_itemGetNI( pInfo->pNewVal ) * pWVT->PTEXTSIZE.y;
x = hb_itemGetNI( pInfo->pNewVal2 ) * pWVT->PTEXTSIZE.x;
}
else
{
x = hb_itemGetNI( pInfo->pNewVal );
y = hb_itemGetNI( pInfo->pNewVal2 );
}
hb_retl( SetWindowPos( pWVT->hWnd, NULL,
x,
y,
rect.right - rect.left,
rect.bottom - rect.top,
SWP_NOSIZE | SWP_NOZORDER ) );
hb_arrayNew( pInfo->pResult, 2 );
if( iType == HB_GTI_SETPOS_ROWCOL )
{
hb_arraySetNI( pInfo->pResult, 1, wi.top / pWVT->PTEXTSIZE.y );
hb_arraySetNI( pInfo->pResult, 2, wi.left / pWVT->PTEXTSIZE.x );
}
else
{
hb_arraySetNI( pInfo->pResult, 2, wi.top );
hb_arraySetNI( pInfo->pResult, 1, wi.left );
}
if( ( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC ) &&
( hb_itemType( pInfo->pNewVal2 ) & HB_IT_NUMERIC ) )
{
if( iType == HB_GTI_SETPOS_ROWCOL )
{
y = hb_itemGetNI( pInfo->pNewVal ) * pWVT->PTEXTSIZE.y;
x = hb_itemGetNI( pInfo->pNewVal2 ) * pWVT->PTEXTSIZE.x;
}
else
{
x = hb_itemGetNI( pInfo->pNewVal );
y = hb_itemGetNI( pInfo->pNewVal2 );
}
hb_retl( SetWindowPos( pWVT->hWnd, NULL,
x,
y,
wi.right - wi.left,
wi.bottom - wi.top,
SWP_NOSIZE | SWP_NOZORDER ) );
}
else if( ( hb_itemType( pInfo->pNewVal ) & HB_IT_ARRAY ) && hb_arrayLen( pInfo->pNewVal ) == 2 )
{
y = hb_arrayGetNI( pInfo->pNewVal, 2 );
x = hb_arrayGetNI( pInfo->pNewVal, 1 );
if( iType == HB_GTI_SETPOS_ROWCOL )
{
y *= pWVT->PTEXTSIZE.y;
x *= pWVT->PTEXTSIZE.x;
}
hb_retl( SetWindowPos( pWVT->hWnd, NULL,
x,
y,
wi.right - wi.left,
wi.bottom - wi.top,
SWP_NOSIZE | SWP_NOZORDER ) );
}
}
break;
}
default:
return HB_GTSUPER_INFO( pGT, iType, pInfo );

View File

@@ -204,6 +204,8 @@ typedef struct
HB_BOOL bResizing;
HB_BOOL bAlreadySizing;
RECT ciLast; /* need in WM_ENTERSIZEMOVE processing and hb_gt_wvt_PaintText() function [HVB] */
} HB_GTWVT, * PHB_GTWVT;
/* xHarbour compatible definitions */

View File

@@ -18,7 +18,7 @@
#include "inkey.ch"
#include "setcurs.ch"
#define RGB(r,g,b) ( r + ( g * 256 ) + ( b * 256 * 256 ) )
#define RGB( r, g, b ) ( r + ( g * 256 ) + ( b * 256 * 256 ) )
//----------------------------------------------------------------------//
@@ -29,50 +29,188 @@ STATIC s_nColorIndex := 1
//----------------------------------------------------------------------//
PROCEDURE Main()
LOCAL nKey, lMark, lResize, lClose
LOCAL nKey, lMark, lResize, lClose, aKeys[ 50 ], nI, lAltEnter
LOCAL nHeight := 20
LOCAL nWidth := Int( nHeight / 2 )
// LOCAL cFont
LOCAL cFontName
LOCAL GetList := {}
LOCAL nModeCols, nModeRows, nWndHeight, nWndWidth, nMaxWHeight, nMaxWWidth, aWndSize := { 0, 0 }
LOCAL nMSec
// Hb_GtInfo( HB_GTI_FONTNAME , cFont )
Hb_GtInfo( HB_GTI_FONTWIDTH, nWidth )
Hb_GtInfo( HB_GTI_FONTSIZE , nHeight )
AFill( aKeys, 0 )
hb_gtInfo( HB_GTI_FONTNAME , "Lucida Console" )
hb_gtInfo( HB_GTI_FONTWIDTH, nWidth )
hb_gtInfo( HB_GTI_FONTSIZE , nHeight )
hb_gtInfo( HB_GTI_WINTITLE , "GTWVT-Test (Resizable by Font)" )
hb_gtInfo( HB_GTI_ALTENTER, .T. ) // allow alt-enter for full screen
SetCursor( SC_NONE )
HB_GtInfo( HB_GTI_CLOSABLE, .F. )
hb_gtInfo( HB_GTI_CLOSABLE, .F. )
DispScreen()
DO WHILE .T.
FOR nI := 1 TO Len( aKeys )
IF aKeys[ nI ] == 0 .OR. nI > MaxRow() - 1
EXIT
ENDIF
@ nI, MaxCol() - 5 SAY Str( aKeys[ nI ], 4, 0 )
NEXT
nKey := Inkey( , INKEY_ALL + HB_INKEY_GTEVENT )
if nKey == K_ESC
exit
endif
IF nMSec != NIL .AND. hb_milliSeconds() > nMSec + 1500
DispOutAt( maxrow(), 0, Space( maxcol()+1 ), "N/G*" )
IF nMSec != NIL .AND. hb_milliSeconds() > nMSec + 2000
DispOutAt( MaxRow(), 0, Space( MaxCol() + 1 ), "N/G*" )
nMSec := NIL
ENDIF
nKey := Inkey( 0.1, 254 + HB_INKEY_GTEVENT )
IF nKey == 0
LOOP
ENDIF
AIns( aKeys, 1 )
aKeys[ 1 ] := nKey
FOR nI := 1 TO Len( aKeys )
IF aKeys[ nI ] == 0 .OR. nI > MaxRow() - 1
EXIT
ENDIF
@ nI, MaxCol() - 5 SAY Str( aKeys[ nI ], 4, 0 )
NEXT
IF nKey == K_ESC
EXIT
ENDIF
DO CASE
CASE nKey == K_ENTER
Alert( "<Enter> Pressed" )
CASE nKey == Asc( "0" ) // setmode
SetColor( "W+/B,GR+/N,W/B,B/B,G+/N" )
DO WHILE .T.
nModeCols := MaxCol() + 1
nModeRows := MaxRow() + 1
@ MaxRow() / 2 - 1, 0 SAY Space( MaxCol() )
@ MaxRow() / 2, 0 SAY Space( MaxCol() )
@ MaxRow() / 2 + 1, 0 SAY Space( MaxCol() )
@ MaxRow() / 2, 2 SAY "SetMode( 99 , 999 ) ESC-Cancels"
@ MaxRow() / 2, 11 GET nModeRows PICTURE "99" RANGE 10, 99
@ MaxRow() / 2, 16 GET nModeCols PICTURE "999" RANGE 20, 300
READ
IF LastKey() == K_ESC
EXIT
ENDIF
IF ! SetMode( nModeRows, nModeCols )
Alert( "SetMode() Failed!" )
ELSE
EXIT
ENDIF
ENDDO
DispScreen()
CASE nKey == Asc( "1" ) // "1" get/set Window-Height
nWndHeight := hb_gtInfo( HB_GTI_SCREENHEIGHT )
nMaxWHeight := hb_gtInfo( HB_GTI_DESKTOPHEIGHT )
SetColor( "W+/B,GR+/N,W/B,B/B,G+/N" )
@ MaxRow() / 2 - 1, 0 SAY Space( MaxCol() )
@ MaxRow() / 2, 0 SAY Space( MaxCol() )
@ MaxRow() / 2 + 1, 0 SAY Space( MaxCol() )
@ MaxRow() / 2, 2 SAY "Get/Set Window Height: 9999 (Max: " + hb_ntos( nMaxWHeight ) + ")"
@ MaxRow() / 2, 25 GET nWndHeight PICTURE "9999" RANGE 100, nMaxWHeight
READ
IF LastKey() != K_ESC
hb_gtInfo( HB_GTI_SCREENHEIGHT, nWndHeight )
ENDIF
DispScreen()
CASE nKey == Asc( "2" ) // get/set Window-WIDTH
nWndWIDTH := hb_gtInfo( HB_GTI_SCREENWIDTH )
nMaxWWIDTH := hb_gtInfo( HB_GTI_DESKTOPWIDTH )
SetColor( "W+/B,GR+/N,W/B,B/B,G+/N" )
@ MaxRow() / 2 - 1, 0 SAY Space( MaxCol() )
@ MaxRow() / 2, 0 SAY Space( MaxCol() )
@ MaxRow() / 2 + 1, 0 SAY Space( MaxCol() )
@ MaxRow() / 2, 2 SAY "Get/Set Window WIDTH: 9999 (Max: " + hb_ntos( nMaxWWIDTH ) + ")"
@ MaxRow() / 2, 24 GET nWndWIDTH PICTURE "9999" RANGE 100, nMaxWWIDTH
READ
IF LastKey() != K_ESC
hb_gtInfo( HB_GTI_SCREENWIDTH, nWndWIDTH )
ENDIF
DispScreen()
CASE nKey == Asc( "3" ) // get/set Window-Size
aWndSize := hb_gtInfo( HB_GTI_SCREENSIZE )
nMaxWWIDTH := hb_gtInfo( HB_GTI_DESKTOPWIDTH )
nMaxWHeight := hb_gtInfo( HB_GTI_DESKTOPHEIGHT )
SetColor( "W+/B,GR+/N,W/B,B/B,G+/N" )
@ MaxRow() / 2 - 1, 0 SAY Space( MaxCol() )
@ MaxRow() / 2, 0 SAY Space( MaxCol() )
@ MaxRow() / 2 + 1, 0 SAY Space( MaxCol() )
@ MaxRow() / 2, 2 SAY "Get/Set Window Size(WxH): 9999 x 9999 (Max: " + hb_ntos( nMaxWWIDTH ) + " x " + hb_ntos( nMaxWHeight ) + ")"
@ MaxRow() / 2, 28 GET aWndSize[ 1 ] PICTURE "9999" RANGE 100, nMaxWWIDTH
@ MaxRow() / 2, 35 GET aWndSize[ 2 ] PICTURE "9999" RANGE 100, nMaxWHeight
READ
IF LastKey() != K_ESC
hb_gtInfo( HB_GTI_SCREENSIZE, aWndSize )
ENDIF
DispScreen()
CASE nKey == Asc( "4" ) // set Window-Position by pixels
aWndSize := hb_gtInfo( HB_GTI_SETPOS_XY )
SetColor( "W+/B,GR+/N,W/B,B/B,G+/N" )
@ MaxRow() / 2 - 1, 0 SAY Space( MaxCol() )
@ MaxRow() / 2, 0 SAY Space( MaxCol() )
@ MaxRow() / 2 + 1, 0 SAY Space( MaxCol() )
@ MaxRow() / 2, 2 SAY "Get/Set Window Position in pixels(Left/Top): 9999 / 9999 "
@ MaxRow() / 2, 47 GET aWndSize[ 1 ] PICTURE "9999"
@ MaxRow() / 2, 54 GET aWndSize[ 2 ] PICTURE "9999"
READ
IF LastKey() != K_ESC
hb_gtInfo( HB_GTI_SETPOS_XY, aWndSize )
ENDIF
DispScreen()
CASE nKey == Asc( "5" ) // set Window-Position by row/col
aWndSize := hb_gtInfo( HB_GTI_SETPOS_ROWCOL )
SetColor( "W+/B,GR+/N,W/B,B/B,G+/N" )
@ MaxRow() / 2 - 1, 0 SAY Space( MaxCol() )
@ MaxRow() / 2, 0 SAY Space( MaxCol() )
@ MaxRow() / 2 + 1, 0 SAY Space( MaxCol() )
@ MaxRow() / 2, 2 SAY "Get/Set Window Position by Row/Col: 999 / 999 "
@ MaxRow() / 2, 38 GET aWndSize[ 1 ] PICTURE "999"
@ MaxRow() / 2, 44 GET aWndSize[ 2 ] PICTURE "999"
READ
IF LastKey() != K_ESC
hb_gtInfo( HB_GTI_SETPOS_ROWCOL, aWndSize[ 1 ], aWndSize[ 2 ] )
ENDIF
DispScreen()
CASE nKey == K_F1
Alert( "Additional Hot-Key Test Settings:;;" + ;
"0 - SetMode( nRows, nCols ) test ;" + ;
"1 - Get/Set HB_GTI_SCREENHEIGHT test ;" + ;
"2 - Get/Set HB_GTI_SCREENWIDTH test ;" + ;
"3 - Get/Set HB_GTI_SCREENSIZE test ;" + ;
"4 - Get/Set HB_GTI_SETPOS_XY test ;" + ;
"5 - Get/Set HB_GTI_SETPOS_ROWCOL test", , "W+/B" )
CASE nKey == K_F2
lMark := Hb_GtInfo( HB_GTI_SELECTCOPY )
Hb_GtInfo( HB_GTI_SELECTCOPY, !lMark )
lMark := hb_gtInfo( HB_GTI_SELECTCOPY )
hb_gtInfo( HB_GTI_SELECTCOPY, ! lMark )
CASE nKey == K_F3
lResize := Hb_GtInfo( HB_GTI_RESIZABLE )
Hb_GtInfo( HB_GTI_RESIZABLE, !lResize )
lResize := hb_gtInfo( HB_GTI_RESIZABLE )
hb_gtInfo( HB_GTI_RESIZABLE, ! lResize )
DispScreen()
CASE nKey == K_F4
lClose := Hb_GtInfo( HB_GTI_CLOSABLE )
hb_GtInfo( HB_GTI_CLOSABLE, !lClose )
lClose := hb_gtInfo( HB_GTI_CLOSABLE )
hb_gtInfo( HB_GTI_CLOSABLE, ! lClose )
DispScreen()
CASE nKey == K_F5
SetPalette( 1 )
@@ -84,10 +222,12 @@ PROCEDURE Main()
SetPaletteIndex()
CASE nKey == K_F8
Alert( "Menu text changed. Was: " + hb_GtInfo( HB_GTI_SELECTCOPY, DToS(Date()) + " " + Time() ) )
Alert( "Menu text changed. Was: " + hb_gtInfo( HB_GTI_SELECTCOPY, Dtos(Date() ) + " " + Time() ) )
CASE nKey == K_F9
hb_GTInfo( HB_GTI_RESIZEMODE, iif( hb_GTInfo( HB_GTI_RESIZEMODE ) == HB_GTI_RESIZEMODE_ROWS, HB_GTI_RESIZEMODE_FONT, HB_GTI_RESIZEMODE_ROWS ) )
hb_gtInfo( HB_GTI_RESIZEMODE, iif( hb_gtInfo( HB_GTI_RESIZEMODE ) == HB_GTI_RESIZEMODE_ROWS, HB_GTI_RESIZEMODE_FONT, HB_GTI_RESIZEMODE_ROWS ) )
hb_gtInfo( HB_GTI_WINTITLE , "GTWVT-Test (Resizable by " + iif( hb_gtInfo( HB_GTI_RESIZEMODE ) == HB_GTI_RESIZEMODE_ROWS, "ROWS", "FONT" ) + ")" )
DispScreen()
CASE nKey == K_F10
IF hb_MTVM()
@@ -96,21 +236,52 @@ PROCEDURE Main()
Alert( "MT mode not available. Rebuild this program with -mt switch and try again." )
ENDIF
CASE nKey == K_F11
lAltEnter := hb_gtInfo( HB_GTI_ALTENTER )
hb_gtInfo( HB_GTI_ALTENTER, ! lAltEnter )
DispScreen()
CASE nKey == K_F12
cFontName := hb_gtInfo( HB_GTI_FONTNAME )
IF cFontName == "Lucida Console"
hb_gtInfo( HB_GTI_FONTNAME , "Courier New" )
ELSEIF cFontName == "Courier New"
hb_gtInfo( HB_GTI_FONTNAME , "Terminal" )
ELSEIF cFontName == "Terminal"
hb_gtInfo( HB_GTI_FONTNAME , "DejaVu Sans Mono" )
ELSE
hb_gtInfo( HB_GTI_FONTNAME , "Lucida Console" )
ENDIF
IF hb_gtInfo( HB_GTI_RESIZEMODE ) == HB_GTI_RESIZEMODE_ROWS
hb_gtInfo( HB_GTI_RESIZEMODE, HB_GTI_RESIZEMODE_FONT )
SetMode( MaxRow(), MaxCol() )
SetMode( MaxRow() + 2, MaxCol() + 2 )
hb_gtInfo( HB_GTI_RESIZEMODE, HB_GTI_RESIZEMODE_ROWS )
ELSE
SetMode( MaxRow(), MaxCol() )
SetMode( MaxRow() + 2, MaxCol() + 2 )
ENDIF
DispScreen()
DispOutAt( MaxRow(), 2, "< Font changed to " + hb_gtInfo( HB_GTI_FONTNAME ) + " >", "B/G*" )
nMSec := hb_milliSeconds()
CASE nKey == HB_K_RESIZE
DispScreen()
DispOutAt( maxrow(), 33, "Resized ", "B/G*" )
DispOutAt( MaxRow(), 33, "Resized ", "B/G*" )
nMSec := hb_milliSeconds()
CASE nKey == HB_K_GOTFOCUS
DispOutAt( maxrow(), 33, "We got focus ", "B/G*" )
ChgPalette( .T. )
DispOutAt( MaxRow(), 33, "We got focus ", "B/G*" )
nMSec := hb_milliSeconds()
CASE nKey == HB_K_LOSTFOCUS
DispOutAt( maxrow(), 33, "We lost focus", "B/G*" )
ChgPalette( .F. )
DispOutAt( MaxRow(), 33, "We lost focus", "B/G*" )
nMSec := hb_milliSeconds()
CASE nKey == HB_K_CLOSE
IF Alert( "Close Application", {"Yes","No" } ) == 1
IF Alert( "Close Application", { "Yes", "No" } ) == 1
QUIT
ENDIF
@@ -119,10 +290,11 @@ PROCEDURE Main()
RETURN
//----------------------------------------------------------------------//
//-------------------------------------------------------------------//
STATIC PROCEDURE DispScreen()
LOCAL nRow := 11
LOCAL nRow := 9
LOCAL cColor := "N/W"
LOCAL nMaxCol := MaxCol() + 1
@@ -139,19 +311,22 @@ STATIC PROCEDURE DispScreen()
DispOutAt( 5, 0, PadC( "_ __ / / /_/ /_ / _ /_/ / /_/ / /_/ /_ / / /_/ / _ / ", nMaxCol ), "W+/W" )
DispOutAt( 6, 0, PadC( "/_/ /_/ \__,_/ /_/ /_.___/\____/\__,_/ /_/ \____/ /_/ ", nMaxCol ), "W+/W" )
DispOutAt( ++nRow, 0, PadC( "< F2 MarkCopy Toggle >", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F3 Resize Toggle >", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F4 Closable Toggle >", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F5 Palette L Repeat >", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F6 Palette D Repeat >", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F7 Palette By Index R >", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F8 MarkCopy menu text >", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< Click Other Window >", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< Click X Button >", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F9 Resize Mode Toggle >", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F10 Open New Window >", nMaxCol ), cColor )
DispOutAt( 8, 0, PadC( "MODE: " + hb_ntos( MaxRow() + 1 ) + " Rows and " + hb_ntos( nMaxCol ) + " Columns", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F2 MarkCopy Toggle > ", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F3 Resizable Toggle > " + iif( hb_gtInfo( HB_GTI_RESIZABLE ), "ON ", "Off" ), nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F4 Closable Toggle > " + iif( hb_gtInfo( HB_GTI_CLOSABLE ), "ON ", "Off" ), nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F5 Palette L Repeat > ", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F6 Palette D Repeat > ", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F7 Palette By Index R > ", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F8 MarkCopy menu text > ", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< Click Other Window > ", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< Click X Button > ", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F9 Resize Mode Toggle > " + iif( hb_gtInfo( HB_GTI_RESIZEMODE ) == HB_GTI_RESIZEMODE_ROWS, "ROWS", "FONT" ), nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F10 Open New Window > ", nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F11 Alt-Enter Toggle > " + iif( hb_gtInfo( HB_GTI_ALTENTER ), "ON ", "Off" ), nMaxCol ), cColor )
DispOutAt( ++nRow, 0, PadC( "< F12 Change Font Test > " + hb_gtInfo( HB_GTI_FONTNAME ) + " " + hb_ntos( hb_gtInfo( HB_GTI_FONTWIDTH ) ) + "x" + hb_ntos( hb_gtInfo( HB_GTI_FONTSIZE ) ), nMaxCol ), cColor )
DispOutAt( maxrow(), 0, Space( MaxCol() + 1 ), "N/G*" )
DispOutAt( MaxRow(), 0, Space( MaxCol() + 1 ), "N/G*" )
DispOutAt( 0, 0 , "TL", "N/GR*" )
DispOutAt( 0, MaxCol() - 1 , "TR", "N/GR*" )
@@ -159,101 +334,109 @@ STATIC PROCEDURE DispScreen()
DispOutAt( MaxRow(), MaxCol() - 1, "BR", "N/G*" )
DispEnd()
RETURN
//----------------------------------------------------------------------//
//-------------------------------------------------------------------//
PROCEDURE HB_GTSYS()
REQUEST HB_GT_WVT_DEFAULT
REQUEST HB_GT_WIN
RETURN
//----------------------------------------------------------------------//
//-------------------------------------------------------------------//
FUNCTION SetPalette( nMode )
LOCAL aPalette := Hb_GtInfo( HB_GTI_PALETTE )
STATIC s_nR := 198
STATIC s_nG := 198
STATIC s_nB := 198
LOCAL aPalette := hb_gtInfo( HB_GTI_PALETTE )
s_nR += iif( nMode == 0, -5, 5 )
s_nG += iif( nMode == 0, -5, 5 )
s_nB += iif( nMode == 0, -5, 5 )
THREAD STATIC t_nR := 198
THREAD STATIC t_nG := 198
THREAD STATIC t_nB := 198
t_nR += iif( nMode == 0, - 5, 5 )
t_nG += iif( nMode == 0, - 5, 5 )
t_nB += iif( nMode == 0, - 5, 5 )
// Change "W" to slightly gray everytime you press F5
//
aPalette[ 8 ] := RGB( s_nR, s_nG, s_nB )
aPalette[ 8 ] := RGB( t_nR, t_nG, t_nB )
Hb_GtInfo( HB_GTI_PALETTE, aPalette )
hb_gtInfo( HB_GTI_PALETTE, aPalette )
DispScreen()
RETURN NIL
//----------------------------------------------------------------------//
//-------------------------------------------------------------------//
FUNCTION SetPaletteIndex()
Hb_GtInfo( HB_GTI_PALETTE, 8, RGB( 120, 200, 240 ) )
hb_gtInfo( HB_GTI_PALETTE, 8, RGB( 120, 200, 240 ) )
DispScreen()
RETURN NIL
//----------------------------------------------------------------------//
//-------------------------------------------------------------------//
PROCEDURE thFunc()
LOCAL cTitle, oBrowse, lEnd, nKey, i, aStruct
LOCAL aColor := { 'W+/N', 'W+/B', 'W+/G', 'W+/BG', 'W+/N*', 'W+/RB', 'N/W*', 'N/GR*' }
STATIC nBrowser := 0
STATIC nZx := 0
STATIC nZy := 0
LOCAL cTitle, oBrowse, lEnd, nKey, i, aStruct
LOCAL aColor := { "W+/N", "W+/B", "W+/G", "W+/BG", "W+/N*", "W+/RB", "N/W*", "N/GR*" }
nBrowser++
nZx += 20
nZy += 20
/* allocate own GT driver */
hb_gtReload( 'WVT' )
Hb_GtInfo( HB_GTI_PALETTE, 8, RGB( 120, 200, 240 ) )
hb_gtReload( "WVT" )
hb_gtInfo( HB_GTI_PALETTE, 8, RGB( 120, 200, 240 ) )
IF ( nBrowser % 2 ) != 0
Hb_GtInfo( HB_GTI_RESIZEMODE, HB_GTI_RESIZEMODE_ROWS )
hb_gtInfo( HB_GTI_RESIZEMODE, HB_GTI_RESIZEMODE_ROWS )
ENDIF
Hb_GtInfo( HB_GTI_WINTITLE, 'test.dbf [' + iif( ( nBrowser % 2 ) != 0, 'RESIZABLE_BY_ROWS', 'RESIZABLE_BY_FONT' ) + ']' )
hb_gtInfo( HB_GTI_FONTNAME , "Lucida Console" )
hb_gtInfo( HB_GTI_WINTITLE, "test.dbf [" + iif( ( nBrowser % 2 ) != 0, "RESIZABLE_BY_ROWS", "RESIZABLE_BY_FONT" ) + "]" )
hb_gtInfo( HB_GTI_ALTENTER, .T. ) //allow alt-enter for full screen
SetCursor( SC_NONE )
s_nColorIndex++
IF s_nColorIndex > len( aColor )
IF s_nColorIndex > Len( aColor )
s_nColorIndex := 1
ENDIF
s_nRows++
s_nCols += 2
SetMode( s_nRows, s_nCols )
SetColor( aColor[ s_nColorIndex ] )
Hb_GtInfo( HB_GTI_WINTITLE, cTitle )
Hb_GtInfo( HB_GTI_SETPOS_XY, nZx, nZy )
cTitle := 'New Window with '+ hb_ntos( MaxRow() ) +;
' Rows and ' + hb_ntos( MaxCol() ) + ' Columns'
DispOutAt( 0, 0, padc( cTitle, maxcol() + 1 ), 'N/GR*' )
cTitle := "New Window with " + hb_ntos( MaxRow() ) + ;
" Rows and " + hb_ntos( MaxCol() ) + " Columns"
dispOutAt( 0, 0, PadC( cTitle, MaxCol() + 1 ), "N/GR*" )
USE test SHARED
aStruct := DbStruct()
hb_gtInfo( HB_GTI_SETPOS_XY, nZx, nZy ) //this does not work until something is displayed
oBrowse := TBrowse():New( 1, 0, maxrow(), maxcol() )
USE test NEW SHARED
aStruct := dbStruct()
oBrowse:ColSep := " ³ "
oBrowse:HeadSep := "ÄÂÄ"
oBrowse := TBrowse():New( 1, 0, MaxRow(), MaxCol() )
oBrowse:ColSep := " | "
oBrowse:HeadSep := "-+-"
oBrowse:GoTopBlock := { || dbGoTop() }
oBrowse:GoBottomBlock := { || dbGoBottom() }
oBrowse:SkipBlock := { | nSkip | dbSkipBlock( nSkip, oBrowse ) }
for i := 1 to len( aStruct )
oBrowse:AddColumn( TBColumnNew( aStruct[ i,1 ], BlockField( i ) ) )
next
FOR i := 1 TO Len( aStruct )
oBrowse:AddColumn( TBColumnNew( aStruct[ i, 1 ], BlockField( i ) ) )
NEXT
oBrowse:configure()
@@ -261,90 +444,108 @@ PROCEDURE thFunc()
DO WHILE ! lEnd
oBrowse:ForceStable()
nKey := InKey( 0, INKEY_ALL + HB_INKEY_GTEVENT )
nKey := Inkey( 0, INKEY_ALL + HB_INKEY_GTEVENT )
IF BrwHandleKey( oBrowse, nKey, @lEnd )
//
ELSE
IF nKey == HB_K_RESIZE
cTitle := 'New Window with '+ltrim( str( MaxRow() ) )+;
' Rows and '+ltrim( str( MaxCol() ) )+' Columns'
DispOutAt( 0, 0, padc( cTitle, maxcol()+1 ), 'N/GR*' )
IF ! BrwHandleKey( oBrowse, nKey, @lEnd )
DO CASE
CASE nKey == HB_K_GOTFOCUS
ChgPalette( .T. )
CASE nKey == HB_K_LOSTFOCUS
ChgPalette( .F. )
CASE nKey == HB_K_RESIZE
cTitle := "New Window with " + hb_ntos( MaxRow() ) + ;
" Rows and " + hb_ntos( MaxCol() ) + " Columns"
dispOutAt( 0, 0, PadC( cTitle, MaxCol() + 1 ), "N/GR*" )
oBrowse:nBottom := MaxRow()
oBrowse:nRight := MaxCol()
oBrowse:Configure()
oBrowse:RefreshAll()
ENDIF
ENDCASE
ENDIF
ENDDO
DbCloseArea()
dbCloseArea()
RETURN
//----------------------------------------------------------------------//
//-------------------------------------------------------------------//
STATIC FUNCTION DbSkipBlock( n, oTbr )
LOCAL nSkipped := 0
if n == 0
DBSkip( 0 )
IF n == 0
dbSkip( 0 )
elseif n > 0
do while nSkipped != n .and. TBNext( oTbr )
ELSEIF n > 0
DO WHILE nSkipped != n .AND. TBNext( oTbr )
nSkipped++
enddo
else
do while nSkipped != n .and. TBPrev( oTbr )
ENDDO
ELSE
DO WHILE nSkipped != n .AND. TBPrev( oTbr )
nSkipped--
enddo
endif
ENDDO
ENDIF
RETURN nSkipped
//-------------------------------------------------------------------//
STATIC FUNCTION TBNext( oTbr )
LOCAL nSaveRecNum := recno()
LOCAL nSaveRecNum := RecNo()
LOCAL lMoved := .T.
HB_SYMBOL_UNUSED( oTbr )
if Eof()
IF Eof()
lMoved := .F.
else
DBSkip( 1 )
if Eof()
ELSE
dbSkip( 1 )
IF Eof()
lMoved := .F.
DBGoTo( nSaveRecNum )
endif
endif
dbGoto( nSaveRecNum )
ENDIF
ENDIF
RETURN lMoved
//-------------------------------------------------------------------//
STATIC FUNCTION TBPrev( oTbr )
LOCAL nSaveRecNum := Recno()
LOCAL nSaveRecNum := RecNo()
LOCAL lMoved := .T.
HB_SYMBOL_UNUSED( oTbr )
DBSkip( -1 )
dbSkip( - 1 )
if Bof()
DBGoTo( nSaveRecNum )
IF Bof()
dbGoto( nSaveRecNum )
lMoved := .F.
endif
ENDIF
RETURN lMoved
//-------------------------------------------------------------------//
STATIC FUNCTION BlockField( i )
RETURN {|| fieldget( i ) }
RETURN { || FieldGet( i ) }
//-------------------------------------------------------------------//
STATIC FUNCTION BrwHandleKey( oBrowse, nKey, lEnd )
LOCAL lRet := .T.
DO CASE
CASE nKey == K_ESC ; lEnd := .T.
CASE nKey == K_ENTER ; lEnd := .T.
// CASE nKey == K_ENTER ; lEnd := .T.
CASE nKey == K_DOWN ; oBrowse:Down()
CASE nKey == K_UP ; oBrowse:Up()
CASE nKey == K_LEFT ; oBrowse:Left()
@@ -365,4 +566,51 @@ STATIC FUNCTION BrwHandleKey( oBrowse, nKey, lEnd )
ENDCASE
RETURN lRet
//-------------------------------------------------------------------//
FUNCTION ChgPalette( lFocus )
LOCAL aPalette := hb_gtInfo( HB_GTI_PALETTE )
LOCAL cSaveScreen := SaveScreen( 0, 0, MaxRow(), MaxCol() )
LOCAL nR, nG, nB, nColor, nI, nDimFactor := 1.5
THREAD STATIC t_aSavePalette
IF t_aSavePalette == NIL
t_aSavePalette := AClone( aPalette )
ENDIF
IF lFocus
aPalette := t_aSavePalette
ELSE
FOR nI := 2 TO Len( aPalette )
nColor := aPalette[ nI ]
IF nColor >= 65536
nB := Int( nColor / 65536 )
nColor -= nB * 65536
nB := Int( nB / nDimFactor )
ELSE
nB := 0
ENDIF
IF nColor >= 256
nG := Int( nColor / 256 )
nColor -= nG * 256
nG := Int( nG / nDimFactor )
ELSE
nG := 0
ENDIF
IF nColor > 0
nR := Int( nColor / nDimFactor )
ELSE
nR := 0
ENDIF
aPalette[ nI ] := RGB( nR, nG, nB )
NEXT
ENDIF
hb_gtInfo( HB_GTI_PALETTE, aPalette )
RestScreen( 0, 0, MaxRow(), MaxCol(), cSaveScreen )
RETURN NIL