From e4cfd4ca066529e63cb85a2437e1f6d08590ce21 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Wed, 12 Dec 2007 18:45:26 +0000 Subject: [PATCH] 2007-12-13 10:42 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/hbgtwvg/wvtpaint.prg ! Formatting. * harbour/contrib/hbgtwvg/hbgtwvg.c + static BOOL hb_gt_wvt_PutChar( PHB_GT pGT, int iRow, int iCol, BYTE bColor, BYTE bAttr, USHORT usChar ) GUI elements need that every screen region requsted to be redrawn must be redrawn. --- harbour/ChangeLog | 10 +- harbour/contrib/hbgtwvg/gtwvg.c | 17 +++ harbour/contrib/hbgtwvg/wvtpaint.prg | 206 +++++++++++++-------------- 3 files changed, 129 insertions(+), 104 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index cf24d28e98..5aa4e34a61 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,4 +1,4 @@ -/* +/* * $Id$ */ @@ -8,6 +8,14 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-12-13 10:42 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com) + * harbour/contrib/hbgtwvg/wvtpaint.prg + ! Formatting. + * harbour/contrib/hbgtwvg/hbgtwvg.c + + static BOOL hb_gt_wvt_PutChar( PHB_GT pGT, int iRow, int iCol, + BYTE bColor, BYTE bAttr, USHORT usChar ) + GUI elements need that every screen region requsted to be redrawn must be redrawn. + 2007-12-12 11:06 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/ChangeLog * removed UTF-8 signature: 0xEF 0xBB 0xBF diff --git a/harbour/contrib/hbgtwvg/gtwvg.c b/harbour/contrib/hbgtwvg/gtwvg.c index 7c30d0587b..5e5b0cb8dc 100644 --- a/harbour/contrib/hbgtwvg/gtwvg.c +++ b/harbour/contrib/hbgtwvg/gtwvg.c @@ -2052,6 +2052,19 @@ static BOOL hb_gt_wvt_SetMode( PHB_GT pGT, int iRow, int iCol ) /* ********************************************************************** */ +static BOOL hb_gt_wvt_PutChar( PHB_GT pGT, int iRow, int iCol, + BYTE bColor, BYTE bAttr, USHORT usChar ) +{ + if( HB_GTSUPER_PUTCHAR( pGT, iRow, iCol, bColor, bAttr, usChar ) ) + { + HB_GTSELF_TOUCHCELL( pGT, iRow, iCol ); + return TRUE; + } + return FALSE; +} + +/* ********************************************************************** */ + static char * hb_gt_wvt_Version( PHB_GT pGT, int iType ) { HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Version(%p,%d)", pGT, iType ) ); @@ -2739,6 +2752,8 @@ static BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) pFuncTable->SetDispCP = hb_gt_wvt_SetDispCP; pFuncTable->SetKeyCP = hb_gt_wvt_SetKeyCP; + pFuncTable->PutChar = hb_gt_wvt_PutChar; + pFuncTable->ReadKey = hb_gt_wvt_ReadKey; pFuncTable->MouseIsPresent = hb_gt_wvt_mouse_IsPresent; @@ -2776,3 +2791,5 @@ HB_CALL_ON_STARTUP_END( _hb_startup_gt_Init_ ) static HB_$INITSYM hb_vm_auto__hb_startup_gt_Init_ = _hb_startup_gt_Init_; #pragma data_seg() #endif + + diff --git a/harbour/contrib/hbgtwvg/wvtpaint.prg b/harbour/contrib/hbgtwvg/wvtpaint.prg index 6ad4e692c8..842fdd4c7f 100644 --- a/harbour/contrib/hbgtwvg/wvtpaint.prg +++ b/harbour/contrib/hbgtwvg/wvtpaint.prg @@ -82,164 +82,164 @@ static paint_:= { { '', {} } } //-------------------------------------------------------------------// function WvtPaintObjects() -LOCAL i, lExe, nLeft, nRight, b, tlbr_, aBlocks, nBlocks + LOCAL i, lExe, nLeft, nRight, b, tlbr_, aBlocks, nBlocks -aBlocks := WvtSetPaint() + aBlocks := WvtSetPaint() -if ( nBlocks := len( aBlocks ) ) > 0 - tlbr_:= Wvt_GetPaintRect() + if ( nBlocks := len( aBlocks ) ) > 0 + tlbr_:= Wvt_GetPaintRect() - for i := 1 to nBlocks - lExe := .t. + for i := 1 to nBlocks + lExe := .t. - if aBlocks[ i,3 ] <> nil .and. !empty( aBlocks[ i,3 ] ) - // Check parameters against tlbr_ depending upon the - // type of object and attributes contained in aAttr - // - do case - case aBlocks[ i,3,1 ] == WVT_BLOCK_GRID_V - b := aBlocks[ i,3,6 ] - if len( b:aColumnsSep ) == 0 - lExe := .f. - else - nLeft := b:aColumnsSep[ 1 ] - nRight := b:aColumnsSep[ len( b:aColumnsSep ) ] - if !( tlbr_[ 1 ] <= aBlocks[ i,3,4 ] .and. ; // top < bottom + if aBlocks[ i,3 ] <> nil .and. !empty( aBlocks[ i,3 ] ) + // Check parameters against tlbr_ depending upon the + // type of object and attributes contained in aAttr + // + do case + case aBlocks[ i,3,1 ] == WVT_BLOCK_GRID_V + b := aBlocks[ i,3,6 ] + if len( b:aColumnsSep ) == 0 + lExe := .f. + else + nLeft := b:aColumnsSep[ 1 ] + nRight := b:aColumnsSep[ len( b:aColumnsSep ) ] + if !( tlbr_[ 1 ] <= aBlocks[ i,3,4 ] .and. ; // top < bottom + tlbr_[ 3 ] >= aBlocks[ i,3,2 ] .and. ; // bootm > top + tlbr_[ 2 ] <= nRight + 1 .and. ; // left < right + tlbr_[ 4 ] >= nLeft - 2 ) // right > left + lExe := .f. + endif + endif + + case aBlocks[ i,3,1 ] == WVT_BLOCK_GETS + if !( tlbr_[ 1 ] <= aBlocks[ i,3,4 ] .and. ; // top < bott tlbr_[ 3 ] >= aBlocks[ i,3,2 ] .and. ; // bootm > top - tlbr_[ 2 ] <= nRight + 1 .and. ; // left < right - tlbr_[ 4 ] >= nLeft - 2 ) // right > left + tlbr_[ 2 ] <= aBlocks[ i,3,5 ] .and. ; // left < righ + tlbr_[ 4 ] >= aBlocks[ i,3,3 ] ) // right > left lExe := .f. endif - endif - case aBlocks[ i,3,1 ] == WVT_BLOCK_GETS - if !( tlbr_[ 1 ] <= aBlocks[ i,3,4 ] .and. ; // top < bott - tlbr_[ 3 ] >= aBlocks[ i,3,2 ] .and. ; // bootm > top - tlbr_[ 2 ] <= aBlocks[ i,3,5 ] .and. ; // left < righ - tlbr_[ 4 ] >= aBlocks[ i,3,3 ] ) // right > left - lExe := .f. - endif + otherwise + // If refreshing rectangle's top is less than objects' bottom + // and left is less than objects' right + // + if !( tlbr_[ 1 ] <= aBlocks[ i,3,4 ] .and. ; // top <= bottom + tlbr_[ 3 ] >= aBlocks[ i,3,2 ] .and. ; // bootm >= top + tlbr_[ 2 ] <= aBlocks[ i,3,5 ] .and. ; // left < right + tlbr_[ 4 ] >= aBlocks[ i,3,3 ] ) // right > left + lExe := .f. + endif + endcase + endif - otherwise - // If refreshing rectangle's top is less than objects' bottom - // and left is less than objects' right - // - if !( tlbr_[ 1 ] <= aBlocks[ i,3,4 ] .and. ; // top <= bottom - tlbr_[ 3 ] >= aBlocks[ i,3,2 ] .and. ; // bootm >= top - tlbr_[ 2 ] <= aBlocks[ i,3,5 ] .and. ; // left < right - tlbr_[ 4 ] >= aBlocks[ i,3,3 ] ) // right > left - lExe := .f. - endif - endcase - endif + if lExe + eval( aBlocks[ i,2 ] ) + endif + next + endif - if lExe - eval( aBlocks[ i,2 ] ) - endif - next -endif - -return ( 0 ) + return ( 0 ) //-------------------------------------------------------------------// function WvtSetPaint( a_ ) -local o -static s := {} + local o + static s := {} -o := s + o := s -if a_ <> nil - s := a_ -endif + if a_ <> nil + s := a_ + endif -return o + return o //-------------------------------------------------------------------// function SetPaint( cID, nAction, xData, aAttr ) -local n, n1, oldData + local n, n1, oldData -if xData <> nil - if ( n := ascan( paint_, { |e_| e_[ 1 ] == cID } ) ) > 0 - if ( n1 := ascan( paint_[ n,2 ], {|e_| e_[ 1 ] == nAction } ) ) > 0 - oldData := paint_[ n,2,n1,2 ] - paint_[ n,2,n1,2 ] := xData - paint_[ n,2,n1,3 ] := aAttr + if xData <> nil + if ( n := ascan( paint_, { |e_| e_[ 1 ] == cID } ) ) > 0 + if ( n1 := ascan( paint_[ n,2 ], {|e_| e_[ 1 ] == nAction } ) ) > 0 + oldData := paint_[ n,2,n1,2 ] + paint_[ n,2,n1,2 ] := xData + paint_[ n,2,n1,3 ] := aAttr + else + aadd( paint_[ n,2 ], { nAction,xData,aAttr } ) + endif else - aadd( paint_[ n,2 ], { nAction,xData,aAttr } ) + aadd( paint_, { cID, {} } ) + n := len( paint_ ) + aadd( paint_[ n,2 ], { nAction, xData, aAttr } ) endif - else - aadd( paint_, { cID, {} } ) - n := len( paint_ ) - aadd( paint_[ n,2 ], { nAction, xData, aAttr } ) endif -endif -return oldData + return oldData //-------------------------------------------------------------------// function GetPaint( cID ) -local n + local n -if ( n := ascan( paint_, { |e_| e_[ 1 ] == cID } ) ) > 0 - return paint_[ n,2 ] -endif + if ( n := ascan( paint_, { |e_| e_[ 1 ] == cID } ) ) > 0 + return paint_[ n,2 ] + endif -return {} + return {} //-------------------------------------------------------------------// function DelPaint( cID, nAction ) -local xData, n1, n + local xData, n1, n -if ( n := ascan( paint_, { |e_| e_[ 1 ] == cID } ) ) > 0 - if ( n1 := ascan( paint_[ n,2 ], {|e_| e_[ 1 ] == nAction } ) ) > 0 - xData := paint_[ n,2,n1,2 ] - paint_[ n,2,n1,2 ] := {|| .t. } + if ( n := ascan( paint_, { |e_| e_[ 1 ] == cID } ) ) > 0 + if ( n1 := ascan( paint_[ n,2 ], {|e_| e_[ 1 ] == nAction } ) ) > 0 + xData := paint_[ n,2,n1,2 ] + paint_[ n,2,n1,2 ] := {|| .t. } + endif endif -endif -return xData + return xData //-------------------------------------------------------------------// function PurgePaint( cID,lDummy ) -local n, aPaint + local n, aPaint -DEFAULT lDummy TO .f. + DEFAULT lDummy TO .f. -if ( n := ascan( paint_, { |e_| e_[ 1 ] == cID } ) ) > 0 - aPaint := paint_[ n ] - ADel( paint_, n ) - aSize( paint_, len( paint_ ) - 1 ) -endif + if ( n := ascan( paint_, { |e_| e_[ 1 ] == cID } ) ) > 0 + aPaint := paint_[ n ] + ADel( paint_, n ) + aSize( paint_, len( paint_ ) - 1 ) + endif -if lDummy - WvtSetPaint( {} ) -endif + if lDummy + WvtSetPaint( {} ) + endif -return ( aPaint ) + return ( aPaint ) //-------------------------------------------------------------------// function InsertPaint( cID, aPaint, lSet ) -local n + local n -DEFAULT lSet TO .f. + DEFAULT lSet TO .f. -if ( n := ascan( paint_, { |e_| e_[ 1 ] == cID } ) ) > 0 - paint_[ n ] := aPaint -else - aadd( paint_, aPaint ) -endif + if ( n := ascan( paint_, { |e_| e_[ 1 ] == cID } ) ) > 0 + paint_[ n ] := aPaint + else + aadd( paint_, aPaint ) + endif -if lSet - WvtSetPaint( aPaint ) -endif + if lSet + WvtSetPaint( aPaint ) + endif -return nil + return nil //-------------------------------------------------------------------// //-------------------------------------------------------------------//