From 9fdbf7de766bbe6826f45939dcb2cca64fafa476 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 4 Dec 2007 11:52:20 +0000 Subject: [PATCH] 2007-12-04 12:51 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbgtcore.h + added some missing HB_GTSUPER_* functions * harbour/contrib/hbgtwvg/wvtcore.c * use hb_gt*() functions instead of hb_gt_*() ones * harbour/contrib/hbgtwvg/wvtutils.c * harbour/contrib/hbgtwvg/gtwvt.c * harbour/source/rtl/gtwin/gtwin.c * harbour/source/rtl/gtgui/gtgui.c * harbour/source/rtl/gtwvt/gtwvt.c * harbour/source/rtl/gttone.c * harbour/source/rtl/gtclip.c * minor cleanup in hb_gt_w32_*() function names * harbour/source/rtl/hbgtcore.c * harbour/source/rtl/gtclip.c * use common for all GT internal Clipboard buffer - thanks to Pritpal for a note --- harbour/ChangeLog | 21 ++++ harbour/contrib/hbgtwvg/gtwvt.c | 6 +- harbour/contrib/hbgtwvg/wvtcore.c | 15 +-- harbour/contrib/hbgtwvg/wvtutils.c | 13 +-- harbour/include/hbgtcore.h | 165 ++++++++++++++++------------- harbour/source/rtl/gtclip.c | 35 +++++- harbour/source/rtl/gtgui/gtgui.c | 6 +- harbour/source/rtl/gttone.c | 4 +- harbour/source/rtl/gtwin/gtwin.c | 6 +- harbour/source/rtl/gtwvt/gtwvt.c | 6 +- harbour/source/rtl/hbgtcore.c | 33 +++--- 11 files changed, 181 insertions(+), 129 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 32bd4fae4f..aff444bf54 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,27 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-12-04 12:51 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbgtcore.h + + added some missing HB_GTSUPER_* functions + + * harbour/contrib/hbgtwvg/wvtcore.c + * use hb_gt*() functions instead of hb_gt_*() ones + + * harbour/contrib/hbgtwvg/wvtutils.c + * harbour/contrib/hbgtwvg/gtwvt.c + * harbour/source/rtl/gtwin/gtwin.c + * harbour/source/rtl/gtgui/gtgui.c + * harbour/source/rtl/gtwvt/gtwvt.c + * harbour/source/rtl/gttone.c + * harbour/source/rtl/gtclip.c + * minor cleanup in hb_gt_w32_*() function names + + * harbour/source/rtl/hbgtcore.c + * harbour/source/rtl/gtclip.c + * use common for all GT internal Clipboard buffer - thanks to Pritpal + for a note + 2007-12-04 10:17 UTC+0100 Marek Paliwoda (mpaliwoda at interia pl) * harbour/contrib/make_b32_all.bat * harbour/contrib/make_vc_all.bat diff --git a/harbour/contrib/hbgtwvg/gtwvt.c b/harbour/contrib/hbgtwvg/gtwvt.c index 10903198eb..346c82de04 100644 --- a/harbour/contrib/hbgtwvg/gtwvt.c +++ b/harbour/contrib/hbgtwvg/gtwvt.c @@ -2076,7 +2076,7 @@ static void hb_gt_wvt_Tone( double dFrequency, double dDuration ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_wvt_Tone(%lf, %lf)", dFrequency, dDuration)); - hb_gt_w32_Tone( dFrequency, dDuration ); + hb_gt_w32_tone( dFrequency, dDuration ); } /* ********************************************************************** */ @@ -2404,7 +2404,7 @@ static BOOL hb_gt_wvt_Info( int iType, PHB_GT_INFO pInfo ) case GTI_CLIPBOARDDATA: if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) { - hb_gt_w32_SetClipboard( _s.CodePage == OEM_CHARSET ? + hb_gt_w32_setClipboard( _s.CodePage == OEM_CHARSET ? CF_OEMTEXT : CF_TEXT, hb_itemGetCPtr( pInfo->pNewVal ), hb_itemGetCLen( pInfo->pNewVal ) ); @@ -2413,7 +2413,7 @@ static BOOL hb_gt_wvt_Info( int iType, PHB_GT_INFO pInfo ) { char * szClipboardData; ULONG ulLen; - if( hb_gt_w32_GetClipboard( _s.CodePage == OEM_CHARSET ? + if( hb_gt_w32_getClipboard( _s.CodePage == OEM_CHARSET ? CF_OEMTEXT : CF_TEXT, &szClipboardData, &ulLen ) ) { diff --git a/harbour/contrib/hbgtwvg/wvtcore.c b/harbour/contrib/hbgtwvg/wvtcore.c index 9d7b24a440..46a5cdc374 100644 --- a/harbour/contrib/hbgtwvg/wvtcore.c +++ b/harbour/contrib/hbgtwvg/wvtcore.c @@ -19,13 +19,6 @@ * Copyright 1999-2000 Paul Tucker * Copyright 2002 Przemysław Czerpak * - * The following parts are Copyright of the individual authors. - * www - http://www.harbour-project.org - * - * - * Copyright 1999 David G. Holm - * hb_gt_Tone() - * * See doc/license.txt for licensing terms. * * www - http://www.harbour-project.org @@ -128,7 +121,7 @@ HB_EXPORT void hb_wvt_GetStringAttrib( USHORT top, USHORT left, USHORT bottom, U BYTE bColor, bAttr; USHORT usChar; - if( !hb_gt_GetScrChar( irow, icol, &bColor, &bAttr, &usChar ) ) + if( !hb_gtGetScrChar( irow, icol, &bColor, &bAttr, &usChar ) ) break; sBuffer[ j ] = ( BYTE ) usChar; @@ -151,7 +144,7 @@ HB_EXPORT void hb_wvt_PutStringAttrib( USHORT top, USHORT left, USHORT bottom, U { for( icol = left; icol <= right; icol++ ) { - if( !hb_gt_PutScrChar( irow, icol, sAttrib[ j ], 0, sBuffer[ j ] ) ) + if( !hb_gtPutScrChar( irow, icol, sAttrib[ j ], 0, sBuffer[ j ] ) ) break; j++; } @@ -913,7 +906,7 @@ static COLORREF hb_wvt_BgColorParam( int iParam ) else { int iColor = ISCHAR( iParam ) ? hb_gtColorToN( hb_parc( iParam ) ) : - hb_gt_GetColor(); + hb_gtGetCurrColor(); color = hb_wvt_gtGetColorData( ( iColor >> 4 ) & 0x0f ); } @@ -929,7 +922,7 @@ static COLORREF hb_wvt_FgColorParam( int iParam ) else { int iColor = ISCHAR( iParam ) ? hb_gtColorToN( hb_parc( iParam ) ) : - hb_gt_GetColor(); + hb_gtGetCurrColor(); color = hb_wvt_gtGetColorData( iColor & 0x0f ); } diff --git a/harbour/contrib/hbgtwvg/wvtutils.c b/harbour/contrib/hbgtwvg/wvtutils.c index 6619616134..b6d152bd5f 100644 --- a/harbour/contrib/hbgtwvg/wvtutils.c +++ b/harbour/contrib/hbgtwvg/wvtutils.c @@ -19,13 +19,6 @@ * Copyright 1999-2000 Paul Tucker * Copyright 2002 Przemysław Czerpak * - * The following parts are Copyright of the individual authors. - * www - http://www.harbour-project.org - * - * - * Copyright 1999 David G. Holm - * hb_gt_Tone() - * * See doc/license.txt for licensing terms. * * www - http://www.harbour-project.org @@ -1022,7 +1015,7 @@ HB_FUNC( WVT_GETCLIPBOARD ) char * szClipboardData; ULONG ulLen; - if( hb_gt_w32_GetClipboard( _s->CodePage == OEM_CHARSET ? + if( hb_gt_w32_getClipboard( _s->CodePage == OEM_CHARSET ? CF_OEMTEXT : CF_TEXT, &szClipboardData, &ulLen ) ) { @@ -1035,7 +1028,7 @@ HB_FUNC( WVT_GETCLIPBOARD ) HB_FUNC( WVT_SETCLIPBOARD ) { if( ISCHAR( 1 ) ) - hb_retl( hb_gt_w32_SetClipboard( _s->CodePage == OEM_CHARSET ? + hb_retl( hb_gt_w32_setClipboard( _s->CodePage == OEM_CHARSET ? CF_OEMTEXT : CF_TEXT, hb_parc( 1 ), hb_parclen( 1 ) ) ); else @@ -1049,7 +1042,7 @@ HB_FUNC( WVT_PASTEFROMCLIPBOARD ) char * szClipboardData; ULONG ulLen, ul; - if( hb_gt_w32_GetClipboard( _s->CodePage == OEM_CHARSET ? + if( hb_gt_w32_getClipboard( _s->CodePage == OEM_CHARSET ? CF_OEMTEXT : CF_TEXT, &szClipboardData, &ulLen ) ) { diff --git a/harbour/include/hbgtcore.h b/harbour/include/hbgtcore.h index 94d4c792fd..89c66f938f 100644 --- a/harbour/include/hbgtcore.h +++ b/harbour/include/hbgtcore.h @@ -108,6 +108,9 @@ #define HB_GT_FUNC_( x, id ) HB_GT_FUNC__( x, id ) #define HB_GT_FUNC__( x, id ) hb##_##id##_##x +/* forward declaration */ +struct _HB_GT_BASE; + typedef struct { void (* Init) ( FHANDLE, FHANDLE, FHANDLE ); @@ -299,8 +302,10 @@ typedef struct typedef HB_GT_CORD * PHB_GT_CORD; */ -typedef struct +typedef struct _HB_GT_BASE { + PHB_GT_FUNCS pFuncTable; + int iRow; /* cursor row position */ int iCol; /* cursor column position */ @@ -327,9 +332,6 @@ typedef struct FHANDLE hStdOut; FHANDLE hStdErr; - char * szClipboardData; - ULONG ulClipboardLen; - BOOL fDispTrans; PHB_CODEPAGE cdpTerm; PHB_CODEPAGE cdpHost; @@ -359,20 +361,31 @@ typedef struct ULONG StrBufferPos; void ** pGTData; /* */ -} HB_GT_BASE; -typedef HB_GT_BASE * PHB_GT_BASE, * PHB_GT; + +} HB_GT_BASE, * PHB_GT_BASE, * PHB_GT; extern PHB_GT hb_gt_Base( void ); -extern void * hb_gt_New( void ); -extern void hb_gt_Free( void * pGtPtr ); extern void hb_gt_Init( FHANDLE hStdIn, FHANDLE hStdOut, FHANDLE hStdErr ); extern void hb_gt_Exit( void ); -extern BOOL hb_gt_CheckPos( int iRow, int iCol, long *plIndex ); -extern void hb_gt_GetPos( int * piRow, int * piCol ); -extern void hb_gt_SetPos( int iRow, int iCol ); +extern void * hb_gt_New( void ); +extern void hb_gt_Free( void * pGtPtr ); +extern BOOL hb_gt_Resize( int iRows, int iCols ); +extern BOOL hb_gt_SetMode( int iRows, int iCols ); +extern void hb_gt_GetSize( int * piRows, int * piCols ); +extern void hb_gt_SemiCold( void ); +extern void hb_gt_ColdArea( int iTop, int iLeft, int iBottom, int iRight ); +extern void hb_gt_ExposeArea( int iTop, int iLeft, int iBottom, int iRight ); +extern void hb_gt_ScrollArea( int iTop, int iLeft, int iBottom, int iRight, BYTE bColor, BYTE bChar, int iRows, int iCols ); +extern void hb_gt_TouchCell( int iRow, int iCol ); +extern void hb_gt_Redraw( int iRow, int iCol, int iSize ); +extern void hb_gt_Refresh( void ); +extern void hb_gt_Flush( void ); extern int hb_gt_MaxCol( void ); extern int hb_gt_MaxRow( void ); +extern BOOL hb_gt_CheckPos( int iRow, int iCol, long *plIndex ); +extern void hb_gt_SetPos( int iRow, int iCol ); +extern void hb_gt_GetPos( int * piRow, int * piCol ); extern BOOL hb_gt_IsColor( void ); extern void hb_gt_GetColorStr( char * ); extern void hb_gt_SetColorStr( const char * ); @@ -391,58 +404,47 @@ extern void hb_gt_SetCursorStyle( int iStyle ); extern void hb_gt_GetScrCursor( int * piRow, int * piCol, int * piStyle ); extern BOOL hb_gt_GetScrChar( int iRow, int iCol, BYTE * pbColor, BYTE * pbAttr, USHORT * pusChar ); extern BOOL hb_gt_PutScrChar( int iRow, int iCol, BYTE bColor, BYTE bAttr, USHORT usChar ); -extern BOOL hb_gt_GetBlink( void ); -extern void hb_gt_SetBlink( BOOL fBlink ); -extern void hb_gt_SetSnowFlag( BOOL fNoSnow ); extern void hb_gt_DispBegin( void ); extern void hb_gt_DispEnd( void ); extern int hb_gt_DispCount( void ); -extern BOOL hb_gt_PreExt( void ); -extern BOOL hb_gt_PostExt( void ); -extern BOOL hb_gt_Suspend( void ); -extern BOOL hb_gt_Resume( void ); -extern char * hb_gt_Version( int iType ); extern BOOL hb_gt_GetChar( int iRow, int iCol, BYTE * pbColor, BYTE * pbAttr, USHORT * pusChar ); extern BOOL hb_gt_PutChar( int iRow, int iCol, BYTE bColor, BYTE bAttr, USHORT usChar ); +extern long hb_gt_RectSize( int iTop, int iLeft, int iBottom, int iRight ); +extern void hb_gt_Save( int iTop, int iLeft, int iBottom, int iRight, BYTE * pBuffer ); +extern void hb_gt_Rest( int iTop, int iLeft, int iBottom, int iRight, BYTE * pBuffer ); extern void hb_gt_PutText( int iRow, int iCol, BYTE bColor, BYTE * pText, ULONG ulLen ); extern void hb_gt_Replicate( int iRow, int iCol, BYTE bColor, BYTE bAttr, USHORT usChar, ULONG ulLen ); extern void hb_gt_WriteAt( int iRow, int iCol, BYTE * pText, ULONG ulLength ); extern void hb_gt_Write( BYTE * pText, ULONG ulLength ); extern void hb_gt_WriteCon( BYTE * pText, ULONG ulLength ); -extern long hb_gt_RectSize( int iTop, int iLeft, int iBottom, int iRight ); -extern void hb_gt_Save( int iTop, int iLeft, int iBottom, int iRight, BYTE * pBuffer ); -extern void hb_gt_Rest( int iTop, int iLeft, int iBottom, int iRight, BYTE * pBuffer ); extern void hb_gt_SetAttribute( int iTop, int iLeft, int iBottom, int iRight, BYTE bColor ); extern void hb_gt_DrawShadow( int iTop, int iLeft, int iBottom, int iRight, BYTE bColor ); extern void hb_gt_Scroll( int iTop, int iLeft, int iBottom, int iRight, BYTE bColor, BYTE bChar, int iRows, int iCols ); extern void hb_gt_ScrollUp( int iRows, BYTE bColor, BYTE bChar ); extern void hb_gt_Box( int iTop, int iLeft, int iBottom, int iRight, BYTE * pbyFrame, BYTE bColor ); -extern void hb_gt_BoxS( int iTop, int iLeft, int iBottom, int iRight, BYTE * pbyFrame, BYTE bColor ); extern void hb_gt_BoxD( int iTop, int iLeft, int iBottom, int iRight, BYTE * pbyFrame, BYTE bColor ); +extern void hb_gt_BoxS( int iTop, int iLeft, int iBottom, int iRight, BYTE * pbyFrame, BYTE bColor ); extern void hb_gt_HorizLine( int iRow, int iLeft, int iRight, BYTE bChar, BYTE bColor ); extern void hb_gt_VertLine( int iCol, int iTop, int iBottom, BYTE bChar, BYTE bColor ); -extern BOOL hb_gt_SetMode( int iRows, int iCols ); -extern BOOL hb_gt_Resize( int iRows, int iCols ); -extern void hb_gt_GetSize( int * piRows, int * piCols ); -extern void hb_gt_SemiCold( void ); -extern void hb_gt_ColdArea( int iTop, int iLeft, int iBottom, int iRight ); -extern void hb_gt_ExposeArea( int iTop, int iLeft, int iBottom, int iRight ); -extern void hb_gt_ScrollArea( int iTop, int iLeft, int iBottom, int iRight, BYTE bColor, BYTE bChar, int iRows, int iCols ); -extern void hb_gt_TouchCell( int iRow, int iCol ); -extern void hb_gt_Redraw( int iRow, int iCol, int iSize ); -extern void hb_gt_Refresh( void ); -extern void hb_gt_Flush( void ); -extern void hb_gt_Tone( double dFrequency, double dDuration ); -extern void hb_gt_Bell( void ); +extern BOOL hb_gt_GetBlink( void ); +extern void hb_gt_SetBlink( BOOL fBlink ); +extern void hb_gt_SetSnowFlag( BOOL fNoSnow ); +extern char * hb_gt_Version( int iType ); +extern BOOL hb_gt_Suspend( void ); +extern BOOL hb_gt_Resume( void ); +extern BOOL hb_gt_PreExt( void ); +extern BOOL hb_gt_PostExt( void ); extern void hb_gt_OutStd( BYTE * pbyStr, ULONG ulLen ); extern void hb_gt_OutErr( BYTE * pbyStr, ULONG ulLen ); -extern BOOL hb_gt_SetDispCP( char * pszTermCDP, char * pszHostCDP, BOOL fBox ); -extern BOOL hb_gt_SetKeyCP( char * pszTermCDP, char * pszHostCDP ); +extern void hb_gt_Tone( double dFrequency, double dDuration ); +extern void hb_gt_Bell( void ); extern BOOL hb_gt_Info( int iType, PHB_GT_INFO pInfo ); extern int hb_gt_Alert( PHB_ITEM pMessage, PHB_ITEM pOptions, int iClrNorm, int iClrHigh, double dDelay ); extern int hb_gt_SetFlag( int iType, int iNewValue ); +extern BOOL hb_gt_SetDispCP( char * pszTermCDP, char * pszHostCDP, BOOL fBox ); +extern BOOL hb_gt_SetKeyCP( char * pszTermCDP, char * pszHostCDP ); extern int hb_gt_ReadKey( int iEventMask ); -extern int hb_inkey_Get( BOOL bWait, double dSeconds, int iEventMask ); +extern int hb_inkey_Get( BOOL fWait, double dSeconds, int iEventMask ); extern void hb_inkey_Put( int iKey ); extern int hb_inkey_Last( int iEventMask ); extern int hb_inkey_Next( int iEventMask ); @@ -478,15 +480,26 @@ extern int hb_gt_GfxPrimitive( int iType, int iTop, int iLeft, int iBottom, i extern void hb_gt_GfxText( int iTop, int iLeft, char * szText, int iColor, int iSize, int iWidth ); extern void hb_gt_WhoCares( void * pCargo ); -#define HB_GTSUPER_NEW() (HB_GTSUPER)->New() -#define HB_GTSUPER_FREE(p) (HB_GTSUPER)->Free(p) #define HB_GTSUPER_INIT(i,o,e) (HB_GTSUPER)->Init(i,o,e) #define HB_GTSUPER_EXIT() (HB_GTSUPER)->Exit() -#define HB_GTSUPER_CHECKPOS(r,c,l) (HB_GTSUPER)->CheckPos(r,c,l) -#define HB_GTSUPER_GETPOS(pr,pc) (HB_GTSUPER)->GetPos(pr,pc) -#define HB_GTSUPER_SETPOS(r,c) (HB_GTSUPER)->SetPos(r,c) +#define HB_GTSUPER_NEW() (HB_GTSUPER)->New() +#define HB_GTSUPER_FREE(p) (HB_GTSUPER)->Free(p) +#define HB_GTSUPER_RESIZE(r,c) (HB_GTSUPER)->Resize(r,c) +#define HB_GTSUPER_SETMODE(r,c) (HB_GTSUPER)->SetMode(r,c) +#define HB_GTSUPER_GETSIZE(pr,pc) (HB_GTSUPER)->GetSize(pr,pc) +#define HB_GTSUPER_SEMICOLD() (HB_GTSUPER)->SemiCold() +#define HB_GTSUPER_COLDAREA(t,l,b,r) (HB_GTSUPER)->ColdArea(t,l,b,r) +#define HB_GTSUPER_EXPOSEAREA(t,l,b,r) (HB_GTSUPER)->ExposeArea(t,l,b,r) +#define HB_GTSUPER_SCROLLAREA(t,l,b,r,m,u,v,h) (HB_GTSUPER)->ScrollArea(t,l,b,r,m,u,v,h) +#define HB_GTSUPER_TOUCHCELL(r,c) (HB_GTSUPER)->TouchCell(r,c) +#define HB_GTSUPER_REDRAW(r,c,l) (HB_GTSUPER)->Redraw(r,c,l) +#define HB_GTSUPER_REFRESH() (HB_GTSUPER)->Refresh() +#define HB_GTSUPER_FLUSH() (HB_GTSUPER)->Flush() #define HB_GTSUPER_MAXCOL() (HB_GTSUPER)->MaxCol() #define HB_GTSUPER_MAXROW() (HB_GTSUPER)->MaxRow() +#define HB_GTSUPER_CHECKPOS(r,c,l) (HB_GTSUPER)->CheckPos(r,c,l) +#define HB_GTSUPER_SETPOS(r,c) (HB_GTSUPER)->SetPos(r,c) +#define HB_GTSUPER_GETPOS(pr,pc) (HB_GTSUPER)->GetPos(pr,pc) #define HB_GTSUPER_ISCOLOR() (HB_GTSUPER)->IsColor() #define HB_GTSUPER_GETCOLORSTR(s) (HB_GTSUPER)->GetColorStr(s) #define HB_GTSUPER_SETCOLORSTR(s) (HB_GTSUPER)->SetColorStr(s) @@ -505,57 +518,55 @@ extern void hb_gt_WhoCares( void * pCargo ); #define HB_GTSUPER_GETSCRCURSOR(pr,pc,ps) (HB_GTSUPER)->GetScrCursor(pr,pc,ps) #define HB_GTSUPER_GETSCRCHAR(r,c,pm,pa,pc) (HB_GTSUPER)->GetScrChar(r,c,pm,pa,pc) #define HB_GTSUPER_PUTSCRCHAR(r,c,m,a,u) (HB_GTSUPER)->PutScrChar(r,c,m,a,u) -#define HB_GTSUPER_GETBLINK() (HB_GTSUPER)->GetBlink() -#define HB_GTSUPER_SETBLINK(b) (HB_GTSUPER)->SetBlink(b) -#define HB_GTSUPER_SETSNOWFLAG(b) (HB_GTSUPER)->SetSnowFlag(b) #define HB_GTSUPER_DISPBEGIN() (HB_GTSUPER)->DispBegin() #define HB_GTSUPER_DISPEND() (HB_GTSUPER)->DispEnd() #define HB_GTSUPER_DISPCOUNT() (HB_GTSUPER)->DispCount() -#define HB_GTSUPER_PREEXT() (HB_GTSUPER)->PreExt() -#define HB_GTSUPER_POSTEXT() (HB_GTSUPER)->PostExt() -#define HB_GTSUPER_SUSPEND() (HB_GTSUPER)->Suspend() -#define HB_GTSUPER_RESUME() (HB_GTSUPER)->Resume() -#define HB_GTSUPER_VERSION(i) (HB_GTSUPER)->Version(i) #define HB_GTSUPER_GETCHAR(r,c,pm,pa,pc) (HB_GTSUPER)->GetChar(r,c,pm,pa,pc) #define HB_GTSUPER_PUTCHAR(r,c,m,a,u) (HB_GTSUPER)->PutChar(r,c,m,a,u) -#define HB_GTSUPER_PUTTEXT(r,c,m,s,l) (HB_GTSUPER)->PutText(r,c,m,s,l) -#define HB_GTSUPER_REPLICATE(r,c,m,a,u,l) (HB_GTSUPER)->Replicate(r,c,m,a,u,l) -#define HB_GTSUPER_WRITE(s,l) (HB_GTSUPER)->Write(s,l) -#define HB_GTSUPER_WRITEAT(r,c,s,l) (HB_GTSUPER)->WriteAt(r,c,s,l) -#define HB_GTSUPER_WRITECON(s,l) (HB_GTSUPER)->WriteCon(s,l) -#define HB_GTSUPER_OUTSTD(s,l) (HB_GTSUPER)->OutStd(s,l) -#define HB_GTSUPER_OUTERR(s,l) (HB_GTSUPER)->OutErr(s,l) #define HB_GTSUPER_RECTSIZE(t,l,b,r) (HB_GTSUPER)->RectSize(t,l,b,r) #define HB_GTSUPER_SAVE(t,l,b,r,p) (HB_GTSUPER)->Save(t,l,b,r,p) #define HB_GTSUPER_REST(t,l,b,r,p) (HB_GTSUPER)->Rest(t,l,b,r,p) +#define HB_GTSUPER_PUTTEXT(r,c,m,s,l) (HB_GTSUPER)->PutText(r,c,m,s,l) +#define HB_GTSUPER_REPLICATE(r,c,m,a,u,l) (HB_GTSUPER)->Replicate(r,c,m,a,u,l) +#define HB_GTSUPER_WRITEAT(r,c,s,l) (HB_GTSUPER)->WriteAt(r,c,s,l) +#define HB_GTSUPER_WRITE(s,l) (HB_GTSUPER)->Write(s,l) +#define HB_GTSUPER_WRITECON(s,l) (HB_GTSUPER)->WriteCon(s,l) #define HB_GTSUPER_SETATTRIBUTE(t,l,b,r,m) (HB_GTSUPER)->SetAttribute(t,l,b,r,m) #define HB_GTSUPER_DRAWSHADOW(t,l,b,r,m) (HB_GTSUPER)->DrawShadow(t,l,b,r,m) #define HB_GTSUPER_SCROLL(t,l,b,r,m,u,v,h) (HB_GTSUPER)->Scroll(t,l,b,r,m,u,v,h) #define HB_GTSUPER_SCROLLUP(r,m,u) (HB_GTSUPER)->ScrollUp(r,m,u) #define HB_GTSUPER_BOX(t,l,b,r,f,m) (HB_GTSUPER)->Box(t,l,b,r,f,m) -#define HB_GTSUPER_BOXS(t,l,b,r,f,m) (HB_GTSUPER)->BoxS(t,l,b,r,f,m) #define HB_GTSUPER_BOXD(t,l,b,r,f,m) (HB_GTSUPER)->BoxD(t,l,b,r,f,m) +#define HB_GTSUPER_BOXS(t,l,b,r,f,m) (HB_GTSUPER)->BoxS(t,l,b,r,f,m) #define HB_GTSUPER_HORIZLINE(h,l,r,u,m) (HB_GTSUPER)->HorizLine(h,l,r,u,m) #define HB_GTSUPER_VERTLINE(c,t,b,u,m) (HB_GTSUPER)->VertLine(c,t,b,u,m) -#define HB_GTSUPER_SETMODE(r,c) (HB_GTSUPER)->SetMode(r,c) -#define HB_GTSUPER_RESIZE(r,c) (HB_GTSUPER)->Resize(r,c) -#define HB_GTSUPER_GETSIZE(pr,pc) (HB_GTSUPER)->GetSize(pr,pc) -#define HB_GTSUPER_SEMICOLD() (HB_GTSUPER)->SemiCold() -#define HB_GTSUPER_COLDAREA(t,l,b,r) (HB_GTSUPER)->ColdArea(t,l,b,r) -#define HB_GTSUPER_EXPOSEAREA(t,l,b,r) (HB_GTSUPER)->ExposeArea(t,l,b,r) -#define HB_GTSUPER_SCROLLAREA(t,l,b,r,m,u,v,h) (HB_GTSUPER)->ScrollArea(t,l,b,r,m,u,v,h) -#define HB_GTSUPER_TOUCHCELL(r,c) (HB_GTSUPER)->TouchCell(r,c) -#define HB_GTSUPER_REDRAW(r,c,l) (HB_GTSUPER)->Redraw(r,c,l) -#define HB_GTSUPER_REFRESH() (HB_GTSUPER)->Refresh() -#define HB_GTSUPER_FLUSH() (HB_GTSUPER)->Flush() +#define HB_GTSUPER_GETBLINK() (HB_GTSUPER)->GetBlink() +#define HB_GTSUPER_SETBLINK(b) (HB_GTSUPER)->SetBlink(b) +#define HB_GTSUPER_SETSNOWFLAG(b) (HB_GTSUPER)->SetSnowFlag(b) +#define HB_GTSUPER_VERSION(i) (HB_GTSUPER)->Version(i) +#define HB_GTSUPER_SUSPEND() (HB_GTSUPER)->Suspend() +#define HB_GTSUPER_RESUME() (HB_GTSUPER)->Resume() +#define HB_GTSUPER_PREEXT() (HB_GTSUPER)->PreExt() +#define HB_GTSUPER_POSTEXT() (HB_GTSUPER)->PostExt() +#define HB_GTSUPER_OUTSTD(s,l) (HB_GTSUPER)->OutStd(s,l) +#define HB_GTSUPER_OUTERR(s,l) (HB_GTSUPER)->OutErr(s,l) #define HB_GTSUPER_TONE(f,d) (HB_GTSUPER)->Tone(f,d) #define HB_GTSUPER_BELL() (HB_GTSUPER)->Bell() -#define HB_GTSUPER_SETDISPCP(t,h,b) (HB_GTSUPER)->SetDispCP(t,h,b) -#define HB_GTSUPER_SETKEYCP(t,h) (HB_GTSUPER)->SetKeyCP(t,h) #define HB_GTSUPER_INFO(i,p) (HB_GTSUPER)->Info(i,p) #define HB_GTSUPER_ALERT(m,o,n,h,d) (HB_GTSUPER)->Alert(m,o,n,h,d) #define HB_GTSUPER_SETFLAG(i,f) (HB_GTSUPER)->SetFlag(i,f) +#define HB_GTSUPER_SETDISPCP(t,h,b) (HB_GTSUPER)->SetDispCP(t,h,b) +#define HB_GTSUPER_SETKEYCP(t,h) (HB_GTSUPER)->SetKeyCP(t,h) #define HB_GTSUPER_READKEY(m) (HB_GTSUPER)->ReadKey(m) +#define HB_GTSUPER_INKEYGET(w,d,m) (HB_GTSUPER)->InkeyGet(w,d,m) +#define HB_GTSUPER_INKEYPUT(k) (HB_GTSUPER)->InkeyPut(k) +#define HB_GTSUPER_INKEYLAST(m) (HB_GTSUPER)->InkeyLast(m) +#define HB_GTSUPER_INKEYNEXT(m) (HB_GTSUPER)->InkeyNext(m) +#define HB_GTSUPER_INKEYPOLL() (HB_GTSUPER)->InkeyPoll() +#define HB_GTSUPER_INKEYSETTEXT(s,l) (HB_GTSUPER)->InkeySetText(s,l) +#define HB_GTSUPER_INKEYSETLAST(k) (HB_GTSUPER)->InkeySetLast(k) +#define HB_GTSUPER_INKEYRESET() (HB_GTSUPER)->InkeyReset() +#define HB_GTSUPER_INKEYEXIT() (HB_GTSUPER)->InkeyExit() #define HB_GTSUPER_MOUSEINIT() (HB_GTSUPER)->MouseInit() #define HB_GTSUPER_MOUSEEXIT() (HB_GTSUPER)->MouseExit() #define HB_GTSUPER_MOUSEISPRESENT() (HB_GTSUPER)->MouseIsPresent() @@ -592,12 +603,14 @@ extern HB_EXPORT void hb_gtStartupInit( void ); /* low level GT functions common to different GTs supported by RTL */ extern int hb_gt_chrmapinit( int *piTransTbl, const char *pszTerm, BOOL fSetACSC ); +extern BOOL hb_gt_setClipboard( char * szClipData, ULONG ulLen ); +extern BOOL hb_gt_getClipboard( char ** pszClipData, ULONG *pulLen ); #if defined( HB_OS_WIN_32 ) -extern void hb_gt_w32_Tone( double dFrequency, double dDuration ); -extern BOOL hb_gt_w32_SetClipboard( UINT uFormat, char * szClipData, ULONG ulLen ); -extern BOOL hb_gt_w32_GetClipboard( UINT uFormat, char ** pszClipData, ULONG *pulLen ); +extern BOOL hb_gt_w32_setClipboard( UINT uFormat, char * szClipData, ULONG ulLen ); +extern BOOL hb_gt_w32_getClipboard( UINT uFormat, char ** pszClipData, ULONG *pulLen ); extern int hb_gt_w32_getKbdState( void ); extern void hb_gt_w32_setKbdState( int kbdShifts ); +extern void hb_gt_w32_tone( double dFrequency, double dDuration ); #endif /* HB_OS_WIN_32 */ diff --git a/harbour/source/rtl/gtclip.c b/harbour/source/rtl/gtclip.c index 9e358e12a8..4ba24cd4f5 100644 --- a/harbour/source/rtl/gtclip.c +++ b/harbour/source/rtl/gtclip.c @@ -56,9 +56,40 @@ #define HB_OS_WIN_32_USED #include "hbgtcore.h" +/* TODO: add protection for MT mode */ +static char * s_szClipboardData; +static ULONG s_ulClipboardLen; + +BOOL hb_gt_setClipboard( char * szClipData, ULONG ulLen ) +{ + if( s_ulClipboardLen ) + hb_xfree( s_szClipboardData ); + s_ulClipboardLen = ulLen; + if( s_ulClipboardLen ) + { + s_szClipboardData = ( char * ) hb_xgrab( s_ulClipboardLen + 1 ); + memcpy( s_szClipboardData, szClipData, s_ulClipboardLen ); + s_szClipboardData[ s_ulClipboardLen ] = '\0'; + } + return TRUE; +} + +BOOL hb_gt_getClipboard( char ** pszClipData, ULONG *pulLen ) +{ + *pszClipData = NULL; + *pulLen = s_ulClipboardLen; + if( s_ulClipboardLen ) + { + *pszClipData = ( char * ) hb_xgrab( s_ulClipboardLen + 1 ); + memcpy( *pszClipData, s_szClipboardData, s_ulClipboardLen ); + *pszClipData[ s_ulClipboardLen ] = '\0'; + } + return *pulLen != 0; +} + #if defined( HB_OS_WIN_32 ) -BOOL hb_gt_w32_SetClipboard( UINT uFormat, char * szClipData, ULONG ulLen ) +BOOL hb_gt_w32_setClipboard( UINT uFormat, char * szClipData, ULONG ulLen ) { LPTSTR lptstrCopy; HGLOBAL hglbCopy; @@ -89,7 +120,7 @@ BOOL hb_gt_w32_SetClipboard( UINT uFormat, char * szClipData, ULONG ulLen ) return fResult; } -BOOL hb_gt_w32_GetClipboard( UINT uFormat, char ** pszClipData, ULONG *pulLen ) +BOOL hb_gt_w32_getClipboard( UINT uFormat, char ** pszClipData, ULONG *pulLen ) { HGLOBAL hglb; LPTSTR lptstr; diff --git a/harbour/source/rtl/gtgui/gtgui.c b/harbour/source/rtl/gtgui/gtgui.c index 7a13615742..adba000d09 100644 --- a/harbour/source/rtl/gtgui/gtgui.c +++ b/harbour/source/rtl/gtgui/gtgui.c @@ -87,7 +87,7 @@ static void hb_gt_gui_Tone( double dFrequency, double dDuration ) HB_TRACE(HB_TR_DEBUG, ("hb_gt_gui_Tone(%lf, %lf)", dFrequency, dDuration)); #if defined( HB_OS_WIN_32 ) - hb_gt_w32_Tone( dFrequency, dDuration ); + hb_gt_w32_tone( dFrequency, dDuration ); #else HB_GTSUPER_TONE( dFrequency, dDuration ); #endif @@ -105,7 +105,7 @@ static BOOL hb_gt_gui_Info( int iType, PHB_GT_INFO pInfo ) case GTI_CLIPBOARDDATA: if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) { - hb_gt_w32_SetClipboard( CF_TEXT, hb_itemGetCPtr( pInfo->pNewVal ), + hb_gt_w32_setClipboard( CF_TEXT, hb_itemGetCPtr( pInfo->pNewVal ), hb_itemGetCLen( pInfo->pNewVal ) ); } else @@ -113,7 +113,7 @@ static BOOL hb_gt_gui_Info( int iType, PHB_GT_INFO pInfo ) char * szClipboardData; ULONG ulLen; - if( hb_gt_w32_GetClipboard( CF_TEXT, &szClipboardData, &ulLen ) ) + if( hb_gt_w32_getClipboard( CF_TEXT, &szClipboardData, &ulLen ) ) { pInfo->pResult = hb_itemPutCPtr( pInfo->pResult, szClipboardData, ulLen ); diff --git a/harbour/source/rtl/gttone.c b/harbour/source/rtl/gttone.c index 72cd38b4c3..a55a09e7f5 100644 --- a/harbour/source/rtl/gttone.c +++ b/harbour/source/rtl/gttone.c @@ -231,12 +231,12 @@ static void hb_gt_wNtTone( double dFreq, double dDurat ) /* *********************************************************************** */ /* dDuration is in 'Ticks' (18.2 per second) */ -void hb_gt_w32_Tone( double dFrequency, double dDuration ) +void hb_gt_w32_tone( double dFrequency, double dDuration ) { static OSVERSIONINFO s_osv; static BOOL s_fInit = TRUE; - HB_TRACE(HB_TR_DEBUG, ("hb_gt_w32_Tone(%lf, %lf)", dFrequency, dDuration)); + HB_TRACE(HB_TR_DEBUG, ("hb_gt_w32_tone(%lf, %lf)", dFrequency, dDuration)); if( s_fInit ) { diff --git a/harbour/source/rtl/gtwin/gtwin.c b/harbour/source/rtl/gtwin/gtwin.c index 94ae25ee7d..6b283cb9b2 100644 --- a/harbour/source/rtl/gtwin/gtwin.c +++ b/harbour/source/rtl/gtwin/gtwin.c @@ -1490,7 +1490,7 @@ static void hb_gt_win_Tone( double dFrequency, double dDuration ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_win_Tone(%lf, %lf)", dFrequency, dDuration)); - hb_gt_w32_Tone( dFrequency, dDuration ); + hb_gt_w32_tone( dFrequency, dDuration ); } /* *********************************************************************** */ @@ -1649,14 +1649,14 @@ static BOOL hb_gt_win_Info( int iType, PHB_GT_INFO pInfo ) case GTI_CLIPBOARDDATA: if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) { - hb_gt_w32_SetClipboard( CF_OEMTEXT, hb_itemGetCPtr( pInfo->pNewVal ), + hb_gt_w32_setClipboard( CF_OEMTEXT, hb_itemGetCPtr( pInfo->pNewVal ), hb_itemGetCLen( pInfo->pNewVal ) ); } else { char * szClipboardData; ULONG ulLen; - if( hb_gt_w32_GetClipboard( CF_OEMTEXT, &szClipboardData, &ulLen ) ) + if( hb_gt_w32_getClipboard( CF_OEMTEXT, &szClipboardData, &ulLen ) ) { pInfo->pResult = hb_itemPutCPtr( pInfo->pResult, szClipboardData, diff --git a/harbour/source/rtl/gtwvt/gtwvt.c b/harbour/source/rtl/gtwvt/gtwvt.c index 2edda4ec57..b82e1f9bea 100644 --- a/harbour/source/rtl/gtwvt/gtwvt.c +++ b/harbour/source/rtl/gtwvt/gtwvt.c @@ -1322,7 +1322,7 @@ static void hb_gt_wvt_Tone( double dFrequency, double dDuration ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_wvt_Tone(%lf, %lf)", dFrequency, dDuration)); - hb_gt_w32_Tone( dFrequency, dDuration ); + hb_gt_w32_tone( dFrequency, dDuration ); } /* ********************************************************************** */ @@ -1650,7 +1650,7 @@ static BOOL hb_gt_wvt_Info( int iType, PHB_GT_INFO pInfo ) case GTI_CLIPBOARDDATA: if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) { - hb_gt_w32_SetClipboard( _s.CodePage == OEM_CHARSET ? + hb_gt_w32_setClipboard( _s.CodePage == OEM_CHARSET ? CF_OEMTEXT : CF_TEXT, hb_itemGetCPtr( pInfo->pNewVal ), hb_itemGetCLen( pInfo->pNewVal ) ); @@ -1659,7 +1659,7 @@ static BOOL hb_gt_wvt_Info( int iType, PHB_GT_INFO pInfo ) { char * szClipboardData; ULONG ulLen; - if( hb_gt_w32_GetClipboard( _s.CodePage == OEM_CHARSET ? + if( hb_gt_w32_getClipboard( _s.CodePage == OEM_CHARSET ? CF_OEMTEXT : CF_TEXT, &szClipboardData, &ulLen ) ) { diff --git a/harbour/source/rtl/hbgtcore.c b/harbour/source/rtl/hbgtcore.c index bb973594aa..41c448d95d 100644 --- a/harbour/source/rtl/hbgtcore.c +++ b/harbour/source/rtl/hbgtcore.c @@ -153,8 +153,6 @@ static void hb_gt_def_Free( void * pGtPtr ) hb_xfree( pGT->prevBuffer ); if( pGT->pLines ) hb_xfree( pGT->pLines ); - if( pGT->ulClipboardLen ) - hb_xfree( pGT->szClipboardData ); if( pGT->iColorCount > 0 ) hb_xfree( pGT->pColor ); if( pGT->pGTData ) @@ -186,6 +184,8 @@ static void hb_gt_def_Exit( void ) hb_gt_Free( s_curGT ); s_curGT = NULL; } + /* clear internal clipboard data */ + hb_gt_setClipboard( NULL, 0 ); } static BOOL hb_gt_def_CheckPos( int iRow, int iCol, long *plIndex ) @@ -1565,21 +1565,22 @@ static BOOL hb_gt_def_Info( int iType, PHB_GT_INFO pInfo ) case GTI_CLIPBOARDDATA: if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) - { /* set new Clipboard value */ - if( s_curGT->ulClipboardLen ) - hb_xfree( s_curGT->szClipboardData ); - s_curGT->ulClipboardLen = hb_itemGetCLen( pInfo->pNewVal ); - if( s_curGT->ulClipboardLen ) - { - s_curGT->szClipboardData = ( char * ) hb_xgrab( s_curGT->ulClipboardLen + 1 ); - memcpy( s_curGT->szClipboardData, hb_itemGetCPtr( pInfo->pNewVal ), - s_curGT->ulClipboardLen ); - s_curGT->szClipboardData[ s_curGT->ulClipboardLen ] = '\0'; - } + { + /* set new Clipboard value */ + hb_gt_setClipboard( hb_itemGetCPtr( pInfo->pNewVal ), + hb_itemGetCLen( pInfo->pNewVal ) ); + } + else + { + /* get Clipboard value */ + char * pszClipData; + ULONG ulLen; + + if( hb_gt_getClipboard( &pszClipData, &ulLen ) ) + pInfo->pResult = hb_itemPutCPtr( pInfo->pResult, pszClipData, ulLen ); + else + pInfo->pResult = hb_itemPutC( pInfo->pResult, NULL ); } - else /* get Clipboard value */ - pInfo->pResult = hb_itemPutCL( pInfo->pResult, s_curGT->szClipboardData, - s_curGT->ulClipboardLen ); break; default: