2008-06-15 11:34 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com)

* contrib/gtwvg/gtwvg.c
   * contrib/gtwvg/gtwvg.h
   * contrib/gtwvg/wvtutils.c
   * contrib/gtwvg/wvtcore.c
   * contrib/gtwvg/wvtpaint.prg
   * contrib/gtwvg/wvtclass.prg
     + Implemented all features recently added in gtwvt.

   * contrib/gtwvg/tests/demowvg.prg
     * Just refreshed to match the date/time stamps with gtwvg.lib

     ; This is first attempt in this series of optimizations in gtwvg
       to synchronize it with gtwvt builing a basis for inheretance
       from gtwvt. 
    
       Now all EXPORTed funtions in gtwvg.c are stripped and isolated
       in wvtpaint.prg as prg code taking use of Hb_GtInfo() architecture.

       gtwvg.c contains only static functions and as such GT layer is made
       self contained. For this to happen I had to define few more GTI_* 
       constants which goes in gtwvg.h and local to wvtpaint.prg. One or two 
       of them validly become candidate fot gtwvt/hbgtinfo.ch also.

       TODO: To clean wvtutils.c by plugging the functionality in HB_GTINFO
             structure. Please do not update any of these files.
This commit is contained in:
Pritpal Bedi
2008-06-14 19:03:07 +00:00
parent 0989f45ccf
commit 6c256e12d8
8 changed files with 1433 additions and 1063 deletions

View File

@@ -8,6 +8,33 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-06-15 11:34 UTC+0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/gtwvg/gtwvg.c
* contrib/gtwvg/gtwvg.h
* contrib/gtwvg/wvtutils.c
* contrib/gtwvg/wvtcore.c
* contrib/gtwvg/wvtpaint.prg
* contrib/gtwvg/wvtclass.prg
+ Implemented all features recently added in gtwvt.
* contrib/gtwvg/tests/demowvg.prg
* Just refreshed to match the date/time stamps with gtwvg.lib
; This is first attempt in this series of optimizations in gtwvg
to synchronize it with gtwvt builing a basis for inheretance
from gtwvt.
Now all EXPORTed funtions in gtwvg.c are stripped and isolated
in wvtpaint.prg as prg code taking use of Hb_GtInfo() architecture.
gtwvg.c contains only static functions and as such GT layer is made
self contained. For this to happen I had to define few more GTI_*
constants which goes in gtwvg.h and local to wvtpaint.prg. One or two
of them validly become candidate fot gtwvt/hbgtinfo.ch also.
TODO: To clean wvtutils.c by plugging the functionality in HB_GTINFO
structure. Please do not update any of these files.
2008-06-14 12:03 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
+ contrib/hbtip/tests
+ contrib/hbtip/tests/bld_b32.bat

File diff suppressed because it is too large Load Diff

View File

