2008-06-13 19:19 UTC+0200 Viktor Szakats (harbour.01 syenar hu)

* source/rtl/gtwvt/gtwvt.h
   * source/rtl/gtwvt/gtwvt.c
   * tests/wvtext.prg
     + Added hb_gtInfo( HB_GTI_SELECTCOPY, <cMenuText> )
       to set the menu text ("Mark and Copy" on startup).
       cMenuText mustn't be zero length. Setting the menu text 
       also enables select&copy automatically. The call 
       will return the previously set menu text. To get 
       the menu text without setting a new one, use: 
       hb_gtInfo( HB_GTI_SELECTCOPY, "" )
       This is good if someone wants to adapt the menu 
       text to the OS's or app's language.

   * doc/en/hb_apiit.txt
   * include/hbapi.h
   * include/hbapiitm.h
   * source/rtl/gtwin/gtwin.c
   * source/rtl/hbgtcore.c
   * source/rtl/gtgui/gtgui.c
   * source/rtl/gtwvt/gtwvt.c
   * source/vm/macro.c
   * source/vm/debug.c
   * source/vm/itemapi.c
   * source/vm/hvm.c
   * source/vm/arrays.c
   * source/vm/extend.c
   * source/rdd/dbfntx/dbfntx1.c
   * source/rdd/sdf1.c
   * source/rdd/dbfcdx/dbfcdx1.c
   * source/rdd/delim1.c
   * source/rdd/dbf1.c
   * source/rdd/dbffpt/dbffpt1.c
   * contrib/hbw32/w32_ole.c
   * contrib/gtwvg/gtwvg.c
   * contrib/rddads/ads1.c
   * contrib/hbmisc/spd.c
   * contrib/hbbmcdx/bmdbfcdx1.c
   * contrib/examples/rdddbt/dbfdbt1.c
     * I did a mistake in 1999 by giving the name hb_itemPutCPtr() 
       to the function which would have to be correctly named 
       hb_itemPutCLPtr() (notice the 'L' for 'length').
       So, now this was renamed to hb_itemPutCLPtr(), and stub was 
       added with the old name, and Harbour code was changed to use 
       the new one. I've also added hb_itemPutCPtr2() as a version 
       not requiring len parameter, the proper name would be hb_itemPutCPtr() 
       for this, but we cannot use without breakin compatiblity.

       IMPORTANT: I'd strongly suggest all 3rd parties to update 
       their code to use the call hb_itemPutCLPtr() instead of 
       hb_itemPutCLPtr().

       The final goal would be to have hb_itemPutCPtr() with two 
       parameters instead of the hakish looking hb_itemPutCPtr2().

       I'd welcome any opinions how to reach this goal. I didn't want to 
       break compatiblity with 3rd parties this time, but IMO we may do 
       it in 1.1, or even before 1.0.

     ! The above also fixes the (potential) problem when hb_retc_buffer()'s 
       szText parameter was evaluated twice if HB_API_MACROS was #defined.
This commit is contained in:
Viktor Szakats
2008-06-13 17:26:48 +00:00
parent 2887345150
commit e708033e0e
28 changed files with 224 additions and 52 deletions

View File

