From f5837235c8c9e0a78acb5b45f3469975a6eb3dff Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 18 Oct 2012 19:07:01 +0000 Subject: [PATCH] 2012-10-18 20:59 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbmisc/hb_f.c ! fixed clang warning * contrib/hbzebra/datamtrx.c ! applied patch from Mindaugas, fixing literal truncation warning on MSVC. Thank you. * include/harbour.hbx * src/rtl/mouse53.c + added HB_MGETBOUNDS( /* @ */ nTop, /* @ */ nLeft, /* @ */ nBotton, /* @ */ nRight ) -> NIL * contrib/hbnf/hbnf.hbx * contrib/hbnf/mouse.c * contrib/hbnf/mouse1.prg * all possible MS-DOS specific mouse handling functions rewritten in Harbour using core mouse API. Now the included sample more or less work. There are still two important functions (FT_MBUT*()) that are MS-DOS specific and don't work. Have no idea yet how to rewrite these in multiplatform way, they work in very MS-DOS specific way. ! fixed few bugs along the way. Maybe introduced new ones. It doesn't help that NF functions (sometimes?) use X for vertical and Y for horizontal position. * contrib/hbnf/tests/mouse1.prg % turn cursor off to avoid excessive flicker * contrib/hbnf/fttext.c * contrib/hbnf/tests/metaph.prg * contrib/hbnf/tests/prtesc.prg * extras/gtwvw/docs/funclist.txt * formatting (mostly fighting long separator lines still) * src/rtl/mousehb.c % use HB_FUNC_TRANSLATE() --- harbour/ChangeLog | 63 +- harbour/contrib/hbmisc/hb_f.c | 12 +- harbour/contrib/hbnf/fttext.c | 43 +- harbour/contrib/hbnf/hbnf.hbx | 1 - harbour/contrib/hbnf/mouse.c | 227 ---- harbour/contrib/hbnf/mouse1.prg | 103 +- harbour/contrib/hbnf/tests/metaph.prg | 6 - harbour/contrib/hbnf/tests/mouse1.prg | 2 + harbour/contrib/hbnf/tests/prtesc.prg | 4 - harbour/contrib/hbzebra/datamtrx.c | 33 +- harbour/extras/gtwvw/docs/funclist.txt | 1512 ++++++++++++------------ harbour/include/harbour.hbx | 1 + harbour/src/rtl/mouse53.c | 12 + harbour/src/rtl/mousehb.c | 7 +- 14 files changed, 954 insertions(+), 1072 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b7bc315d99..d6afed8a69 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,44 @@ The license applies to all entries newer than 2009-04-28. */ +2012-10-18 20:59 UTC+0200 Viktor Szakats (harbour syenar.net) + * contrib/hbmisc/hb_f.c + ! fixed clang warning + + * contrib/hbzebra/datamtrx.c + ! applied patch from Mindaugas, fixing literal truncation + warning on MSVC. Thank you. + + * include/harbour.hbx + * src/rtl/mouse53.c + + added HB_MGETBOUNDS( /* @ */ nTop, /* @ */ nLeft, /* @ */ nBotton, /* @ */ nRight ) -> NIL + + * contrib/hbnf/hbnf.hbx + * contrib/hbnf/mouse.c + * contrib/hbnf/mouse1.prg + * all possible MS-DOS specific mouse handling + functions rewritten in Harbour using core mouse API. + Now the included sample more or less work. + There are still two important functions (FT_MBUT*()) + that are MS-DOS specific and don't work. Have no + idea yet how to rewrite these in multiplatform way, + they work in very MS-DOS specific way. + ! fixed few bugs along the way. Maybe introduced new + ones. It doesn't help that NF functions (sometimes?) + use X for vertical and Y for horizontal position. + + * contrib/hbnf/tests/mouse1.prg + % turn cursor off to avoid excessive flicker + + * contrib/hbnf/fttext.c + * contrib/hbnf/tests/metaph.prg + * contrib/hbnf/tests/prtesc.prg + * extras/gtwvw/docs/funclist.txt + * formatting (mostly fighting long separator lines still) + + * src/rtl/mousehb.c + % use HB_FUNC_TRANSLATE() + 2012-10-18 14:50 UTC+0200 Viktor Szakats (harbour syenar.net) * INSTALL ! found typo (while testing a diffing tool) @@ -160,19 +198,18 @@ This is the complete list of MSVC warnings that remain after this: --- - harbour.y(1077) : warning C4244: '=' : conversion from 'HB_SIZE' to 'int', possible loss of data - harbour.y(1371) : warning C4309: 'argument' : truncation of constant value - harbour.y(1374) : warning C4309: 'argument' : truncation of constant value - harboury.c(4089) : warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data - harboury.c(7737) : warning C4702: unreachable code - harboury.c(7776) : warning C4701: potentially uninitialized local variable 'hb_comp_yylval' used - macroy.c(1786) : warning C4065: switch statement contains 'default' but no 'case' labels - macroy.c(1915) : warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data - macroy.c(3254) : warning C4702: unreachable code - macroy.c(3293) : warning C4701: potentially uninitialized local variable 'hb_macro_yylval' used - ../../../dbffpt1.c(521) : warning C4310: cast truncates constant value - ../../../dbffpt1.c(904) : warning C4310: cast truncates constant value - hbzebra\datamtrx.c(149) : warning C4310: cast truncates constant value + harbour.y(1077) : warning C4244: '=' : conversion from 'HB_SIZE' to 'int', possible loss of data + harbour.y(1371) : warning C4309: 'argument' : truncation of constant value + harbour.y(1374) : warning C4309: 'argument' : truncation of constant value + harboury.c(4089) : warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data + harboury.c(7737) : warning C4702: unreachable code + harboury.c(7776) : warning C4701: potentially uninitialized local variable 'hb_comp_yylval' used + macroy.c(1786) : warning C4065: switch statement contains 'default' but no 'case' labels + macroy.c(1915) : warning C4244: '=' : conversion from 'int' to 'yytype_int16', possible loss of data + macroy.c(3254) : warning C4702: unreachable code + macroy.c(3293) : warning C4701: potentially uninitialized local variable 'hb_macro_yylval' used + ../../../dbffpt1.c(521) : warning C4310: cast truncates constant value + ../../../dbffpt1.c(904) : warning C4310: cast truncates constant value --- 2012-10-17 22:04 UTC+0200 Viktor Szakats (harbour syenar.net) diff --git a/harbour/contrib/hbmisc/hb_f.c b/harbour/contrib/hbmisc/hb_f.c index 5368ea83a7..dc630a6fcf 100644 --- a/harbour/contrib/hbmisc/hb_f.c +++ b/harbour/contrib/hbmisc/hb_f.c @@ -162,24 +162,23 @@ static long hb_hbfskip( PFT_TEXT ft_text, char * buffer, HB_SIZE bufsize, int re } else { - recs = -recs; - ft_text->isEof[ ft_text->area ] = HB_FALSE; + recs = -recs; + ft_text->isEof[ ft_text->area ] = HB_FALSE; if( ( ft_text->recno[ ft_text->area ] - recs ) < 1 ) return 1; for( y = recs; y > 0; --y ) { - if( ft_text->offset[ ft_text->area ] - bufsize < 0 ) + read_pos = ( size_t ) ( ft_text->offset[ ft_text->area ] - bufsize ); + + if( read_pos < 0 ) { read_pos = 0; read_len = ( size_t ) ft_text->offset[ ft_text->area ]; } else - { - read_pos = ( size_t ) ( ft_text->offset[ ft_text->area ] - bufsize ); read_len = bufsize; - } hb_fsSeekLarge( ft_text->handles[ ft_text->area ], read_pos, FS_SET ); read_len = hb_fsReadLarge( ft_text->handles[ ft_text->area ], buffer, read_len ); @@ -400,7 +399,6 @@ HB_FUNC( HB_FINFO ) /* used for debugging */ It does its own skip and read, so an entire file can be read sequentially with just this function. -BH - -------------------------------------------------- */ HB_FUNC( HB_FREADANDSKIP ) { diff --git a/harbour/contrib/hbnf/fttext.c b/harbour/contrib/hbnf/fttext.c index 33ebf693ed..a67e81a9e0 100644 --- a/harbour/contrib/hbnf/fttext.c +++ b/harbour/contrib/hbnf/fttext.c @@ -382,14 +382,12 @@ static long _ft_skip( long iRecs ) ft_text->last_off[ ft_text->area ] = ft_text->offset[ ft_text->area ]; ft_text->error[ ft_text->area ] = hb_fsError(); break; - } iBytesRemaining = iBytesRead; /* parse the buffer while there's still stuff in it */ do { - /* get count of chars in this line */ iByteCount = _findeol( cPtr, iBytesRemaining ); @@ -476,7 +474,6 @@ static long _ft_skip( long iRecs ) /* parse the buffer while there's still stuff in it */ do { - /* get count of chars in this line */ iByteCount = _findbol( cPtr, iBytesRemaining ); @@ -495,7 +492,6 @@ static long _ft_skip( long iRecs ) } else { - /* no more CRLFs in this buffer so we're either at BOF or record crosses buffer boundary */ /* check for BOF */ @@ -520,7 +516,6 @@ static long _ft_skip( long iRecs ) } else { - ft_text->offset[ ft_text->area ] = 0; ft_text->recno[ ft_text->area ] = 1; ft_text->isBof[ ft_text->area ] = HB_TRUE; @@ -840,19 +835,17 @@ HB_FUNC( FT_FGOTO ) } /*---------------------------------------------------------------------- + In-line assembler routine to parse a buffer + for a CRLF pair - _findeol() - In-line assembler routine to parse a buffer - for a CRLF pair + Returns count to first character _after_ next + CRLF pair (beginning of next line). Current line + will contain the trailing CRLF. 1Ah and trailing + LFs will be ignored (included in count). - Returns count to first character _after_ next - CRLF pair (beginning of next line). Current line - will contain the trailing CRLF. 1Ah and trailing - LFs will be ignored (included in count). - - If no CRLF found return is zero. (could mean EOF or - line is longer than buffer end) - - ------------------------------------------------------------------------*/ + If no CRLF found return is zero. (could mean EOF or + line is longer than buffer end) + */ static HB_ISIZ _findeol( char * buf, HB_ISIZ buf_len ) { HB_ISIZ tmp; @@ -869,17 +862,15 @@ static HB_ISIZ _findeol( char * buf, HB_ISIZ buf_len ) } /*---------------------------------------------------------------------- + In-line assembler routine to parse a buffer + for a CRLF pair - _findbol() - In-line assembler routine to parse a buffer - for a CRLF pair - - buf pointer points at beginning of search (end - of the buffer), all searches are conducted - backwards, returns No. of characters betw. - initial position and first character _after_ - the preceding CRLF pair (beginning of line). - - ------------------------------------------------------------------------*/ + buf pointer points at beginning of search (end + of the buffer), all searches are conducted + backwards, returns No. of characters betw. + initial position and first character _after_ + the preceding CRLF pair (beginning of line). + */ static HB_ISIZ _findbol( char * buf, HB_ISIZ buf_len ) { HB_ISIZ tmp = buf_len - 1; diff --git a/harbour/contrib/hbnf/hbnf.hbx b/harbour/contrib/hbnf/hbnf.hbx index 98546ad8b9..c5efacd3d2 100644 --- a/harbour/contrib/hbnf/hbnf.hbx +++ b/harbour/contrib/hbnf/hbnf.hbx @@ -240,7 +240,6 @@ DYNAMIC _FT_DFINIT DYNAMIC _FT_NWKSTAT DYNAMIC _FT_TEMPFIL DYNAMIC _MSET_SENSITIVE -DYNAMIC _M_RESET #if defined( __HBEXTREQ__ ) .OR. defined( __HBEXTERN__HBNF__REQUEST ) #uncommand DYNAMIC => EXTERNAL diff --git a/harbour/contrib/hbnf/mouse.c b/harbour/contrib/hbnf/mouse.c index 75b6b28d3f..d081379619 100644 --- a/harbour/contrib/hbnf/mouse.c +++ b/harbour/contrib/hbnf/mouse.c @@ -56,73 +56,6 @@ # include #endif -HB_FUNC( FT_MGETPAGE ) -{ - int iPage; - -#if defined( HB_OS_DOS ) && 0 - { - union REGS regs; - regs.HB_XREGS.ax = 0x1E; - HB_DOS_INT86( 0x33, ®s, ®s ); - iPage = regs.HB_XREGS.bx; - } -#else - { - iPage = 0; - } -#endif - - hb_retni( iPage ); -} - -HB_FUNC( FT_MSETPAGE ) -{ -#if defined( HB_OS_DOS ) && 0 - { - union REGS regs; - regs.HB_XREGS.ax = 0x1D; - regs.HB_XREGS.bx = hb_parni( 1 ); - HB_DOS_INT86( 0x33, ®s, ®s ); - } -#endif -} - -HB_FUNC( FT_MVERSION ) -{ - int iMinor; - int iType; - int iIRQ; - int iMajor; - -#if defined( HB_OS_DOS ) - { - union REGS regs; - - regs.HB_XREGS.ax = 0x24; - HB_DOS_INT86( 0x33, ®s, ®s ); - - iMinor = regs.h.bl; - iType = regs.h.ch; - iIRQ = regs.h.cl; - iMajor = regs.h.bh; - } -#else - { - iMinor = 0; - iType = 0; - iIRQ = 0; - iMajor = 0; - } -#endif - - hb_storni( iMinor, 1 ); - hb_storni( iType, 2 ); - hb_storni( iIRQ, 3 ); - - hb_retni( iMajor ); -} - HB_FUNC( _MSET_SENSITIVE ) /* nHoriz, nVert, nDouble */ { #if defined( HB_OS_DOS ) @@ -180,131 +113,6 @@ HB_FUNC( FT_MCONOFF ) #endif } -HB_FUNC( FT_MMICKEYS ) -{ - int iX; - int iY; - -#if defined( HB_OS_DOS ) - { - union REGS regs; - regs.HB_XREGS.ax = 0x0B; - HB_DOS_INT86( 0x33, ®s, ®s ); - iX = regs.HB_XREGS.cx; - iY = regs.HB_XREGS.dx; - } -#else - { - iX = 0; - iY = 0; - } -#endif - - hb_storni( 1, iX ); - hb_storni( 2, iY ); -} - -HB_FUNC( _M_RESET ) -{ - HB_BOOL fMouse; - -#if defined( HB_OS_DOS ) - { - union REGS regs; - regs.HB_XREGS.ax = 0; - HB_DOS_INT86( 0x33, ®s, ®s ); - fMouse = regs.HB_XREGS.ax != 0; - } -#else - { - fMouse = HB_FALSE; - } -#endif - - hb_retl( fMouse ); -} - -HB_FUNC( FT_MGETPOS ) -{ - int iX; - int iY; - int iButton; - -#if defined( HB_OS_DOS ) - { - union REGS regs; - regs.HB_XREGS.ax = 3; - HB_DOS_INT86( 0x33, ®s, ®s ); - iX = regs.HB_XREGS.dx; - iY = regs.HB_XREGS.cx; - iButton = regs.HB_XREGS.bx; - } -#else - { - iX = 0; - iY = 0; - iButton = 0; - } -#endif - - hb_storni( iX, 1 ); - hb_storni( iY, 2 ); - - hb_retni( iButton ); -} - -HB_FUNC( FT_MSETPOS ) -{ -#if defined( HB_OS_DOS ) - { - union REGS regs; - regs.HB_XREGS.ax = 4; - regs.HB_XREGS.dx = hb_parni( 1 ); /* x */ - regs.HB_XREGS.cx = hb_parni( 2 ); /* y */ - HB_DOS_INT86( 0x33, ®s, ®s ); - } -#endif -} - -HB_FUNC( FT_MSETCOORD ) -{ -#if defined( HB_OS_DOS ) - { - union REGS regs; - regs.HB_XREGS.ax = 4; - regs.HB_XREGS.dx = hb_parni( 1 ) * 8; /* x */ - regs.HB_XREGS.cx = hb_parni( 2 ) * 8; /* y */ - HB_DOS_INT86( 0x33, ®s, ®s ); - } -#endif -} - -HB_FUNC( FT_MXLIMIT ) -{ -#if defined( HB_OS_DOS ) - { - union REGS regs; - regs.HB_XREGS.ax = 7; - regs.HB_XREGS.cx = hb_parni( 1 ); /* nXMin */ - regs.HB_XREGS.dx = hb_parni( 2 ); /* nXMax */ - HB_DOS_INT86( 0x33, ®s, ®s ); - } -#endif -} - -HB_FUNC( FT_MYLIMIT ) -{ -#if defined( HB_OS_DOS ) - { - union REGS regs; - regs.HB_XREGS.ax = 8; - regs.HB_XREGS.cx = hb_parni( 1 ); /* nYMin */ - regs.HB_XREGS.dx = hb_parni( 2 ); /* nYMax */ - HB_DOS_INT86( 0x33, ®s, ®s ); - } -#endif -} - HB_FUNC( FT_MBUTPRS ) { int inX; @@ -386,38 +194,3 @@ HB_FUNC( FT_MDEFCRS ) } #endif } - -HB_FUNC( FT_MGETCOORD ) -{ - int inX; - int inY; - int inButton; - -#if defined( HB_OS_DOS ) - { - union REGS regs; - regs.HB_XREGS.ax = 3; - HB_DOS_INT86( 0x33, ®s, ®s ); - inX = regs.HB_XREGS.dx / 8; - inY = regs.HB_XREGS.cx / 8; - inButton = regs.HB_XREGS.bx; - } -#else - { - inX = 0; - inY = 0; - inButton = 0; - } -#endif - - hb_storni( inX, 1 ); - hb_storni( inY, 2 ); - - hb_retni( inButton ); -} - -/* NOTE: This is what original NFLib did, returned - vertical position (row) as X and - horizontal position (col) as Y. [vszakats] */ -HB_FUNC_TRANSLATE( FT_MGETX, MROW ) -HB_FUNC_TRANSLATE( FT_MGETY, MCOL ) diff --git a/harbour/contrib/hbnf/mouse1.prg b/harbour/contrib/hbnf/mouse1.prg index ad2e759d34..3a91ff662e 100644 --- a/harbour/contrib/hbnf/mouse1.prg +++ b/harbour/contrib/hbnf/mouse1.prg @@ -3,7 +3,7 @@ */ THREAD STATIC t_lCrsState := .F. -THREAD STATIC t_lMinit := .F. +THREAD STATIC t_lMInit := .F. FUNCTION FT_MDBLCLK( nClick, nButton, nInterval, nRow, nCol, nStart ) @@ -25,7 +25,7 @@ FUNCTION FT_MDBLCLK( nClick, nButton, nInterval, nRow, nCol, nStart ) // Wait for first press if requested - DO WHILE !lDone + DO WHILE ! lDone FT_MBUTPRS( nButton, @nPrs, @nVert, @nHorz ) nVert := Int( nVert / 8 ) @@ -78,6 +78,41 @@ FUNCTION FT_MINREGION( nTR, nLC, nBR, nRC ) MRow() >= nTR .AND. MRow() <= nBR .AND. ; MCol() >= nLC .AND. MCol() <= nRC +FUNCTION FT_MMICKEYS( /* @ */ nX, /* @ */ nY ) + + nX := MRow() * 8 + nY := MCol() * 8 + + RETURN NIL + +FUNCTION FT_MGETPOS( /* @ */ nX, /* @ */ nY ) + + nX := MRow() * 8 + nY := MCol() * 8 + + RETURN ; + iif( MLeftDown(), 1, 0 ) + ; + iif( MRightDown(), 2, 0 ) + ; + iif( hb_MMiddleDown(), 4, 0 ) + +FUNCTION FT_MSETPOS( nX, nY ) + + RETURN MSetPos( nX / 8, nY / 8 ) + +FUNCTION FT_MGETCOORD( /* @ */ nX, /* @ */ nY ) + + nX := MRow() + nY := MCol() + + RETURN ; + iif( MLeftDown(), 1, 0 ) + ; + iif( MRightDown(), 2, 0 ) + ; + iif( hb_MMiddleDown(), 4, 0 ) + +FUNCTION FT_MSETCOORD( nX, nY ) + + RETURN MSetPos( nX, nY ) + FUNCTION FT_MSETSENS( nHoriz, nVert, nDouble ) LOCAL nCurHoriz, nCurVert, nCurDouble @@ -94,28 +129,34 @@ FUNCTION FT_MSETSENS( nHoriz, nVert, nDouble ) RETURN NIL +FUNCTION FT_MVERSION( /* @ */ nMinor, /* @ */ nType, /* @ */ nIRQ ) + + nMinor := 20 + nType := 2 /* serial */ + nIRQ := 3 + + RETURN 8 + FUNCTION FT_MINIT() // If not previously initialized then try - IF ! t_lMinit - t_lMinit := ( FT_MRESET() != 0 ) + IF ! t_lMInit + t_lMInit := ( FT_MRESET() != 0 ) ELSE MSetBounds() ENDIF - RETURN t_lMinit + RETURN t_lMInit FUNCTION FT_MRESET() - LOCAL lStatus - - t_lCrsState := .F. // Cursor is off after reset - lStatus := _m_reset() - + t_lCrsState := .F. // Cursor is off after reset + MHide() MSetBounds() + MSetPos( ( MaxRow() + 1 ) / 2, ( MaxCol() + 1 ) / 2 ) - RETURN lStatus + RETURN iif( MPresent(), -1, 0 ) FUNCTION FT_MCURSOR( lState ) @@ -146,3 +187,43 @@ FUNCTION FT_MHIDECRS() // decrement internal cursor flag and hide cursor t_lCrsState := .F. RETURN NIL // no output from function + +FUNCTION FT_MXLIMIT( nMin, nMax ) + + LOCAL nTop, nBottom + + hb_MGetBounds( @nTop, , @nBottom ) + MSetBounds( nTop, nMin, nBottom, nMax ) + + RETURN NIL + +FUNCTION FT_MYLIMIT( nMin, nMax ) + + LOCAL nLeft, nRight + + hb_MGetBounds( , @nLeft, , @nRight ) + MSetBounds( nMin, nLeft, nMax, nRight ) + + RETURN NIL + +/* NOTE: This is what original NFLib did, returned + vertical position (row) as X and + horizontal position (col) as Y. [vszakats] */ + +FUNCTION FT_MGETX() + + RETURN MRow() + +FUNCTION FT_MGETY() + + RETURN MCol() + +FUNCTION FT_MGETPAGE() + RETURN 0 + +/* NOTE: Page is ignored in Harbour */ +FUNCTION FT_MSETPAGE( nPage ) + + HB_SYMBOL_UNUSED( nPage ) + + RETURN NIL diff --git a/harbour/contrib/hbnf/tests/metaph.prg b/harbour/contrib/hbnf/tests/metaph.prg index 482342c26a..b334c78bfa 100644 --- a/harbour/contrib/hbnf/tests/metaph.prg +++ b/harbour/contrib/hbnf/tests/metaph.prg @@ -88,16 +88,10 @@ PROCEDURE Main() RETURN -//------------------------------------------------ - STATIC FUNCTION _ftRow( nElem ) // Determine which row to print on RETURN iif( nElem > 40, nElem - 40, iif( nElem > 20, nElem - 20, nElem ) ) -//------------------------------------------------ - STATIC FUNCTION _ftCol( nElem ) // Determine which column to start print RETURN iif( nElem > 40, 55, iif( nElem > 20, 28, 1 ) ) - -//------------------------------------------------ diff --git a/harbour/contrib/hbnf/tests/mouse1.prg b/harbour/contrib/hbnf/tests/mouse1.prg index 416d5c6fc2..87a3627c5d 100644 --- a/harbour/contrib/hbnf/tests/mouse1.prg +++ b/harbour/contrib/hbnf/tests/mouse1.prg @@ -39,6 +39,8 @@ PROCEDURE Main( nRow, nCol ) RETURN ENDIF + SET CURSOR OFF + // ..... Set up the screen cSavClr := SetColor( "w/n" ) @ 0, 0, MaxRow(), MaxCol() BOX hb_UTF8ToStr( "░░░░░░░░░" ) diff --git a/harbour/contrib/hbnf/tests/prtesc.prg b/harbour/contrib/hbnf/tests/prtesc.prg index b85070cdc9..0e46efbf4d 100644 --- a/harbour/contrib/hbnf/tests/prtesc.prg +++ b/harbour/contrib/hbnf/tests/prtesc.prg @@ -6,10 +6,6 @@ PROCEDURE Main( cParm1 ) - //------------------------------------------------------- - // Sample routine to test function from command line - //------------------------------------------------------- - IF PCount() > 0 ? FT_ESCCODE( cParm1 ) ELSE diff --git a/harbour/contrib/hbzebra/datamtrx.c b/harbour/contrib/hbzebra/datamtrx.c index e9dedbe1bb..b7274823dc 100644 --- a/harbour/contrib/hbzebra/datamtrx.c +++ b/harbour/contrib/hbzebra/datamtrx.c @@ -76,7 +76,10 @@ #include "hbapierr.h" -#define PADDING 129 +/* Special CodeWords */ +#define PADDING 129 +#define PAIR_OF_DIGITS 130 /* 00..99 encoded as 130..229 */ +#define SHIFT_EXTENDED_ASCII 235 /* Shift to extended ASCII for 1 character */ #define SIZE_COUNT 30 @@ -130,24 +133,24 @@ static int _datamatrix_isdigit( char ch ) return '0' <= ch && ch <= '9'; } -static int _datamatrix_encode( const char * szCode, int iLen, char * pCW ) +static int _datamatrix_encode( const char * szCode, int iLen, unsigned char * pCW ) { int i, iPos = 0; for( i = 0; i < iLen; i++ ) { if( _datamatrix_isdigit( szCode[ i ] ) && i < iLen - 1 && _datamatrix_isdigit( szCode[ i + 1 ] ) ) { - pCW[ iPos++ ] = ( szCode[ i ] - '0' ) * 10 + szCode[ i + 1 ] - '0' + 130; + pCW[ iPos++ ] = ( unsigned char ) ( ( szCode[ i ] - '0' ) * 10 + szCode[ i + 1 ] - '0' + PAIR_OF_DIGITS ); i++; } else if( ( unsigned char ) szCode[ i ] <= 127 ) { - pCW[ iPos++ ] = szCode[ i ] + 1; + pCW[ iPos++ ] = ( unsigned char ) szCode[ i ] + 1; } else { - pCW[ iPos++ ] = '\xEB'; /* Shift to extended ASCII for 1 character */ - pCW[ iPos++ ] = szCode[ i ] - 127; + pCW[ iPos++ ] = SHIFT_EXTENDED_ASCII; + pCW[ iPos++ ] = ( unsigned char ) szCode[ i ] - 127; } } return iPos; @@ -178,7 +181,7 @@ static void _reed_solomon_encode( unsigned char * pData, int iDataLen, unsigned } } -static void _datamatrix_reed_solomon( char * pData, const DATAMATRIX_SIZE * pSize ) +static void _datamatrix_reed_solomon( unsigned char * pData, const DATAMATRIX_SIZE * pSize ) { int * pPoly, * pExp, * pLog; int i, j, iBits, iMod, iPoly, iECLen, iIndex, iBlocks; @@ -233,7 +236,7 @@ static void _datamatrix_reed_solomon( char * pData, const DATAMATRIX_SIZE * pSiz /* Copy to temporary buffer */ for( j = i; j < pSize->iDataSize; j += iBlocks ) - data[ k++ ] = ( unsigned char ) pData[ j ]; + data[ k++ ] = pData[ j ]; /* Calculate Reed-Solomon ECC for one block */ _reed_solomon_encode( data, k, ecc, pSize->iBlockErrorSize, pPoly, pExp, pLog, iMod ); @@ -241,7 +244,7 @@ static void _datamatrix_reed_solomon( char * pData, const DATAMATRIX_SIZE * pSiz /* Copy ECC to codeword array */ k = pSize->iBlockErrorSize; for( j = i; j < pSize->iBlockErrorSize * iBlocks; j += iBlocks ) - pData[ pSize->iDataSize + j ] = ( char ) ecc[ --k ]; + pData[ pSize->iDataSize + j ] = ecc[ --k ]; } hb_xfree( pExp ); @@ -325,7 +328,7 @@ static void _datamatrix_place_d( int * pArr, int iPRow, int iPCol, int iIndex ) _datamatrix_place_bit( pArr, iPRow, iPCol, 1, iPCol - 1, ( iIndex << 3 ) + 0 ); } -static void _datamatrix_do_placement( PHB_BITBUFFER pBits, char * pCW, const DATAMATRIX_SIZE * pSize ) +static void _datamatrix_do_placement( PHB_BITBUFFER pBits, unsigned char * pCW, const DATAMATRIX_SIZE * pSize ) { int * pArr; int i, iR, iC, iPRow, iPCol; @@ -404,7 +407,7 @@ PHB_ZEBRA hb_zebra_create_datamatrix( const char * szCode, HB_SIZE nLen, int iFl { PHB_ZEBRA pZebra; const DATAMATRIX_SIZE * pSize; - char * pCW; + unsigned char * pCW; int i, j, iDataCount, iErrorSize, iLen = ( int ) nLen; pZebra = hb_zebra_create(); @@ -416,7 +419,7 @@ PHB_ZEBRA hb_zebra_create_datamatrix( const char * szCode, HB_SIZE nLen, int iFl return pZebra; } - pCW = ( char * ) hb_xgrab( sizeof( char ) * iLen * 2 ); + pCW = ( unsigned char * ) hb_xgrab( sizeof( char ) * iLen * 2 ); iDataCount = _datamatrix_encode( szCode, iLen, pCW ); if( iDataCount > 3116 ) @@ -448,10 +451,10 @@ PHB_ZEBRA hb_zebra_create_datamatrix( const char * szCode, HB_SIZE nLen, int iFl iErrorSize = ( pSize->iDataSize + 2 ) / pSize->iBlockSize * pSize->iBlockErrorSize; - pCW = ( char * ) hb_xrealloc( pCW, pSize->iDataSize + iErrorSize ); + pCW = ( unsigned char * ) hb_xrealloc( pCW, pSize->iDataSize + iErrorSize ); for( i = iDataCount; i < pSize->iDataSize; i++ ) { - pCW[ i ] = ( char ) ( unsigned char ) PADDING; + pCW[ i ] = PADDING; } /* Reed-Solomon error correction */ @@ -460,7 +463,7 @@ PHB_ZEBRA hb_zebra_create_datamatrix( const char * szCode, HB_SIZE nLen, int iFl #if 0 for( i = 0; i < pSize->iDataSize + iErrorSize; i++ ) { - HB_TRACE( HB_TR_ALWAYS, ("cw=%d", ( unsigned char ) pCW[ i ] )); + HB_TRACE( HB_TR_ALWAYS, ("cw=%d", pCW[ i ] )); } #endif diff --git a/harbour/extras/gtwvw/docs/funclist.txt b/harbour/extras/gtwvw/docs/funclist.txt index 4ce699d727..6fdd844a11 100644 --- a/harbour/extras/gtwvw/docs/funclist.txt +++ b/harbour/extras/gtwvw/docs/funclist.txt @@ -37,11 +37,11 @@ Contents - Epilogue -/*-------------------------------------------------------------------*/ -/* */ -/* Introduction */ -/* */ -/*-------------------------------------------------------------------*/ +//------------------------------------------------- +// +// Introduction +// +//------------------------------------------------- This document contains list (and description) of GTWVW .prg callable functions. These descriptions and function list are taken from GTWVW source code, @@ -55,514 +55,514 @@ an aid to help you get start with GTWVW. If you need a complete reference, read the source code :-). -/*-------------------------------------------------------------------*/ -/* */ -/* GTWVW specific functions */ -/* */ -/*-------------------------------------------------------------------*/ - - -/*-------------------------------------------------------------------*/ -/* Window Operation from .prg */ -/*-------------------------------------------------------------------*/ - -/* - *WVW_nOpenWindow(cWinName, row1, col1, row2, col2, ; - * nStyle, nParentWin) - *rowx and colx are relative to MAIN WINDOW (not current window!) - *rowx and colx are used for: - *(1) positioning window to its initial position, - *(2) determining the size of the window (new maxrow() and maxcol()) - *(3) saved into RowOfs and ColOfs for MainCoord mode - * - *nStyle is window style (eg. WS_OVERLAPPEDWINDOW, etc.) - * default is: WS_CAPTION|WS_SYSMENU |WS_CLIPCHILDREN - * WARNING: you must know what you're doing if you supplied this param - * NOTES: if you will use controls such as PUSHBUTTON, - * you MUST include WS_CLIPCHILDREN. - * - *nParentWin is parent window of the new on we're about to open. - * default is: current window (in Standard Mode) - * last window (in MainCoord Mode) - * If you want the new window to not have parent, - * pass -1 as nParentWin. - * - * - *returns window number if successful - *returns 0 if failed - */ - -/*WVW_lCloseWindow() - *closes the last/topmost window - *returns .t. if successful - */ - -/*WVW_nNumWindows() - *returns number of windows opened (including main window) - */ - -/*WVW_xReposWindow() - *reposition all windows to their initial position - */ - -/*WVW_nSetCurWindow( nWinNum ) (0==MAIN) - *assigns nWinNum as the new current window (s_usCurWindow) - *returns old current window - *example: saved := WVW_nSetCurWindow(0) - * ? "This will be displayed in Main Window" - * WVW_nSetCurWindow(saved) - *notes: makes sense only if !s_bMainCoordMode - */ - -/*WVW_nRowOfs( [nWinNum] ) - *returns row offset of window #nWinNum (0==MAIN), relative to Main Window - *nWinNum defaults to current window - */ - -/*WVW_nColOfs( [nWinNum] ) - *returns col offset of window #nWinNum (0==MAIN), relative to Main Window - *nWinNum defaults to topmost window - */ - -/*WVW_SetMainCoord( [lMainCoord] ) - *returns old setting of s_bMainCoordMode, - *then assigns s_bMainCoordMode := lMainCoord (if supplied) - */ - -/* WVW_ADDROWS( [nWinNum], nRows) - * add nRows rows to window nWinNum (nRows may be < 0) - * returns .t. if successful - * - * NOTES: newly added rows (for nRows>0) will be colored with - * column 0 of original last row - * WARNING: no checking if window size will become larger than desktop area - * (except if in MainCoord Mode, because it is implied from - * restriction of resulted maxrow()) - */ - -/* - *WVW_NOCLOSE( [nWinNum] ) - *disable CLOSE 'X' button of a window - * - *no return value - */ - -/* - *WVW_SETWINSTYLE( [nWinNum], [nStyle] ) - *Get/Set window style - *NOTES: if window has controls (eg. pushbutton, scrollbar) - * you should include WS_CLIPCHILDREN in nStyle - * - *SIDE EFFECT: - * if window is hidden, applying nStyle here will cause it to show - * - *return Window Style prior to applying the new style - */ - -/*-------------------------------------------------------------------*/ -/* GTWVW parameter setting from .prg */ -/*-------------------------------------------------------------------*/ - -/*WVW_SetPaintRefresh( [nPaintRefresh] ) - *returns old setting of s_uiPaintRefresh (millisec between calls to WVW_PAINT) - *then assigns s_uiPaintRefresh:= nPaintRefresh (if supplied) - *NOTES: nPaintRefresh must be >= 50 - * or nPaintRefresh == 0, causing Repaint to execute immediately, as GTWVT - */ - -/*WVW_SetVertCaret( [lOn] ) - *if lOn is supplied: - *lOn == .t.: turn caret into vertical caret - *lOn == .f.: turn caret into horizontal caret - *return old setting of s_bVertCaret - */ - -/*WVW_SetDefLineSpacing( [nLineSpacing] ) - *returns old setting of s_byDefLineSpacing (default linespacing between lines) - *then assigns s_byDefLineSpacing:= nLineSpacing (if supplied) - *NOTES: - * - nLineSpacing will be the default line spacing for all window opens - * - nLineSpacing must be even, positive number <= 40 - * otherwise it will be ignored - * - to check line spacing being used by a window, use WVW_SetLineSpacing() - */ - -/*WVW_SetLineSpacing( [nWinNum], [nLineSpacing] ) - *returns old setting of linespacing between lines in window nWinNum - *then set the line spacing to nLineSpacing (if supplied) - *NOTES: - * - nLineSpacing must be even, positive number <= 40 - * otherwise it will be ignored - * - if window size will become too high, line spacing is restored - * - to change default line spacing for next window open, use WVW_SetDefLineSpacing() - */ - -/*WVW_NoStartupSubWindow( [lOn] ) - *if lOn is supplied: - *lOn == .t.: when opening window, window will not be displayed - *lOn == .f.: when opening window, window will be displayed (default) - *return old setting of s_bNOSTARTUPWINDOW - * - *See Also: WVW_ShowWindow() - */ - -/*-------------------------------------------------------------------*/ -/* STATUS BAR */ -/*-------------------------------------------------------------------*/ - -/*WVW_SBcreate( [nWinNum] ) - *create status bar for window nWinNum, with one part. - *returns handle to status bar of windows nWinNum - *returns 0 if failed, eg. if there is already a status bar for this window - */ - -/*WVW_SBdestroy( [nWinNum] ) - *destroy status bar for window nWinNum - */ - -/*WVW_SBaddPart(nWinNum, cMaxText, nWidth, nStyle, lResetParts, [cIcon , cToolTip]) - *ps. - *lResetParts==.t. :: remove all previously created parts - *nStyle: 0 (default), 0x0200 (SBT_POPOUT), 0x0100 (SBT_NOBORDERS) - *nWidth: expected width in pixels - *NOTE: if cMaxText is passed, nWidth is ignored. width of cMaxText will be used instead - *NOTE: the leftmost part will eventually have width of remaining spaces - *NOTE: cIcon and cToolTip does not work currently - * - *returns number of parts - *returns 0 if failed - */ - -/*WVW_SBrefresh(nWinNum) - *reinitialize StatusBar's parts, eg. after window resize - *returns number of parts - *returns 0 if failed - */ - -/*WVW_SBsetText([nWinNum], [nPart], cText) - *Set Text of status bar's part #npart - */ - -/*WVW_SBgetText([nWinNum], [nPart]) - *Get Text of status bar's part #npart - */ - -/*WVW_SBgetparts([nWinNum]) - *Get number of parts in statusbar of window nWinNum - */ - -/*-------------------------------------------------------------------*/ -/* TIMER */ -/*-------------------------------------------------------------------*/ - -/*WVW_SetTimer([nWinNum], nInterval) - *set timer event for every nInterval millisec - *(effective only if WVW_TIMER() function exists) - *eg. it can be usefull to update clock on status bar - *returns .t. if successfull - */ - - -/*WVW_KillTimer([nWinNum]) - *kill the timer event handler for window nWinNum - *returns .t. if successfull - */ - -/*-------------------------------------------------------------------*/ -/* TOOLBAR */ -/*-------------------------------------------------------------------*/ - -/*WVW_TBCreate([nWinNum], lDisplayText, nStyle, nSystemBitmap, nImageWidth, nImageHeight) - *creates a toolbar at the top (no button initially) - *lDisplayText==.f. button's string is used as tooltips (default) - *nStyle: toolbar style, defaults to TBSTYLE_FLAT | TBSTYLE_TOOLTIPS - *nSystemBitmap: 0:none, 1:small, 2:large (defaults: 1) - * small=16x16 large=24x24 - *nImageWidth/Height are in effect only if nSystemBitmap==0 - */ - -/*WVW_TBAddButton([nWinNum], nCommand, xBitmap, cLabel, nBitmapType,; - * lMap3Dcolors) - *adds one button on the right of existing buttons - *xBitmap: - *nBitmap is resource id. or use cBitmap as bitmap file name. - *(bitmap from resources cannot have > 256 colors) - * - *cLabel: if lDisplayText, it will be displayed below the bitmap - * otherwise it will be used as tooltip - *nBitmapType: 0:custom, 1:system std bitmap, 2:system view bitmap, 3:system hist bitmap - *lMap3Dcolors: defaults to .f. - * (meaningfull for custom bitmap only) - * if .t. the following color mapping will be performed: - * RGB(192,192,192) --> COLOR_3DFACE ("transparent") - * RGB(128,128,128) --> COLOR_3DSHADOW - * RGB(223,223,223) --> COLOR_3DLIGHT - * This might be desirable to have transparent effect. - * LIMITATION: this will work on 256 colored bitmaps only - */ - - -/*WVW_TBButtonCount([nWinNum]) - *returns number of buttons in toolbar on window nWinNum - */ - -/*WVW_TBDelButton([nWinNum], nButton) - *nButton is zero based index of button to delete - *index=0 is the leftmost button - *NOTE: button separator is indexed and deleteable too - */ - -/*WVW_TBEnableButton([nWinNum], nButton, [lToggle]) - *nButton is zero based index of button to delete - *index=0 is the leftmost button - *NOTE: button separator is indexed too - *returns .t. if successful - */ - -/*WVW_TBdestroy( [nWinNum] ) - *destroy toolbar for window nWinNum - */ - -/*WVW_TBINDEX2CMD([nWinNum], nIndex) - *returns Command Id of button nIndex (0 based) - *returns -1 if the button does not exist - */ - -/*WVW_TBCmd2Index([nWinNum], nCmd) - *returns Index (0 based) of button whose command id is nCmd - *returns -1 if the button does not exist - */ - - -/*-------------------------------------------------------------------*/ -/* SCROLLBAR */ -/*-------------------------------------------------------------------*/ - -/*WVW_XBcreate( [nWinNum], nStyle, nTop, nLeft, nLength, bBlock, aOffset) - *create scroll bar for window nWinNum - *nStyle: SBS_HORZ (0)=horizontal, SBS_VERT (1)=vertical - *nTop: row of top/left corner (in character unit) - *nLeft: col of top/left corner (in character unit) - *nLength: length of scrollbar (in character unit) - *NOTES: width of scrollbar (in character unit) - * horiz: defaults to one character height - * verti: defaults to one character _height_ too (!) - * use aOffset to adjust the dimension - *aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust - * dimension of scroll bar. - * defaults for vertical scroll bar: {0,+3,0,0} - * defaults for horiz scroll bar: {+3-linespacing,0,0,0} - * NOTES: these defaults are meant to make room for other common - * GUI elements like raised/recessed lines. - * - *bBlock: codeblock to execute on every WM_VSCROLL/WM_HSCROLL event. - * This codeblock will be evaluated with these parameters: - * nWinNum: window number - * nXBid : scrollbar id - * nXBmsg : scrollbar message, ie. one of these: - * nXBpos : scrollthumb position (only if message==SB_THUMB...) - * the "must be handled" messages: - * SB_LINEUP/SB_LINELEFT 0: up/left button clicked - * SB_LINEDOWN/SB_LINERIGHT 1: down/right button clicked - * SB_PAGEUP/SB_PAGELEFT 2: upper/left shaft clicked - * SB_PAGEDOWN/SB_PAGERIGHT 3: lower/right shaft clicked - * the "may not be handled" messages: - * SB_THUMBPOSITION 4: scroll thumb is released at position nXBpos - * SB_THUMBTRACK 5: scroll thumb is being dragged at position nXBpos - * SB_ENDSCROLL 8 - * - *returns control id of newly created scroll bar of windows nWinNum - *returns 0 if failed - * - *example: - *WVW_XBcreate( , 1, 10, 70, 12) - * :: creates Vertical scrollbar on current window at (10,70) with length 12 - * dimensions using default ones. - * buttons/parts behaviour using default ones. - * - *WVW_XBcreate( , 1, 10, 70, 12, {0, +5, 0, +5} ) - * :: creates Vertical scrollbar on current window at (10,70) with length 12 - * left and right coordinate is shifted 5 pixels to the right. - * buttons/parts behaviour using default ones. - * - *NOTES: - *ScrollRange is always 0 - 100. - *Initial ScrollPos is 0 - */ - -/*WVW_XBdestroy( [nWinNum], nXBid ) - *destroy scrollbar nXBid for window nWinNum - */ - -/*WVW_XBupdate(nWinNum, XBid, [nPos], [nPageSize], [nMin], [nMax]) - *update scrollbar data and its display - *nPos, nPageSize, nMin, nMax are optional. - *however, both nMin & nMax must be supplied, or not at all. - *returns current position of scroll thumb. - *returns -1 if update failed. - */ - -/*WVW_XBenable( [nWinNum], nXBid, nFlags ) - *enable/disable scrollbar nXBid in window nWinNum (default to topmost window) - *nFlags: ESB_ENABLE_BOTH 0: enable both arrows - * ESB_DISABLE_LEFT/ESB_DISABLE_UP 1: disable left/up arrow - * ESB_DISABLE_RIGHT/ESB_DISABLE_DOWN 2: disable right/down arrow - * ESB_DISABLE_BOTH 3: disable both arrow - *returns .t. if successful - */ - - -/*-------------------------------------------------------------------*/ -/* PUSHBUTTON */ -/*-------------------------------------------------------------------*/ - -/*WVW_PBcreate( [nWinNum], nTop, nLeft, nBottom, nRight, cText, cImage/nImage, bBlock, aOffset) - *create pushbutton for window nWinNum - *nTop: row of top/left corner (in character unit) - *nLeft: col of top/left corner (in character unit) - *nBottom: row of bottom/right corner (in character unit) defaults==nTop - *nRight: col of bottom/right corner (in character unit) defaults==?? - *cText: caption, default == "" - * - *reserved for future: (TODO): - *cImage: bitmap file name, can be supplied as nImage: bitmap resource id - *this parm is now ignored - * - *aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust - * dimension of pushbutton. - * defaults for vertical scroll bar: {0,+3,0,0} - * defaults for horiz scroll bar: {+3-linespacing,0,0,0} - * NOTES: these defaults are meant to make room for other common - * GUI elements like raised/recessed lines. - * - *bBlock: codeblock to execute on every BN_CLICK event. - * This codeblock will be evaluated with these parameters: - * nWinNum: window number - * nPBid : pushbutton id - * - *returns control id of newly created pushbutton of windows nWinNum - *returns 0 if failed - * - *example: - */ - -/*WVW_PBdestroy( [nWinNum], nPBid ) - *destroy button nPBid for window nWinNum - */ - -/*WVW_PBsetFocus( [nWinNum], nButtonId ) - *set the focus to button nButtonId in window nWinNum - */ - -/*WVW_PBenable( [nWinNum], nButtonId, [lToggle] ) - *enable/disable button nButtonId on window nWinNum - *(lToggle defaults to .t., ie. enabling the button) - *return previous state of the button (TRUE:enabled FALSE:disabled) - *(if nButtonId is invalid, this function returns FALSE too) - */ - -/*WVW_PBsetcodeblock( [nWinNum], nPBid, bBlock ) - *assign (new) codeblock bBlock to button nPBid for window nWinNum - * - * return .t. if successful - */ - -/*WVW_PBsetstyle( [nWinNum], nPBid, nStyle ) - *assign new style nStyle to button nPBid for window nWinNum - *typical usage: nStyle==BS_DEFPUSHBUTTON (==01) to turn the button - * into default push button - * (thick border) - * BS_PUSHBUTTON (==00) to turn the button - * into regular push button - * - *using other styles like BS_MULTILINE may also be usefull, - *but I haven't tried that - * - * this function always return .t. - */ - -/*WVW_PBSetFont([nWinNum], cFontFace, nHeight, nWidth, nWeight, nQUality,; - * lItalic, lUnderline, lStrikeout - * - *this will initialize font for ALL pushbuttons in window nWinNum - *(including ones created later on) - */ - - -/*-------------------------------------------------------------------*/ -/* PROGRESSBAR */ -/*-------------------------------------------------------------------*/ - -/*WVW_PGcreate( [nWinNum], nTop, nLeft, nBottom, nRight, [aOffset], - * [nBackColor], [nBarColor], [lSmooth], [lVertical]) - *create progress bar for window nWinNum - *nTop: row of top/left corner (in character unit) - *nLeft: col of top/left corner (in character unit) - *nBottom: row of bottom/right corner (in character unit) - *nRight: col of bottom/right corner (in character unit) - *aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust - * dimension of progress bar. defaults: {0, 0, 0, 0} - *nBackColor: color of background (as RGB value) - *nBarColor: color of bar (as RGB value) - *lSmooth: if .t., draw as smooth bar (default is .f.) - *lVertical: if .t., draw as vertical progress bar (default is .f.) - * - *returns control id of newly created progress bar of windows nWinNum - *returns 0 if failed - * - *example: - *WVW_PGcreate( , 5, 10, 5, 30) - * :: creates horiz progressbar on current window at (5,10) to (5,30) - * colors using default ones. - * - *WVW_PGcreate( , 5, 10, 5, 30, {-1, 0, +1, 0} ) - * :: same as above, but the bar is enlarged 1 pixel to the top - * and 1 pixel to the bottom - * - *NOTES: - *ProgressRange is initially set as 0 - 100. - *Initial ProgressPos is 0 - */ - -/*WVW_PGdestroy( [nWinNum], nPGid ) - *destroy progressbar nPGid for window nWinNum - *This function has no return value. - */ - -/*WVW_PGsetrange(nWinNum, PGid, [nMin], [nMax]) - *update progressbar data range (default is 0-100) - *nMin: a number in range of -32767 to +32767 - *nMax: a number in range of -32767 to +32767 - * - *Remark: progress position is reset to nMin - * - *returns .t. if operation considered successfull -*/ - -/*WVW_PGsetpos(nWinNum, PGid, [nPos]) - *update progressbar position within current range - *nPos: a number in range of current range - *returns .t. if operation considered successfull -*/ - -/*WVW_PGgetpos(nWinNum, PGid) - *get progressbar current position - *returns 0 if operation failed -*/ - - -/*-------------------------------------------------------------------*/ -/* */ -/* GTWVT compatibility functions. */ -/* See WVT2WVW.CH about how to map coresponding */ -/* GTWVT functions to GTWVW's ones. */ -/* */ -/*-------------------------------------------------------------------*/ - - -/*-------------------------------------------------------------------*/ +//------------------------------------------------- +// +// GTWVW specific functions +// +//------------------------------------------------- + + +//------------------------------------------------- +// Window Operation from .prg +//------------------------------------------------- + +// +//WVW_nOpenWindow(cWinName, row1, col1, row2, col2, ; +// nStyle, nParentWin) +//rowx and colx are relative to MAIN WINDOW (not current window!) +//rowx and colx are used for: +//(1) positioning window to its initial position, +//(2) determining the size of the window (new maxrow() and maxcol()) +//(3) saved into RowOfs and ColOfs for MainCoord mode +// +//nStyle is window style (eg. WS_OVERLAPPEDWINDOW, etc.) +// default is: WS_CAPTION|WS_SYSMENU |WS_CLIPCHILDREN +// WARNING: you must know what you're doing if you supplied this param +// NOTES: if you will use controls such as PUSHBUTTON, +// you MUST include WS_CLIPCHILDREN. +// +//nParentWin is parent window of the new on we're about to open. +// default is: current window (in Standard Mode) +// last window (in MainCoord Mode) +// If you want the new window to not have parent, +// pass -1 as nParentWin. +// +// +//returns window number if successful +//returns 0 if failed +// + +//WVW_lCloseWindow() +//closes the last/topmost window +//returns .t. if successful +// + +//WVW_nNumWindows() +//returns number of windows opened (including main window) +// + +//WVW_xReposWindow() +//reposition all windows to their initial position +// + +//WVW_nSetCurWindow( nWinNum ) (0==MAIN) +//assigns nWinNum as the new current window (s_usCurWindow) +//returns old current window +//example: saved := WVW_nSetCurWindow(0) +// ? "This will be displayed in Main Window" +// WVW_nSetCurWindow(saved) +//notes: makes sense only if !s_bMainCoordMode +// + +//WVW_nRowOfs( [nWinNum] ) +//returns row offset of window #nWinNum (0==MAIN), relative to Main Window +//nWinNum defaults to current window +// + +//WVW_nColOfs( [nWinNum] ) +//returns col offset of window #nWinNum (0==MAIN), relative to Main Window +//nWinNum defaults to topmost window +// + +//WVW_SetMainCoord( [lMainCoord] ) +//returns old setting of s_bMainCoordMode, +//then assigns s_bMainCoordMode := lMainCoord (if supplied) +// + +// WVW_ADDROWS( [nWinNum], nRows) +// add nRows rows to window nWinNum (nRows may be < 0) +// returns .t. if successful +// +// NOTES: newly added rows (for nRows>0) will be colored with +// column 0 of original last row +// WARNING: no checking if window size will become larger than desktop area +// (except if in MainCoord Mode, because it is implied from +// restriction of resulted maxrow()) +// + +// +//WVW_NOCLOSE( [nWinNum] ) +//disable CLOSE 'X' button of a window +// +//no return value +// + +// +//WVW_SETWINSTYLE( [nWinNum], [nStyle] ) +//Get/Set window style +//NOTES: if window has controls (eg. pushbutton, scrollbar) +// you should include WS_CLIPCHILDREN in nStyle +// +//SIDE EFFECT: +// if window is hidden, applying nStyle here will cause it to show +// +//return Window Style prior to applying the new style +// + +//------------------------------------------------- +// GTWVW parameter setting from .prg +//------------------------------------------------- + +//WVW_SetPaintRefresh( [nPaintRefresh] ) +//returns old setting of s_uiPaintRefresh (millisec between calls to WVW_PAINT) +//then assigns s_uiPaintRefresh:= nPaintRefresh (if supplied) +//NOTES: nPaintRefresh must be >= 50 +// or nPaintRefresh == 0, causing Repaint to execute immediately, as GTWVT +// + +//WVW_SetVertCaret( [lOn] ) +//if lOn is supplied: +//lOn == .t.: turn caret into vertical caret +//lOn == .f.: turn caret into horizontal caret +//return old setting of s_bVertCaret +// + +//WVW_SetDefLineSpacing( [nLineSpacing] ) +//returns old setting of s_byDefLineSpacing (default linespacing between lines) +//then assigns s_byDefLineSpacing:= nLineSpacing (if supplied) +//NOTES: +// - nLineSpacing will be the default line spacing for all window opens +// - nLineSpacing must be even, positive number <= 40 +// otherwise it will be ignored +// - to check line spacing being used by a window, use WVW_SetLineSpacing() +// + +//WVW_SetLineSpacing( [nWinNum], [nLineSpacing] ) +//returns old setting of linespacing between lines in window nWinNum +//then set the line spacing to nLineSpacing (if supplied) +//NOTES: +// - nLineSpacing must be even, positive number <= 40 +// otherwise it will be ignored +// - if window size will become too high, line spacing is restored +// - to change default line spacing for next window open, use WVW_SetDefLineSpacing() +// + +//WVW_NoStartupSubWindow( [lOn] ) +//if lOn is supplied: +//lOn == .t.: when opening window, window will not be displayed +//lOn == .f.: when opening window, window will be displayed (default) +//return old setting of s_bNOSTARTUPWINDOW +// +//See Also: WVW_ShowWindow() +// + +//------------------------------------------------- +// STATUS BAR +//------------------------------------------------- + +//WVW_SBcreate( [nWinNum] ) +//create status bar for window nWinNum, with one part. +//returns handle to status bar of windows nWinNum +//returns 0 if failed, eg. if there is already a status bar for this window +// + +//WVW_SBdestroy( [nWinNum] ) +//destroy status bar for window nWinNum +// + +//WVW_SBaddPart(nWinNum, cMaxText, nWidth, nStyle, lResetParts, [cIcon , cToolTip]) +//ps. +//lResetParts==.t. :: remove all previously created parts +//nStyle: 0 (default), 0x0200 (SBT_POPOUT), 0x0100 (SBT_NOBORDERS) +//nWidth: expected width in pixels +//NOTE: if cMaxText is passed, nWidth is ignored. width of cMaxText will be used instead +//NOTE: the leftmost part will eventually have width of remaining spaces +//NOTE: cIcon and cToolTip does not work currently +// +//returns number of parts +//returns 0 if failed +// + +//WVW_SBrefresh(nWinNum) +//reinitialize StatusBar's parts, eg. after window resize +//returns number of parts +//returns 0 if failed +// + +//WVW_SBsetText([nWinNum], [nPart], cText) +//Set Text of status bar's part #npart +// + +//WVW_SBgetText([nWinNum], [nPart]) +//Get Text of status bar's part #npart +// + +//WVW_SBgetparts([nWinNum]) +//Get number of parts in statusbar of window nWinNum +// + +//------------------------------------------------- +// TIMER +//------------------------------------------------- + +//WVW_SetTimer([nWinNum], nInterval) +//set timer event for every nInterval millisec +//(effective only if WVW_TIMER() function exists) +//eg. it can be usefull to update clock on status bar +//returns .t. if successfull +// + + +//WVW_KillTimer([nWinNum]) +//kill the timer event handler for window nWinNum +//returns .t. if successfull +// + +//------------------------------------------------- +// TOOLBAR +//------------------------------------------------- + +//WVW_TBCreate([nWinNum], lDisplayText, nStyle, nSystemBitmap, nImageWidth, nImageHeight) +//creates a toolbar at the top (no button initially) +//lDisplayText==.f. button's string is used as tooltips (default) +//nStyle: toolbar style, defaults to TBSTYLE_FLAT | TBSTYLE_TOOLTIPS +//nSystemBitmap: 0:none, 1:small, 2:large (defaults: 1) +// small=16x16 large=24x24 +//nImageWidth/Height are in effect only if nSystemBitmap==0 +// + +//WVW_TBAddButton([nWinNum], nCommand, xBitmap, cLabel, nBitmapType,; +// lMap3Dcolors) +//adds one button on the right of existing buttons +//xBitmap: +//nBitmap is resource id. or use cBitmap as bitmap file name. +//(bitmap from resources cannot have > 256 colors) +// +//cLabel: if lDisplayText, it will be displayed below the bitmap +// otherwise it will be used as tooltip +//nBitmapType: 0:custom, 1:system std bitmap, 2:system view bitmap, 3:system hist bitmap +//lMap3Dcolors: defaults to .f. +// (meaningfull for custom bitmap only) +// if .t. the following color mapping will be performed: +// RGB(192,192,192) --> COLOR_3DFACE ("transparent") +// RGB(128,128,128) --> COLOR_3DSHADOW +// RGB(223,223,223) --> COLOR_3DLIGHT +// This might be desirable to have transparent effect. +// LIMITATION: this will work on 256 colored bitmaps only +// + + +//WVW_TBButtonCount([nWinNum]) +//returns number of buttons in toolbar on window nWinNum +// + +//WVW_TBDelButton([nWinNum], nButton) +//nButton is zero based index of button to delete +//index=0 is the leftmost button +//NOTE: button separator is indexed and deleteable too +// + +//WVW_TBEnableButton([nWinNum], nButton, [lToggle]) +//nButton is zero based index of button to delete +//index=0 is the leftmost button +//NOTE: button separator is indexed too +//returns .t. if successful +// + +//WVW_TBdestroy( [nWinNum] ) +//destroy toolbar for window nWinNum +// + +//WVW_TBINDEX2CMD([nWinNum], nIndex) +//returns Command Id of button nIndex (0 based) +//returns -1 if the button does not exist +// + +//WVW_TBCmd2Index([nWinNum], nCmd) +//returns Index (0 based) of button whose command id is nCmd +//returns -1 if the button does not exist +// + + +//------------------------------------------------- +// SCROLLBAR +//------------------------------------------------- + +//WVW_XBcreate( [nWinNum], nStyle, nTop, nLeft, nLength, bBlock, aOffset) +//create scroll bar for window nWinNum +//nStyle: SBS_HORZ (0)=horizontal, SBS_VERT (1)=vertical +//nTop: row of top/left corner (in character unit) +//nLeft: col of top/left corner (in character unit) +//nLength: length of scrollbar (in character unit) +//NOTES: width of scrollbar (in character unit) +// horiz: defaults to one character height +// verti: defaults to one character _height_ too (!) +// use aOffset to adjust the dimension +//aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust +// dimension of scroll bar. +// defaults for vertical scroll bar: {0,+3,0,0} +// defaults for horiz scroll bar: {+3-linespacing,0,0,0} +// NOTES: these defaults are meant to make room for other common +// GUI elements like raised/recessed lines. +// +//bBlock: codeblock to execute on every WM_VSCROLL/WM_HSCROLL event. +// This codeblock will be evaluated with these parameters: +// nWinNum: window number +// nXBid : scrollbar id +// nXBmsg : scrollbar message, ie. one of these: +// nXBpos : scrollthumb position (only if message==SB_THUMB...) +// the "must be handled" messages: +// SB_LINEUP/SB_LINELEFT 0: up/left button clicked +// SB_LINEDOWN/SB_LINERIGHT 1: down/right button clicked +// SB_PAGEUP/SB_PAGELEFT 2: upper/left shaft clicked +// SB_PAGEDOWN/SB_PAGERIGHT 3: lower/right shaft clicked +// the "may not be handled" messages: +// SB_THUMBPOSITION 4: scroll thumb is released at position nXBpos +// SB_THUMBTRACK 5: scroll thumb is being dragged at position nXBpos +// SB_ENDSCROLL 8 +// +//returns control id of newly created scroll bar of windows nWinNum +//returns 0 if failed +// +//example: +//WVW_XBcreate( , 1, 10, 70, 12) +// :: creates Vertical scrollbar on current window at (10,70) with length 12 +// dimensions using default ones. +// buttons/parts behaviour using default ones. +// +//WVW_XBcreate( , 1, 10, 70, 12, {0, +5, 0, +5} ) +// :: creates Vertical scrollbar on current window at (10,70) with length 12 +// left and right coordinate is shifted 5 pixels to the right. +// buttons/parts behaviour using default ones. +// +//NOTES: +//ScrollRange is always 0 - 100. +//Initial ScrollPos is 0 +// + +//WVW_XBdestroy( [nWinNum], nXBid ) +//destroy scrollbar nXBid for window nWinNum +// + +//WVW_XBupdate(nWinNum, XBid, [nPos], [nPageSize], [nMin], [nMax]) +//update scrollbar data and its display +//nPos, nPageSize, nMin, nMax are optional. +//however, both nMin & nMax must be supplied, or not at all. +//returns current position of scroll thumb. +//returns -1 if update failed. +// + +//WVW_XBenable( [nWinNum], nXBid, nFlags ) +//enable/disable scrollbar nXBid in window nWinNum (default to topmost window) +//nFlags: ESB_ENABLE_BOTH 0: enable both arrows +// ESB_DISABLE_LEFT/ESB_DISABLE_UP 1: disable left/up arrow +// ESB_DISABLE_RIGHT/ESB_DISABLE_DOWN 2: disable right/down arrow +// ESB_DISABLE_BOTH 3: disable both arrow +//returns .t. if successful +// + + +//------------------------------------------------- +// PUSHBUTTON +//------------------------------------------------- + +//WVW_PBcreate( [nWinNum], nTop, nLeft, nBottom, nRight, cText, cImage/nImage, bBlock, aOffset) +//create pushbutton for window nWinNum +//nTop: row of top/left corner (in character unit) +//nLeft: col of top/left corner (in character unit) +//nBottom: row of bottom/right corner (in character unit) defaults==nTop +//nRight: col of bottom/right corner (in character unit) defaults==?? +//cText: caption, default == "" +// +//reserved for future: (TODO): +//cImage: bitmap file name, can be supplied as nImage: bitmap resource id +//this parm is now ignored +// +//aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust +// dimension of pushbutton. +// defaults for vertical scroll bar: {0,+3,0,0} +// defaults for horiz scroll bar: {+3-linespacing,0,0,0} +// NOTES: these defaults are meant to make room for other common +// GUI elements like raised/recessed lines. +// +//bBlock: codeblock to execute on every BN_CLICK event. +// This codeblock will be evaluated with these parameters: +// nWinNum: window number +// nPBid : pushbutton id +// +//returns control id of newly created pushbutton of windows nWinNum +//returns 0 if failed +// +//example: +// + +//WVW_PBdestroy( [nWinNum], nPBid ) +//destroy button nPBid for window nWinNum +// + +//WVW_PBsetFocus( [nWinNum], nButtonId ) +//set the focus to button nButtonId in window nWinNum +// + +//WVW_PBenable( [nWinNum], nButtonId, [lToggle] ) +//enable/disable button nButtonId on window nWinNum +//(lToggle defaults to .t., ie. enabling the button) +//return previous state of the button (TRUE:enabled FALSE:disabled) +//(if nButtonId is invalid, this function returns FALSE too) +// + +//WVW_PBsetcodeblock( [nWinNum], nPBid, bBlock ) +//assign (new) codeblock bBlock to button nPBid for window nWinNum +// +// return .t. if successful +// + +//WVW_PBsetstyle( [nWinNum], nPBid, nStyle ) +//assign new style nStyle to button nPBid for window nWinNum +//typical usage: nStyle==BS_DEFPUSHBUTTON (==01) to turn the button +// into default push button +// (thick border) +// BS_PUSHBUTTON (==00) to turn the button +// into regular push button +// +//using other styles like BS_MULTILINE may also be usefull, +//but I haven't tried that +// +// this function always return .t. +// + +//WVW_PBSetFont([nWinNum], cFontFace, nHeight, nWidth, nWeight, nQUality,; +// lItalic, lUnderline, lStrikeout +// +//this will initialize font for ALL pushbuttons in window nWinNum +//(including ones created later on) +// + + +//------------------------------------------------- +// PROGRESSBAR +//------------------------------------------------- + +//WVW_PGcreate( [nWinNum], nTop, nLeft, nBottom, nRight, [aOffset], +// [nBackColor], [nBarColor], [lSmooth], [lVertical]) +//create progress bar for window nWinNum +//nTop: row of top/left corner (in character unit) +//nLeft: col of top/left corner (in character unit) +//nBottom: row of bottom/right corner (in character unit) +//nRight: col of bottom/right corner (in character unit) +//aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust +// dimension of progress bar. defaults: {0, 0, 0, 0} +//nBackColor: color of background (as RGB value) +//nBarColor: color of bar (as RGB value) +//lSmooth: if .t., draw as smooth bar (default is .f.) +//lVertical: if .t., draw as vertical progress bar (default is .f.) +// +//returns control id of newly created progress bar of windows nWinNum +//returns 0 if failed +// +//example: +//WVW_PGcreate( , 5, 10, 5, 30) +// :: creates horiz progressbar on current window at (5,10) to (5,30) +// colors using default ones. +// +//WVW_PGcreate( , 5, 10, 5, 30, {-1, 0, +1, 0} ) +// :: same as above, but the bar is enlarged 1 pixel to the top +// and 1 pixel to the bottom +// +//NOTES: +//ProgressRange is initially set as 0 - 100. +//Initial ProgressPos is 0 +// + +//WVW_PGdestroy( [nWinNum], nPGid ) +//destroy progressbar nPGid for window nWinNum +//This function has no return value. +// + +//WVW_PGsetrange(nWinNum, PGid, [nMin], [nMax]) +//update progressbar data range (default is 0-100) +//nMin: a number in range of -32767 to +32767 +//nMax: a number in range of -32767 to +32767 +// +//Remark: progress position is reset to nMin +// +//returns .t. if operation considered successfull +// + +//WVW_PGsetpos(nWinNum, PGid, [nPos]) +//update progressbar position within current range +//nPos: a number in range of current range +//returns .t. if operation considered successfull +// + +//WVW_PGgetpos(nWinNum, PGid) +//get progressbar current position +//returns 0 if operation failed +// + + +//------------------------------------------------- +// +// GTWVT compatibility functions. +// See WVT2WVW.CH about how to map coresponding +// GTWVT functions to GTWVW's ones. +// +//------------------------------------------------- + + +//------------------------------------------------- PART-1: WINDOW INDEPENDENT (the same parameter list with GTWVT) -/*-------------------------------------------------------------------*/ +//------------------------------------------------- WVW_CREATEMENU ([]) WVW_CREATEPOPUPMENU ([]) @@ -601,11 +601,11 @@ WVW_CBSETCURSEL ([]) WVW_DLGSETICON ([]) -/*-------------------------------------------------------------------*/ +//------------------------------------------------- PART-2: WINDOW DEPENDENT (additional nWinNum parameter) -/*-------------------------------------------------------------------*/ +//------------------------------------------------- -/* +// Notes: All the following functions expect nWinNum as the first parameter. @@ -621,7 +621,7 @@ PART-2: WINDOW DEPENDENT (additional nWinNum parameter) Topmost Window endif -*/ +// WVW_SETMENU ([nWinNum] [, ]) WVW_SETPOPUPMENU ([nWinNum] [, ]) @@ -651,16 +651,16 @@ WVW_SAVESCREEN ([nWinNum] [, ]) WVW_RESTSCREEN ([nWinNum] [, ]) WVW_DRAWLABELOBJ ([nWinNum] [, ]) -/******************************************************************** +//******************************************************************* WVW_DRAWTOOLBUTTONSTATE is for compatibility only. Recommended to use WVW_TBxxxx specific functions instead. -*********************************************************************/ +******************************************************************** WVW_DRAWTOOLBUTTONSTATE ([nWinNum] [, ]) -/******************************************************************** +//******************************************************************* WVW_DRAWSCROLL* is for compatibility only. Recommended to use WVW_XBxxxx specific functions instead. -*********************************************************************/ +******************************************************************** WVW_DRAWSCROLLBUTTON ([nWinNum] [, ]) WVW_DRAWSCROLLTHUMBVERT ([nWinNum] [, ]) WVW_DRAWSCROLLTHUMBHORZ ([nWinNum] [, ]) @@ -669,10 +669,10 @@ WVW_DRAWSHADEDRECT ([nWinNum] [, ]) WVW_DRAWTEXTBOX ([nWinNum] [, ]) -/******************************************************************** +//******************************************************************* WVW_DRAWPROGRESSBAR is for compatibility only. Recommended to use WVW_PGxxxx specific functions instead. -*********************************************************************/ +******************************************************************** WVW_DRAWPROGRESSBAR ([nWinNum] [, ]) WVW_TRACKPOPUPMENU ([nWinNum] [, ]) @@ -697,17 +697,17 @@ WVW_DRAWFOCUSRECT ([nWinNum] [, ]) WVW_DRAWGRIDHORZ ([nWinNum] [, ]) WVW_DRAWGRIDVERT ([nWinNum] [, ]) -/******************************************************************** +//******************************************************************* WVW_DRAWBUTTON is for compatibility only. Recommended to use WVW_PBxxxx specific functions instead. -*********************************************************************/ +******************************************************************** WVW_DRAWBUTTON ([nWinNum] [, ]) WVW_SETMOUSEPOS ([nWinNum] [, ]) -/* in gtwvt no pending rect is reflected as {0,0,0,0} +// in gtwvt no pending rect is reflected as {0,0,0,0} in gtwvw no pending rect is reflected as {y1,x1,y2,x2} where y1 > y2 or x1 > x2 -*/ +// WVW_GETPAINTRECT ([nWinNum] [, ]) WVW_SETPOINTER ([nWinNum] [, ]) @@ -728,25 +728,25 @@ WVW_GETTOOLTIPWIDTH ([nWinNum] [, ]) WVW_GETTOOLTIPBKCOLOR ([nWinNum] [, ]) WVW_GETTOOLTIPTEXTCOLOR ([nWinNum] [, ]) -/******************************************************************** +//******************************************************************* Timer functions. WARNING: WVT implementation is slightly different. -*********************************************************************/ +******************************************************************** WVW_SETTIMER ([nWinNum] [, ]) WVW_KILLTIMER ([nWinNum] [, ]) -/******************************************************************** +//******************************************************************* WVW_DRAWSTATUSBAR is for compatibility only. Recommended to use WVW_SBxxxx specific functions instead. -*********************************************************************/ +******************************************************************** WVW_DRAWSTATUSBAR ([nWinNum] [, ]) -/*-------------------------------------------------------------------*/ +//------------------------------------------------- PART-3: General Windows API functions -/*-------------------------------------------------------------------*/ +//------------------------------------------------- -/* +// Notes: These functions are recently added to GTWVT, hence it is also loaded @@ -756,7 +756,7 @@ PART-3: General Windows API functions exist in What32 library. These functions are exactly the same as the ones in GTWVT. -*/ +// WIN_SENDMESSAGE ([]) WIN_SENDDLGITEMMESSAGE([]) @@ -794,16 +794,16 @@ WIN_CREATEBRUSH ([]) WIN_DRAWTEXT ([]) -/*-------------------------------------------------------------------*/ -/* */ -/* CALLBACK FUNCTIONS */ -/* (functions in .prg, called by gtwvw) */ -/* See WVT2WVW.CH about how to map coresponding */ -/* GTWVT functions to GTWVW's ones. */ -/* */ -/*-------------------------------------------------------------------*/ +//------------------------------------------------- +// +// CALLBACK FUNCTIONS +// (functions in .prg, called by gtwvw) +// See WVT2WVW.CH about how to map coresponding +// GTWVT functions to GTWVW's ones. +// +//------------------------------------------------- -/* +// Notes: These functions, if exist in your code, will be called by gtwvw on particular events. @@ -813,7 +813,7 @@ WIN_DRAWTEXT ([]) Please see program samples on how to write/use such functions. -*/ +// FUNCTION WVW_PAINT(nWinNum) @@ -830,268 +830,268 @@ FUNCTION WVW_MENUSELECT(nWinNum, hWnd, message, wParam, lParam) FUNCTION WVW_INPUTFOCUS(nWinNum, hWnd, message, wParam, lParam) -/*-------------------------------------------------------------------*/ -/* */ -/* Brief descriptions of some GTWVW functions */ -/* imported from GTWVT. */ -/* */ -/*-------------------------------------------------------------------*/ +//------------------------------------------------- +// +// Brief descriptions of some GTWVW functions +// imported from GTWVT. +// +//------------------------------------------------- -/*-------------------------------------------------------------------*/ -/* aScr := Wvw_SaveScreen( nWinNum, nTop, nLeft, nBottom, nRight ) */ -/* */ +//------------------------------------------------- +// aScr := Wvw_SaveScreen( nWinNum, nTop, nLeft, nBottom, nRight ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_RestScreen( nWinNum, nTop, nLeft, nBottom, nRight, aScr, lDoNotDestroyBMP )*/ -/* */ +//------------------------------------------------- +// Wvw_RestScreen( nWinNum, nTop, nLeft, nBottom, nRight, aScr, lDoNotDestroyBMP ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_CreateFont( cFontFace, nHeight, nWidth, nWeight, lItalic, lUnderline,*/ -/* lStrikeout, nCharSet, nQuality, nEscapement ) */ -/* */ +//------------------------------------------------- +// Wvw_CreateFont( cFontFace, nHeight, nWidth, nWeight, lItalic, lUnderline, +// lStrikeout, nCharSet, nQuality, nEscapement ) +// -/*-------------------------------------------------------------------*/ -/* WVW_DRAWLABELOBJ( [nWinNum], nTop, nLeft, nBottom, nRight, cLabel, nAlignHorz, nAlignVert, nTextColor, nBkColor, hFont )*/ -/* */ +//------------------------------------------------- +// WVW_DRAWLABELOBJ( [nWinNum], nTop, nLeft, nBottom, nRight, cLabel, nAlignHorz, nAlignVert, nTextColor, nBkColor, hFont ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawToolButtonState( [nWinNum], nTop, nLeft, nBottom, nRight, aPxlOff, nState )*/ -/* */ +//------------------------------------------------- +// Wvw_DrawToolButtonState( [nWinNum], nTop, nLeft, nBottom, nRight, aPxlOff, nState ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawScrollButton( [nWinNum], nTop, nLeft, nBottom, nRight, aOffPixels, nTLBR, lDepressed )*/ -/* */ -/* SEE ALSO: WVW_XB* functions */ +//------------------------------------------------- +// Wvw_DrawScrollButton( [nWinNum], nTop, nLeft, nBottom, nRight, aOffPixels, nTLBR, lDepressed ) +// +// SEE ALSO: WVW_XB* functions -/*-------------------------------------------------------------------*/ -/* */ -/* Wvw_DrawScrollbarThumbVert( [nWinNum], nTop, nLeft, nBottom, nRight, aPxlScroll, nThumbPos )*/ -/* */ -/* SEE ALSO: WVW_XB* functions */ +//------------------------------------------------- +// +// Wvw_DrawScrollbarThumbVert( [nWinNum], nTop, nLeft, nBottom, nRight, aPxlScroll, nThumbPos ) +// +// SEE ALSO: WVW_XB* functions -/*-------------------------------------------------------------------*/ -/* */ -/* Wvw_DrawScrollbarThumbHorz( [nWinNum], nTop, nLeft, nBottom, nRight, aPxlOffset, nThumbPos )*/ -/* */ -/* SEE ALSO: WVW_XB* functions */ +//------------------------------------------------- +// +// Wvw_DrawScrollbarThumbHorz( [nWinNum], nTop, nLeft, nBottom, nRight, aPxlOffset, nThumbPos ) +// +// SEE ALSO: WVW_XB* functions -/*-------------------------------------------------------------------*/ -/* Wvw_DrawShadedRect( [nWinNum], nTop, nLeft, nBottom, nRight, aPxlOffSet, nHorVert, aRGBb, aRGBe )*/ -/* */ +//------------------------------------------------- +// Wvw_DrawShadedRect( [nWinNum], nTop, nLeft, nBottom, nRight, aPxlOffSet, nHorVert, aRGBb, aRGBe ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawTextBox( [nWinNum], nTop, nLeft, nBottom, nRight, aPxlOffSet, cText, ;*/ -/* nAlignHorz, nAlignVert, nTextColor, nBackColor, ; */ -/* nBackMode, hFont ) */ -/* */ +//------------------------------------------------- +// Wvw_DrawTextBox( [nWinNum], nTop, nLeft, nBottom, nRight, aPxlOffSet, cText, ; +// nAlignHorz, nAlignVert, nTextColor, nBackColor, ; +// nBackMode, hFont ) +// -/*------------------------------------------------------------------- - * Wvw_DrawProgressBar( [nWinNum], nTop, nLeft, nBottom, nRight, aPxlTLBR, nPercent,; - * nBackColor, nBarColor, cImage, lVertical, nDirection ) - */ +//------------------------------------------------- +// Wvw_DrawProgressBar( [nWinNum], nTop, nLeft, nBottom, nRight, aPxlTLBR, nPercent,; +// nBackColor, nBarColor, cImage, lVertical, nDirection ) +// -/* WVW_TrackPopupMenu([nWinNum], n) */ +// WVW_TrackPopupMenu([nWinNum], n) -/* WVW_GetMenu([nWinNum]) */ +// WVW_GetMenu([nWinNum]) -/*-------------------------------------------------------------------*/ -/* */ -/* Wvw_SetPen( nPenStyle, nWidth, nColor ) */ -/* */ -/* IMPORTANT: in prev release this functions has nWinNum parameter +//------------------------------------------------- +// +// Wvw_SetPen( nPenStyle, nWidth, nColor ) +// +// IMPORTANT: in prev release this functions has nWinNum parameter PENs are now application-wide. - */ +// -/*-------------------------------------------------------------------*/ -/* */ -/* Wvw_SetBrush( nStyle, nColor, [ nHatch ] ) */ -/* */ -/* IMPORTANT: in prev release this functions has nWinNum parameter +//------------------------------------------------- +// +// Wvw_SetBrush( nStyle, nColor, [ nHatch ] ) +// +// IMPORTANT: in prev release this functions has nWinNum parameter BRUSHes are now application-wide. - */ +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawBoxGet( [nWinNum], nRow, nCol, nWidth ) */ -/* */ +//------------------------------------------------- +// Wvw_DrawBoxGet( [nWinNum], nRow, nCol, nWidth ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawBoxRaised( nWinNum, */ -/* nTop, nLeft, nBottom, nRight, */ -/* lTight) <--none in gtwvt */ -/* */ -/* if lTight, box is drawn inside the character region */ -/* AND top and left lines are lower two pixel down to make room for above/left object*/ -/* WARNING: gui object of this type subject to be overwritten by chars */ -/* NOTE that these lines are to be overwritten by displayed char, */ -/* we are depending on the fact that gui object will be painted last */ -/* */ +//------------------------------------------------- +// Wvw_DrawBoxRaised( nWinNum, +// nTop, nLeft, nBottom, nRight, +// lTight) <--none in gtwvt +// +// if lTight, box is drawn inside the character region +// AND top and left lines are lower two pixel down to make room for above/left object +// WARNING: gui object of this type subject to be overwritten by chars +// NOTE that these lines are to be overwritten by displayed char, +// we are depending on the fact that gui object will be painted last +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawBoxRecessed( nWinNum, ; */ -/* nTop, nLeft, nBottom, nRight, */ -/* lTight) <--none in gtwvt */ -/* */ -/* if lTight, box is drawn inside the character region */ -/* AND top and left lines are lower two pixel down to make room for above/left object */ -/* WARNING: gui object of this type subject to be overwritten by chars */ -/* NOTE that these lines are to be overwritten by displayed char, */ -/* we are depending on the fact that gui object will be painted last */ -/* */ +//------------------------------------------------- +// Wvw_DrawBoxRecessed( nWinNum, ; +// nTop, nLeft, nBottom, nRight, +// lTight) <--none in gtwvt +// +// if lTight, box is drawn inside the character region +// AND top and left lines are lower two pixel down to make room for above/left object +// WARNING: gui object of this type subject to be overwritten by chars +// NOTE that these lines are to be overwritten by displayed char, +// we are depending on the fact that gui object will be painted last +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawBoxGroup( nWinNum, ; */ -/* nTop, nLeft, nBottom, nRight ) */ -/* */ +//------------------------------------------------- +// Wvw_DrawBoxGroup( nWinNum, ; +// nTop, nLeft, nBottom, nRight ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawBoxRaised( nWinNum, ; */ -/* nTop, nLeft, nBottom, nRight ) */ -/* */ +//------------------------------------------------- +// Wvw_DrawBoxRaised( nWinNum, ; +// nTop, nLeft, nBottom, nRight ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawImage( nWinNum, ; */ -/* nTop, nLeft, nBottom, nRight, cImage/nPictureSlot, ; */ -/* lTight/aOffset) <--none in gtwvt */ -/* */ +//------------------------------------------------- +// Wvw_DrawImage( nWinNum, ; +// nTop, nLeft, nBottom, nRight, cImage/nPictureSlot, ; +// lTight/aOffset) <--none in gtwvt +// -/*-------------------------------------------------------------------*/ -/* WVW_DRAWLABEL( nWinNum, ; */ -/* nRow, nCol, cLabel, nAlign, nEscapement, nTextColor, ; */ -/* nBkColor, cFontFace,nHeight, nWidth, nWeight, ; */ -/* nQuality, nCharSet, lItalic, lUnderline, lStrikeOut ) */ -/* */ +//------------------------------------------------- +// WVW_DRAWLABEL( nWinNum, ; +// nRow, nCol, cLabel, nAlign, nEscapement, nTextColor, ; +// nBkColor, cFontFace,nHeight, nWidth, nWeight, ; +// nQuality, nCharSet, lItalic, lUnderline, lStrikeOut ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawOutline( nWinNum, ; */ -/* nTop, nLeft, nBottom, nRight, */ -/* nThick, nShape, nRGBColor ) */ -/* */ +//------------------------------------------------- +// Wvw_DrawOutline( nWinNum, ; +// nTop, nLeft, nBottom, nRight, +// nThick, nShape, nRGBColor ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawLine( nWinNum, ; */ -/* nTop, nLeft, nBottom, nRight, nOrient, nFormat, nAlign, nStyle, nThick, nColor ) */ -/* */ +//------------------------------------------------- +// Wvw_DrawLine( nWinNum, ; +// nTop, nLeft, nBottom, nRight, nOrient, nFormat, nAlign, nStyle, nThick, nColor ) +// -/*-------------------------------------------------------------------*/ -/* Inside the area requested! */ -/* Wvw_DrawEllipse( nWinNum, nTop, nLeft, nBottom, nRight ) */ -/* */ +//------------------------------------------------- +// Inside the area requested! +// Wvw_DrawEllipse( nWinNum, nTop, nLeft, nBottom, nRight ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawRectangle( nWinNum, nTop, nLeft, nBottom, nRight ) */ -/* */ +//------------------------------------------------- +// Wvw_DrawRectangle( nWinNum, nTop, nLeft, nBottom, nRight ) +// -/*-------------------------------------------------------------------*/ -/*GTWVW specific */ -/*none in gtwvt */ -/* Wvw_FillRectangle( nWinNum, nTop, nLeft, nBottom, nRight, nRGBcolor/hBrush, */ -/* lTight, lUseBrush ) */ -/* */ -/* if lTight, rect is drawn inside the character region */ -/* AND top and left lines are lower two pixel down to make room for above/left object */ -/* WARNING: gui object of this type subject to be overwritten by chars */ -/* NOTE that these lines are to be overwritten by displayed char, */ -/* we are depending on the fact that gui object will be painted last */ -/* */ -/* if lUseBrush, nRGBcolor is treated as a BRUSH handle */ -/* */ +//------------------------------------------------- +//GTWVW specific +//none in gtwvt +// Wvw_FillRectangle( nWinNum, nTop, nLeft, nBottom, nRight, nRGBcolor/hBrush, +// lTight, lUseBrush ) +// +// if lTight, rect is drawn inside the character region +// AND top and left lines are lower two pixel down to make room for above/left object +// WARNING: gui object of this type subject to be overwritten by chars +// NOTE that these lines are to be overwritten by displayed char, +// we are depending on the fact that gui object will be painted last +// +// if lUseBrush, nRGBcolor is treated as a BRUSH handle +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawRoundRect( nWinNum, nTop, nLeft, nBottom, nRight, nRoundHeight, nRoundWidth )*/ -/* */ +//------------------------------------------------- +// Wvw_DrawRoundRect( nWinNum, nTop, nLeft, nBottom, nRight, nRoundHeight, nRoundWidth ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawFocusRect( nWinNum, nTop, nLeft, nBottom, nRight ) */ -/* */ +//------------------------------------------------- +// Wvw_DrawFocusRect( nWinNum, nTop, nLeft, nBottom, nRight ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawGridHorz( nWinNum, ; */ -/* nTop, nLeft, nRight, nRows ) */ -/* */ +//------------------------------------------------- +// Wvw_DrawGridHorz( nWinNum, ; +// nTop, nLeft, nRight, nRows ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawGridVert( nWinNum, ; */ -/* nTop, nBottom, aCols, nCols ) */ -/* */ +//------------------------------------------------- +// Wvw_DrawGridVert( nWinNum, ; +// nTop, nBottom, aCols, nCols ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawButton( nWinNum, ; */ -/* nTop, nLeft, nBottom, nRight, cText, cImage/nImage, nFormat, ; */ -/* nTextColor, nBkColor, nImageAt ) */ -/* */ +//------------------------------------------------- +// Wvw_DrawButton( nWinNum, ; +// nTop, nLeft, nBottom, nRight, cText, cImage/nImage, nFormat, ; +// nTextColor, nBkColor, nImageAt ) +// -/* WVW_DrawStatusbar() is meant for WVT compatibility only. - WVW_SBxxxx() functions are recommended instead. - */ +// WVW_DrawStatusbar() is meant for WVT compatibility only. +// WVW_SBxxxx() functions are recommended instead. +// -/*-------------------------------------------------------------------*/ -/* Wvw_ChooseFont( cFontName, nHeight, nWidth, nWeight, nQuality, ; */ -/* lItalic, lUnderline, lStrikeout ) */ -/* */ +//------------------------------------------------- +// Wvw_ChooseFont( cFontName, nHeight, nWidth, nWeight, nQuality, ; +// lItalic, lUnderline, lStrikeout ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_ChooseColor( nRGBInit, aRGB16, nFlags ) => nRGBSelected */ -/* */ +//------------------------------------------------- +// Wvw_ChooseColor( nRGBInit, aRGB16, nFlags ) => nRGBSelected +// -/*WVW_SETMOUSEPOS( nWinNum, nRow, nCol ) nWinNum is 0 based */ -/*WHAT'S the difference with GT_FUNC( mouse_SetPos ) ??? */ -/*this func is able to position cursor on any window */ -/*NOTE: consider using 'standard' SETMOUSE() instead: */ -/* SETMOUSE(.t., nRow, nCol) */ -/* This will treat (nRow,nCol) according to current s_bMainCoordMode setting */ +//WVW_SETMOUSEPOS( nWinNum, nRow, nCol ) nWinNum is 0 based +//WHAT'S the difference with GT_FUNC( mouse_SetPos ) ??? +//this func is able to position cursor on any window +//NOTE: consider using 'standard' SETMOUSE() instead: +// SETMOUSE(.t., nRow, nCol) +// This will treat (nRow,nCol) according to current s_bMainCoordMode setting -/*WVW_GetPaintRect( nWinNum ) nWinNum is 0 based */ -/*returns array of paint pending rect {top, left, bottom, right} */ -/*WARNING: */ -/*unlike WVT, top maybe > bottom */ -/* left maybe > right */ -/*in these cases, no paint request is pending */ -/*(in WVT these is reflected in {0,0,0,0}) */ +//WVW_GetPaintRect( nWinNum ) nWinNum is 0 based +//returns array of paint pending rect {top, left, bottom, right} +//WARNING: +//unlike WVT, top maybe > bottom +// left maybe > right +//in these cases, no paint request is pending +//(in WVT these is reflected in {0,0,0,0}) -/*-------------------------------------------------------------------*/ -/* Wvw_LoadPicture( nSlot, cFilePic ) */ -/* */ +//------------------------------------------------- +// Wvw_LoadPicture( nSlot, cFilePic ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_LoadFont( nSlotFont, cFontFace, nHeight, nWidth, nWeight, lItalic, lUnderline, lStrikeout, */ -/* nCharSet, nQuality, nEscapement ) */ -/* */ +//------------------------------------------------- +// Wvw_LoadFont( nSlotFont, cFontFace, nHeight, nWidth, nWeight, lItalic, lUnderline, lStrikeout, +// nCharSet, nQuality, nEscapement ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_LoadPen( nSlot, nStyle, nWidth, nRGBColor ) */ -/* */ +//------------------------------------------------- +// Wvw_LoadPen( nSlot, nStyle, nWidth, nRGBColor ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawPicture( [nWinNum], nTop, nLeft, nBottom, nRight, nSlot, lTight/aAdj ) -> lOk */ -/* nSlot <= 20 aAdj == { 0,0,-2,-2 } To Adjust the pixels for { Top,Left,Bottom,Right } */ -/* */ +//------------------------------------------------- +// Wvw_DrawPicture( [nWinNum], nTop, nLeft, nBottom, nRight, nSlot, lTight/aAdj ) -> lOk +// nSlot <= 20 aAdj == { 0,0,-2,-2 } To Adjust the pixels for { Top,Left,Bottom,Right } +// -/*-------------------------------------------------------------------*/ -/* WVW_DRAWLABELEX( [nWinNum], nRow, nCol, cLabel, nAlign, nTextColor, nBkColor, nSlotFont ) */ -/* */ +//------------------------------------------------- +// WVW_DRAWLABELEX( [nWinNum], nRow, nCol, cLabel, nAlign, nTextColor, nBkColor, nSlotFont ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawLineEx( [nWinNum], nTop, nLeft, nBottom, nRight, nOrient, nFormat, nAlign, nSlotPen ) */ -/* */ +//------------------------------------------------- +// Wvw_DrawLineEx( [nWinNum], nTop, nLeft, nBottom, nRight, nOrient, nFormat, nAlign, nSlotPen ) +// -/*-------------------------------------------------------------------*/ -/* Wvw_DrawOutlineEx( [nWinNum], nTop, nLeft, nBottom, nRight, nSlotPen ) */ -/* */ +//------------------------------------------------- +// Wvw_DrawOutlineEx( [nWinNum], nTop, nLeft, nBottom, nRight, nSlotPen ) +// -/*-------------------------------------------------------------------*/ -/* WVW_SetToolTopActive([nWinNum], [lToggle]) */ -/* */ +//------------------------------------------------- +// WVW_SetToolTopActive([nWinNum], [lToggle]) +// -/*-------------------------------------------------------------------*/ -/* Wvw_SetToolTip( [nWinNum], nTop, nLeft, nBottom, nRight, cToolText ) */ -/* */ +//------------------------------------------------- +// Wvw_SetToolTip( [nWinNum], nTop, nLeft, nBottom, nRight, cToolText ) +// -/*-------------------------------------------------------------------*/ -/* */ -/* Epilogue */ -/* */ -/*-------------------------------------------------------------------*/ +//------------------------------------------------- +// +// Epilogue +// +//------------------------------------------------- Should you find errors in this document, please report it to gtwvw@csacomputer.com diff --git a/harbour/include/harbour.hbx b/harbour/include/harbour.hbx index c007663871..ea9f66567e 100644 --- a/harbour/include/harbour.hbx +++ b/harbour/include/harbour.hbx @@ -674,6 +674,7 @@ DYNAMIC hb_MemoWrit DYNAMIC hb_MethodName DYNAMIC hb_milliSeconds DYNAMIC hb_Minute +DYNAMIC hb_MGetBounds DYNAMIC hb_MMiddleDown DYNAMIC hb_mtvm DYNAMIC hb_mutexCreate diff --git a/harbour/src/rtl/mouse53.c b/harbour/src/rtl/mouse53.c index 7f3f07d80d..01fa3e9017 100644 --- a/harbour/src/rtl/mouse53.c +++ b/harbour/src/rtl/mouse53.c @@ -160,6 +160,18 @@ HB_FUNC( MSETBOUNDS ) #endif +HB_FUNC( HB_MGETBOUNDS ) +{ + int iTop, iLeft, iBottom, iRight; + + hb_mouseGetBounds( &iTop, &iLeft, &iBottom, &iRight ); + + hb_storni( iTop, 1 ); + hb_storni( iLeft, 2 ); + hb_storni( iBottom, 3 ); + hb_storni( iRight, 4 ); +} + HB_FUNC( HB_MMIDDLEDOWN ) { hb_retl( hb_mouseButtonState( HB_MBUTTON_MIDDLE ) ); diff --git a/harbour/src/rtl/mousehb.c b/harbour/src/rtl/mousehb.c index 878add6bfb..6625c693e8 100644 --- a/harbour/src/rtl/mousehb.c +++ b/harbour/src/rtl/mousehb.c @@ -58,11 +58,6 @@ original CA-Cl*pper namespace. It should have been marked as HB_EXTENSION, but it's not. */ -HB_FUNC_EXTERN( HB_MMIDDLEDOWN ); - -HB_FUNC( MMIDDLEDOWN ) -{ - HB_FUNC_EXEC( HB_MMIDDLEDOWN ); -} +HB_FUNC_TRANSLATE( MMIDDLEDOWN, HB_MMIDDLEDOWN ) #endif