@@ -98,42 +98,43 @@
#include "hbgfxdef.ch"
#define WVT_CHAR_QUEUE_SIZE 128
#define WVT_MAX_TITLE_SIZE 128
#define WVT_MAX_ROWS 256
#define WVT_MAX_COLS 256
#define WVT_CHAR_QUEUE_SIZE 128
#define WVT_MAX_TITLE_SIZE 128
#define WVT_MAX_ROWS 256
#define WVT_MAX_COLS 256
#if defined( HB_WINCE )
# define WVT_DEFAULT_ROWS 15
# define WVT_DEFAULT_COLS 50
# define WVT_DEFAULT_FONT_HEIGHT 12
# define WVT_DEFAULT_FONT_WIDTH 8
# define WVT_DEFAULT_FONT_WIDTH 8
#else
# define WVT_DEFAULT_ROWS 25
# define WVT_DEFAULT_COLS 80
# define WVT_DEFAULT_FONT_HEIGHT 16
# define WVT_DEFAULT_FONT_WIDTH 8
# define WVT_DEFAULT_FONT_WIDTH 8
#endif
#define WVT_DEFAULT_FONT_NAME "Terminal"
#define BLACK RGB( 0x0 ,0x0 ,0x0 )
#define BLUE RGB( 0x0 ,0x0 ,0x85 )
#define GREEN RGB( 0x0 ,0x85,0x0 )
#define CYAN RGB( 0x0 ,0x85,0x85 )
#define RED RGB( 0x85,0x0 ,0x0 )
#define MAGENTA RGB( 0x85,0x0 ,0x85 )
#define BROWN RGB( 0x85,0x85,0x0 )
#define WHITE RGB( 0xC6,0xC6,0xC6 )
#define LIGHT_GRAY RGB( 0x60,0x60,0x60 )
#define BRIGHT_BLUE RGB( 0x00,0x00,0xFF )
#define BRIGHT_GREEN RGB( 0x60,0xFF,0x60 )
#define BRIGHT_CYAN RGB( 0x60,0xFF,0xFF )
#define BRIGHT_RED RGB( 0xF8,0x00,0x26 )
#define BRIGHT_MAGENTA RGB( 0xFF,0x60,0xFF )
#define YELLOW RGB( 0xFF,0xFF,0x00 )
#define BRIGHT_WHITE RGB( 0xFF,0xFF,0xFF )
#define BLACK RGB( 0x0 ,0x0 ,0x0 )
#define BLUE RGB( 0x0 ,0x0 ,0x85 )
#define GREEN RGB( 0x0 ,0x85,0x0 )
#define CYAN RGB( 0x0 ,0x85,0x85 )
#define RED RGB( 0x85,0x0 ,0x0 )
#define MAGENTA RGB( 0x85,0x0 ,0x85 )
#define BROWN RGB( 0x85,0x85,0x0 )
#define WHITE RGB( 0xC6,0xC6,0xC6 )
#define LIGHT_GRAY RGB( 0x60,0x60,0x60 )
#define BRIGHT_BLUE RGB( 0x00,0x00,0xFF )
#define BRIGHT_GREEN RGB( 0x60,0xFF,0x60 )
#define BRIGHT_CYAN RGB( 0x60,0xFF,0xFF )
#define BRIGHT_RED RGB( 0xF8,0x00,0x26 )
#define BRIGHT_MAGENTA RGB( 0xFF,0x60,0xFF )
#define YELLOW RGB( 0xFF,0xFF,0x00 )
#define BRIGHT_WHITE RGB( 0xFF,0xFF,0xFF )
#define WM_MY_UPDATE_CARET ( WM_USER + 0x0101 )
#define SYS_EV_MARK 1000
//-------------------------------------------------------------------//
#define WVT_PICTURES_MAX 50
#define WVT_FONTS_MAX 50
@@ -145,7 +146,7 @@
#if defined(__DMC__)
#if (_WIN32_IE >= 0x0300)
#if !defined(ICC_BAR_CLASSES)
#define ICC_BAR_CLASSES 0x00000004
#define ICC_BAR_CLASSES 0x00000004
#endif
#if !defined(COLOR16)
typedef USHORT COLOR16;
@@ -244,6 +245,16 @@ typedef struct global_data
BOOL IgnoreWM_SYSCHAR;
BOOL bMaximized; /* Flag is set when window has been maximized */
BOOL bBeingMarked; /* Flag to control DOS window like copy operation */
BOOL bBeginMarked;
char * pszSelectCopy;
BOOL bResizable;
BOOL bSelectCopy;
BOOL bClosable;
BOOL bResizing;
/* *** GUI part *** */
@@ -310,48 +321,6 @@ typedef struct global_data
//-------------------------------------------------------------------//
POINT HB_EXPORT hb_wvt_gtGetXYFromColRow( USHORT col, USHORT row );
BOOL HB_EXPORT hb_wvt_gtSetMenuKeyEvent( int iMenuKeyEvent );
BOOL HB_EXPORT hb_wvt_gtSetCentreWindow( BOOL bCentre, BOOL bPaint );
void HB_EXPORT hb_wvt_gtResetWindow( void );
BOOL HB_EXPORT hb_wvt_gtSetCodePage( int iCodePage );
int HB_EXPORT hb_wvt_gtGetLastMenuEvent( void );
int HB_EXPORT hb_wvt_gtSetLastMenuEvent( int iLastMenuEvent );
void HB_EXPORT hb_wvt_gtSetWindowTitle( char * title );
DWORD HB_EXPORT hb_wvt_gtSetWindowIcon( int icon, char *lpicon );
DWORD HB_EXPORT hb_wvt_gtSetWindowIconFromFile( char *icon );
int HB_EXPORT hb_wvt_gtGetWindowTitle( char *title, int length );
BOOL HB_EXPORT hb_wvt_gtSetFont( char *fontFace, int height, int width, int Bold, int Quality );
//void HB_EXPORT hb_wvt_gtSetCloseEvent( int iEvent );
//void HB_EXPORT hb_wvt_gtSetShutdownEvent( int iEvent );
HWND HB_EXPORT hb_wvt_gtGetWindowHandle( void );
void HB_EXPORT hb_wvt_gtPostMessage( int message );
BOOL HB_EXPORT hb_wvt_gtSetWindowPos( int left, int top );
BOOL HB_EXPORT hb_wvt_gtSetAltF4Close( BOOL bCanClose );
void HB_EXPORT hb_wvt_gtDoProcessMessages( void );
BOOL HB_EXPORT hb_wvt_gtSetMouseMove( BOOL bHandleEvent );
BOOL HB_EXPORT hb_wvt_gtEnableShortCuts( BOOL bEnable );
void HB_EXPORT hb_wvt_gtAddCharToInputQueue( int data );
HB_EXPORT IPicture * hb_wvt_gtLoadPicture( char * image );
HB_EXPORT IPicture * hb_wvt_gtLoadPictureFromResource( LPCSTR cResource, LPCSTR cSection );
BOOL HB_EXPORT hb_wvt_gtRenderPicture( int x1, int y1, int wd, int ht, IPicture * iPicture );
BOOL HB_EXPORT hb_wvt_gtDestroyPicture( IPicture * iPicture );
COLORREF HB_EXPORT hb_wvt_gtGetColorData( int iIndex );
BOOL HB_EXPORT hb_wvt_gtSetColorData( int iIndex, COLORREF ulCr );
BOOL HB_EXPORT hb_wvt_DrawImage( HDC hdc, int x1, int y1, int wd, int ht, char * image );
LPWORD HB_EXPORT lpwAlign( LPWORD lpIn );
int HB_EXPORT nCopyAnsiToWideChar( LPWORD lpWCStr, LPSTR lpAnsiIn );
BOOL HB_EXPORT CALLBACK hb_wvt_gtDlgProcMLess( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam );
BOOL HB_EXPORT CALLBACK hb_wvt_gtDlgProcModal( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam );
GLOBAL_DATA HB_EXPORT * hb_wvt_gtGetGlobalData( void );
void HB_EXPORT hb_wvt_wvtCore( void );
void HB_EXPORT hb_wvt_wvtUtils( void );
//-------------------------------------------------------------------//
#ifndef INVALID_FILE_SIZE
#define INVALID_FILE_SIZE (DWORD)0xFFFFFFFF
#endif
@@ -432,4 +401,38 @@ typedef struct _tag_HB_GT_COLDEF
# define WM_MOUSEWHEEL 0x020A
#endif
//----------------------------------------------------------------------//
POINT HB_EXPORT hb_wvt_gtGetXYFromColRow( USHORT col, USHORT row );
IPicture HB_EXPORT * hb_wvt_gtLoadPicture( char * image );
IPicture HB_EXPORT * hb_wvt_gtLoadPictureFromResource( LPCSTR cResource, LPCSTR cSection );
BOOL HB_EXPORT hb_wvt_gtRenderPicture( int x1, int y1, int wd, int ht, IPicture * iPicture );
BOOL HB_EXPORT hb_wvt_gtDestroyPicture( IPicture * iPicture );
BOOL HB_EXPORT hb_wvt_DrawImage( HDC hdc, int x1, int y1, int wd, int ht, char * image );
LPWORD HB_EXPORT lpwAlign( LPWORD lpIn );
int HB_EXPORT nCopyAnsiToWideChar( LPWORD lpWCStr, LPSTR lpAnsiIn );
BOOL HB_EXPORT CALLBACK hb_wvt_gtDlgProcMLess( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam );
BOOL HB_EXPORT CALLBACK hb_wvt_gtDlgProcModal( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam );
void HB_EXPORT hb_wvt_wvtCore( void );
void HB_EXPORT hb_wvt_wvtUtils( void );
GLOBAL_DATA HB_EXPORT * hb_wvt_gtGetGlobalData( void );
//-------------------------------------------------------------------//
//
// Candidates for inculsion in hbgtinfo.ch
//
#define HB_GTI_SETFONT 71
#define HB_GTI_USER 1000
#define HB_GTU_WINDOWHANDLE 1
#define HB_GTU_CENTERWINDOW 2
#define HB_GTU_PROCESSMESSAGES 3
#define HB_GTU_KEYBOARD 4
#define HB_GTU_RESETWINDOW 5
//----------------------------------------------------------------------//
#endif /* HB_WVT_H_ */