@@ -8,6 +8,68 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-06-13 19:19 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* source/rtl/gtwvt/gtwvt.h
* source/rtl/gtwvt/gtwvt.c
* tests/wvtext.prg
+ Added hb_gtInfo( HB_GTI_SELECTCOPY, <cMenuText> )
to set the menu text ("Mark and Copy" on startup).
cMenuText mustn't be zero length. Setting the menu text
also enables select&copy automatically. The call
will return the previously set menu text. To get
the menu text without setting a new one, use:
hb_gtInfo( HB_GTI_SELECTCOPY, "" )
This is good if someone wants to adapt the menu
text to the OS's or app's language.
* doc/en/hb_apiit.txt
* include/hbapi.h
* include/hbapiitm.h
* source/rtl/gtwin/gtwin.c
* source/rtl/hbgtcore.c
* source/rtl/gtgui/gtgui.c
* source/rtl/gtwvt/gtwvt.c
* source/vm/macro.c
* source/vm/debug.c
* source/vm/itemapi.c
* source/vm/hvm.c
* source/vm/arrays.c
* source/vm/extend.c
* source/rdd/dbfntx/dbfntx1.c
* source/rdd/sdf1.c
* source/rdd/dbfcdx/dbfcdx1.c
* source/rdd/delim1.c
* source/rdd/dbf1.c
* source/rdd/dbffpt/dbffpt1.c
* contrib/hbw32/w32_ole.c
* contrib/gtwvg/gtwvg.c
* contrib/rddads/ads1.c
* contrib/hbmisc/spd.c
* contrib/hbbmcdx/bmdbfcdx1.c
* contrib/examples/rdddbt/dbfdbt1.c
* I did a mistake in 1999 by giving the name hb_itemPutCPtr()
to the function which would have to be correctly named
hb_itemPutCLPtr() (notice the 'L' for 'length').
So, now this was renamed to hb_itemPutCLPtr(), and stub was
added with the old name, and Harbour code was changed to use
the new one. I've also added hb_itemPutCPtr2() as a version
not requiring len parameter, the proper name would be hb_itemPutCPtr()
for this, but we cannot use without breakin compatiblity.
IMPORTANT: I'd strongly suggest all 3rd parties to update
their code to use the call hb_itemPutCLPtr() instead of
hb_itemPutCLPtr().
The final goal would be to have hb_itemPutCPtr() with two
parameters instead of the hakish looking hb_itemPutCPtr2().
I'd welcome any opinions how to reach this goal. I didn't want to
break compatiblity with 3rd parties this time, but IMO we may do
it in 1.1, or even before 1.0.
! The above also fixes the (potential) problem when hb_retc_buffer()'s
szText parameter was evaluated twice if HB_API_MACROS was #defined.
2008-06-14 06:18 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/source/rtl/gtwvt/gtwvt.c
! Replaced min()/max() functions with HB_MIN()/HB_MAX() macro.

View File

@@ -324,7 +324,7 @@ static void hb_dbtGetMemo( DBTAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
else
*pBuffer = '\0';
hb_itemPutCPtr( pItem, ( char * ) pBuffer, ulSize );
hb_itemPutCLPtr( pItem, ( char * ) pBuffer, ulSize );
hb_itemSetCMemo( pItem );
}

View File

@@ -2371,7 +2371,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
{
char * szTitle = NULL;
if( hb_gt_wvt_GetWindowTitle( &szTitle ) )
pInfo->pResult = hb_itemPutCPtr( pInfo->pResult, szTitle, strlen( szTitle ) );
pInfo->pResult = hb_itemPutCPtr2( pInfo->pResult, szTitle );
else
pInfo->pResult = hb_itemPutC( pInfo->pResult, "" );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
@@ -2460,7 +2460,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
CF_OEMTEXT : CF_TEXT,
&szClipboardData, &ulLen ) )
{
pInfo->pResult = hb_itemPutCPtr( pInfo->pResult,
pInfo->pResult = hb_itemPutCLPtr( pInfo->pResult,
szClipboardData,
ulLen );
}

View File

@@ -705,7 +705,7 @@ static PHB_ITEM hb_cdxKeyGetItem( LPCDXKEY pKey, PHB_ITEM pItem, LPCDXTAG pTag,
pVal[ pKey->len ] = '\0';
hb_cdpnTranslate( pVal, pTag->pIndex->pArea->cdPage, hb_cdp_page,
pKey->len );
pItem = hb_itemPutCPtr( pItem, pVal, pKey->len );
pItem = hb_itemPutCLPtr( pItem, pVal, pKey->len );
}
else
#else

View File

@@ -69,7 +69,7 @@ static void STAItm( PHB_ITEM pItmPar )
cRes[i++] = *c++;
}
cRes[i++] = '\''; /* cRes[i] = '\0'; */
hb_itemPutCPtr( pItmPar, cRes, i );
hb_itemPutCLPtr( pItmPar, cRes, i );
}
static ULONG SCItm( char *cBuffer, ULONG ulMaxBuf, char *cParFrm, int iCOut, int IsIndW, int iIndWidth, int IsIndP, int iIndPrec, PHB_ITEM pItmPar )

View File

