From c6c9937ab67e49f1864f95153a6779cb8d09f97e Mon Sep 17 00:00:00 2001 From: bedipritpal Date: Mon, 14 Jan 2019 12:24:00 -0800 Subject: [PATCH] 2019-01-14 12:18 UTC-0800 Pritpal Bedi (bedipritpal/at/hotmail.com) * contrib/gtwvg/wnd.prg ! Fixed: x,y,w,h values if aPos and aSize parameters were containing negatve values. * contrib/gtwvg/paint.prg ! Fixed to return proper color index if a compound color string is supplied to wvt_GetRGBColorByString(). ; Above patch provided by Jose Quintas - many thanks. --- ChangeLog.txt | 11 +++++++++++ contrib/gtwvg/paint.prg | 5 +++++ contrib/gtwvg/wnd.prg | 39 ++++++++++++++++++--------------------- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index e9210029bb..5c811e05f4 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,17 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2019-01-14 12:18 UTC-0800 Pritpal Bedi (bedipritpal/at/hotmail.com) + * contrib/gtwvg/wnd.prg + ! Fixed: x,y,w,h values if aPos and aSize parameters were + containing negatve values. + + * contrib/gtwvg/paint.prg + ! Fixed to return proper color index if a compound color string + is supplied to wvt_GetRGBColorByString(). + + ; Above patch provided by Jose Quintas - many thanks. + 2019-01-11 13:52 UTC-0800 Pritpal Bedi (bedipritpal/at/hotmail.com) * contrib/gtwvg/wnd.prg * contrib/gtwvg/activex.prg diff --git a/contrib/gtwvg/paint.prg b/contrib/gtwvg/paint.prg index 2b8c93510b..cdf59a9e0c 100644 --- a/contrib/gtwvg/paint.prg +++ b/contrib/gtwvg/paint.prg @@ -603,6 +603,9 @@ FUNCTION wvt_GetRGBColorByString( cColor, nForeBack ) s := SubStr( cColor, 1, n - 1 ) ELSE s := SubStr( cColor, n + 1 ) + IF "," $ s + s := Substr( s, 1, At( ",", s ) - 1 ) + ENDIF ENDIF ELSE s := cColor @@ -619,6 +622,8 @@ FUNCTION wvt_GetRGBColorByString( cColor, nForeBack ) nIndex += 8 ENDIF nIndex-- + ELSEIF Val( s ) > 0 .AND. Val( s ) < 16 + nIndex := Val( s ) ENDIF ENDIF diff --git a/contrib/gtwvg/wnd.prg b/contrib/gtwvg/wnd.prg index b575b687e2..c6bad2386b 100644 --- a/contrib/gtwvg/wnd.prg +++ b/contrib/gtwvg/wnd.prg @@ -1,7 +1,7 @@ /* * Xbase++ Compatible xbpWindow Class * - * Copyright 2008-2012 Pritpal Bedi + * Copyright 2008-2019 Pritpal Bedi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1130,9 +1130,7 @@ METHOD WvgWindow:findObjectByHandle( hWnd ) METHOD WvgWindow:getPosAndSize( aPs, aSz ) - LOCAL nX, nY, nW, nH, aXY - LOCAL aPos, aSize - LOCAL nFH, nFW + LOCAL nX, nY, nW, nH, aPos, aSize, aFontInfo __defaultNIL( @aPs, AClone( ::aPos ) ) __defaultNIL( @aSz, AClone( ::aSize ) ) @@ -1154,27 +1152,26 @@ METHOD WvgWindow:getPosAndSize( aPs, aSz ) aSize[ 2 ] := Eval( aSize[ 2 ] ) ENDIF - IF aPos[ 1 ] < 0 .AND. aPos[ 2 ] < 0 .AND. aSize[ 1 ] < 0 .AND. aSize[ 2 ] < 0 - nX := Abs( aPos[ 2 ] ) - IF nX < 1 - nX := 0 + IF aPos[ 1 ] < 0 .OR. aPos[ 2 ] < 0 .OR. aSize[ 1 ] < 0 .OR. aSize[ 2 ] < 0 + aFontInfo := wvt_GetFontInfo() + + nX := aPos[ 2 ] + IF nX < 0 + nX := Int( Abs( aPos[ 2 ] ) * aFontInfo[ 7 ] ) ENDIF - nY := Abs( aPos[ 1 ] ) - IF nY < 1 - nY := 0 + nY := aPos[ 1 ] + IF nY < 0 + nY := Int( Abs( aPos[ 1 ] ) * aFontInfo[ 6 ] ) ENDIF - nW := Abs( aSize[ 2 ] ) - IF nW < 1 - nW := 0 + nW := aSize[ 2 ] + IF nW < 0 + nW := Int( Abs( aSize[ 2 ] ) * aFontInfo[ 7 ] ) ENDIF - nH := Abs( aSize[ 1 ] ) - IF nH < 1 - nH := 0 + nH := aSize[ 1 ] + IF nH < 0 + nH := Int( Abs( aSize[ 1 ] ) * aFontInfo[ 6 ] ) ENDIF - aXY := wvt_GetXYFromRowCol( nY, nX ) - nFH := wvt_GetFontInfo()[ 6 ] - nFW := wvt_GetFontInfo()[ 7 ] - RETURN { aXY[ 1 ], aXY[ 2 ], nW * nFW, nH * nFH } + RETURN { nX, nY, nW, nH } ENDIF ENDIF