View File

@@ -120,7 +120,7 @@ static paint_:= { { '', {} } }
//-------------------------------------------------------------------//
PROCEDURE Main( cDSN )
LOCAL aLastPaint, clr, scr, bWhen, bValid
LOCAL aLastPaint, clr, scr, bWhen, bValid, a_:={}
LOCAL dDate := ctod( '' )
LOCAL cName := Pad( 'Pritpal Bedi', 35 )
LOCAL cAdd1 := Pad( '60, New Professor Colony', 35 )
@@ -153,6 +153,7 @@ PROCEDURE Main( cDSN )
Popups( 1 )
Wvt_SetFont( 'Courier New', 18, 0, 0 )
Wvt_SetMouseMove( .t. )
Wvt_ShowWindow( SW_RESTORE )
@@ -250,7 +251,7 @@ PROCEDURE Main( cDSN )
SetColor( 'N/W,N/GR*,,,N/W*' )
Wvt_SetMenu( oMenu:hMenu )
Wvt_DrawMenuBar()
SetKey( Wvt_SetMenuKeyEvent(), { || ActivateMenu( oMenu ) } )
@ 6, nColGet SAY '< Date >'
@@ -423,7 +424,7 @@ FUNCTION Wvt_SetFocus( hWnd )
LOCAL nRow := row()
LOCAL nCol := col()
DispOutAt( 1,3, 'Focus Gained!', 'r/w' )
DispOutAt( 1,3, 'Focus Gained!', 'R/W' )
DevPos( nRow, nCol )
@@ -438,7 +439,7 @@ FUNCTION Wvt_KillFocus( hWnd )
LOCAL nRow := row()
LOCAL nCol := col()
DispOutAt( 1,3, 'Focus Lost...', 'B/w' )
DispOutAt( 1,3, 'Focus Lost...', 'B/W' )
DevPos( nRow, nCol )
@@ -684,7 +685,7 @@ FUNCTION WvtMyBrowse()
aAdd( aBlocks, {|| Wvt_DrawBoxRaised( nTop, nLeft, nBottom, nRight ) } )
aAdd( aBlocks, {|| Wvt_DrawBoxRecessed( nTop+3, nLeft+2, nBottom-1, nRight-2 ) } )
aAdd( aBlocks, {|| Wvt_DrawGridHorz( oBrowse:nTop+3, oBrowse:nLeft, oBrowse:nRight, oBrowse:nBottom - oBrowse:nTop - 2 ) } )
//aAdd( aBlocks, {|| Wvt_DrawGridVert( oBrowse:nTop, oBrowse:nBottom, oBrowse:aColumnsSep, len( oBrowse:aColumnsSep ) ) } )
aAdd( aBlocks, {|| Wvt_DrawGridVert( oBrowse:nTop, oBrowse:nBottom, oBrowse:aColumnsSep, len( oBrowse:aColumnsSep ) ) } )
aLastPaint := WvtSetBlocks( aBlocks )
@@ -2098,3 +2099,6 @@ FUNCTION DrawSlide( hDlg, nSlide )
Win_ReleaseDC( hDlg,hDC )
Return nil
//----------------------------------------------------------------------//

