diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2994a2d60a..653787dda6 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,13 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-01-19 19:34 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/contrib/hbct/ctwin.c + * harbour/contrib/hbct/ctwin.h + * harbour/contrib/hbct/ctwfunc.c + + added support for window shadows which clears highlight attributes + instead of using fixed shadow color attribute + 2009-01-19 13:10 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbmzip/hbmzip.c ! added missing nInternalAttr and nExternalAttr parameters decoding in diff --git a/harbour/contrib/hbct/ctwfunc.c b/harbour/contrib/hbct/ctwfunc.c index 7ffa4485ec..75c683d1a5 100644 --- a/harbour/contrib/hbct/ctwfunc.c +++ b/harbour/contrib/hbct/ctwfunc.c @@ -116,7 +116,7 @@ HB_FUNC( GETCLEARB ) HB_FUNC( WSETSHADOW ) { - hb_retni( hb_ctwSetShadowAttr( hb_ctColorParam( 1, -2 ) ) ); + hb_retni( hb_ctwSetShadowAttr( hb_ctColorParam( 1, HB_CTW_SHADOW_UNDEF ) ) ); } HB_FUNC( WSETMOVE ) @@ -385,7 +385,7 @@ HB_FUNC( WSHADOW ) { int iAttr; - iAttr = ISNUM( 1 ) ? hb_parni( 1 ) : -2; + iAttr = ISNUM( 1 ) ? hb_parni( 1 ) : HB_CTW_SHADOW_UNDEF; hb_retni( hb_ctwSetWindowShadow( hb_ctwCurrentWindow(), iAttr ) ); } diff --git a/harbour/contrib/hbct/ctwin.c b/harbour/contrib/hbct/ctwin.c index 0daf4e64db..427eadc826 100644 --- a/harbour/contrib/hbct/ctwin.c +++ b/harbour/contrib/hbct/ctwin.c @@ -224,7 +224,7 @@ static void hb_ctw_WindowMap( PHB_GTCTW pCTW, int iWindow, BOOL fExpose ) hb_ctw_SetMap( pCTW, pCTW->pShadowMap, 0, pWnd->iFirstRow, pWnd->iFirstCol, iLastRow, iLastCol ); - if( pWnd->iShadowAttr >= 0 && + if( pWnd->iShadowAttr != HB_CTW_SHADOW_OFF && iLastRow >= pCTW->iBoardTop && iLastCol >= pCTW->iBoardLeft && pWnd->iFirstRow <= pCTW->iBoardBottom && pWnd->iFirstCol <= pCTW->iBoardRight ) { @@ -264,7 +264,9 @@ static int hb_ctw_SetShadowAttr( PHB_GTCTW pCTW, int iAttr ) HB_TRACE(HB_TR_DEBUG, ("hb_ctw_SetShadowAttr(%p,%d)", pCTW, iAttr)); iOldAttr = pCTW->iShadowAttr; - if( iAttr >= -1 ) + if( iAttr >= 0 || + iAttr == HB_CTW_SHADOW_OFF || + iAttr == HB_CTW_SHADOW_EXT ) pCTW->iShadowAttr = iAttr; return iOldAttr; @@ -493,7 +495,10 @@ static int hb_ctw_SetWindowShadow( PHB_GTCTW pCTW, int iWindow, int iAttr ) PHB_CT_WND pWnd = pCTW->windows[ iWindow ]; iResult = pWnd->iShadowAttr; - if( iAttr >= -1 && pWnd->iShadowAttr != iAttr ) + if( ( iAttr >= 0 || + iAttr == HB_CTW_SHADOW_OFF || + iAttr == HB_CTW_SHADOW_EXT ) && + pWnd->iShadowAttr != iAttr ) { pWnd->iShadowAttr = iAttr; if( !pWnd->fHidden ) @@ -1553,6 +1558,15 @@ static BOOL hb_ctw_gt_GetScrChar( PHB_GT pGT, int iRow, int iCol, PHB_CT_WND pWnd = pCTW->windows[ iShadow ]; if( pWnd->iShadowAttr >= 0 ) *pbColor = ( BYTE ) pWnd->iShadowAttr; + else if( pWnd->iShadowAttr == HB_CTW_SHADOW_EXT ) + { + if( ( *pbColor & 0x80 ) == 0 ) + *pbColor &= 0x0F; + if( ( *pbColor & 0x08 ) == 0 ) + *pbColor &= 0xF0; + if( ( *pbColor &= 0x77 ) == 0 ) + *pbColor = 0x07; + } *pbAttr |= HB_GT_ATTR_SHADOW; } diff --git a/harbour/contrib/hbct/ctwin.h b/harbour/contrib/hbct/ctwin.h index dd3f698766..717eefcf12 100644 --- a/harbour/contrib/hbct/ctwin.h +++ b/harbour/contrib/hbct/ctwin.h @@ -53,13 +53,17 @@ #ifndef HB_CTWIN_H_ #define HB_CTWIN_H_ -#define HB_CTW_UNDEF -1 -#define HB_CTW_HIDDEN 0 -#define HB_CTW_VISIBLE 1 +#define HB_CTW_UNDEF -1 +#define HB_CTW_HIDDEN 0 +#define HB_CTW_VISIBLE 1 -#define HB_CTW_BOTTOM 0 -#define HB_CTW_DEFAULT 1 -#define HB_CTW_TOP 2 +#define HB_CTW_SHADOW_OFF -1 +#define HB_CTW_SHADOW_EXT -2 +#define HB_CTW_SHADOW_UNDEF -3 + +#define HB_CTW_BOTTOM 0 +#define HB_CTW_DEFAULT 1 +#define HB_CTW_TOP 2 HB_EXTERN_BEGIN