@@ -724,12 +724,12 @@ static void FreeParams( DISPPARAMS *pDispParams, PHB_ITEM *aPrgParams )
case VT_BYREF | VT_BSTR:
SysFreeString( *pVariant->n1.n2.n3.pbstrVal );
sString = hb_oleWideToAnsi( *( pVariant->n1.n2.n3.pbstrVal ) );
hb_itemPutCPtr( pItem, sString, strlen( sString ) );
hb_itemPutCPtr2( pItem, sString );
break;
case VT_BSTR:
sString = hb_oleWideToAnsi( pVariant->n1.n2.n3.bstrVal );
hb_itemPutCPtr( pItem, sString, strlen( sString ) );
hb_itemPutCPtr2( pItem, sString );
break;
case VT_BYREF | VT_BOOL:
@@ -1048,7 +1048,7 @@ HRESULT hb_oleVariantToItem( PHB_ITEM pItem, VARIANT *pVariant )
if( sString )
{
hb_itemPutCPtr( pItem, sString, strlen( sString ) );
hb_itemPutCPtr2( pItem, sString );
}
else
{
@@ -2120,7 +2120,7 @@ HB_FUNC( TOLEAUTO_ONERROR )
//HB_TRACE(HB_TR_INFO, ("Class: '%s'\n", sOleClassName));
hb_itemPutCPtr( pOleClassName, sOleClassName, iClassNameLen + 1 + iMsgNameLen );
hb_itemPutCLPtr( pOleClassName, sOleClassName, iClassNameLen + 1 + iMsgNameLen );
hb_vmPushSymbol( hb_dynsymSymbol( s_pSym_cClassName ) );
hb_vmPush( pReturn );

View File

@@ -2138,7 +2138,7 @@ static ERRCODE adsGetValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
pulLen++; /* make room for NULL */
pucBuf = ( UNSIGNED8 * ) hb_xgrab( pulLen );
AdsGetBinary( pArea->hTable, ADSFIELD( uiIndex ), 0, pucBuf, &pulLen );
hb_itemPutCPtr( pItem, ( char * ) pucBuf, pulLen );
hb_itemPutCLPtr( pItem, ( char * ) pucBuf, pulLen );
}
}
hb_itemSetCMemo( pItem );

View File

