From 5a3c61ba5496dcc312e9597b118beba405b3067d Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 18 Jan 2010 13:37:42 +0000 Subject: [PATCH] 2010-01-18 14:36 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * hbwin/hbwapi.h * hbwin/win_prn1.c + Added HFONT GC interface. --- harbour/ChangeLog | 5 +++++ harbour/contrib/hbwin/hbwapi.h | 2 ++ harbour/contrib/hbwin/win_prn1.c | 33 ++++++++++++++++++++++---------- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f66b72ee9f..ac5b26a0f0 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,11 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-18 14:36 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * hbwin/hbwapi.h + * hbwin/win_prn1.c + + Added HFONT GC interface. + 2010-01-18 13:27 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbwin/win_prn1.c * contrib/hbwin/hbwapi.h diff --git a/harbour/contrib/hbwin/hbwapi.h b/harbour/contrib/hbwin/hbwapi.h index ea921a3abf..28ae72ef12 100644 --- a/harbour/contrib/hbwin/hbwapi.h +++ b/harbour/contrib/hbwin/hbwapi.h @@ -104,9 +104,11 @@ HB_EXPORT DWORD hbwapi_GetLastError( void ); HB_EXPORT HDC hbwapi_par_HDC( int iParam ); HB_EXPORT HPEN hbwapi_par_HPEN( int iParam ); +HB_EXPORT HFONT hbwapi_par_HFONT( int iParam ); HB_EXPORT void hbwapi_ret_HDC( HDC p ); HB_EXPORT void hbwapi_ret_HPEN( HPEN p ); +HB_EXPORT void hbwapi_ret_HFONT( HFONT p ); HB_EXTERN_END diff --git a/harbour/contrib/hbwin/win_prn1.c b/harbour/contrib/hbwin/win_prn1.c index e561905a61..2aa67cd4a3 100644 --- a/harbour/contrib/hbwin/win_prn1.c +++ b/harbour/contrib/hbwin/win_prn1.c @@ -185,6 +185,27 @@ static const HB_GC_FUNCS s_gc_HFONT_funcs = hb_gcDummyMark }; +void hbwapi_ret_HFONT( HFONT p ) +{ + if( p ) + { + void ** ph = ( void ** ) hb_gcAllocate( sizeof( HFONT * ), &s_gc_HFONT_funcs ); + + *ph = p; + + hb_retptrGC( ph ); + } + else + hb_retptr( NULL ); +} + +HFONT hbwapi_par_HFONT( int iParam ) +{ + void ** ph = ( void ** ) hb_parptrGC( &s_gc_HFONT_funcs, iParam ); + + return ph ? ( HFONT ) * ph : ( HFONT ) hb_parptr( iParam ); +} + HB_FUNC( WIN_CREATEDC ) { if( HB_ISCHAR( 1 ) ) @@ -428,18 +449,10 @@ HB_FUNC( WIN_CREATEFONT ) hb_strfree( hFontFace ); + hbwapi_ret_HFONT( hFont ); + if( hFont ) - { - void ** ph = ( void ** ) hb_gcAllocate( sizeof( HFONT * ), &s_gc_HFONT_funcs ); - - *ph = hFont; - - hb_retptrGC( ph ); - SelectObject( hDC, hFont ); - } - else - hb_retptr( NULL ); } else hb_retptr( NULL );