View File

@@ -353,16 +353,15 @@ METHOD Destroy() CLASS wvtDialog
if ::oldMenuHandle <> nil .and. ::oldMenuHandle <> 0
Wvt_SetMenu( ::oldMenuHandle )
Wvt_DrawMenuBar()
endif
SetKey( Wvt_SetMenuKeyEvent(), ::oldMenuBlock )
RestScreen( 0, 0, maxrow(), maxcol(), ::cScreen )
Wvt_RestScreen( 0, 0 ,maxrow(), maxcol(), ::aWvtScreen )
PurgePaint( ::cPaintBlockID )
WvtSetPaint( ::aOldPnt )
Wvt_SetGui( ::lGui )
RETURN nil
//-------------------------------------------------------------------//

View File

@@ -908,7 +908,7 @@ static COLORREF hb_wvt_BgColorParam( int iParam )
int iColor = ISCHAR( iParam ) ? hb_gtColorToN( hb_parc( iParam ) ) : - 1;
if( iColor == -1 )
iColor = hb_gtGetCurrColor();
color = hb_wvt_gtGetColorData( ( iColor >> 4 ) & 0x0f );
color = _s->COLORS[ ( ( iColor >> 4 ) & 0x0f ) ];
}
return color;
@@ -925,7 +925,7 @@ static COLORREF hb_wvt_FgColorParam( int iParam )
int iColor = ISCHAR( iParam ) ? hb_gtColorToN( hb_parc( iParam ) ) : - 1;
if( iColor == -1 )
iColor = hb_gtGetCurrColor();
color = hb_wvt_gtGetColorData( iColor & 0x0f );
color = _s->COLORS[ ( ( iColor >> 4 ) & 0x0f ) ];
}
return color;
@@ -1686,8 +1686,8 @@ HB_FUNC( WVT_DRAWBUTTON )
BOOL bText = ISCHAR( 5 );
BOOL bImage = !( ISNIL( 6 ) );
int iFormat = ISNIL( 7 ) ? 0 : hb_parni( 7 );
COLORREF textColor = ISNIL( 8 ) ? hb_wvt_gtGetColorData( 0 ) : ( COLORREF ) hb_parnl( 8 ) ;
COLORREF bkColor = ISNIL( 9 ) ? hb_wvt_gtGetColorData( 7 ) : ( COLORREF ) hb_parnl( 9 ) ;
COLORREF textColor = ISNIL( 8 ) ? _s->COLORS[ 0 ] : ( COLORREF ) hb_parnl( 8 ) ;
COLORREF bkColor = ISNIL( 9 ) ? _s->COLORS[ 7 ] : ( COLORREF ) hb_parnl( 9 ) ;
// int iImageAt = ISNIL( 10 ) ? 0 : hb_parni( 10 );
xy = hb_wvt_gtGetXYFromColRow( hb_parni( 2 ), hb_parni( 1 ) );
@@ -2980,7 +2980,7 @@ HB_FUNC( WVT_DRAWPROGRESSBAR )
}
else
{
crBarColor = ISNIL( 8 ) ? hb_wvt_gtGetColorData( 0 ) : ( COLORREF ) hb_parnl( 8 );
crBarColor = ISNIL( 8 ) ? _s->COLORS[ 0 ] : ( COLORREF ) hb_parnl( 8 );
lb.lbStyle = BS_SOLID;
lb.lbColor = crBarColor;

View File

@@ -556,5 +556,182 @@ FUNCTION WVT_GetSaveFileName( hWnd, cFile, cTitle, aFilter, nFlags, cIniDir, cDe
Return ( cFile )
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//
// C Functions to PRG Ports
//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
#include 'hbgtinfo.ch'
// Eventually the defines below should go into hbgtinfo.ch
//
#define HB_GTI_SETFONT 71
#define HB_GTI_USER 1000
#define HB_GTU_WINDOWHANDLE 1
#define HB_GTU_CENTERWINDOW 2
#define HB_GTU_PROCESSMESSAGES 3
#define HB_GTU_KEYBOARD 4
#define HB_GTU_RESETWINDOW 5
//----------------------------------------------------------------------//
FUNCTION Wvt_SetTitle( cTitle )
RETURN Hb_GtInfo( HB_GTI_WINTITLE, cTitle )
//----------------------------------------------------------------------//
FUNCTION Wvt_GetTitle()
RETURN Hb_GtInfo( HB_GTI_WINTITLE )
//----------------------------------------------------------------------//
FUNCTION Wvt_SetIcon( ncIconRes, cIconName )
if valtype( ncIconRes ) == 'N'
Hb_GtInfo( HB_GTI_ICONRES, ncIconRes )
elseif valtype( cIconName ) == 'C'
Hb_GtInfo( HB_GTI_ICONRES, cIconName )
elseif valtype( ncIconRes ) == 'C'
Hb_GtInfo( HB_GTI_ICONFILE, ncIconRes )
endif
RETURN NIL
//----------------------------------------------------------------------//
FUNCTION Wvt_SetFont( cFontName, nSize, nWidth, nWeight, nQuality )
DEFAULT cFontName TO Hb_GtInfo( HB_GTI_FONTNAME )
DEFAULT nWidth TO Hb_GtInfo( HB_GTI_FONTWIDTH )
DEFAULT nWeight TO Hb_GtInfo( HB_GTI_FONTWEIGHT )
DEFAULT nQuality TO Hb_GtInfo( HB_GTI_FONTQUALITY )
DEFAULT nSize TO Hb_GtInfo( HB_GTI_FONTSIZE )
RETURN Hb_GtInfo( HB_GTI_SETFONT, { cFontName, nSize, nWidth, nWeight, nQuality } )
//----------------------------------------------------------------------//
FUNCTION Wvt_SetCodePage( nCodePage )
RETURN Hb_GtInfo( HB_GTI_CODEPAGE, nCodePage )
//----------------------------------------------------------------------//
FUNCTION Wvt_GetPalette()
RETURN Hb_GtInfo( HB_GTI_PALETTE )
//----------------------------------------------------------------------//
FUNCTION Wvt_SetPalette( aRGB )
RETURN Hb_GtInfo( HB_GTI_PALETTE, aRGB )
//----------------------------------------------------------------------//
FUNCTION Wvt_GetRGBColor( nIndex )
RETURN Hb_GtInfo( HB_GTI_PALETTE, nIndex )
//----------------------------------------------------------------------//
FUNCTION Wvt_SetAltF4Close( lSetClose )
RETURN Hb_GtInfo( HB_GTI_CLOSABLE, lSetClose )
//----------------------------------------------------------------------//
FUNCTION Wvt_GetScreenWidth()
RETURN Hb_GtInfo( HB_GTI_DESKTOPWIDTH )
//-------------------------------------------------------------------//
FUNCTION Wvt_GetScreenHeight()
RETURN Hb_GtInfo( HB_GTI_DESKTOPHEIGHT )
//-------------------------------------------------------------------//
FUNCTION WVT_GETWINDOWHANDLE()
RETURN Hb_GtInfo( HB_GTI_USER, HB_GTU_WINDOWHANDLE )
//-------------------------------------------------------------------//
FUNCTION WVT_CENTERWINDOW( lCenter, lRePaint )
DEFAULT lCenter TO .t.
DEFAULT lRePaint TO .f.
RETURN Hb_GtInfo( HB_GTI_USER, HB_GTU_CENTERWINDOW, { lCenter, lRePaint } )
//-------------------------------------------------------------------//
FUNCTION WVT_SETWINDOWCENTRE( lCenter, lRePaint )
DEFAULT lCenter TO .t.
DEFAULT lRePaint TO .f.
RETURN Hb_GtInfo( HB_GTI_USER, HB_GTU_CENTERWINDOW, { lCenter, lRePaint } )
//-------------------------------------------------------------------//
FUNCTION WVT_PROCESSMESSAGES()
Hb_GtInfo( HB_GTI_USER, HB_GTU_PROCESSMESSAGES )
RETURN .t.
//----------------------------------------------------------------------//
FUNCTION WVT_KEYBOARD( nKey )
Hb_GtInfo( HB_GTI_USER, HB_GTU_KEYBOARD, nKey )
RETURN NIL
//-------------------------------------------------------------------//
FUNCTION WVT_GETCLIPBOARD()
RETURN Hb_GtInfo( HB_GTI_CLIPBOARDDATA )
//-------------------------------------------------------------------//
FUNCTION WVT_SETCLIPBOARD( cText )
RETURN Hb_GtInfo( HB_GTI_CLIPBOARDDATA, cText )
//-------------------------------------------------------------------//
FUNCTION WVT_PASTEFROMCLIPBOARD()
Local cText, nLen, i
cText := Hb_GtInfo( HB_GTI_CLIPBOARDDATA )
if ( nLen := Len( cText ) ) > 0
for i := 1 to nLen
Wvt_KeyBoard( asc( substr( cText, i, 1 ) ) )
next
endif
RETURN NIL
//-------------------------------------------------------------------//
FUNCTION Wvt_ResetWindow()
RETURN Hb_GtInfo( HB_GTI_USER, HB_GTU_RESETWINDOW )
//----------------------------------------------------------------------//

View File

@@ -527,6 +527,20 @@ HB_FUNC( WVT_MAXIMIZE )
//-------------------------------------------------------------------//
HB_FUNC( WVT_HIDE )
{
ShowWindow( _s->hWnd, SW_HIDE );
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_SHOW )
{
ShowWindow( _s->hWnd, SW_SHOWNORMAL );
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_SETMOUSEPOS )
{
POINT xy = { 0,0 };
@@ -640,81 +654,30 @@ HB_FUNC( WVT_SETPOINTER )
//-------------------------------------------------------------------//
HB_FUNC( WVT_SETFONT )
{
hb_retl( hb_wvt_gtSetFont(
ISNIL( 1 ) ? _s->fontFace : hb_parc( 1 ),
ISNIL( 2 ) ? _s->fontHeight : hb_parni( 2 ),
ISNIL( 3 ) ? _s->fontWidth : hb_parni( 3 ),
ISNIL( 4 ) ? _s->fontWeight : hb_parni( 4 ),
ISNIL( 5 ) ? _s->fontQuality: hb_parni( 5 )
) ) ;
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_SETICON )
{
if ( ISNUM( 1 ) || ISCHAR( 2 ) )
{
hb_retnl( hb_wvt_gtSetWindowIcon( hb_parni( 1 ), hb_parc( 2 ) ) ) ;
}
else
{
hb_retnl( hb_wvt_gtSetWindowIconFromFile( hb_parc( 1 ) ) ) ;
}
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_SETTITLE )
{
hb_wvt_gtSetWindowTitle( hb_parc( 1 ) ) ;
return ;
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_SETWINDOWPOS )
{
hb_wvt_gtSetWindowPos( hb_parni( 1 ), hb_parni( 2 ) );
}
RECT rect = { 0,0,0,0 };
//-------------------------------------------------------------------//
GetWindowRect( _s->hWnd, &rect );
HB_FUNC( WVT_GETWINDOWHANDLE )
{
hb_retnl( ( LONG ) hb_wvt_gtGetWindowHandle() ) ;
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_SETCODEPAGE )
{
hb_retni( hb_wvt_gtSetCodePage( hb_parni( 1 ) ) );
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_CENTERWINDOW )
{
hb_retl( hb_wvt_gtSetCentreWindow(
ISNIL( 1 ) ? TRUE : hb_parl( 1 ),
ISNIL( 2 ) ? FALSE : hb_parl( 2 ) ) );
hb_retl( SetWindowPos( _s->hWnd, NULL,
hb_parni( 1 ),
hb_parni( 2 ),
rect.right - rect.left + 1,
rect.bottom - rect.top + 1,
SWP_NOZORDER ) );
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_SETMOUSEMOVE )
{
if ( ISNIL( 1 ) )
{
hb_retl( _s->MouseMove );
}
else
{
hb_retl( hb_wvt_gtSetMouseMove( hb_parl( 1 ) ) );
}
BOOL bMouseMove = _s->MouseMove;
if( ISLOG( 1 ) )
_s->MouseMove = hb_parl( 1 );
hb_retl( bMouseMove );
}
//-------------------------------------------------------------------//
@@ -749,34 +712,6 @@ HB_FUNC( WVT_GETFONTINFO )
hb_itemReturnRelease( info );
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_GETPALETTE )
{
PHB_ITEM info = hb_itemArrayNew( 16 );
int i;
for ( i = 0; i < 16; i++ )
{
hb_arraySetNL( info, i+1, hb_wvt_gtGetColorData( i ) );
}
hb_itemReturnRelease( info );
}
//-------------------------------------------------------------------//
//
// Wvt_SetPalette( aRGBValues ) -> An array of 16 elements with RGB values
//
HB_FUNC( WVT_SETPALETTE )
{
int i;
for ( i = 0; i < 16; i++ )
{
hb_wvt_gtSetColorData( i, hb_parnl( 1, i+1 ) );
}
}
//-------------------------------------------------------------------//
//-------------------------------------------------------------------//
//-------------------------------------------------------------------//
@@ -789,9 +724,28 @@ HB_FUNC( WVT_SETPALETTE )
HB_FUNC( WVT_SETMENU )
{
RECT wi = { 0, 0, 0, 0 };
RECT ci = { 0, 0, 0, 0 };
RECT rc = { 0, 0, 0, 0 };
USHORT height, width;
SetMenu( _s->hWnd, ( HMENU ) hb_parni( 1 ) ) ;
hb_wvt_gtResetWindow();
GetWindowRect( _s->hWnd, &wi );
GetClientRect( _s->hWnd, &ci );
height = ( USHORT ) ( _s->PTEXTSIZE.y * _s->ROWS );
width = ( USHORT ) ( _s->PTEXTSIZE.x * _s->COLS );
width += ( USHORT ) ( wi.right - wi.left - ci.right );
height += ( USHORT ) ( wi.bottom - wi.top - ci.bottom );
if( _s->CentreWindow && SystemParametersInfo( SPI_GETWORKAREA, 0, &rc, 0 ) )
{
wi.left = rc.left + ( ( rc.right - rc.left - width ) / 2 );
wi.top = rc.top + ( ( rc.bottom - rc.top - height ) / 2 );
}
SetWindowPos( _s->hWnd, NULL, wi.left, wi.top, width, height, SWP_NOZORDER );
}
//-------------------------------------------------------------------//
@@ -884,28 +838,30 @@ HB_FUNC( WVT_ENABLEMENUITEM )
HB_FUNC( WVT_GETLASTMENUEVENT )
{
hb_retni( hb_wvt_gtGetLastMenuEvent() ) ;
hb_retni( _s->LastMenuEvent );
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_SETLASTMENUEVENT )
{
hb_retni( hb_wvt_gtSetLastMenuEvent( hb_parni(1) ) );
int iEvent = _s->LastMenuEvent;
if ( ISNUM( 1 ) )
_s->LastMenuEvent = hb_parni( 1 );
hb_retni( iEvent );
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_SETMENUKEYEVENT )
{
int iEvent = 0;
int iOldEvent = _s->MenuKeyEvent;
if ( ISNUM( 1 ) )
{
iEvent = hb_parnl( 1 ) ;
}
if( ISNUM( 1 ) )
_s->MenuKeyEvent = hb_parni( 1 );
hb_retni( hb_wvt_gtSetMenuKeyEvent( iEvent ) ) ;
hb_retni( iOldEvent ) ;
}
//-------------------------------------------------------------------//
@@ -917,148 +873,14 @@ HB_FUNC( WVT_DRAWMENUBAR )
//-------------------------------------------------------------------//
HB_FUNC( WVT_GETSCREENWIDTH )
HB_FUNC( WVT_ENABLESHORTCUTS )
{
hb_retni( GetSystemMetrics( SM_CXSCREEN ) );
}
BOOL bWas = _s->EnableShortCuts;
//-------------------------------------------------------------------//
if( ISLOG( 1 ) )
_s->EnableShortCuts = hb_parl( 1 );
HB_FUNC( WVT_GETSCREENHEIGHT )
{
hb_retni( GetSystemMetrics( SM_CYSCREEN ) );
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_SETWINDOWCENTRE )
{
hb_wvt_gtSetCentreWindow( hb_parl( 1 ), hb_parl( 2 ) ) ;
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_SETALTF4CLOSE )
{
hb_retl( hb_wvt_gtSetAltF4Close( hb_parl( 1 ) ) );
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_PROCESSMESSAGES )
{
hb_wvt_gtDoProcessMessages();
hb_retl( 1 );
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_GETTITLE )
{
TCHAR buffer[WVT_MAX_TITLE_SIZE];
int iResult;
iResult = GetWindowText( _s->hWnd, buffer, WVT_MAX_TITLE_SIZE );
if( iResult > 0 )
{
hb_retc( HB_TCHAR_CONVFROM( buffer ) );
}
else
{
hb_retc( "" );
}
}
//-------------------------------------------------------------------//
//-------------------------------------------------------------------//
//-------------------------------------------------------------------//
//
// Author.....: Francesco Saverio Giudice <info@fsgiudice.com>
// Syntax.....: Wvt_GetRGBColor( nColor ) --> nRGBColor
// Description: Return the RGB values passing the color positional value
// 0=Black, 1=Blue, etc
// as returned from hb_ColorToN()
// Creat. Date: 2004/01/15
// Last Modif.: 2004/01/15
//
//-------------------------------------------------------------------//
//-------------------------------------------------------------------//
//-------------------------------------------------------------------//
HB_FUNC( WVT_GETRGBCOLOR )
{
int iColor;
if ( !ISNIL( 1 ) )
{
iColor = hb_parni( 1 );
if ( iColor >= 0 && iColor < 16 ) /* Test bound error */
{
hb_retnl( hb_wvt_gtGetColorData( iColor ) );
}
}
}
//-------------------------------------------------------------------//
//-------------------------------------------------------------------//
//-------------------------------------------------------------------//
//
// Giancarlo Niccolai
//
//-------------------------------------------------------------------//
//-------------------------------------------------------------------//
//-------------------------------------------------------------------//
HB_FUNC( WVT_GETCLIPBOARD )
{
char * szClipboardData;
ULONG ulLen;
if( hb_gt_w32_getClipboard( _s->CodePage == OEM_CHARSET ?
CF_OEMTEXT : CF_TEXT,
&szClipboardData, &ulLen ) )
{
hb_retclen_buffer( szClipboardData, ulLen );
}
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_SETCLIPBOARD )
{
if( ISCHAR( 1 ) )
hb_retl( hb_gt_w32_setClipboard( _s->CodePage == OEM_CHARSET ?
CF_OEMTEXT : CF_TEXT,
hb_parc( 1 ), hb_parclen( 1 ) ) );
else
hb_retl( FALSE );
}
//-------------------------------------------------------------------//
HB_FUNC( WVT_PASTEFROMCLIPBOARD )
{
char * szClipboardData;
ULONG ulLen, ul;
if( hb_gt_w32_getClipboard( _s->CodePage == OEM_CHARSET ?
CF_OEMTEXT : CF_TEXT,
&szClipboardData, &ulLen ) )
{
for( ul = 0; ul < ulLen; ul++ )
{
hb_wvt_gtAddCharToInputQueue( ( UCHAR ) szClipboardData[ ul ] );
}
}
}
//-------------------------------------------------------------------//
//-------------------------------------------------------------------//
//-------------------------------------------------------------------//
HB_FUNC( WVT_KEYBOARD )
{
hb_wvt_gtAddCharToInputQueue( hb_parnl( 1 ) );
hb_retl( bWas );
}
//-------------------------------------------------------------------//
@@ -2389,5 +2211,17 @@ HB_FUNC( WIN_CHOOSECOLOR )
//-------------------------------------------------------------------//
HB_FUNC( WIN_FINDWINDOW )
{
HWND hwnd = FindWindow( NULL, hb_parc( 1 ) );
if ( hwnd )
{
hb_retnl( (LONG) hwnd );
}
else
{
hb_retnl( -1 );
}
}
//----------------------------------------------------------------------//