@@ -947,7 +947,7 @@
/* $DOC$
* $FUNCNAME$
* hb_itemPutCPtr()
* hb_itemPutCPtr2()
* $CATEGORY$
* Item API
* $ONELINER$
@@ -956,7 +956,44 @@
* C Prototype
*
* #include <hbapiitm.h>
* hb_itemPutCPtr( PHB_ITEM pItem, char * szText, ULONG ulLen ) --> ( PHB_ITEM )pResult
* hb_itemPutCPtr2( PHB_ITEM pItem, char * szText ) --> ( PHB_ITEM )pResult
* $ARGUMENTS$
* <pItem>
*
* <szText>
*
* <ulLen>
* $RETURNS$
*
* $DESCRIPTION$
*
* $EXAMPLES$
*
* $STATUS$
* R
* $COMPLIANCE$
* Compliance is not applicable to API calls.
* $FILES$
* Library is rtl
* $PLATFORMS$
* All
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* hb_itemPutCLPtr()
* $CATEGORY$
* Item API
* $ONELINER$
*
* $SYNTAX$
* C Prototype
*
* #include <hbapiitm.h>
* hb_itemPutCLPtr( PHB_ITEM pItem, char * szText, ULONG ulLen ) --> ( PHB_ITEM )pResult
* $ARGUMENTS$
* <pItem>
*

View File

@@ -646,10 +646,10 @@ extern HB_EXPORT void hb_retnlllen( LONGLONG lNumber, int iWidth ); /* returns
#define hb_reta( ulLen ) hb_arrayNew( hb_stackReturnItem(), ulLen )
#define hb_retc( szText ) hb_itemPutC( hb_stackReturnItem(), szText )
#define hb_retc_null() hb_itemPutC( hb_stackReturnItem(), NULL )
#define hb_retc_buffer( szText ) hb_itemPutCPtr( hb_stackReturnItem(), szText, strlen( szText ) )
#define hb_retc_buffer( szText ) hb_itemPutCPtr2( hb_stackReturnItem(), szText )
#define hb_retc_const( szText ) hb_itemPutCConst( hb_stackReturnItem(), szText )
#define hb_retclen( szText, ulLen ) hb_itemPutCL( hb_stackReturnItem(), szText, ulLen )
#define hb_retclen_buffer( szText, ulLen ) hb_itemPutCPtr( hb_stackReturnItem(), szText, ulLen )
#define hb_retclen_buffer( szText, ulLen ) hb_itemPutCLPtr( hb_stackReturnItem(), szText, ulLen )
#define hb_retds( szDate ) hb_itemPutDS( hb_stackReturnItem(), szDate )
#define hb_retd( iYear, iMonth, iDay ) hb_itemPutD( hb_stackReturnItem(), iYear, iMonth, iDay )
#define hb_retdl( lJulian ) hb_itemPutDL( hb_stackReturnItem(), lJulian )

View File

@@ -107,7 +107,9 @@ extern HB_EXPORT PHB_ITEM hb_itemPutC ( PHB_ITEM pItem, const char * szTe
extern HB_EXPORT PHB_ITEM hb_itemPutCL ( PHB_ITEM pItem, const char * szText, ULONG ulLen );
extern HB_EXPORT PHB_ITEM hb_itemPutCConst ( PHB_ITEM pItem, const char * szText );
extern HB_EXPORT PHB_ITEM hb_itemPutCLConst( PHB_ITEM pItem, const char * szText, ULONG ulLen );
extern HB_EXPORT PHB_ITEM hb_itemPutCPtr2 ( PHB_ITEM pItem, char * szText );
extern HB_EXPORT PHB_ITEM hb_itemPutCPtr ( PHB_ITEM pItem, char * szText, ULONG ulLen );
extern HB_EXPORT PHB_ITEM hb_itemPutCLPtr ( PHB_ITEM pItem, char * szText, ULONG ulLen );
extern HB_EXPORT void hb_itemSetCMemo ( PHB_ITEM pItem );
extern HB_EXPORT PHB_ITEM hb_itemPutD ( PHB_ITEM pItem, int iYear, int iMonth, int iDay );
extern HB_EXPORT PHB_ITEM hb_itemPutDS ( PHB_ITEM pItem, const char * szDate );

View File

@@ -1868,7 +1868,7 @@ static ERRCODE hb_dbfGetValue( DBFAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
memcpy( pVal, pArea->pRecord + pArea->pFieldOffset[ uiIndex ], pField->uiLen );
pVal[ pField->uiLen ] = '\0';
hb_cdpnTranslate( pVal, pArea->cdPage, hb_cdp_page, pField->uiLen );
hb_itemPutCPtr( pItem, pVal, pField->uiLen );
hb_itemPutCLPtr( pItem, pVal, pField->uiLen );
}
else
#endif
@@ -3526,7 +3526,7 @@ static ERRCODE hb_dbfRecInfo( DBFAREAP pArea, PHB_ITEM pRecID, USHORT uiInfoType
}
}
}
hb_itemPutCPtr( pInfo, ( char * ) pResult, ulLength );
hb_itemPutCLPtr( pInfo, ( char * ) pResult, ulLength );
break;
}
@@ -5408,7 +5408,7 @@ static ERRCODE hb_dbfRddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnect, P
}
if( fFree && szTrigger )
hb_itemPutCPtr( pItem, szTrigger, strlen( szTrigger ) );
hb_itemPutCPtr2( pItem, szTrigger );
else
hb_itemPutC( pItem, szTrigger );
@@ -5430,8 +5430,7 @@ static ERRCODE hb_dbfRddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnect, P
}
else if( pData->szPendingTrigger )
{
hb_itemPutCPtr( pItem, pData->szPendingTrigger,
strlen( pData->szPendingTrigger ) );
hb_itemPutCPtr2( pItem, pData->szPendingTrigger );
pData->szPendingTrigger = NULL;
}
else
@@ -5451,7 +5450,7 @@ static ERRCODE hb_dbfRddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnect, P
}
if( fFree && szPasswd )
hb_itemPutCPtr( pItem, szPasswd, strlen( szPasswd ) );
hb_itemPutCPtr2( pItem, szPasswd );
else
hb_itemPutC( pItem, szPasswd );
@@ -5473,8 +5472,7 @@ static ERRCODE hb_dbfRddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnect, P
}
else if( pData->szPendingPasswd )
{
hb_itemPutCPtr( pItem, pData->szPendingPasswd,
strlen( pData->szPendingPasswd ) );
hb_itemPutCPtr2( pItem, pData->szPendingPasswd );
pData->szPendingPasswd = NULL;
}
else

View File

@@ -684,7 +684,7 @@ static PHB_ITEM hb_cdxKeyGetItem( LPCDXKEY pKey, PHB_ITEM pItem, LPCDXTAG pTag,
pVal[ pKey->len ] = '\0';
hb_cdpnTranslate( pVal, pTag->pIndex->pArea->cdPage, hb_cdp_page,
pKey->len );
pItem = hb_itemPutCPtr( pItem, pVal, pKey->len );
pItem = hb_itemPutCLPtr( pItem, pVal, pKey->len );
}
else
#else

View File

@@ -1456,7 +1456,7 @@ static ERRCODE hb_fptReadRawSMTItem( FPTAREAP pArea, PHB_ITEM pItem )
#ifndef HB_CDP_SUPPORT_OFF
hb_cdpnTranslate( ( char *) pBuffer, pArea->cdPage, hb_cdp_page, ulLen );
#endif
hb_itemPutCPtr( pItem, ( char *) pBuffer, ulLen );
hb_itemPutCLPtr( pItem, ( char *) pBuffer, ulLen );
break;
case SMT_IT_INT:
@@ -2497,7 +2497,7 @@ static ERRCODE hb_fptReadBlobBlock( FPTAREAP pArea, PHB_ITEM pItem,
hb_xfree( bBuffer );
return EDBF_READ;
}
hb_itemPutCPtr( pItem, ( char * ) bBuffer, ulSize );
hb_itemPutCLPtr( pItem, ( char * ) bBuffer, ulSize );
}
return SUCCESS;
}
@@ -2652,7 +2652,7 @@ static ERRCODE hb_fptGetMemo( FPTAREAP pArea, USHORT uiIndex, PHB_ITEM pItem,
hb_cdpnTranslate( ( char *) pBuffer, pArea->cdPage, hb_cdp_page, ulSize );
#endif
pBuffer[ ulSize ] = '\0';
hb_itemPutCPtr( pItem, ( char * ) pBuffer, ulSize );
hb_itemPutCLPtr( pItem, ( char * ) pBuffer, ulSize );
hb_itemSetCMemo( pItem );
pBuffer = NULL;
}
@@ -2664,7 +2664,7 @@ static ERRCODE hb_fptGetMemo( FPTAREAP pArea, USHORT uiIndex, PHB_ITEM pItem,
hb_cdpnTranslate( ( char *) pBuffer, pArea->cdPage, hb_cdp_page, ulSize );
#endif
pBuffer[ ulSize ] = '\0';
hb_itemPutCPtr( pItem, ( char * ) pBuffer, ulSize );
hb_itemPutCLPtr( pItem, ( char * ) pBuffer, ulSize );
hb_itemSetCMemo( pItem );
pBuffer = NULL;
}
@@ -2744,13 +2744,13 @@ static ERRCODE hb_fptGetMemo( FPTAREAP pArea, USHORT uiIndex, PHB_ITEM pItem,
hb_cdpnTranslate( ( char *) pBuffer, pArea->cdPage, hb_cdp_page, ulSize );
#endif
pBuffer[ ulSize ] = '\0';
hb_itemPutCPtr( pItem, ( char * ) pBuffer, ulSize );
hb_itemPutCLPtr( pItem, ( char * ) pBuffer, ulSize );
hb_itemSetCMemo( pItem );
pBuffer = NULL;
break;
case FPTIT_PICT:
pBuffer[ ulSize ] = '\0';
hb_itemPutCPtr( pItem, ( char * ) pBuffer, ulSize );
hb_itemPutCLPtr( pItem, ( char * ) pBuffer, ulSize );
pBuffer = NULL;
break;
default:
@@ -3271,7 +3271,7 @@ static ERRCODE hb_fptGetVarField( FPTAREAP pArea, USHORT uiIndex, PHB_ITEM pItem
}
else
{
hb_itemPutCPtr( pItem, pString, uiType );
hb_itemPutCLPtr( pItem, pString, uiType );
}
}
else
@@ -4204,7 +4204,7 @@ static ERRCODE hb_fptPutValueFile( FPTAREAP pArea, USHORT uiIndex, BYTE * szFile
else
{
pAlloc[ ulSize ] = '\0';
pItem = hb_itemPutCPtr( NULL, ( char * ) pAlloc, ulSize );
pItem = hb_itemPutCLPtr( NULL, ( char * ) pAlloc, ulSize );
uiError = hb_fptPutVarField( pArea, uiIndex, pItem );
hb_itemRelease( pItem );
}

View File

@@ -477,7 +477,7 @@ static PHB_ITEM hb_ntxKeyGetItem( PHB_ITEM pItem, LPKEYINFO pKey,
pVal[ pTag->KeyLength ] = '\0';
hb_cdpnTranslate( pVal, pTag->Owner->Owner->cdPage, hb_cdp_page,
pTag->KeyLength );
pItem = hb_itemPutCPtr( pItem, pVal, pTag->KeyLength );
pItem = hb_itemPutCLPtr( pItem, pVal, pTag->KeyLength );
}
else
#else

View File

@@ -559,7 +559,7 @@ static ERRCODE hb_delimGetValue( DELIMAREAP pArea, USHORT uiIndex, PHB_ITEM pIte
memcpy( pVal, pArea->pRecord + pArea->pFieldOffset[ uiIndex ], pField->uiLen );
pVal[ pField->uiLen ] = '\0';
hb_cdpnTranslate( pVal, pArea->cdPage, hb_cdp_page, pField->uiLen );
hb_itemPutCPtr( pItem, pVal, pField->uiLen );
hb_itemPutCLPtr( pItem, pVal, pField->uiLen );
}
else
#endif

View File

@@ -385,7 +385,7 @@ static ERRCODE hb_sdfGetValue( SDFAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
memcpy( pVal, pArea->pRecord + pArea->pFieldOffset[ uiIndex ], pField->uiLen );
pVal[ pField->uiLen ] = '\0';
hb_cdpnTranslate( pVal, pArea->cdPage, hb_cdp_page, pField->uiLen );
hb_itemPutCPtr( pItem, pVal, pField->uiLen );
hb_itemPutCLPtr( pItem, pVal, pField->uiLen );
}
else
#endif

View File

@@ -118,7 +118,7 @@ static BOOL hb_gt_gui_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
if( hb_gt_w32_getClipboard( CF_TEXT, &szClipboardData, &ulLen ) )
{
pInfo->pResult = hb_itemPutCPtr( pInfo->pResult,
pInfo->pResult = hb_itemPutCLPtr( pInfo->pResult,
szClipboardData, ulLen );
}
else

View File

@@ -1590,7 +1590,7 @@ static BOOL hb_gt_win_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
dwLen = GetConsoleTitle( buff, sizeof( buff ) / sizeof( TCHAR ) );
szTitle = ( char * ) hb_xgrab( dwLen + 1 );
HB_TCHAR_GETFROM( szTitle, buff, dwLen );
pInfo->pResult = hb_itemPutCPtr( pInfo->pResult, szTitle, dwLen );
pInfo->pResult = hb_itemPutCLPtr( pInfo->pResult, szTitle, dwLen );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
{
LPTSTR lpTitle = HB_TCHAR_CONVTO( hb_itemGetCPtr( pInfo->pNewVal ) );
@@ -1651,7 +1651,7 @@ static BOOL hb_gt_win_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
ULONG ulLen;
if( hb_gt_w32_getClipboard( CF_OEMTEXT, &szClipboardData, &ulLen ) )
{
pInfo->pResult = hb_itemPutCPtr( pInfo->pResult,
pInfo->pResult = hb_itemPutCLPtr( pInfo->pResult,
szClipboardData,
ulLen );
}

View File

@@ -152,6 +152,10 @@ static void hb_gt_wvt_Free( PHB_GTWVT pWVT )
{
--s_wvtCount;
s_wvtWindows[pWVT->iHandle] = NULL;
if( pWVT->wSelectCopy )
HB_TCHAR_FREE( pWVT->wSelectCopy );
hb_xfree( pWVT );
}
@@ -225,6 +229,7 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT )
pWVT->bBeingMarked = FALSE;
pWVT->bBeginMarked = FALSE;
pWVT->wSelectCopy = HB_TCHAR_CONVTO( "Mark and Copy" );
pWVT->bSelectCopy = TRUE;
pWVT->bResizable = TRUE;
pWVT->bClosable = TRUE;
@@ -1637,7 +1642,7 @@ static void hb_gt_wvt_Init( PHB_GT pGT, FHANDLE hFilenoStdin, FHANDLE hFilenoStd
/* Create "Mark" prompt in SysMenu to allow console type copy operation */
{
HMENU hSysMenu = GetSystemMenu( pWVT->hWnd, FALSE );
AppendMenu( hSysMenu, MF_STRING, SYS_EV_MARK, TEXT( "Mark and Copy" ) );
AppendMenu( hSysMenu, MF_STRING, SYS_EV_MARK, pWVT->wSelectCopy );
}
/* SUPER GT initialization */
@@ -2038,7 +2043,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
{
char * szTitle = NULL;
if( hb_gt_wvt_GetWindowTitle( pWVT->hWnd, &szTitle ) )
pInfo->pResult = hb_itemPutCPtr( pInfo->pResult, szTitle, strlen( szTitle ) );
pInfo->pResult = hb_itemPutCPtr2( pInfo->pResult, szTitle );
else
pInfo->pResult = hb_itemPutC( pInfo->pResult, NULL );
if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
@@ -2127,7 +2132,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
CF_OEMTEXT : CF_TEXT,
&szClipboardData, &ulLen ) )
{
pInfo->pResult = hb_itemPutCPtr( pInfo->pResult,
pInfo->pResult = hb_itemPutCLPtr( pInfo->pResult,
szClipboardData,
ulLen );
}
@@ -2197,7 +2202,25 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
case HB_GTI_SELECTCOPY:
{
pInfo->pResult = hb_itemPutL( pInfo->pResult, pWVT->bSelectCopy );
if( pInfo->pNewVal )
if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
{
pInfo->pResult = hb_itemPutCPtr2( pInfo->pResult, HB_TCHAR_CONVFROM( pWVT->wSelectCopy ) );
if( hb_itemGetCLen( pInfo->pNewVal ) )
{
HMENU hSysMenu = GetSystemMenu( pWVT->hWnd, FALSE );
if( pWVT->wSelectCopy )
HB_TCHAR_FREE( pWVT->wSelectCopy );
pWVT->wSelectCopy = HB_TCHAR_CONVTO( hb_itemGetCPtr( pInfo->pNewVal ) );
pWVT->bSelectCopy = TRUE;
ModifyMenu( hSysMenu, SYS_EV_MARK, MF_BYCOMMAND | MF_STRING | MF_ENABLED, SYS_EV_MARK, pWVT->wSelectCopy );
}
}
else if( pInfo->pNewVal )
{
BOOL bNewValue = hb_itemGetL( pInfo->pNewVal );
if( bNewValue != pWVT->bSelectCopy )

View File

@@ -118,7 +118,7 @@ typedef struct
USHORT ROWS; /* number of displayable rows in window */
USHORT COLS; /* number of displayable columns in window */
COLORREF COLORS[16]; /* colors */
COLORREF COLORS[ 16 ]; /* colors */
BOOL CaretExist; /* TRUE if a caret has been created */
BOOL CaretHidden; /* TRUE if a caret has been hiden */
@@ -160,6 +160,7 @@ typedef struct
BOOL bResizable;
BOOL bSelectCopy;
LPWSTR wSelectCopy;
BOOL bClosable;
} HB_GTWVT, * PHB_GTWVT;

View File

@@ -1537,7 +1537,7 @@ static BOOL hb_gt_def_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
ULONG ulLen;
if( hb_gt_getClipboard( &pszClipData, &ulLen ) )
pInfo->pResult = hb_itemPutCPtr( pInfo->pResult, pszClipData, ulLen );
pInfo->pResult = hb_itemPutCLPtr( pInfo->pResult, pszClipData, ulLen );
else
pInfo->pResult = hb_itemPutC( pInfo->pResult, NULL );
}

View File

@@ -747,7 +747,7 @@ HB_EXPORT BOOL hb_arraySetCPtr( PHB_ITEM pArray, ULONG ulIndex, char * szText, U
if( HB_IS_ARRAY( pArray ) && ulIndex > 0 && ulIndex <= pArray->item.asArray.value->ulLen )
{
hb_itemPutCPtr( pArray->item.asArray.value->pItems + ulIndex - 1, szText, ulLen );
hb_itemPutCLPtr( pArray->item.asArray.value->pItems + ulIndex - 1, szText, ulLen );
return TRUE;
}
else

View File

@@ -75,7 +75,7 @@ static void AddToArray( PHB_ITEM pItem, PHB_ITEM pReturn, ULONG ulPos )
char * szBuff = ( char * ) hb_xgrab( ulLen + 1 );
snprintf( szBuff, ulLen + 1, "[%s]", pItem->item.asSymbol.value->szName );
hb_itemPutCPtr( pArrayItem, szBuff, ulLen );
hb_itemPutCLPtr( pArrayItem, szBuff, ulLen );
}
}
else /* Normal types */

