From 332c8149884858d60758baf2ab84d2e69270ddc8 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Fri, 11 Oct 2013 21:56:38 -0700 Subject: [PATCH] 2013-10-11 21:36 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) 2013-10-11 21:36 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/gtwvg/crt.prg + Added: Method RefreshEx() which refreshes the CRT window directly via WINAPI call instead of through hb_gtInfo( ... ) mechanism. This is useful in MT applications where one thread want to refresh the scren contents of CRT window in another thread. * contrib/gtwvg/gtwvgd.c + Added: hb_gtInfo( HB_GTI_BORDERSIZES ) -> { nLeft, nTop, nRight, nBottom } Useful in cases when you need to position precisely another window on top of existing GT window. % Aligned: hb_gtInfo( HB_GTI_SCREENHEIGHT and HB_GTI_SCREENWIDTH ) with GTWVG code with a small difference. * contrib/gtwvg/hbgtwvg.ch + Added: #define HB_GTI_BORDERSIZES * contrib/gtwvg/wvgcore.c + Added: HB_FUNC( WVT_DESTROYPICTURE ) <- Destroys the IPicture created with WVT_LOADPICTURE*() functions. + Added: HB_FUNC( WVT_LOADPICTUREEX ) <- -> --- ChangeLog.txt | 28 +++++++++++++++++--- contrib/gtwvg/crt.prg | 5 ++++ contrib/gtwvg/gtwvgd.c | 55 +++++++++++++++++++++++++++++++++++++--- contrib/gtwvg/hbgtwvg.ch | 1 + contrib/gtwvg/wvgcore.c | 23 +++++++++++++++++ 5 files changed, 106 insertions(+), 6 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index bb9c7663f3..30c04751c4 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,5 +1,5 @@ -/* - * $Id$ +/* + * $Id: bb9c7663f30fb4d1a34eefca196d43d0d30212d8 $ */ /* Read doc/howtorep.txt and use this format for entry headers: @@ -10,6 +10,28 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2013-10-11 21:36 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/gtwvg/crt.prg + + Added: Method RefreshEx() which refreshes the CRT window directly via + WINAPI call instead of through hb_gtInfo( ... ) mechanism. This is + useful in MT applications where one thread want to refresh the + scren contents of CRT window in another thread. + + * contrib/gtwvg/gtwvgd.c + + Added: hb_gtInfo( HB_GTI_BORDERSIZES ) -> { nLeft, nTop, nRight, nBottom } + Useful in cases when you need to position precisely another window on top + of existing GT window. + % Aligned: hb_gtInfo( HB_GTI_SCREENHEIGHT and HB_GTI_SCREENWIDTH ) with + GTWVG code with a small difference. + + * contrib/gtwvg/hbgtwvg.ch + + Added: #define HB_GTI_BORDERSIZES + + * contrib/gtwvg/wvgcore.c + + Added: HB_FUNC( WVT_DESTROYPICTURE ) <- + Destroys the IPicture created with WVT_LOADPICTURE*() functions. + + Added: HB_FUNC( WVT_LOADPICTUREEX ) <- -> + 2013-10-10 01:32 UTC+0200 Viktor Szakáts (vszakats users.noreply.github.com) * src/3rd/zlib/ChangeLog -> src/3rd/zlib/ChangeLog.txt * various cleanups @@ -306,7 +328,7 @@ * src/debug/debugger.prg ! keep RunAtStartup flag synced with menu ! fixed options decoding from init.cld file. - Thanks to Franček Prijatelj for locating the problem though fix + Thanks to Francek Prijatelj for locating the problem though fix should be a little bit different. * src/debug/tbrwtext.prg diff --git a/contrib/gtwvg/crt.prg b/contrib/gtwvg/crt.prg index 5f9299eda4..6f529947fd 100644 --- a/contrib/gtwvg/crt.prg +++ b/contrib/gtwvg/crt.prg @@ -164,6 +164,7 @@ CREATE CLASS WvgCrt INHERIT WvgWindow, WvgPartHandler METHOD getTitle() INLINE hb_gtInfo( HB_GTI_WINTITLE ) METHOD showWindow() INLINE ::show() METHOD refresh() INLINE ::invalidateRect() + METHOD refreshEx() /* LIFE CYCLE */ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) @@ -436,6 +437,10 @@ METHOD WvgCrt:hide() RETURN Self +METHOD WvgCrt:refreshEx() + Wvg_InvalidateRect( ::hWnd ) + RETURN Self + METHOD WvgCrt:invalidateRect( nTop, nLeft, nBottom, nRight ) __defaultNIL( @nTop, 0 ) diff --git a/contrib/gtwvg/gtwvgd.c b/contrib/gtwvg/gtwvgd.c index beab612556..e5ed8dccb2 100644 --- a/contrib/gtwvg/gtwvgd.c +++ b/contrib/gtwvg/gtwvgd.c @@ -3126,15 +3126,64 @@ 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 ) + if( iVal > 0 && ! pWVT->bMaximized && ! pWVT->bFullScreen && pWVT->hWnd ) /* Don't allow if Maximized or FullScreen */ + { HB_GTSELF_SETMODE( pGT, ( iVal / pWVT->PTEXTSIZE.y ), pWVT->COLS ); + + /* 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 ); + hb_gt_wvt_FitSizeRows( pWVT ); /* Needed because GTWVG does not adjust to resize until WM_EXITSIZEMOVE is received */ + } + } 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 && ! pWVT->bFullScreen && pWVT->hWnd ) /* Don't allow if Maximized or FullScreen */ + { + HB_GTSELF_SETMODE( pGT, ( iVal / pWVT->PTEXTSIZE.y ), pWVT->COLS ); + + /* 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 ); + hb_gt_wvt_FitSizeRows( pWVT ); /* Needed because GTWVG does not adjust to resize until WM_EXITSIZEMOVE is received */ + } + } + break; + + case HB_GTI_BORDERSIZES: + if( pWVT->hWnd ) + { + RECT ci, wi; + int borderWidth, borderHeight; + + GetClientRect( pWVT->hWnd, &ci ); + GetWindowRect( pWVT->hWnd, &wi ); + + borderWidth = ( wi.right - wi.left - ( ci.right - ci.left ) ) / 2; + borderHeight = ( wi.bottom - wi.top - ( ci.bottom - ci.top ) ); + + pInfo->pResult = hb_itemNew( NULL ); + hb_arrayNew( pInfo->pResult, 4 ); + hb_arraySetNI( pInfo->pResult, 1, borderWidth ); + hb_arraySetNI( pInfo->pResult, 2, borderHeight - borderWidth ); + hb_arraySetNI( pInfo->pResult, 3, borderWidth ); + hb_arraySetNI( pInfo->pResult, 4, borderWidth ); + } break; case HB_GTI_DESKTOPWIDTH: diff --git a/contrib/gtwvg/hbgtwvg.ch b/contrib/gtwvg/hbgtwvg.ch index d5086fe27c..3aeb4156f1 100644 --- a/contrib/gtwvg/hbgtwvg.ch +++ b/contrib/gtwvg/hbgtwvg.ch @@ -85,6 +85,7 @@ #define HB_GTI_REFRESH 79 #define HB_GTI_NOTIFIERBLOCKGUI 80 #define HB_GTI_MAXIMIZABLE 81 +#define HB_GTI_BORDERSIZES 82 /* Presentation Parameters | HB_GTI_PRESPARAMS */ #define HB_GTI_PP_EXSTYLE 1 diff --git a/contrib/gtwvg/wvgcore.c b/contrib/gtwvg/wvgcore.c index c31c83e394..0f0b165995 100644 --- a/contrib/gtwvg/wvgcore.c +++ b/contrib/gtwvg/wvgcore.c @@ -2738,6 +2738,29 @@ HB_FUNC( WVT_LOADPICTURE ) hb_retl( bResult ); } +HB_FUNC( WVT_DESTROYPICTURE ) +{ + IPicture * iPicture = ( IPicture * ) ( HB_PTRDIFF ) hb_parnl( 1 ); + hb_retl( hb_wvt_gtDestroyPicture( iPicture ) ); +} + +/* + * Wvt_LoadPictureEx( cFilePic ) + */ +HB_FUNC( WVT_LOADPICTUREEX ) +{ +#if ! defined( HB_OS_WIN_CE ) + void * hImage; + IPicture * iPicture = hb_wvt_gtLoadPicture( HB_PARSTR( 1, &hImage, NULL ) ); + + hb_strfree( hImage ); + if( iPicture ) + { + hb_retnl( ( HB_PTRDIFF ) iPicture ); + } +#endif +} + HB_FUNC( WVT_LOADPICTUREFROMRESOURCE ) { HB_BOOL bResult = HB_FALSE;