diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ada58245d1..0e4858794e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,10 @@ The license applies to all entries newer than 2009-04-28. */ +2011-05-20 17:26 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/gtwvg/gtwvg.c + ! Applied: GTWVT fix by Przemek regarding HB_GTI_FONTSIZE. + 2011-05-20 17:11 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/gtwvt/gtwvt.c ! update font metrics after HB_GTI_FONTSIZE also when window is not diff --git a/harbour/contrib/gtwvg/gtwvg.c b/harbour/contrib/gtwvg/gtwvg.c index 893fb53f3c..22ab7c06c5 100644 --- a/harbour/contrib/gtwvg/gtwvg.c +++ b/harbour/contrib/gtwvg/gtwvg.c @@ -2827,29 +2827,21 @@ 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 ) - { - fResult = hb_gt_wvt_InitWindow( pWVT, iRow, iCol ); - HB_GTSELF_REFRESH( pGT ); - } - else - { - HFONT hFont = hb_gt_wvt_GetFont( pWVT->fontFace, pWVT->fontHeight, pWVT->fontWidth, - pWVT->fontWeight, pWVT->fontQuality, pWVT->CodePage ); + HFONT hFont = hb_gt_wvt_GetFont( pWVT->fontFace, pWVT->fontHeight, pWVT->fontWidth, + pWVT->fontWeight, pWVT->fontQuality, pWVT->CodePage ); - if( hFont ) + 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 ) ) { - /* - * 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 ); - } - DeleteObject( hFont ); - HB_GTSELF_REFRESH( pGT ); + fResult = hb_gt_wvt_InitWindow( pWVT, iRow, iCol ); } + DeleteObject( hFont ); + HB_GTSELF_REFRESH( pGT ); } } else @@ -3083,6 +3075,22 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) hb_gt_wvt_ResetWindowSize( pWVT ); HB_GTSELF_REFRESH( pGT ); } + else + { + TEXTMETRIC tm; + HWND hDesk = GetDesktopWindow(); + HDC hdc = GetDC( hDesk ); + HFONT hOldFont = ( HFONT ) SelectObject( hdc, hFont ); + + SetTextCharacterExtra( hdc, 0 ); + GetTextMetrics( hdc, &tm ); + SelectObject( hdc, hOldFont ); + ReleaseDC( hDesk, hdc ); + + pWVT->PTEXTSIZE.x = tm.tmAveCharWidth; + pWVT->PTEXTSIZE.y = tm.tmHeight; + } + DeleteObject( hFont ); } }