View File

@@ -747,7 +747,7 @@ HB_EXPORT void hb_retc_buffer( char * szText )
{
HB_TRACE(HB_TR_DEBUG, ("hb_retc_buffer(%s)", szText));
hb_itemPutCPtr( hb_stackReturnItem(), szText, strlen( szText ) );
hb_itemPutCPtr2( hb_stackReturnItem(), szText );
}
#undef hb_retc_const
@@ -771,7 +771,7 @@ HB_EXPORT void hb_retclen_buffer( char * szText, ULONG ulLen )
{
HB_TRACE(HB_TR_DEBUG, ("hb_retclen_buffer(%s, %lu)", szText, ulLen));
hb_itemPutCPtr( hb_stackReturnItem(), szText, ulLen );
hb_itemPutCLPtr( hb_stackReturnItem(), szText, ulLen );
}
/* szDate must have YYYYMMDD format */
@@ -1002,7 +1002,7 @@ HB_EXPORT int hb_storclen_buffer( char * szText, ULONG ulLen, int iParam, ... )
}
else if( bByRef || iParam == -1 )
{
hb_itemPutCPtr( pItem, szText, ulLen );
hb_itemPutCLPtr( pItem, szText, ulLen );
return 1;
}
}

View File

@@ -1512,7 +1512,7 @@ HB_EXPORT void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols )
{
ULONG ulSize = ( ULONG ) HB_PCODE_MKUSHORT( &pCode[ w + 2 ] );
char * szText = hb_compDecodeString( pCode[ w + 1 ], ( char * ) pCode + w + 4, &ulSize );
hb_itemPutCPtr( hb_stackAllocItem(), szText, ulSize );
hb_itemPutCLPtr( hb_stackAllocItem(), szText, ulSize );
w += ( 4 + ulSize );
break;
}

