From a0ac1274544a9911e66415bff09a69c38cd79e87 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Sun, 1 Jan 2012 05:23:56 +0000 Subject: [PATCH] 2011-12-31 21:16 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/gtwvg/gtwvg.c * contrib/gtwvg/gtwvg.h * contrib/gtwvg/wvgcore.c * contrib/gtwvg/wvgcuig.c * contrib/gtwvg/wvggui.c * contrib/gtwvg/wvgutils.c * contrib/gtwvg/wvgwin.c * contrib/gtwvg/wvgwing.c ! Removed: TCHAR_* macros, almost. Only 6 occurances are still present in the code which I do not know how to cover. * contrib/gtwvg/wvgmenub.prg ! Adapted: the conversion of character '~' to '&' at prg level instead of C level. --- harbour/ChangeLog | 17 ++++ harbour/contrib/gtwvg/gtwvg.c | 60 ++++++------ harbour/contrib/gtwvg/gtwvg.h | 10 +- harbour/contrib/gtwvg/wvgcore.c | 68 +++++++------- harbour/contrib/gtwvg/wvgcuig.c | 28 +++++- harbour/contrib/gtwvg/wvggui.c | 3 +- harbour/contrib/gtwvg/wvgmenub.prg | 3 +- harbour/contrib/gtwvg/wvgutils.c | 57 ++++++------ harbour/contrib/gtwvg/wvgwin.c | 53 +++-------- harbour/contrib/gtwvg/wvgwing.c | 142 +++++++++++------------------ 10 files changed, 203 insertions(+), 238 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bf8af6e316..315e3648c0 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,23 @@ The license applies to all entries newer than 2009-04-28. */ +2011-12-31 21:16 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/gtwvg/gtwvg.c + * contrib/gtwvg/gtwvg.h + * contrib/gtwvg/wvgcore.c + * contrib/gtwvg/wvgcuig.c + * contrib/gtwvg/wvggui.c + * contrib/gtwvg/wvgutils.c + * contrib/gtwvg/wvgwin.c + * contrib/gtwvg/wvgwing.c + ! Removed: TCHAR_* macros, almost. + Only 6 occurances are still present in the code which I do not + know how to cover. + + * contrib/gtwvg/wvgmenub.prg + ! Adapted: the conversion of character '~' to '&' at prg level + instead of C level. + 2011-12-31 03:30 UTC+0100 Viktor Szakats (harbour syenar.hu) * contrib/xhb/xhw32prn.prg ! fixed typo in ::TEXTATFONT() to pass vertical alignment parameter. diff --git a/harbour/contrib/gtwvg/gtwvg.c b/harbour/contrib/gtwvg/gtwvg.c index 9dab84ef14..4df05f65ac 100644 --- a/harbour/contrib/gtwvg/gtwvg.c +++ b/harbour/contrib/gtwvg/gtwvg.c @@ -389,7 +389,7 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow ) pWVT->fontHeight = WVT_DEFAULT_FONT_HEIGHT; pWVT->fontWeight = FW_NORMAL; pWVT->fontQuality = DEFAULT_QUALITY; - hb_strncpy( pWVT->fontFace, WVT_DEFAULT_FONT_NAME, sizeof( pWVT->fontFace ) - 1 ); + HB_STRNCPY( pWVT->fontFace, WVT_DEFAULT_FONT_NAME, HB_SIZEOFARRAY( pWVT->fontFace ) - 1 ); pWVT->CaretExist = HB_FALSE; pWVT->CaretHidden = HB_TRUE; @@ -523,7 +523,7 @@ static void hb_gt_wvt_FireMenuEvent( PHB_GTWVT pWVT, int iMode, int menuIndex ) /* * use the standard fixed oem font, unless the caller has requested set size fonts */ -static HFONT hb_gt_wvt_GetFont( const char * pszFace, int iHeight, int iWidth, int iWeight, int iQuality, int iCodePage ) +static HFONT hb_gt_wvt_GetFont( LPCTSTR lpFace, int iHeight, int iWidth, int iWeight, int iQuality, int iCodePage ) { if( iHeight > 0 ) { @@ -544,7 +544,7 @@ static HFONT hb_gt_wvt_GetFont( const char * pszFace, int iHeight, int iWidth, i logfont.lfHeight = iHeight; logfont.lfWidth = iWidth < 0 ? -iWidth : iWidth; - HB_TCHAR_COPYTO( logfont.lfFaceName, pszFace, HB_SIZEOFARRAY( logfont.lfFaceName ) - 1 ); + HB_STRNCPY( logfont.lfFaceName, lpFace, HB_SIZEOFARRAY( logfont.lfFaceName ) - 1 ); return CreateFontIndirect( &logfont ); } @@ -2503,7 +2503,7 @@ static HWND hb_gt_wvt_CreateWindow( PHB_GTWVT pWVT, HB_BOOL bResizable ) pWVT->fontWeight = pWVTp->fontWeight; pWVT->fontQuality = pWVTp->fontQuality; pWVT->CodePage = pWVTp->CodePage; - hb_strncpy( pWVT->fontFace, pWVTp->fontFace, sizeof( pWVTp->fontFace ) - 1 ); + HB_STRNCPY( pWVT->fontFace, pWVTp->fontFace, sizeof( pWVTp->fontFace ) - 1 ); pWVT->hFont = hb_gt_wvt_GetFont( pWVT->fontFace, pWVT->fontHeight, pWVT->fontWidth, pWVT->fontWeight, pWVT->fontQuality, pWVT->CodePage ); @@ -3027,17 +3027,21 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) pInfo->pResult = hb_itemPutL( pInfo->pResult, HB_FALSE ); if( hb_itemType( pInfo->pNewVal ) & HB_IT_ARRAY ) { - HFONT hFont = hb_gt_wvt_GetFont( hb_arrayGetCPtr( pInfo->pNewVal, 1 ), + void * hText; + HFONT hFont = hb_gt_wvt_GetFont( HB_ARRAYGETSTR( pInfo->pNewVal, 1, &hText, NULL ), hb_arrayGetNI( pInfo->pNewVal, 2 ), hb_arrayGetNI( pInfo->pNewVal, 3 ), hb_arrayGetNI( pInfo->pNewVal, 4 ), hb_arrayGetNI( pInfo->pNewVal, 5 ), pWVT->CodePage ); + hb_strfree( hText ); + if( hFont ) { pInfo->pResult = hb_itemPutL( pInfo->pResult, HB_TRUE ); - hb_strncpy( pWVT->fontFace, hb_arrayGetCPtr( pInfo->pNewVal, 1 ), sizeof( pWVT->fontFace ) - 1 ); + HB_STRNCPY( pWVT->fontFace, HB_ARRAYGETSTR( pInfo->pNewVal, 1, &hText, NULL ), HB_SIZEOFARRAY( pWVT->fontFace ) - 1 ); + hb_strfree( hText ); pWVT->fontHeight = hb_arrayGetNI( pInfo->pNewVal, 2 ); pWVT->fontWidth = hb_arrayGetNI( pInfo->pNewVal, 3 ); pWVT->fontWeight = hb_arrayGetNI( pInfo->pNewVal, 4 ); @@ -3108,47 +3112,38 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->fontWidth ); if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC ) pWVT->fontWidth = hb_itemGetNI( pInfo->pNewVal ); - break; case HB_GTI_FONTNAME: - pInfo->pResult = hb_itemPutC( pInfo->pResult, pWVT->fontFace ); + pInfo->pResult = HB_ITEMPUTSTR( pInfo->pResult, pWVT->fontFace ); if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) - { - hb_strncpy( pWVT->fontFace, hb_itemGetCPtr( pInfo->pNewVal ), sizeof( pWVT->fontFace ) - 1 ); - } + HB_ITEMCOPYSTR( pInfo->pNewVal, pWVT->fontFace, HB_SIZEOFARRAY( pWVT->fontFace ) ); break; case HB_GTI_FONTWEIGHT: pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->fontWeight ); if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC ) pWVT->fontWeight = hb_itemGetNI( pInfo->pNewVal ); - break; case HB_GTI_FONTQUALITY: pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->fontQuality ); if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC ) pWVT->fontQuality = hb_itemGetNI( pInfo->pNewVal ); - break; case HB_GTI_SCREENHEIGHT: pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->PTEXTSIZE.y * pWVT->ROWS ); iVal = hb_itemGetNI( pInfo->pNewVal ); if( iVal > 0 ) - { HB_GTSELF_SETMODE( pGT, ( iVal / pWVT->PTEXTSIZE.y ), pWVT->COLS ); - } break; case HB_GTI_SCREENWIDTH: pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->PTEXTSIZE.x * pWVT->COLS ); iVal = hb_itemGetNI( pInfo->pNewVal ); if( iVal > 0 ) - { HB_GTSELF_SETMODE( pGT, pWVT->ROWS, ( iVal / pWVT->PTEXTSIZE.x ) ); - } break; case HB_GTI_DESKTOPWIDTH: @@ -3204,7 +3199,7 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) iVal = hb_itemGetNI( pInfo->pNewVal ); if( iVal != pWVT->CodePage ) { - if( !pWVT->hWnd ) + if( ! pWVT->hWnd ) { pWVT->CodePage = iVal; } @@ -3225,11 +3220,15 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) HFONT hFont = hb_gt_wvt_GetFont( pWVT->fontFace, pWVT->fontHeight, pWVT->fontWidth, pWVT->fontWeight, pWVT->fontQuality, iVal ); if( hFont ) - { + { +#if !defined( UNICODE ) + if( pWVT->hFont && pWVT->hFont != pWVT->hFontBox ) +#else if( pWVT->hFont ) +#endif DeleteObject( pWVT->hFont ); pWVT->hFont = hFont; - pWVT->CodePage = iVal; + pWVT->CodePage = iVal; } } } @@ -3273,7 +3272,7 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) pWVT->fontWeight, pWVT->fontQuality, iVal ); if( hFont ) { - if( pWVT->hFontBox ) + if( pWVT->hFontBox && pWVT->hFontBox != pWVT->hFont ) DeleteObject( pWVT->hFontBox ); pWVT->hFontBox = hFont; pWVT->boxCodePage = iVal; @@ -3314,12 +3313,12 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) { HICON hIconToFree = pWVT->bIconToFree ? pWVT->hIcon : NULL; - void * hIconName; + void * hText; pWVT->bIconToFree = HB_FALSE; pWVT->hIcon = LoadIcon( pWVT->hInstance, - HB_ITEMGETSTR( pInfo->pNewVal, &hIconName, NULL ) ); - hb_strfree( hIconName ); + HB_ITEMGETSTR( pInfo->pNewVal, &hText, NULL ) ); + hb_strfree( hText ); if( pWVT->hWnd ) { SendNotifyMessage( pWVT->hWnd, WM_SETICON, ICON_SMALL, ( LPARAM ) pWVT->hIcon ); /* Set Title Bar Icon */ @@ -3692,19 +3691,19 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) int iIconType = hb_arrayGetNI( pInfo->pNewVal2, 2 ); HICON hIcon = 0; NOTIFYICONDATA tnid; - void * hIconName; + void * hText; if( iIconType == 0 ) { hIcon = ( HICON ) LoadImage( ( HINSTANCE ) NULL, - HB_ARRAYGETSTR( pInfo->pNewVal2, 3, &hIconName, NULL ), + HB_ARRAYGETSTR( pInfo->pNewVal2, 3, &hText, NULL ), IMAGE_ICON, 0, 0, LR_LOADFROMFILE ); - hb_strfree( hIconName ); + hb_strfree( hText ); } else if( iIconType == 1 ) { - hIcon = LoadIcon( pWVT->hInstance, HB_ARRAYGETSTR( pInfo->pNewVal2, 3, &hIconName, NULL ) ); - hb_strfree( hIconName ); + hIcon = LoadIcon( pWVT->hInstance, HB_ARRAYGETSTR( pInfo->pNewVal2, 3, &hText, NULL ) ); + hb_strfree( hText ); } else if( iIconType == 2 ) { @@ -3719,7 +3718,8 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) tnid.uCallbackMessage = HB_MSG_NOTIFYICON; tnid.hIcon = hIcon; - HB_TCHAR_COPYTO( tnid.szTip, hb_arrayGetCPtr( pInfo->pNewVal2, 4 ), HB_SIZEOFARRAY( tnid.szTip ) - 1 ); + HB_STRNCPY( tnid.szTip, HB_ARRAYGETSTR( pInfo->pNewVal2, 4, &hText, NULL ), HB_SIZEOFARRAY( tnid.szTip ) - 1 ); + hb_strfree( hText ); Shell_NotifyIcon( mode, &tnid ); diff --git a/harbour/contrib/gtwvg/gtwvg.h b/harbour/contrib/gtwvg/gtwvg.h index 2f5d8d0c2e..e8f7775c64 100644 --- a/harbour/contrib/gtwvg/gtwvg.h +++ b/harbour/contrib/gtwvg/gtwvg.h @@ -113,7 +113,7 @@ HB_EXTERN_BEGIN # define WVT_DEFAULT_FONT_HEIGHT 16 # define WVT_DEFAULT_FONT_WIDTH 10 #endif -#define WVT_DEFAULT_FONT_NAME "Courier New" +#define WVT_DEFAULT_FONT_NAME TEXT( "Courier New" ) #define BLACK RGB( 0x0 ,0x0 ,0x0 ) #define BLUE RGB( 0x0 ,0x0 ,0x85 ) @@ -351,7 +351,7 @@ typedef struct int fontWidth; /* requested font width */ int fontWeight; /* Bold level */ int fontQuality; /* requested font quality */ - char fontFace[ LF_FACESIZE ]; /* requested font face name LF_FACESIZE #defined in wingdi.h */ + TCHAR fontFace[ LF_FACESIZE ]; /* requested font face name LF_FACESIZE #defined in wingdi.h */ HFONT hFont; /* current font handle */ #if ! defined( UNICODE ) HFONT hFontBox; /* current font handle to draw lines */ @@ -581,12 +581,12 @@ typedef enum extern HB_EXPORT POINT hb_wvt_gtGetXYFromColRow( int col, int row ); #if ! defined( HB_OS_WIN_CE ) -extern HB_EXPORT IPicture * hb_wvt_gtLoadPicture( const char * image ); -extern HB_EXPORT IPicture * hb_wvt_gtLoadPictureFromResource( LPCSTR cResource, LPCSTR cSection ); +extern HB_EXPORT IPicture * hb_wvt_gtLoadPicture( LPCTSTR image ); +extern HB_EXPORT IPicture * hb_wvt_gtLoadPictureFromResource( LPCTSTR resource, LPCTSTR section ); extern HB_EXPORT HB_BOOL hb_wvt_gtRenderPicture( int x1, int y1, int wd, int ht, IPicture * iPicture ); extern HB_EXPORT HB_BOOL hb_wvt_gtDestroyPicture( IPicture * iPicture ); #endif -extern HB_EXPORT HB_BOOL hb_wvt_DrawImage( HDC hdc, int x1, int y1, int wd, int ht, const char * image ); +extern HB_EXPORT HB_BOOL hb_wvt_DrawImage( HDC hdc, int x1, int y1, int wd, int ht, LPCTSTR image ); extern HB_EXPORT void hb_wvt_GetStringAttrib( int top, int left, int bottom, int right, HB_BYTE * sBuffer, HB_BYTE * sAttrib ); extern HB_EXPORT void hb_wvt_PutStringAttrib( int top, int left, int bottom, int right, HB_BYTE * sBuffer, HB_BYTE * sAttrib ); diff --git a/harbour/contrib/gtwvg/wvgcore.c b/harbour/contrib/gtwvg/wvgcore.c index e69b162d54..712d42c2c7 100644 --- a/harbour/contrib/gtwvg/wvgcore.c +++ b/harbour/contrib/gtwvg/wvgcore.c @@ -148,12 +148,10 @@ void hb_wvt_PutStringAttrib( int top, int left, int bottom, int right, HB_BYTE * * Courtesy - Augusto Infante - Thanks */ #if ! defined( HB_OS_WIN_CE ) -IPicture * hb_wvt_gtLoadPictureFromResource( LPCSTR cResource, LPCSTR cSection ) +IPicture * hb_wvt_gtLoadPictureFromResource( LPCTSTR resource, LPCTSTR section ) { HRSRC res = 0; LPVOID iPicture = NULL; - LPTSTR resource = HB_TCHAR_CONVTO( ( LPSTR ) cResource ); - LPTSTR section = HB_TCHAR_CONVTO( ( LPSTR ) cSection ); HANDLE hInstance; if( hb_winmainArgGet( &hInstance, NULL, NULL ) ) @@ -179,15 +177,12 @@ IPicture * hb_wvt_gtLoadPictureFromResource( LPCSTR cResource, LPCSTR cSection ) FreeResource( mem ); } - HB_TCHAR_FREE( resource ); - HB_TCHAR_FREE( section ); - return ( IPicture * ) iPicture; } /*--------------------------------------------------------------------*/ -IPicture * hb_wvt_gtLoadPicture( const char * cImage ) +IPicture * hb_wvt_gtLoadPicture( LPCTSTR image ) { IStream * iStream; LPVOID iPicture = NULL; @@ -195,7 +190,6 @@ IPicture * hb_wvt_gtLoadPicture( const char * cImage ) HANDLE hFile; DWORD nFileSize; DWORD nReadByte; - LPTSTR image = HB_TCHAR_CONVTO( cImage ); hFile = CreateFile( image, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); if( hFile != INVALID_HANDLE_VALUE ) @@ -219,8 +213,6 @@ IPicture * hb_wvt_gtLoadPicture( const char * cImage ) CloseHandle( hFile ); } - HB_TCHAR_FREE( image ); - return ( IPicture * ) iPicture; } @@ -573,7 +565,7 @@ BOOL CALLBACK hb_wvt_gtDlgProcModal( HWND hDlg, UINT message, WPARAM wParam, LPA /*----------------------------------------------------------------------*/ -HB_BOOL hb_wvt_DrawImage( HDC hdc, int x1, int y1, int wd, int ht, const char * image ) +HB_BOOL hb_wvt_DrawImage( HDC hdc, int x1, int y1, int wd, int ht, LPCTSTR lpImage ) { #if ! defined( HB_OS_WIN_CE ) HGLOBAL hGlobal; @@ -591,11 +583,9 @@ HB_BOOL hb_wvt_DrawImage( HDC hdc, int x1, int y1, int wd, int ht, const char * HRGN hrgn1; POINT lpp = { 0, 0 }; HB_BOOL bResult = HB_FALSE; - LPTSTR lpImage = HB_TCHAR_CONVTO( image ); hFile = CreateFile( lpImage, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); - HB_TCHAR_FREE( lpImage ); if( hFile != INVALID_HANDLE_VALUE ) { @@ -1177,11 +1167,14 @@ HB_FUNC( WVT_DRAWIMAGE ) } else { - hb_wvt_DrawImage( _s->hdc, iLeft, iTop, ( iRight - iLeft ) + 1, ( iBottom - iTop ) + 1, hb_parcx( 5 ) ); + void * hImage; + hb_wvt_DrawImage( _s->hdc, iLeft, iTop, ( iRight - iLeft ) + 1, ( iBottom - iTop ) + 1, HB_PARSTR( 5, &hImage, NULL ) ); + hb_strfree( hImage ); #if defined( __SETGUI__ ) if( _s->bGui ) { - hb_wvt_DrawImage( _s->hGuiDC, iLeft, iTop, ( iRight - iLeft ) + 1, ( iBottom - iTop ) + 1, hb_parcx( 5 ) ); + hb_wvt_DrawImage( _s->hGuiDC, iLeft, iTop, ( iRight - iLeft ) + 1, ( iBottom - iTop ) + 1, HB_PARSTR( 5, &hImage, NULL ) ); + hb_strfree( hImage ); } #endif } @@ -1220,8 +1213,7 @@ HB_FUNC( WVT_DRAWLABEL ) logfont.lfHeight = hb_parnidef( 9, _s->fontHeight ); logfont.lfWidth = hb_parnidef( 10, _s->fontWidth < 0 ? -_s->fontWidth : _s->fontWidth ); - - HB_TCHAR_COPYTO( logfont.lfFaceName, ( ! HB_ISCHAR( 8 ) ? _s->fontFace : hb_parcx( 8 ) ), HB_SIZEOFARRAY( logfont.lfFaceName ) - 1 ); + HB_STRNCPY( logfont.lfFaceName, ( HB_ISCHAR( 8 ) ? ( LPCTSTR ) hb_parcx( 8 ) : _s->fontFace ), HB_SIZEOFARRAY( logfont.lfFaceName ) - 1 ); hFont = CreateFontIndirect( &logfont ); if( hFont ) @@ -1931,10 +1923,13 @@ HB_FUNC( WVT_DRAWBUTTON ) } else { - hb_wvt_DrawImage( _s->hdc, iLeft + 4, iTop + 4, iImageWidth, iImageHeight, hb_parcx( 6 ) ); + void * hImage; + hb_wvt_DrawImage( _s->hdc, iLeft + 4, iTop + 4, iImageWidth, iImageHeight, HB_PARSTR( 6, &hImage, NULL ) ); + hb_strfree( hImage ); if( _s->bGui ) { - hb_wvt_DrawImage( _s->hGuiDC, iLeft + 4, iTop + 4, iImageWidth, iImageHeight, hb_parcx( 6 ) ); + hb_wvt_DrawImage( _s->hGuiDC, iLeft + 4, iTop + 4, iImageWidth, iImageHeight, HB_PARSTR( 6, &hImage, NULL ) ); + hb_strfree( hImage ); } } #endif @@ -2869,11 +2864,14 @@ HB_FUNC( WVT_DRAWPROGRESSBAR ) if( bImage ) { - hb_wvt_DrawImage( _s->hdc, rc.left, rc.top, rc.right - rc.left + 1, rc.bottom - rc.top + 1, hb_parc( 9 ) ); + void * hImage; + hb_wvt_DrawImage( _s->hdc, rc.left, rc.top, rc.right - rc.left + 1, rc.bottom - rc.top + 1, HB_PARSTR( 9, &hImage, NULL ) ); + hb_strfree( hImage ); #if defined( __SETGUI__ ) if( _s->bGui ) { - hb_wvt_DrawImage( _s->hGuiDC, rc.left, rc.top, rc.right - rc.left + 1, rc.bottom - rc.top + 1, hb_parc( 9 ) ); + hb_wvt_DrawImage( _s->hGuiDC, rc.left, rc.top, rc.right - rc.left + 1, rc.bottom - rc.top + 1, HB_PARSTR( 9, &hImage, NULL ) ); + hb_strfree( hImage ); } #endif } @@ -2928,7 +2926,7 @@ HB_FUNC( WVT_CREATEFONT ) logfont.lfHeight = hb_parnidef( 2, _s->fontHeight ); logfont.lfWidth = hb_parnidef( 3, _s->fontWidth < 0 ? -_s->fontWidth : _s->fontWidth ); - HB_TCHAR_COPYTO( logfont.lfFaceName, ( ! HB_ISCHAR( 1 ) ? _s->fontFace : hb_parcx( 1 ) ), HB_SIZEOFARRAY( logfont.lfFaceName ) - 1 ); + HB_STRNCPY( logfont.lfFaceName, ( ! HB_ISCHAR( 1 ) ? _s->fontFace : ( LPCTSTR ) hb_parcx( 1 ) ), HB_SIZEOFARRAY( logfont.lfFaceName ) - 1 ); hb_retnint( ( HB_PTRDIFF ) CreateFontIndirect( &logfont ) ); } @@ -2943,19 +2941,17 @@ HB_FUNC( WVT_LOADPICTURE ) #if ! defined( HB_OS_WIN_CE ) PHB_GTWVT _s = hb_wvt_gtGetWVT(); - - IPicture * iPicture = hb_wvt_gtLoadPicture( hb_parcx( 2 ) ); + void * hImage; + IPicture * iPicture = hb_wvt_gtLoadPicture( HB_PARSTR( 2, &hImage, NULL ) ); int iSlot = hb_parni( 1 ) - 1; + hb_strfree( hImage ); if( iPicture ) { if( _s->pGUI->iPicture[ iSlot ] ) - { hb_wvt_gtDestroyPicture( _s->pGUI->iPicture[ iSlot ] ); - } - _s->pGUI->iPicture[ iSlot ] = iPicture; - bResult = HB_TRUE; + bResult = HB_TRUE; } #endif hb_retl( bResult ); @@ -2969,19 +2965,19 @@ HB_FUNC( WVT_LOADPICTUREFROMRESOURCE ) #if ! defined( HB_OS_WIN_CE ) PHB_GTWVT _s = hb_wvt_gtGetWVT(); - - IPicture * iPicture = hb_wvt_gtLoadPictureFromResource( hb_parcx( 2 ), hb_parcx( 3 ) ); + void * hResource; + void * hSection; + IPicture * iPicture = hb_wvt_gtLoadPictureFromResource( HB_PARSTR( 2, &hResource, NULL ), HB_PARSTR( 3, &hSection, NULL ) ); int iSlot = hb_parni( 1 ) - 1; + hb_strfree( hResource ); + hb_strfree( hSection ); if( iPicture ) { if( _s->pGUI->iPicture[ iSlot ] ) - { hb_wvt_gtDestroyPicture( _s->pGUI->iPicture[ iSlot ] ); - } - _s->pGUI->iPicture[ iSlot ] = iPicture; - bResult = HB_TRUE; + bResult = HB_TRUE; } #endif hb_retl( bResult ); @@ -2999,6 +2995,7 @@ HB_FUNC( WVT_LOADFONT ) LOGFONT logfont; /* = { 0 }; */ int iSlot = hb_parni( 1 ) - 1; HFONT hFont; + void * hF; logfont.lfEscapement = hb_parni( 11 ) * 10; logfont.lfOrientation = 0; @@ -3014,7 +3011,8 @@ HB_FUNC( WVT_LOADFONT ) logfont.lfHeight = hb_parnidef( 3, _s->fontHeight ); logfont.lfWidth = hb_parnidef( 4, _s->fontWidth < 0 ? -_s->fontWidth : _s->fontWidth ); - HB_TCHAR_COPYTO( logfont.lfFaceName, ( ! HB_ISCHAR( 2 ) ? _s->fontFace : hb_parcx( 2 ) ), HB_SIZEOFARRAY( logfont.lfFaceName ) - 1 ); + HB_STRNCPY( logfont.lfFaceName, ( ! HB_ISCHAR( 2 ) ? _s->fontFace : HB_PARSTR( 2, &hF, NULL ) ), HB_SIZEOFARRAY( logfont.lfFaceName ) - 1 ); + hb_strfree( hF ); hFont = CreateFontIndirect( &logfont ); if( hFont ) diff --git a/harbour/contrib/gtwvg/wvgcuig.c b/harbour/contrib/gtwvg/wvgcuig.c index 24194f53ed..8cc5c9f3a1 100644 --- a/harbour/contrib/gtwvg/wvgcuig.c +++ b/harbour/contrib/gtwvg/wvgcuig.c @@ -242,9 +242,17 @@ HB_FUNC( WVG_SETGOBJDATA ) } else { - iPicture = hb_wvt_gtLoadPicture( hb_parc( 3 ) ); + void * hPic; + iPicture = hb_wvt_gtLoadPicture( HB_PARSTR( 3, &hPic, NULL ) ); + hb_strfree( hPic ); if( ! iPicture ) - iPicture = hb_wvt_gtLoadPictureFromResource( hb_parc( 3 ), hb_parc( 4 ) ); + { + void * hRes; + void * hSec; + iPicture = hb_wvt_gtLoadPictureFromResource( HB_PARSTR( 3, &hRes, NULL ), HB_PARSTR( 4, &hSec, NULL ) ); + hb_strfree( hRes ); + hb_strfree( hSec ); + } } if( iPicture ) { @@ -597,7 +605,7 @@ HB_FUNC( WVG_LABEL ) lf.lfHeight = hb_parnidef( 10, pWVT->fontHeight ); lf.lfWidth = hb_parnidef( 11, pWVT->fontWidth < 0 ? -pWVT->fontWidth : pWVT->fontWidth ); - HB_TCHAR_COPYTO( lf.lfFaceName, ( ! HB_ISCHAR( 9 ) ? pWVT->fontFace : hb_parc( 9 ) ), HB_SIZEOFARRAY( lf.lfFaceName ) - 1 ); + HB_STRNCPY( lf.lfFaceName, ( ! HB_ISCHAR( 9 ) ? pWVT->fontFace : ( LPCTSTR ) hb_parc( 9 ) ), HB_SIZEOFARRAY( lf.lfFaceName ) - 1 ); hFont = CreateFontIndirect( &lf ); if( hFont ) @@ -1318,11 +1326,21 @@ HB_FUNC( WVG_IMAGE ) } break; case GOBJ_IMAGESOURCE_RESOURCE: - iPicture = hb_wvt_gtLoadPictureFromResource( hb_parc( 7 ), hb_parc( 8 ) ); + { + void * hPic; + void * hRes; + iPicture = hb_wvt_gtLoadPictureFromResource( HB_PARSTR( 7, &hPic, NULL ), HB_PARSTR( 8, &hRes, NULL ) ); + hb_strfree( hPic ); + hb_strfree( hRes ); break; + } case GOBJ_IMAGESOURCE_FILE: - iPicture = hb_wvt_gtLoadPicture( hb_parc( 7 ) ); + { + void * hPic; + iPicture = hb_wvt_gtLoadPicture( HB_PARSTR( 7, &hPic, NULL ) ); + hb_strfree( hPic ); break; + } } if( iPicture ) diff --git a/harbour/contrib/gtwvg/wvggui.c b/harbour/contrib/gtwvg/wvggui.c index 29f1867ac8..39a455659e 100644 --- a/harbour/contrib/gtwvg/wvggui.c +++ b/harbour/contrib/gtwvg/wvggui.c @@ -1932,7 +1932,8 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) tnid.uCallbackMessage = HB_MSG_NOTIFYICON; tnid.hIcon = hIcon; - HB_TCHAR_COPYTO( tnid.szTip, hb_arrayGetCPtr( pInfo->pNewVal2, 4 ), HB_SIZEOFARRAY( tnid.szTip ) - 1 ); + HB_STRNCPY( tnid.szTip, HB_ARRAYGETSTR( pInfo->pNewVal2, 4, &hIconName, NULL ), HB_SIZEOFARRAY( tnid.szTip ) - 1 ); + hb_strfree( hIconName ); Shell_NotifyIcon( mode, &tnid ); diff --git a/harbour/contrib/gtwvg/wvgmenub.prg b/harbour/contrib/gtwvg/wvgmenub.prg index f4ee3998fb..4a1aea26c8 100644 --- a/harbour/contrib/gtwvg/wvgmenub.prg +++ b/harbour/contrib/gtwvg/wvgmenub.prg @@ -309,8 +309,7 @@ METHOD WvgMenuBar:addItem( aItem, p2, p3, p4 ) end aadd( ::aMenuItems, aItem ) - WVG_AppendMenu( ::hMenu, aItem[ 1 ], aItem[ 2 ], aItem[ 3 ] ) - + WVG_AppendMenu( ::hMenu, aItem[ 1 ], aItem[ 2 ], iif( hb_isChar( aItem[ 3 ] ), strtran( aItem[ 3 ], "~", "&" ), aItem[ 3 ] ) ) IF ++::nPass == 1 IF ::oParent:className $ "WVGCRT,WVGDIALOG" WVG_SetMenu( ::oParent:getHWND(), ::hMenu ) diff --git a/harbour/contrib/gtwvg/wvgutils.c b/harbour/contrib/gtwvg/wvgutils.c index 0278cda472..d4fe6ac099 100644 --- a/harbour/contrib/gtwvg/wvgutils.c +++ b/harbour/contrib/gtwvg/wvgutils.c @@ -151,7 +151,7 @@ HB_FUNC( WVT_CHOOSEFONT ) lf.lfPitchAndFamily = FF_DONTCARE; if( HB_ISCHAR( 1 ) ) { - HB_TCHAR_COPYTO( lf.lfFaceName, hb_parc( 1 ), HB_SIZEOFARRAY( lf.lfFaceName ) - 1 ); + HB_STRNCPY( lf.lfFaceName, ( LPCTSTR ) hb_parc( 1 ), HB_SIZEOFARRAY( lf.lfFaceName ) - 1 ); } cf.lStructSize = sizeof( CHOOSEFONT ); @@ -172,35 +172,37 @@ HB_FUNC( WVT_CHOOSEFONT ) if( ChooseFont( &cf ) ) { - char * szFaceName = HB_TCHAR_CONVFROM( lf.lfFaceName ); + PHB_ITEM ary = hb_itemNew( NULL ); + hb_arrayNew( ary, 9 ); PointSize = -MulDiv( lf.lfHeight, 72, GetDeviceCaps( _s->hdc, LOGPIXELSY ) ); - hb_reta( 9 ); - hb_storvc( szFaceName, -1, 1 ); - hb_storvnl( ( long ) PointSize, -1, 2 ); - hb_storvni( lf.lfWidth, -1, 3 ); - hb_storvni( lf.lfWeight, -1, 4 ); - hb_storvni( lf.lfQuality, -1, 5 ); - hb_storvl( lf.lfItalic, -1, 6 ); - hb_storvl( lf.lfUnderline, -1, 7 ); - hb_storvl( lf.lfStrikeOut, -1, 8 ); - hb_storvni( cf.rgbColors, -1, 9 ); + HB_ARRAYSETSTR( ary, 1, lf.lfFaceName ); + hb_arraySetNI( ary, 2, PointSize ); + hb_arraySetNI( ary, 3, lf.lfWidth ); + hb_arraySetNI( ary, 4, lf.lfWeight ); + hb_arraySetNI( ary, 5, lf.lfQuality ); + hb_arraySetL( ary, 6, lf.lfItalic ); + hb_arraySetL( ary, 7, lf.lfUnderline ); + hb_arraySetNI( ary, 8, cf.rgbColors ); - HB_TCHAR_FREE( szFaceName ); + hb_itemReturnRelease( ary ); } else { - hb_reta( 9 ); - hb_storvc( NULL, -1, 1 ); - hb_storvnl( ( long ) 0, -1, 2 ); - hb_storvni( 0, -1, 3 ); - hb_storvni( 0, -1, 4 ); - hb_storvni( 0, -1, 5 ); - hb_storvl( 0, -1, 6 ); - hb_storvl( 0, -1, 7 ); - hb_storvl( 0, -1, 8 ); - hb_storvni( 0, -1, 9 ); + PHB_ITEM ary = hb_itemNew( NULL ); + hb_arrayNew( ary, 9 ); + + HB_ARRAYSETSTR( ary, 1, NULL ); + hb_arraySetNI( ary, 2, 0 ); + hb_arraySetNI( ary, 3, 0 ); + hb_arraySetNI( ary, 4, 0 ); + hb_arraySetNI( ary, 5, 0 ); + hb_arraySetL( ary, 6, 0 ); + hb_arraySetL( ary, 7, 0 ); + hb_arraySetNI( ary, 8, 0 ); + + hb_itemReturnRelease( ary ); } return; @@ -288,9 +290,7 @@ HB_FUNC( WVT_SETTOOLTIP ) int iTop, iLeft, iBottom, iRight; if( ! _s->bToolTipActive ) - { return; - } memset( &ti, 0, sizeof( ti ) ); ti.cbSize = sizeof( TOOLINFO ); @@ -299,7 +299,7 @@ HB_FUNC( WVT_SETTOOLTIP ) if( SendMessage( _s->hWndTT, TTM_GETTOOLINFO, 0, ( LPARAM ) &ti ) ) { - LPTSTR text = HB_TCHAR_CONVTO( hb_parcx( 5 ) ); + LPTSTR text = HB_TCHAR_CONVTO( hb_parc( 5 ) ); xy = hb_wvt_gtGetXYFromColRow( hb_parni( 2 ), hb_parni( 1 ) ); iTop = xy.y; @@ -310,7 +310,6 @@ HB_FUNC( WVT_SETTOOLTIP ) iRight = xy.x - 1; ti.lpszText = text; - ti.rect.left = iLeft; ti.rect.top = iTop; ti.rect.right = iRight; @@ -336,7 +335,7 @@ HB_FUNC( WVT_SETTOOLTIPTEXT ) if( SendMessage( _s->hWndTT, TTM_GETTOOLINFO, 0, ( LPARAM ) &ti ) ) { - LPTSTR text = HB_TCHAR_CONVTO( hb_parcx( 1 ) ); + LPTSTR text = HB_TCHAR_CONVTO( hb_parc( 1 ) ); ti.lpszText = text; SendMessage( _s->hWndTT, TTM_UPDATETIPTEXT, 0, ( LPARAM ) &ti ); HB_TCHAR_FREE( text ); @@ -637,7 +636,7 @@ HB_FUNC( WVT_GETFONTINFO ) PHB_ITEM info = hb_itemArrayNew( 7 ); - hb_arraySetC( info, 1, _s->fontFace ); + HB_ARRAYSETSTR( info, 1, _s->fontFace ); hb_arraySetNL( info, 2, _s->fontHeight ); hb_arraySetNL( info, 3, _s->fontWidth ); hb_arraySetNL( info, 4, _s->fontWeight ); diff --git a/harbour/contrib/gtwvg/wvgwin.c b/harbour/contrib/gtwvg/wvgwin.c index f3cddedba7..835c402e58 100644 --- a/harbour/contrib/gtwvg/wvgwin.c +++ b/harbour/contrib/gtwvg/wvgwin.c @@ -272,7 +272,7 @@ HB_FUNC( WVG_GETDLGITEMTEXT ) { int iLen = ( int ) SendMessage( GetDlgItem( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ), WM_GETTEXTLENGTH, 0, 0 ) + 1; LPTSTR cText = ( LPTSTR ) hb_xgrab( iLen * sizeof( TCHAR ) ); - char * szText; +// char * szText; UINT iResult; iResult = GetDlgItemText( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), /* handle of dialog box */ @@ -282,9 +282,7 @@ HB_FUNC( WVG_GETDLGITEMTEXT ) ); cText[ iResult ] = '\0'; - szText = HB_TCHAR_CONVFROM( cText ); - hb_retc( szText ); - HB_TCHAR_FREE( szText ); + HB_RETSTR( cText ); hb_xfree( cText ); } @@ -433,8 +431,10 @@ HB_FUNC( WVG_GETCLIENTRECT ) */ HB_FUNC( WVG_DRAWIMAGE ) { + void * hImage; hb_retl( hb_wvt_DrawImage( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), hb_parni( 3 ), - hb_parni( 4 ), hb_parni( 5 ), hb_parc( 6 ) ) ); + hb_parni( 4 ), hb_parni( 5 ), HB_PARSTR( 6, &hImage, NULL ) ) ); + hb_strfree( hImage ); } /*----------------------------------------------------------------------*/ @@ -762,33 +762,9 @@ HB_FUNC( WVG_APPENDMENU ) { if( HB_ISCHAR( 4 ) ) { - LPTSTR buffer; - HB_ISIZ i, iLen; - - iLen = hb_parclen( 4 ); - if( iLen > 0 && iLen < 256 ) /* Translate '~' to '&' */ - { - char * text = ( char * ) hb_xgrab( iLen + 1 ); - - memcpy( text, hb_parc( 4 ), iLen + 1 ); - - for( i = 0; i < iLen; i++ ) - { - if( text[ i ] == '~' ) - text[ i ] = '&'; - } - - buffer = HB_TCHAR_CONVTO( text ); - hb_retl( AppendMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( HB_PTRDIFF ) hb_parnint( 3 ), buffer ) ); - HB_TCHAR_FREE( buffer ); - hb_xfree( text ); - } - else - { - buffer = HB_TCHAR_CONVTO( hb_parc( 4 ) ); - hb_retl( AppendMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( HB_PTRDIFF ) hb_parnint( 3 ), buffer ) ); - HB_TCHAR_FREE( buffer ); - } + void * hBuffer; + hb_retl( AppendMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( HB_PTRDIFF ) hb_parnint( 3 ), HB_PARSTR( 4, &hBuffer, NULL ) ) ); + hb_strfree( hBuffer ); } else /* It is a SEPARATOR or Submenu */ { @@ -896,11 +872,7 @@ HB_FUNC( WVG_GETMESSAGETEXT ) SendMessage( wvg_parhwnd( 1 ), ( UINT ) hb_parni( 2 ), wvg_parwparam( 3 ), ( LPARAM ) cText ); - { - char * szText = HB_TCHAR_CONVFROM( cText ); - hb_retc( szText ); - HB_TCHAR_FREE( szText ); - } + HB_RETSTR( cText ); } /*----------------------------------------------------------------------*/ @@ -996,14 +968,11 @@ HB_FUNC( WVG_TVIS_EXPANDED ) HB_FUNC( WVG_LBGETTEXT ) { - TCHAR text[ MAX_PATH + 1 ]; - char * szText; + TCHAR text[ MAX_PATH + 1 ]; SendMessage( wvg_parhwnd( 1 ), LB_GETTEXT, wvg_parwparam( 2 ), ( LPARAM ) text ); - szText = HB_TCHAR_CONVFROM( text ); - hb_retc( szText ); - HB_TCHAR_FREE( szText ); + HB_RETSTR( text ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/gtwvg/wvgwing.c b/harbour/contrib/gtwvg/wvgwing.c index 2cc3040587..91196188e6 100644 --- a/harbour/contrib/gtwvg/wvgwing.c +++ b/harbour/contrib/gtwvg/wvgwing.c @@ -160,7 +160,8 @@ HB_FUNC( WVG_HINSTANCE ) * Bitmap Management Function . Coutesy GTWVW */ /*----------------------------------------------------------------------*/ -static BITMAPINFO * PackedDibLoad( PTSTR szFileName ) + +static BITMAPINFO * PackedDibLoad( LPCTSTR szFileName ) { BITMAPFILEHEADER bmfh; BITMAPINFO * pbmi; @@ -285,7 +286,7 @@ static BYTE * PackedDibGetBitsPtr( BITMAPINFO * pPackedDib ) PackedDibGetColorTableSize( pPackedDib ); } #endif -static HBITMAP hPrepareBitmap( const char * szBitmapX, UINT uiBitmap, +static HBITMAP hPrepareBitmap( LPCTSTR szBitmap, UINT uiBitmap, int iExpWidth, int iExpHeight, HB_BOOL bMap3Dcolors, HWND hCtrl, @@ -297,15 +298,12 @@ static HBITMAP hPrepareBitmap( const char * szBitmapX, UINT uiBitmap, { case 0: - if( szBitmapX ) + if( szBitmap ) { int iWidth, iHeight; { BITMAPINFO * pPackedDib = NULL; HDC hdc; - TCHAR * szBitmap; - - szBitmap = HB_TCHAR_CONVTO( szBitmapX ); if( ! bMap3Dcolors ) pPackedDib = PackedDibLoad( szBitmap ); @@ -394,7 +392,6 @@ static HBITMAP hPrepareBitmap( const char * szBitmapX, UINT uiBitmap, DeleteDC( hdcTarget ); } - HB_TCHAR_FREE( szBitmap ); ReleaseDC( hCtrl, hdc ); if( pPackedDib ) hb_xfree( pPackedDib ); @@ -404,23 +401,18 @@ static HBITMAP hPrepareBitmap( const char * szBitmapX, UINT uiBitmap, break; case 1: { - UINT uiOptions = bMap3Dcolors ? LR_LOADMAP3DCOLORS : LR_DEFAULTCOLOR; - TCHAR * szBitmap; + UINT uiOptions = bMap3Dcolors ? LR_LOADMAP3DCOLORS : LR_DEFAULTCOLOR; - szBitmap = HB_TCHAR_CONVTO( szBitmapX ); - - hBitmap = ( HBITMAP ) LoadImage( + hBitmap = ( HBITMAP ) LoadImage( ( HINSTANCE ) wvg_hInstance(), - ( LPCTSTR ) szBitmap, + szBitmap, IMAGE_BITMAP, iExpWidth, iExpHeight, uiOptions ); - HB_TCHAR_FREE( szBitmap ); + if( hBitmap == NULL ) - { return NULL; - } } break; case 2: /* loading from resourceid */ @@ -451,10 +443,11 @@ static HBITMAP hPrepareBitmap( const char * szBitmapX, UINT uiBitmap, HB_FUNC( WVG_PREPAREBITMAPFROMFILE ) { HBITMAP hBitmap; + void * hText; - hBitmap = hPrepareBitmap( hb_parc( 1 ), 0, hb_parni( 2 ), hb_parni( 3 ), hb_parl( 4 ), + hBitmap = hPrepareBitmap( HB_PARSTR( 1, &hText, NULL ), 0, hb_parni( 2 ), hb_parni( 3 ), hb_parl( 4 ), ( HWND ) ( HB_PTRDIFF ) hb_parnint( 5 ), 0 ); - + hb_strfree( hText ); hb_retptr( ( void * ) hBitmap ); } @@ -475,10 +468,11 @@ HB_FUNC( WVG_PREPAREBITMAPFROMRESOURCEID ) HB_FUNC( WVG_PREPAREBITMAPFROMRESOURCENAME ) { HBITMAP hBitmap; + void * hText; - hBitmap = hPrepareBitmap( hb_parc( 1 ), 0, hb_parni( 2 ), hb_parni( 3 ), hb_parl( 4 ), + hBitmap = hPrepareBitmap( HB_PARSTR( 1, &hText, NULL ), 0, hb_parni( 2 ), hb_parni( 3 ), hb_parl( 4 ), ( HWND ) ( HB_PTRDIFF ) hb_parnint( 5 ), 1 ); - + hb_strfree( hText ); hb_retptr( ( void * ) hBitmap ); } /*----------------------------------------------------------------------*/ @@ -625,22 +619,6 @@ HB_FUNC( WVG_GETNMMOUSEINFO ) hb_itemReturnRelease( pEvParams ); } /*----------------------------------------------------------------------*/ -/* - * Wvg_SetToolbarButtonTip( nlParam, cToolTip ) - */ -#if 0 -HB_FUNC( WVG_SETTOOLBARBUTTONTIP ) -{ - LPNMTBGETINFOTIP lptbgit = ( LPNMTBGETINFOTIP ) hbwapi_par_LPARAM( 1 ); - LPTSTR pszText = HB_TCHAR_CONVTO( hb_parcx( 2 ) ); - - lptbgit->cchTextMax = strlen( hb_parcx( 2 ) ); - /*memcpy( lptbgit->pszText, pszText, strlen( hb_parcx( 2 ) ) );*/ - lptbgit->pszText = pszText; - HB_TCHAR_FREE( pszText ); * / -} -#endif -/*----------------------------------------------------------------------*/ /* * Wvg_GetNMTreeViewInfo( nlParam ) */ @@ -684,11 +662,7 @@ HB_FUNC( WVG_TREEVIEW_GETSELECTIONINFO ) item.cchTextMax = MAX_PATH; if( TreeView_GetItem( wvg_parhwnd( 1 ), &item ) ) - { - char * szText = HB_TCHAR_CONVFROM( text ); - hb_storc( szText, 4 ); - HB_TCHAR_FREE( szText ); - } + HB_STORSTR( text, 4 ); hParent = TreeView_GetParent( wvg_parhwnd( 1 ), hSelected ); hb_stornint( ( HB_PTRDIFF ) hParent, 5 ); @@ -699,11 +673,7 @@ HB_FUNC( WVG_TREEVIEW_GETSELECTIONINFO ) item.cchTextMax = MAX_PATH; if( TreeView_GetItem( wvg_parhwnd( 1 ), &item ) ) - { - char * szText = HB_TCHAR_CONVFROM( Parent ); - hb_storc( szText, 3 ); - HB_TCHAR_FREE( szText ); - } + HB_STORSTR( Parent, 3 ); } } @@ -796,42 +766,38 @@ PHB_ITEM wvg_logfontTOarray( LPLOGFONT lf, HB_BOOL bEmpty ) if( bEmpty ) { - hb_arraySetC( aFont, 1, NULL ); - hb_arraySetNL( aFont, 2, 0 ); - hb_arraySetNL( aFont, 3, 0 ); - hb_arraySetNL( aFont, 4, 0 ); - hb_arraySetL( aFont, 5, 0 ); - hb_arraySetL( aFont, 6, 0 ); - hb_arraySetL( aFont, 7, 0 ); - hb_arraySetNI( aFont, 8, 0 ); - hb_arraySetNI( aFont, 9, 0 ); - hb_arraySetNI( aFont, 10, 0 ); - hb_arraySetNI( aFont, 11, 0 ); - hb_arraySetNI( aFont, 12, 0 ); - hb_arraySetNI( aFont, 13, 0 ); - hb_arraySetNI( aFont, 14, 0 ); + hb_arraySetC( aFont, 1, NULL ); + hb_arraySetNL( aFont, 2, 0 ); + hb_arraySetNL( aFont, 3, 0 ); + hb_arraySetNL( aFont, 4, 0 ); + hb_arraySetL( aFont, 5, 0 ); + hb_arraySetL( aFont, 6, 0 ); + hb_arraySetL( aFont, 7, 0 ); + hb_arraySetNI( aFont, 8, 0 ); + hb_arraySetNI( aFont, 9, 0 ); + hb_arraySetNI( aFont, 10, 0 ); + hb_arraySetNI( aFont, 11, 0 ); + hb_arraySetNI( aFont, 12, 0 ); + hb_arraySetNI( aFont, 13, 0 ); + hb_arraySetNI( aFont, 14, 0 ); hb_arraySetNInt( aFont, 15, 0 ); } else { - char * szFaceName = HB_TCHAR_CONVFROM( lf->lfFaceName ); - - hb_arraySetC( aFont, 1, szFaceName ); - hb_arraySetNL( aFont, 2, lf->lfHeight ); - hb_arraySetNL( aFont, 3, lf->lfWidth ); - hb_arraySetNL( aFont, 4, lf->lfWeight ); - hb_arraySetL( aFont, 5, lf->lfItalic ); - hb_arraySetL( aFont, 6, lf->lfUnderline ); - hb_arraySetL( aFont, 7, lf->lfStrikeOut ); - hb_arraySetNI( aFont, 8, lf->lfCharSet ); - hb_arraySetNI( aFont, 9, lf->lfEscapement ); + HB_ARRAYSETSTR( aFont, 1, lf->lfFaceName ); + hb_arraySetNL( aFont, 2, lf->lfHeight ); + hb_arraySetNL( aFont, 3, lf->lfWidth ); + hb_arraySetNL( aFont, 4, lf->lfWeight ); + hb_arraySetL( aFont, 5, lf->lfItalic ); + hb_arraySetL( aFont, 6, lf->lfUnderline ); + hb_arraySetL( aFont, 7, lf->lfStrikeOut ); + hb_arraySetNI( aFont, 8, lf->lfCharSet ); + hb_arraySetNI( aFont, 9, lf->lfEscapement ); hb_arraySetNI( aFont, 10, lf->lfOrientation ); hb_arraySetNI( aFont, 11, lf->lfOutPrecision ); hb_arraySetNI( aFont, 12, lf->lfClipPrecision ); hb_arraySetNI( aFont, 13, lf->lfQuality ); hb_arraySetNI( aFont, 14, lf->lfPitchAndFamily ); - - HB_TCHAR_FREE( szFaceName ); } return aFont; @@ -897,7 +863,9 @@ HB_FUNC( WVG_CHOOSEFONT ) if( HB_ISCHAR( 3 ) ) { - HB_TCHAR_COPYTO( lf.lfFaceName, hb_parcx( 3 ), HB_SIZEOFARRAY( lf.lfFaceName ) - 1 ); + void * hText; + HB_STRNCPY( lf.lfFaceName, HB_PARSTR( 3, &hText, NULL ), HB_SIZEOFARRAY( lf.lfFaceName ) - 1 ); + hb_strfree( hText ); } if( HB_ISNUM( 4 ) && hb_parnl( 4 ) ) { @@ -958,11 +926,7 @@ HB_FUNC( WVG_CHOOSEFONT ) hb_arraySetNI( aInfo, 1, cf.iPointSize ); hb_arraySetNInt( aInfo, 2, cf.rgbColors ); hb_arraySetNI( aInfo, 3, cf.nFontType ); - { - char * szText = HB_TCHAR_CONVFROM( cf.lpszStyle ); - hb_arraySetC( aInfo, 4, szText ); - HB_TCHAR_FREE( szText ); - } + HB_ARRAYSETSTR( aInfo, 4, cf.lpszStyle ); hb_arraySet( aFont, 15, aInfo ); hb_itemReturnRelease( aFont ); @@ -999,6 +963,7 @@ HB_FUNC( WVG_FONTCREATE ) memset( &lf, 0, sizeof( lf ) ); HB_TCHAR_COPYTO( lf.lfFaceName, hb_parvcx( 1, 1 ), HB_SIZEOFARRAY( lf.lfFaceName ) - 1 ); + lf.lfHeight = ( LONG ) hb_parvnl( 1, 2 ); lf.lfWidth = ( LONG ) hb_parvnl( 1, 3 ); lf.lfWeight = ( LONG ) hb_parvnl( 1, 4 ); @@ -1137,7 +1102,7 @@ HB_FUNC( WVG_ADDTOOLBARBUTTON ) HB_FUNC( WVG_REGISTERCLASS_BYNAME ) { WNDCLASS wndclass; - LPTSTR szClass = HB_TCHAR_CONVTO( hb_parcx( 1 ) ); + void * hClass; memset( &wndclass, 0, sizeof( WNDCLASS ) ); wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; @@ -1147,14 +1112,13 @@ HB_FUNC( WVG_REGISTERCLASS_BYNAME ) wndclass.hCursor = LoadCursor( NULL, IDC_ARROW ); wndclass.hbrBackground = NULL; wndclass.lpszMenuName = NULL; - wndclass.lpszClassName = szClass; + wndclass.lpszClassName = HB_PARSTR( 1, &hClass, NULL ); if( ! RegisterClass( &wndclass ) ) - { if( GetLastError() != 1410 ) hb_errInternal( 10001, "Failed to register DA window class", NULL, NULL ); - } - HB_TCHAR_FREE( szClass ); + + hb_strfree( hClass ); } /*----------------------------------------------------------------------*/ @@ -1256,9 +1220,9 @@ HB_FUNC( WVG_RELEASEWINDOWPROCBLOCK ) */ HB_FUNC( WVG_CREATETOOLTIPWINDOW ) { - HWND hwndTip; - TOOLINFO toolInfo; - LPTSTR pszText = HB_TCHAR_CONVTO( "" ); + HWND hwndTip; + TOOLINFO toolInfo; + LPTSTR pszText = HB_TCHAR_CONVTO( "" ); hwndTip = CreateWindowEx( ( DWORD ) NULL, TOOLTIPS_CLASS, NULL, WS_POPUP |TTS_ALWAYSTIP, // | TTS_BALLOON, @@ -1266,8 +1230,8 @@ HB_FUNC( WVG_CREATETOOLTIPWINDOW ) CW_USEDEFAULT, CW_USEDEFAULT, wvg_parhwnd( 1 ), NULL, wvg_hInstance(), NULL); - if ( ! hwndTip ) - return; + if( ! hwndTip ) + return; toolInfo.cbSize = sizeof( toolInfo ); toolInfo.hwnd = ( HWND ) wvg_parhwnd( 1 );