From 2f24768cdb7ee18d4e9edfa5afdb8e752b3c93a7 Mon Sep 17 00:00:00 2001 From: bedipritpal Date: Fri, 11 Jan 2019 14:02:42 -0800 Subject: [PATCH] 2019-01-11 13:52 UTC-0800 Pritpal Bedi (bedipritpal/at/hotmail.com) * contrib/gtwvg/wnd.prg * contrib/gtwvg/activex.prg ! modified to honor plain hWnd as container window instead of an WvgWnd() object. * contrib/gtwvg/gtwvgd.c + added - HB_GTI_VIEWPORTHEIGHT and HB_GTI_VIEWPORTWIDTH handelling. ! Pacified some warnings reported by BCC-720. * contrib/gtwvg/wvgcore.c * contrib/gtwvg/wvgcuig.c ! Pacified some warnings reported by BCC-720. --- ChangeLog.txt | 12 ++++++++++++ contrib/gtwvg/activex.prg | 28 ++++++++++++++++------------ contrib/gtwvg/gtwvgd.c | 6 ++++-- contrib/gtwvg/wnd.prg | 2 +- contrib/gtwvg/wvgcore.c | 8 ++++++-- contrib/gtwvg/wvgcuig.c | 5 +++-- 6 files changed, 42 insertions(+), 19 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 7984664c20..e9210029bb 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,18 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2019-01-11 13:52 UTC-0800 Pritpal Bedi (bedipritpal/at/hotmail.com) + * contrib/gtwvg/wnd.prg + * contrib/gtwvg/activex.prg + ! modified to honor plain hWnd as container window instead of an + WvgWnd() object. + * contrib/gtwvg/gtwvgd.c + + added - HB_GTI_VIEWPORTHEIGHT and HB_GTI_VIEWPORTWIDTH handelling. + ! Pacified some warnings reported by BCC-720. + * contrib/gtwvg/wvgcore.c + * contrib/gtwvg/wvgcuig.c + ! Pacified some warnings reported by BCC-720. + 2018-12-31 15:32 UTC+0100 Maurizio la Cecilia (m.lacecilia/at/gmail.com) * contrib/hbssl/hbssl.hbc * made compliant also for Windows static builds diff --git a/contrib/gtwvg/activex.prg b/contrib/gtwvg/activex.prg index b8e1a2565f..aeefbb44fe 100644 --- a/contrib/gtwvg/activex.prg +++ b/contrib/gtwvg/activex.prg @@ -120,27 +120,27 @@ METHOD WvgActiveXControl:Create( oParent, oOwner, aPos, aSize, aPresParams, lVis LOCAL hObj, hWnd - ::WvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + ::WvgWindow:create( @oParent, @oOwner, aPos, aSize, aPresParams, lVisible ) __defaultNIL( @cCLSID, ::CLSID ) __defaultNIL( @cLicense, ::license ) ::CLSID := cCLSID ::license := cLicense - ::hContainer := ::oParent:getHWND() + ::hContainer := iif( HB_ISOBJECT( ::oParent ), ::oParent:getHWND(), ::oParent ) IF ! HB_ISNUMERIC( ::hContainer ) .OR. ! HB_ISSTRING( ::CLSID ) RETURN NIL ENDIF ::hWnd := NIL - ::nID := ::oParent:GetControlId() + ::nID := iif( HB_ISOBJECT( ::oParent ), ::oParent:GetControlId(), ::getControlID() ) ::oOLE := win_oleAuto() win_axInit() hWnd := wapi_CreateWindowEx( ::exStyle, "AtlAxWin", ::CLSID, ::style, ::aPos[ 1 ], ::aPos[ 2 ], ; - ::aSize[ 1 ], ::aSize[ 2 ], win_N2P( ::hContainer ), 0 ) + ::aSize[ 1 ], ::aSize[ 2 ], win_N2P( ::hContainer ), 0, NIL, NIL ) IF Empty( hWnd ) RETURN NIL ENDIF @@ -162,13 +162,16 @@ METHOD WvgActiveXControl:Create( oParent, oOwner, aPos, aSize, aPresParams, lVis ::SetWindowProcCallback() /* Is this needed to catch windowing events ? - NO */ #endif - ::oParent:addChild( Self ) + IF HB_ISOBJECT( ::oParent ) + ::oParent:addChild( Self ) + ENDIF + + ::setPosAndSize() IF ::visible ::show() ELSE ::hide() ENDIF - ::setPosAndSize() IF ::isParentCrt() ::oParent:setFocus() ENDIF @@ -225,14 +228,15 @@ METHOD WvgActiveXControl:OnError() METHOD PROCEDURE WvgActiveXControl:Destroy() - IF ! Empty( ::oOLE:__hObj ) - IF wapi_IsWindow( ::pWnd ) - wapi_DestroyWindow( ::pWnd ) + IF ! Empty( ::oOLE ) + IF ! Empty( ::oOLE:__hObj ) + IF wapi_IsWindow( ::pWnd ) + wapi_DestroyWindow( ::pWnd ) + ENDIF + ::oOle := NIL + ::hWnd := NIL ENDIF - ::oOle := NIL - ::hWnd := NIL ENDIF - RETURN METHOD WvgActiveXControl:mapEvent( nEvent, bBlock ) diff --git a/contrib/gtwvg/gtwvgd.c b/contrib/gtwvg/gtwvgd.c index 65fc3b4986..aa31be0422 100644 --- a/contrib/gtwvg/gtwvgd.c +++ b/contrib/gtwvg/gtwvgd.c @@ -3377,10 +3377,12 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) pInfo->pResult = hb_itemPutNInt( pInfo->pResult, ( HB_PTRUINT ) pWVT->hIcon ); break; + case HB_GTI_VIEWPORTWIDTH: case HB_GTI_VIEWMAXWIDTH: pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->COLS ); break; + case HB_GTI_VIEWPORTHEIGHT: case HB_GTI_VIEWMAXHEIGHT: pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->ROWS ); break; @@ -3664,8 +3666,8 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case HB_GTI_SETPOS_ROWCOL: if( pWVT->hWnd ) { - int i1 = -1; - int i2 = -1; + int i1, i2; + RECT rect = { 0, 0, 0, 0 }; GetWindowRect( pWVT->hWnd, &rect ); diff --git a/contrib/gtwvg/wnd.prg b/contrib/gtwvg/wnd.prg index a3988dd11a..b575b687e2 100644 --- a/contrib/gtwvg/wnd.prg +++ b/contrib/gtwvg/wnd.prg @@ -245,7 +245,7 @@ CREATE CLASS WvgWindow INHERIT WvgPartHandler PROTECTED: METHOD getPosAndSize( aPs, aSz ) - METHOD isParentCrt() INLINE ::oParent:objType == objTypeCrt + METHOD isParentCrt() INLINE ( iif( HB_ISOBJECT( ::oParent ), ::oParent:objType == objTypeCrt, .F. ) ) METHOD rePosition() METHOD createControl() diff --git a/contrib/gtwvg/wvgcore.c b/contrib/gtwvg/wvgcore.c index 439611536c..4ae6e77d38 100644 --- a/contrib/gtwvg/wvgcore.c +++ b/contrib/gtwvg/wvgcore.c @@ -194,7 +194,7 @@ HB_BOOL hb_wvt_gtRenderPicture( int x, int y, int wd, int ht, IPicture * iPictur PHB_GTWVT _s = hb_wvt_gtGetWVT(); LONG lWidth, lHeight; - int xe, ye, iWd = 0, iHt = 0; + int xe, ye; HRGN hrgn1; POINT lpp = { 0, 0 }; HB_BOOL bResult = HB_FALSE; @@ -207,6 +207,8 @@ HB_BOOL hb_wvt_gtRenderPicture( int x, int y, int wd, int ht, IPicture * iPictur if( bDoNotScale ) { + int iWd, iHt; + if( lHeight > lWidth ) { iWd = ( int ) ( ( double ) ht * lWidth / lHeight ); @@ -506,7 +508,7 @@ HB_BOOL hb_wvt_DrawImage( HDC hdc, int x, int y, int wd, int ht, LPCTSTR lpImage DWORD nFileSize; DWORD nReadByte; LONG lWidth, lHeight; - int xe, ye, iWd = 0, iHt = 0; + int xe, ye; HRGN hrgn1; POINT lpp = { 0, 0 }; HB_BOOL bResult = HB_FALSE; @@ -539,6 +541,8 @@ HB_BOOL hb_wvt_DrawImage( HDC hdc, int x, int y, int wd, int ht, LPCTSTR lpImage if( bDoNotScale ) { + int iWd, iHt; + if( lHeight > lWidth ) { iWd = ( int ) ( ( double ) ht * lWidth / lHeight ); diff --git a/contrib/gtwvg/wvgcuig.c b/contrib/gtwvg/wvgcuig.c index e7786f9406..0a815e3c26 100644 --- a/contrib/gtwvg/wvgcuig.c +++ b/contrib/gtwvg/wvgcuig.c @@ -732,7 +732,6 @@ static void hb_wvg_LabelEx2( PHB_GTWVT pWVT, PHB_GOBJS gObj, int iLeft, int iTop hOldFont = ( HFONT ) SelectObject( pWVT->hdc, gObj->hFont ); x = iLeft; - y = iTop; switch( gObj->iAlign ) { @@ -1463,7 +1462,7 @@ static void hb_wvg_RenderPicture( PHB_GTWVT pWVT, PHB_GOBJS gObj, int iLeft, int { #if ! defined( HB_OS_WIN_CE ) LONG lWidth, lHeight; - int xe, ye, iWd = 0, iHt = 0, x, y, wd, ht; + int xe, ye, x, y, wd, ht; HRGN hrgn1; POINT lpp = { 0, 0 }; @@ -1482,6 +1481,8 @@ static void hb_wvg_RenderPicture( PHB_GTWVT pWVT, PHB_GOBJS gObj, int iLeft, int if( gObj->iData == 1 ) { + int iWd, iHt; + if( lHeight > lWidth ) { iWd = ( int ) ( ( double ) ht * lWidth / lHeight );