2007-11-22 14:22 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbwince.h
+ added HB_TCHAR_CONVNREV() macro
* harbour/contrib/gtwvg/wvtutils.c
* harbour/contrib/gtwvg/wvtcore.c
* harbour/contrib/gtwvg/gtwvt.c
* cleaned MinGW warnings
! fixed compilation with HB_TR_LEVEL_DEBUG
* some minor cleanup in UNICODE conversions
This commit is contained in:
@@ -8,6 +8,17 @@
|
||||
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2007-11-22 14:22 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbwince.h
|
||||
+ added HB_TCHAR_CONVNREV() macro
|
||||
|
||||
* harbour/contrib/gtwvg/wvtutils.c
|
||||
* harbour/contrib/gtwvg/wvtcore.c
|
||||
* harbour/contrib/gtwvg/gtwvt.c
|
||||
* cleaned MinGW warnings
|
||||
! fixed compilation with HB_TR_LEVEL_DEBUG
|
||||
* some minor cleanup in UNICODE conversions
|
||||
|
||||
2007-11-22 12:21 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/source/rtl/gtwvt/gtwvt.c
|
||||
* formatting
|
||||
|
||||
@@ -1468,8 +1468,7 @@ static void hb_wvt_gtPaintText( HWND hWnd, RECT updateRect )
|
||||
{
|
||||
hb_wvt_gtSetColors( hdc, oldAttrib );
|
||||
|
||||
//text = HB_TCHAR_CONVNTO( ( const char* ) _s.pBuffer + startIndex, len );
|
||||
text = HB_TCHAR_CONVNTO( ( BYTE * ) _s.pBuffer + startIndex, len );
|
||||
text = HB_TCHAR_CONVNTO( ( char * ) _s.pBuffer + startIndex, len );
|
||||
//hb_wvt_gtTextOut( hdc, startCol, irow, ( char const * ) _s.pBuffer + startIndex, len );
|
||||
hb_wvt_gtTextOut( hdc, startCol, irow, text, len );
|
||||
|
||||
@@ -1490,8 +1489,7 @@ static void hb_wvt_gtPaintText( HWND hWnd, RECT updateRect )
|
||||
index++;
|
||||
}
|
||||
hb_wvt_gtSetColors( hdc, oldAttrib );
|
||||
//text = HB_TCHAR_CONVNTO( ( const char* ) _s.pBuffer + startIndex, len );
|
||||
text = HB_TCHAR_CONVNTO( ( BYTE * ) _s.pBuffer + startIndex, len );
|
||||
text = HB_TCHAR_CONVNTO( ( char * ) _s.pBuffer + startIndex, len );
|
||||
hb_wvt_gtTextOut( hdc, startCol, irow, text, len );
|
||||
if ( _s.bGui )
|
||||
{
|
||||
@@ -1670,8 +1668,6 @@ static void gt_hbInitStatics( void )
|
||||
OSVERSIONINFO osvi ;
|
||||
HINSTANCE h;
|
||||
int iIndex;
|
||||
LPTSTR msimg32 = HB_TCHAR_CONVTO( "msimg32.dll" );
|
||||
LPTSTR GradientFill = HB_TCHAR_CONVTO( "GradientFill" );
|
||||
|
||||
_s.ROWS = WVT_DEFAULT_ROWS;
|
||||
_s.COLS = WVT_DEFAULT_COLS;
|
||||
@@ -1726,12 +1722,15 @@ static void gt_hbInitStatics( void )
|
||||
_s.colStop = 0;
|
||||
_s.bToolTipActive = FALSE;
|
||||
|
||||
h = LoadLibraryEx( msimg32, NULL, 0 );
|
||||
HB_TCHAR_FREE( msimg32 );
|
||||
h = LoadLibraryEx( TEXT( "msimg32.dll" ), NULL, 0 );
|
||||
if ( h )
|
||||
{
|
||||
_s.pfnGF = ( wvtGradientFill ) GetProcAddress( h, GradientFill );
|
||||
HB_TCHAR_FREE( GradientFill );
|
||||
/* workaround for wrong declarations in some old C compilers */
|
||||
#if defined( UNICODE ) && defined( GetProcAddress )
|
||||
_s.pfnGF = ( wvtGradientFill ) GetProcAddressW( h, TEXT( "GradientFill" ) );
|
||||
#else
|
||||
_s.pfnGF = ( wvtGradientFill ) GetProcAddress( h, "GradientFill" );
|
||||
#endif
|
||||
if ( _s.pfnGF )
|
||||
{
|
||||
_s.hMSImg32 = h;
|
||||
@@ -2513,8 +2512,13 @@ DWORD HB_EXPORT hb_wvt_gtSetWindowIconFromFile( char *icon )
|
||||
|
||||
int HB_EXPORT hb_wvt_gtGetWindowTitle( char * cTitle, int length )
|
||||
{
|
||||
//LPTSTR title = HB_TCHAR_CONVTO( cTitle );
|
||||
return( GetWindowText( _s.hWnd, HB_TCHAR_CONVTO( cTitle ), length ) );
|
||||
int iResult;
|
||||
LPTSTR lpBuffer = HB_TCHAR_CONVNTO( cTitle, length );
|
||||
|
||||
iResult = GetWindowText( _s.hWnd, lpBuffer, length );
|
||||
HB_TCHAR_CONVNREV( cTitle, lpBuffer, length );
|
||||
|
||||
return iResult;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------//
|
||||
@@ -2631,10 +2635,10 @@ HB_EXPORT IPicture * hb_wvt_gtLoadPictureFromResource( LPCSTR cResource, LPCSTR
|
||||
{
|
||||
HRSRC res;
|
||||
LPVOID iPicture = NULL;
|
||||
//LPTSTR resource = cResource; //HB_TCHAR_CPTO( cResource );
|
||||
//LPTSTR section = cSection; //HB_TCHAR_CPTO( cSection );
|
||||
LPTSTR resource = HB_TCHAR_CONVTO( ( LPSTR ) cResource );
|
||||
LPTSTR section = HB_TCHAR_CONVTO( ( LPSTR ) cSection );
|
||||
|
||||
res = FindResource( ( HINSTANCE ) hb_hInstance, cResource, cSection );
|
||||
res = FindResource( ( HINSTANCE ) hb_hInstance, resource, section );
|
||||
if ( res )
|
||||
{
|
||||
IStream *iStream = NULL;
|
||||
@@ -2655,8 +2659,8 @@ HB_EXPORT IPicture * hb_wvt_gtLoadPictureFromResource( LPCSTR cResource, LPCSTR
|
||||
FreeResource( mem );
|
||||
}
|
||||
|
||||
//HB_TCHAR_FREE( resource );
|
||||
//HB_TCHAR_FREE( section );
|
||||
HB_TCHAR_FREE( resource );
|
||||
HB_TCHAR_FREE( section );
|
||||
|
||||
return (IPicture *) iPicture;
|
||||
}
|
||||
@@ -3014,7 +3018,7 @@ static void HB_GT_FUNC( gt_SetPos( int sRow, int sCol ) )
|
||||
|
||||
static void HB_GT_FUNC( gt_GetPos( int * sRow, int * sCol ) )
|
||||
{
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_SetPos( %hd, %hd, %hd )", sRow, sCol, sMethod ) );
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_GetPos( %p, %p )", sRow, sCol ) );
|
||||
|
||||
*sCol = _s.caretPos.x;
|
||||
*sRow = _s.caretPos.y;
|
||||
@@ -3284,7 +3288,7 @@ static void HB_GT_FUNC( gt_PutText( int top, int left, BYTE bColor, BYTE * pText
|
||||
{
|
||||
USHORT irow, icol, index, j, right;
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_PutText( %hu, %hu, %hu, %hu, %p )", top, left, bottom, right, sBuffer ) );
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_PutText( %d, %d, %d, %s, %lu )", top, left, bColor, pText, ulLen ) );
|
||||
|
||||
j = 0;
|
||||
irow = top;
|
||||
@@ -3850,7 +3854,7 @@ int HB_GT_FUNC( gt_ReadKey() )
|
||||
int c = 0;
|
||||
BOOL bKey;
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_ReadKey( %d )", ( int ) eventmask ) );
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_ReadKey()" ) );
|
||||
|
||||
hb_wvt_gtProcessMessages() ;
|
||||
bKey = hb_wvt_gtGetCharFromInputQueue( &c );
|
||||
|
||||
@@ -117,8 +117,6 @@ HB_FUNC( WVT_CORE )
|
||||
|
||||
HB_EXPORT BOOL hb_wvt_DrawImage( HDC hdc, int x1, int y1, int wd, int ht, char * image )
|
||||
{
|
||||
IStream *iStream;
|
||||
IPicture *iPicture;
|
||||
HGLOBAL hGlobal;
|
||||
HANDLE hFile;
|
||||
DWORD nFileSize;
|
||||
@@ -149,8 +147,12 @@ HB_EXPORT BOOL hb_wvt_DrawImage( HDC hdc, int x1, int y1, int wd, int ht, char *
|
||||
{
|
||||
if ( ReadFile( hFile, hGlobal, nFileSize, &nReadByte, NULL ) )
|
||||
{
|
||||
IStream *iStream;
|
||||
IPicture *iPicture;
|
||||
IPicture ** iPictureRef = &iPicture;
|
||||
|
||||
CreateStreamOnHGlobal( hGlobal, TRUE, &iStream );
|
||||
OleLoadPicture( iStream, nFileSize, TRUE, (REFIID) &IID_IPicture, ( LPVOID* )&iPicture );
|
||||
OleLoadPicture( iStream, nFileSize, TRUE, (REFIID) &IID_IPicture, ( LPVOID * ) iPictureRef );
|
||||
|
||||
if ( iPicture )
|
||||
{
|
||||
@@ -705,6 +707,8 @@ HB_FUNC( WVT_DRAWOUTLINE )
|
||||
iBottom = xy.y;
|
||||
iRight = xy.x;
|
||||
|
||||
hOldPenGUI = hOldPen = 0;
|
||||
|
||||
if ( ISNUM( 5 ) )
|
||||
{
|
||||
hPen = CreatePen( hb_parni( 5 ), 0, ( ISNIL( 7 ) ? 0 : ( COLORREF ) hb_parnl( 7 ) ) );
|
||||
@@ -736,7 +740,7 @@ HB_FUNC( WVT_DRAWOUTLINE )
|
||||
if ( hPen )
|
||||
{
|
||||
SelectObject( _s->hdc, hOldPen );
|
||||
if ( _s->bGui )
|
||||
if ( hOldPenGUI )
|
||||
{
|
||||
SelectObject( _s->hGuiDC, hOldPenGUI );
|
||||
}
|
||||
@@ -774,7 +778,6 @@ HB_FUNC( WVT_DRAWLINE )
|
||||
switch ( iAlign )
|
||||
{
|
||||
case 0: // Center
|
||||
{
|
||||
if ( iOrient == 0 ) // Horizontal
|
||||
{
|
||||
iOffset = ( ( iBottom - iTop ) / 2 ) ;
|
||||
@@ -785,14 +788,12 @@ HB_FUNC( WVT_DRAWLINE )
|
||||
iOffset = ( ( iRight - iLeft ) / 2 ) ;
|
||||
x = iLeft + iOffset ;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 1: // Top
|
||||
break;
|
||||
break;
|
||||
|
||||
case 2: // bottom
|
||||
{
|
||||
if ( iFormat == 0 || iFormat == 1 ) // Raised/Recessd
|
||||
{
|
||||
y = iBottom - 1;
|
||||
@@ -801,14 +802,12 @@ HB_FUNC( WVT_DRAWLINE )
|
||||
{
|
||||
y = iBottom;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 3: // Left
|
||||
break;
|
||||
break;
|
||||
|
||||
case 4: // Right
|
||||
{
|
||||
if ( iFormat == 0 || iFormat == 1 ) // Raised/Recessd
|
||||
{
|
||||
x = iRight - 1;
|
||||
@@ -817,16 +816,12 @@ HB_FUNC( WVT_DRAWLINE )
|
||||
{
|
||||
x = iRight;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
hPen = CreatePen( iStyle, iThick, cr );
|
||||
hOldPen = (HPEN) SelectObject( _s->hdc, hPen );
|
||||
if ( _s->bGui )
|
||||
{
|
||||
hOldPenGUI = (HPEN) SelectObject( _s->hGuiDC, hPen );
|
||||
}
|
||||
hOldPenGUI = _s->bGui ? (HPEN) SelectObject( _s->hGuiDC, hPen ) : 0;
|
||||
|
||||
switch ( iFormat )
|
||||
{
|
||||
@@ -944,7 +939,7 @@ HB_FUNC( WVT_DRAWLINE )
|
||||
}
|
||||
|
||||
SelectObject( _s->hdc, hOldPen );
|
||||
if ( _s->bGui )
|
||||
if ( hOldPenGUI )
|
||||
{
|
||||
SelectObject( _s->hGuiDC, hOldPenGUI );
|
||||
}
|
||||
@@ -1955,8 +1950,8 @@ HB_FUNC( WVT_DRAWLABELOBJ )
|
||||
iBottom = xy.y - 1;
|
||||
iRight = xy.x - 1;
|
||||
|
||||
iAlignHorz = ( ISNIL( 6 ) ? 0 : hb_parni( 6 ) );
|
||||
iAlignVert = ( ISNIL( 7 ) ? 0 : hb_parni( 7 ) );
|
||||
iAlignHorz = hb_parni( 6 ); /* default is 0 */
|
||||
iAlignVert = hb_parni( 7 ); /* default is 0 */
|
||||
|
||||
SetTextColor( _s->hdc, ISNIL( 8 ) ? _s->foreground : ( COLORREF ) hb_parnl( 8 ) );
|
||||
SetBkColor( _s->hdc, ISNIL( 9 ) ? _s->background : ( COLORREF ) hb_parnl( 9 ) );
|
||||
@@ -1970,22 +1965,21 @@ HB_FUNC( WVT_DRAWLABELOBJ )
|
||||
switch ( iAlignHorz )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
iAlignH = TA_LEFT;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
iAlignH = TA_RIGHT;
|
||||
x = iRight;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
iAlignH = TA_CENTER;
|
||||
x = iLeft + ( ( iRight - iLeft + 1 ) / 2 );
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
iAlignH = 0;
|
||||
}
|
||||
|
||||
iAlignV = TA_TOP;
|
||||
@@ -1993,15 +1987,12 @@ HB_FUNC( WVT_DRAWLABELOBJ )
|
||||
switch ( iAlignVert )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
y = iBottom - sz.cy;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
y = iTop + ( ( iBottom - iTop + 1 - sz.cy ) / 2 );
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
SetTextAlign( _s->hdc, iAlignH | iAlignV );
|
||||
@@ -2342,28 +2333,24 @@ HB_FUNC( WVT_DRAWTEXTBOX )
|
||||
int iBottom = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
|
||||
int iRight = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );
|
||||
|
||||
int iAlignHorz = ( ISNIL( 7 ) ? 0 : hb_parni( 7 ) );
|
||||
int iAlignH ;
|
||||
int iAlignHorz = hb_parni( 7 ); /* default to 0 */
|
||||
int iAlignH = 0;
|
||||
|
||||
RECT rc = { 0,0,0,0 };
|
||||
|
||||
switch ( iAlignHorz )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
iAlignH = DT_LEFT;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
iAlignH = DT_RIGHT;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
iAlignH = DT_CENTER;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
rc.top = iTop;
|
||||
|
||||
@@ -1234,9 +1234,9 @@ HB_FUNC( WVT_CREATEDIALOGDYNAMIC )
|
||||
PHB_ITEM pFirst = hb_param( 3,HB_IT_ANY );
|
||||
PHB_ITEM pFunc = NULL ;
|
||||
PHB_DYNS pExecSym;
|
||||
HWND hDlg ;
|
||||
HWND hDlg = 0;
|
||||
int iType = 0;
|
||||
int iIndex;
|
||||
int iType;
|
||||
int iResource = hb_parni( 4 );
|
||||
|
||||
/* check if we still have room for a new dialog */
|
||||
@@ -1678,26 +1678,27 @@ HB_FUNC( WVT_DLGSETICON )
|
||||
|
||||
HB_FUNC( WIN_SENDMESSAGE )
|
||||
{
|
||||
char *cText ;
|
||||
char *cText = NULL;
|
||||
ULONG ulLen = 0;
|
||||
|
||||
if( ISBYREF( 4 ) )
|
||||
{
|
||||
cText = ( char* ) hb_xgrab( hb_parcsiz( 4 ) );
|
||||
hb_xmemcpy( cText, hb_parc( 4 ), hb_parcsiz( 4 ) );
|
||||
ulLen = hb_parclen( 4 );
|
||||
cText = ( char* ) hb_xgrab( ulLen + 1 );
|
||||
hb_xmemcpy( cText, hb_parcx( 4 ), ulLen + 1 );
|
||||
}
|
||||
|
||||
hb_retnl( ( ULONG ) SendMessage( ( HWND ) hb_parnl( 1 ),
|
||||
( UINT ) hb_parni( 2 ),
|
||||
( ISNIL( 3 ) ? 0 : ( WPARAM ) hb_parnl( 3 ) ),
|
||||
( ISNIL( 4 ) ? 0 : ( ISBYREF( 4 ) ? ( LPARAM ) ( LPSTR ) cText :
|
||||
( ISNIL( 4 ) ? 0 : ( cText ? ( LPARAM ) ( LPSTR ) cText :
|
||||
( ISCHAR( 4 ) ? ( LPARAM )( LPSTR ) hb_parc( 4 ) :
|
||||
( LPARAM ) hb_parnl( 4 ) ) ) ) )
|
||||
);
|
||||
|
||||
if ( ISBYREF( 4 ) )
|
||||
if ( cText )
|
||||
{
|
||||
hb_storclen( cText, hb_parcsiz( 4 ), 4 );
|
||||
hb_xfree( cText );
|
||||
hb_storclen_buffer( cText, ulLen, 4 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1930,28 +1931,22 @@ HB_FUNC( WIN_LOADICON )
|
||||
//
|
||||
HB_FUNC( WIN_LOADIMAGE )
|
||||
{
|
||||
HBITMAP hImage;
|
||||
HBITMAP hImage = 0;
|
||||
int iSource = hb_parni( 2 );
|
||||
|
||||
switch ( iSource )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
hImage = LoadBitmap( ( HINSTANCE ) hb_hInstance, MAKEINTRESOURCE( hb_parni( 1 ) ) );
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
hImage = LoadBitmap( ( HINSTANCE ) hb_hInstance, hb_parc( 1 ) );
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
hImage = ( HBITMAP ) LoadImage( ( HINSTANCE ) NULL, hb_parc( 1 ), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
hb_retnl( ( ULONG ) hImage ) ;
|
||||
@@ -2089,13 +2084,11 @@ HB_FUNC( WIN_ISWINDOW )
|
||||
|
||||
HB_FUNC( WVT_GETFONTHANDLE )
|
||||
{
|
||||
HFONT hFont;
|
||||
int iSlot = hb_parni( 1 )-1;
|
||||
HFONT hFont = 0;
|
||||
int iSlot = hb_parni( 1 ) - 1;
|
||||
|
||||
if ( iSlot >= 0 && iSlot < WVT_PICTURES_MAX )
|
||||
{
|
||||
hFont = _s->hUserFonts[ iSlot ];
|
||||
}
|
||||
|
||||
hb_retnl( ( ULONG ) hFont );
|
||||
}
|
||||
|
||||
@@ -176,6 +176,7 @@ extern void hb_wctombget( char *dstA, const wchar_t *srcW, unsigned long ulLen )
|
||||
#define HB_TCHAR_CONVFROM(s) hb_wctomb(s)
|
||||
#define HB_TCHAR_CONVNTO(s,l) hb_mbntowc(s,l)
|
||||
#define HB_TCHAR_CONVNFROM(s,l) hb_wcntomb(s,l)
|
||||
#define HB_TCHAR_CONVNREV(d,s,l) do { hb_wctombget(d,s,l); hb_xfree(s); } while( 0 )
|
||||
#define HB_TCHAR_FREE(s) hb_xfree(s)
|
||||
|
||||
#else
|
||||
@@ -187,6 +188,7 @@ extern void hb_wctombget( char *dstA, const wchar_t *srcW, unsigned long ulLen )
|
||||
#define HB_TCHAR_CONVFROM(s) (s)
|
||||
#define HB_TCHAR_CONVNTO(s,l) (s)
|
||||
#define HB_TCHAR_CONVNFROM(s,l) (s)
|
||||
#define HB_TCHAR_CONVNREV(d,s,l) do { ; } while( 0 )
|
||||
#define HB_TCHAR_FREE(s) HB_SYMBOL_UNUSED(s)
|
||||
|
||||
#endif /* UNICODE */
|
||||
|
||||
Reference in New Issue
Block a user