diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d07fc4a58d..8166127702 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,20 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-11-23 20:26 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbwin/win_tprn.prg + * contrib/hbwin/win_prn1.c + ! Fixed ::SETPEN() and WIN_SETPEN() to not leak objects. + Patch submitted by Xavi. + + * config/wce/poccarm.mk + * config/win/pocc.mk + % Removed some unnecessary logic, thus making it similar to all + other compiler setups. + + * ChangeLog + * TODO marked as DONE. + 2009-11-23 16:28 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/mpkg_rpm_win.sh + added yet another path for cross-mingw compiler detection @@ -95,7 +109,7 @@ problems. Please test and if it does, we should add missing options to LDFLAGS. ; TODO: Clean CPPFLAGS vs. CFLAGS usage in all .mk files. - They should all uniformly use CFLAGS now. + They should all uniformly use CFLAGS now. [DONE] 2009-11-23 09:11 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/filesys.c diff --git a/harbour/config/wce/poccarm.mk b/harbour/config/wce/poccarm.mk index 6a05672a60..1e5b334bb0 100644 --- a/harbour/config/wce/poccarm.mk +++ b/harbour/config/wce/poccarm.mk @@ -14,8 +14,7 @@ CC := pocc.exe CC_IN := -c CC_OUT := -Fo -CFLAGS := -I. -CFLAGS += -Ze -Go +CFLAGS := -I. -I$(HB_INC_COMPILE) -Ze -Go LDFLAGS := ifneq ($(HB_BUILD_WARN),no) @@ -32,10 +31,6 @@ endif # For Pocket PC and ARM processors (including XScale) CFLAGS += -Tarm-coff -D_M_ARM -D_WINCE -ifneq ($(HB_INC_COMPILE),) - CFLAGS += -I$(HB_INC_COMPILE) -endif - ifeq ($(HB_BUILD_DEBUG),yes) CFLAGS += -Zi endif diff --git a/harbour/config/win/pocc.mk b/harbour/config/win/pocc.mk index 5af5c12ac3..55f362eb7f 100644 --- a/harbour/config/win/pocc.mk +++ b/harbour/config/win/pocc.mk @@ -14,7 +14,7 @@ CC := pocc.exe CC_IN := -c CC_OUT := -Fo -CFLAGS := -I. -Ze -Go -MT +CFLAGS := -I. -I$(HB_INC_COMPILE) -Ze -Go -MT LDFLAGS := ifneq ($(HB_BUILD_WARN),no) @@ -28,10 +28,6 @@ ifneq ($(HB_BUILD_OPTIM),no) # -Ox: can cause GPF in 4.50/5.00, so it's disabled. endif -ifneq ($(HB_INC_COMPILE),) - CFLAGS += -I$(HB_INC_COMPILE) -endif - ifeq ($(HB_BUILD_DEBUG),yes) CFLAGS += -Zi endif diff --git a/harbour/contrib/hbwin/win_prn1.c b/harbour/contrib/hbwin/win_prn1.c index bf5f103e06..49e301d68f 100644 --- a/harbour/contrib/hbwin/win_prn1.c +++ b/harbour/contrib/hbwin/win_prn1.c @@ -120,7 +120,7 @@ static HB_GARBAGE_FUNC( win_HPEN_release ) if( ph && * ph ) { /* Destroy the object */ - DeleteObject( ( HDC ) * ph ); + DeleteObject( ( HPEN ) * ph ); /* set pointer to NULL to avoid multiple freeing */ * ph = NULL; @@ -159,9 +159,18 @@ HB_FUNC( WIN_CREATEDC ) if( HB_ISCHAR( 1 ) ) { LPTSTR lpText = HB_TCHAR_CONVTO( hb_parc( 1 ) ); - void ** ph = ( void ** ) hb_gcAllocate( sizeof( HDC * ), &s_gc_HDC_funcs ); - *ph = ( void * ) CreateDC( TEXT( "" ), lpText, NULL, NULL ); - hb_retptrGC( ph ); + HDC hDC = CreateDC( TEXT( "" ), lpText, NULL, NULL ); + + if( hDC ) + { + void ** ph = ( void ** ) hb_gcAllocate( sizeof( HDC * ), &s_gc_HDC_funcs ); + + *ph = hDC; + hb_retptrGC( ph ); + } + else + hb_retptr( NULL ); + HB_TCHAR_FREE( lpText ); } else @@ -663,21 +672,23 @@ HB_FUNC( WIN_SETPEN ) if( hDC ) { - HPEN hOldPen; + HPEN hPen; - void ** ph = ( void ** ) hb_gcAllocate( sizeof( HPEN * ), &s_gc_HPEN_funcs ); + hPen = CreatePen( hb_parni( 2 ), /* pen style */ + hb_parni( 3 ), /* pen width */ + ( COLORREF ) hb_parnl( 4 ) /* pen color */ + ); - * ph = ( void * ) CreatePen( hb_parni( 2 ), /* pen style */ - hb_parni( 3 ), /* pen width */ - ( COLORREF ) hb_parnl( 4 ) /* pen color */ - ); + if( hPen ) + { + void ** ph = ( void ** ) hb_gcAllocate( sizeof( HPEN * ), &s_gc_HPEN_funcs ); - hOldPen = ( HPEN ) SelectObject( hDC, ( HPEN ) * ph ); - - if( hOldPen ) - DeleteObject( hOldPen ); - - hb_retptrGC( ph ); + *ph = hPen; + SelectObject( hDC, hPen ); + hb_retptrGC( ph ); + } + else + hb_retptr( NULL ); } else diff --git a/harbour/contrib/hbwin/win_tprn.prg b/harbour/contrib/hbwin/win_tprn.prg index c8503656f5..d5eab0daa8 100644 --- a/harbour/contrib/hbwin/win_tprn.prg +++ b/harbour/contrib/hbwin/win_tprn.prg @@ -195,6 +195,7 @@ CREATE CLASS WIN_PRN VAR BkColor VAR TextAlign + VAR hPen INIT 0 VAR PenStyle VAR PenWidth VAR PenColor @@ -511,7 +512,7 @@ METHOD SetPen( nStyle, nWidth, nColor ) CLASS WIN_PRN ::PenStyle := nStyle ::PenWidth := nWidth ::PenColor := nColor - RETURN win_SetPen(::hPrinterDC, nStyle, nWidth, nColor ) + RETURN ! Empty( ::hPen := win_SetPen(::hPrinterDC, nStyle, nWidth, nColor ) ) METHOD Line( nX1, nY1, nX2, nY2 ) CLASS WIN_PRN RETURN win_LineTo( ::hPrinterDC, nX1, nY1, nX2, nY2 ) @@ -565,10 +566,10 @@ METHOD SetPrc( nRow, nCol ) CLASS WIN_PRN ::SetPos( ( nCol * ::CharWidth ) + ::LeftMArgin, ( nRow * ::LineHeight ) + ::TopMargin ) RETURN NIL -METHOD PROW() CLASS WIN_PRN +METHOD PRow() CLASS WIN_PRN RETURN Int( ( ::PosY- ::TopMargin ) / ::LineHeight ) // No test for Div by ZERO -METHOD PCOL() CLASS WIN_PRN +METHOD PCol() CLASS WIN_PRN RETURN Int( ( ::PosX - ::LeftMargin ) / ::CharWidth ) // Uses width of current character METHOD MaxRow() CLASS WIN_PRN @@ -577,16 +578,16 @@ METHOD MaxRow() CLASS WIN_PRN METHOD MaxCol() CLASS WIN_PRN RETURN Int( ( ( ::RightMargin - ::LeftMargin ) + 1 ) / ::CharWidth ) - 1 -METHOD MM_TO_POSX( nMm ) CLASS WIN_PRN +METHOD MM_To_PosX( nMm ) CLASS WIN_PRN RETURN Int( ( ( nMM * ::PixelsPerInchX ) / MM_TO_INCH ) - ::LeftMargin ) -METHOD MM_TO_POSY( nMm ) CLASS WIN_PRN +METHOD MM_To_PosY( nMm ) CLASS WIN_PRN RETURN Int( ( ( nMM * ::PixelsPerInchY ) / MM_TO_INCH ) - ::TopMargin ) -METHOD INCH_TO_POSX( nInch ) CLASS WIN_PRN +METHOD Inch_To_PosX( nInch ) CLASS WIN_PRN RETURN Int( ( nInch * ::PixelsPerInchX ) - ::LeftMargin ) -METHOD INCH_TO_POSY( nInch ) CLASS WIN_PRN +METHOD Inch_To_PosY( nInch ) CLASS WIN_PRN RETURN Int( ( nInch * ::PixelsPerInchY ) - ::TopMargin ) METHOD TextAtFont( nPosX, nPosY, cString, cFont, nPointSize, nWidth, nBold, lUnderLine, lItalic, nCharSet, lNewLine, lUpdatePosX, nColor, nAlign ) CLASS WIN_PRN