View File

@@ -346,9 +346,54 @@ HB_EXPORT PHB_ITEM hb_itemPutCLConst( PHB_ITEM pItem, const char * szText, ULONG
return pItem;
}
HB_EXPORT PHB_ITEM hb_itemPutCPtr2( PHB_ITEM pItem, char * szText )
{
ULONG ulLen;
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutCPtr2(%p, %s)", pItem, szText));
if( pItem )
{
if( HB_IS_COMPLEX( pItem ) )
hb_itemClear( pItem );
}
else
pItem = hb_itemNew( NULL );
ulLen = szText ? strlen( szText ) : 0;
pItem->type = HB_IT_STRING;
pItem->item.asString.length = ulLen;
if( ulLen == 0 )
{
pItem->item.asString.allocated = 0;
pItem->item.asString.value = "";
hb_xfree( szText );
}
else if( ulLen == 1 )
{
pItem->item.asString.allocated = 0;
pItem->item.asString.value = ( char * ) hb_szAscii[ (unsigned char) ( szText[0] ) ];
hb_xfree( szText );
}
else
{
szText[ ulLen ] = '\0';
pItem->item.asString.allocated = ulLen + 1;
pItem->item.asString.value = szText;
}
return pItem;
}
HB_EXPORT PHB_ITEM hb_itemPutCPtr( PHB_ITEM pItem, char * szText, ULONG ulLen )
{
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutCPtr(%p, %s, %lu)", pItem, szText, ulLen));
return hb_itemPutCLPtr( pItem, szText, ulLen );
}
HB_EXPORT PHB_ITEM hb_itemPutCLPtr( PHB_ITEM pItem, char * szText, ULONG ulLen )
{
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutCLPtr(%p, %s, %lu)", pItem, szText, ulLen));
if( pItem )
{
@@ -2521,7 +2566,7 @@ HB_EXPORT PHB_ITEM hb_itemValToStr( PHB_ITEM pItem )
buffer = hb_itemString( pItem, &ulLen, &bFreeReq );
if( bFreeReq )
pResult = hb_itemPutCPtr( NULL, buffer, ulLen );
pResult = hb_itemPutCLPtr( NULL, buffer, ulLen );
else
pResult = hb_itemPutCL( NULL, buffer, ulLen );

View File

@@ -792,7 +792,7 @@ void hb_macroTextValue( HB_ITEM_PTR pItem )
{
/* replace the old value on the eval stack with the new one
*/
hb_itemPutCPtr( pItem, szString, ulLength );
hb_itemPutCLPtr( pItem, szString, ulLength );
}
/*
* else

View File

@@ -73,6 +73,9 @@ FUNCTION Main()
CASE nKey == K_F7
SetPaletteIndex()
CASE nKey == K_F8
Alert( "Menu text changed. Was: " + hb_GtInfo( HB_GTI_SELECTCOPY, DToS(Date()) + " " + Time() ) )
ENDCASE
ENDDO
@@ -122,6 +125,7 @@ STATIC FUNCTION DispScreen()
DispOutAt( ++nRow, nCol, '< F5 Palette L Repeat >', cColor )
DispOutAt( ++nRow, nCol, '< F6 Palette D Repeat >', cColor )
DispOutAt( ++nRow, nCol, '< F7 Palette By Index R >', cColor )
DispOutAt( ++nRow, nCol, '< F8 MarkCopy menu text >', cColor )
DispOutAt( ++nRow, nCol, '< Click Other Window >', cColor )
DispOutAt( ++nRow, nCol, '< Click X Button >', cColor )