2009-01-26 15:07 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* harbour/contrib/gtwvg/gtwvg.c
  * harbour/contrib/gtwvg/gtwvg.h
    ! Synchronized with GTWVT per Viktor's changes for box characters.
    ! Commented out previous change per Przemek's "Layered Attributes".
      Somehow, this change had increased the flickering of the window as
      it invalidates the whole window when it regain focus, not desirable
      behavior in GTWVG with GUI elelments.
This commit is contained in:
Pritpal Bedi
2009-01-26 23:11:50 +00:00
parent 96c34194db
commit 913cfad6ba
3 changed files with 58 additions and 8 deletions

View File

@@ -8,6 +8,15 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2009-01-26 15:07 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/gtwvg/gtwvg.c
* harbour/contrib/gtwvg/gtwvg.h
! Synchronized with GTWVT per Viktor's changes for box characters.
! Commented out previous change per Przemek's "Layered Attributes".
Somehow, this change had increased the flickering of the window as
it invalidates the whole window when it regain focus, not desirable
behavior in GTWVG with GUI elelments.
2009-01-26 23:37 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* contrib/examples/uhttpd/hbmk_b32.bat
! Missed update from previous commit.

View File

@@ -356,6 +356,7 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow )
pWVT->hostCDP = hb_vmCDP();
#if defined( UNICODE )
pWVT->inCDP = hb_vmCDP();
pWVT->boxCDP = hb_cdpFind( "EN" );
#else
{
int i;
@@ -751,6 +752,12 @@ static BOOL hb_gt_wvt_FitSize( PHB_GTWVT pWVT )
{
if( pWVT->hFont )
DeleteObject( pWVT->hFont );
#if ! defined( UNICODE )
if( pWVT->hFontBox )
DeleteObject( pWVT->hFontBox );
pWVT->hFontBox = hb_gt_wvt_GetFont( pWVT->fontFace, fontHeight, fontWidth, pWVT->fontWeight, pWVT->fontQuality, OEM_CHARSET );
#endif
pWVT->hFont = hFont;
pWVT->fontHeight = tm.tmHeight;
@@ -866,6 +873,13 @@ static void hb_gt_wvt_ResetWindowSize( PHB_GTWVT pWVT )
DeleteObject( pWVT->hFont );
pWVT->hFont = hFont;
#if ! defined( UNICODE )
if( pWVT->hFontBox )
DeleteObject( pWVT->hFontBox );
pWVT->hFontBox = hb_gt_wvt_GetFont( pWVT->fontFace, pWVT->fontHeight, pWVT->fontWidth,
pWVT->fontWeight, pWVT->fontQuality, OEM_CHARSET );
#endif
hdc = GetDC( pWVT->hWnd );
hOldFont = ( HFONT ) SelectObject( hdc, hFont );
GetTextMetrics( hdc, &tm );
@@ -954,7 +968,7 @@ static void hb_gt_wvt_SetWindowTitle( HWND hWnd, const char * title )
static BOOL hb_gt_wvt_GetWindowTitle( HWND hWnd, char ** title )
{
TCHAR buffer[WVT_MAX_TITLE_SIZE];
TCHAR buffer[ WVT_MAX_TITLE_SIZE ];
int iResult;
iResult = GetWindowText( hWnd, buffer, WVT_MAX_TITLE_SIZE );
@@ -1631,6 +1645,9 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect )
RECT rcRect;
int iRow, iCol, startCol, len;
BYTE bColor, bAttr, bOldColor = 0;
#if ! defined( UNICODE )
BYTE bOldAttr = 0;
#endif
USHORT usChar;
TCHAR text[ WVT_MAX_ROWS ];
@@ -1673,25 +1690,43 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect )
break;
#if defined( UNICODE )
usChar = hb_cdpGetU16( pWVT->hostCDP, TRUE, ( BYTE ) usChar );
#else
usChar = pWVT->chrTransTbl[ usChar & 0xFF ];
#endif
usChar = hb_cdpGetU16( bAttr & HB_GT_ATTR_BOX ? pWVT->boxCDP : pWVT->hostCDP, TRUE, ( BYTE ) usChar );
if( len == 0 )
{
bOldColor = bColor;
}
else if( bColor != bOldColor )
{
hb_gt_wvt_TextOut( pWVT, hdc, ( USHORT ) startCol, ( USHORT ) iRow, bOldColor, text, ( USHORT ) len );
bOldColor = bColor;
startCol = iCol;
len = 0;
}
#else
usChar = pWVT->chrTransTbl[ usChar & 0xFF ];
if( len == 0 )
{
SelectObject( hdc, ( bAttr & HB_GT_ATTR_BOX ) ? pWVT->hFontBox : pWVT->hFont );
bOldAttr = bAttr;
bOldColor = bColor;
}
else if( bColor != bOldColor || bAttr != bOldAttr )
{
hb_gt_wvt_TextOut( pWVT, hdc, ( USHORT ) startCol, ( USHORT ) iRow, bOldColor, text, ( USHORT ) len );
if( pWVT->bGui )
{
hb_gt_wvt_TextOut( pWVT, pWVT->hGuiDC, ( USHORT ) startCol, ( USHORT ) iRow, bOldColor, text, ( USHORT ) len );
}
if( bAttr != bOldAttr )
{
SelectObject( hdc, ( bAttr & HB_GT_ATTR_BOX ) ? pWVT->hFontBox : pWVT->hFont );
bOldAttr = bAttr;
}
bOldColor = bColor;
startCol = iCol;
len = 0;
}
#endif
text[ len++ ] = ( TCHAR ) usChar;
iCol++;
}
@@ -2167,7 +2202,7 @@ static BOOL hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT )
pWVT->hWnd = hb_gt_wvt_CreateWindow( pWVT );
if( !pWVT->hWnd )
hb_errInternal( 10001, "Failed to create WVT window", NULL, NULL );
#if 0
if( ! GetSystemMetrics( SM_REMOTESESSION ) )
{
typedef BOOL ( WINAPI * P_SLWA )( HWND, COLORREF, BYTE, DWORD );
@@ -2196,7 +2231,7 @@ static BOOL hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT )
LWA_ALPHA /* DWORD dwFlags */ );
}
}
#endif
hb_gt_wvt_InitWindow( pWVT, pWVT->ROWS, pWVT->COLS );
/* Set icon */
if( pWVT->hIcon )
@@ -3825,7 +3860,6 @@ static void hb_wvt_gtReleaseGuiData( void )
static void hb_wvt_gtCreateObjects( PHB_GTWVT pWVT )
{
LOGBRUSH lb;
HINSTANCE h;
int iIndex;
pWVT->bDeferPaint = FALSE;

View File

@@ -310,12 +310,19 @@ typedef struct
int fontQuality; /* requested font quality */
char fontFace[ LF_FACESIZE ]; /* requested font face name LF_FACESIZE #defined in wingdi.h */
HFONT hFont; /* current font handle */
#if ! defined( UNICODE )
HFONT hFontBox; /* current font handle to draw lines */
#endif
HWND hWnd; /* the window handle */
BOOL fInit; /* logical variable indicating that window should be open */
PHB_CODEPAGE hostCDP; /* Host/HVM CodePage for unicode output translations */
PHB_CODEPAGE inCDP; /* Host/HVM CodePage for unicode input translations */
#if defined( UNICODE )
PHB_CODEPAGE boxCDP; /* CodePage for legacy drawing chars: IBM437 */
#endif
#if !defined(UNICODE)
BYTE keyTransTbl[ 256 ];
BYTE chrTransTbl[ 256 ];