diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 64e92ff62b..16c6506dd7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,50 @@ The license applies to all entries newer than 2009-04-28. */ +2012-10-18 12:58 UTC+0200 Viktor Szakats (harbour syenar.net) + * contrib/hbnf/hbnf.hbx + * contrib/hbnf/menu1.prg + * contrib/hbnf/mouse.c + % use MROW()/MCOL()/MHIDE()/MSHOW() functions in + place of MS-DOS low-level implementations + * disabled page handling functions + + * contrib/hbnf/aading.prg + * contrib/hbnf/acctadj.prg + * contrib/hbnf/aemaxlen.prg + * contrib/hbnf/aeminlen.prg + * contrib/hbnf/at2.prg + * contrib/hbnf/calendar.prg + * contrib/hbnf/dfile.prg + * contrib/hbnf/dispmsg.prg + * contrib/hbnf/lastday.prg + * contrib/hbnf/menu1.prg + * contrib/hbnf/menuto.prg + * contrib/hbnf/metaph.prg + * contrib/hbnf/mouse1.prg + * contrib/hbnf/netpv.prg + * contrib/hbnf/nwuid.prg + * contrib/hbnf/pending.prg + * contrib/hbnf/popadder.prg + * contrib/hbnf/sqzn.prg + * contrib/hbnf/tbwhile.prg + * contrib/hbnf/xbox.prg + * use __defaultNIL()/hb_default() + % optimizations done along the way + + * contrib/hbnf/tests/mouse1.prg + * updated with mouse2.prg + + * contrib/hbnf/peek.c + * synced with gtdos.c after Przemek's changes. + ! added missing MK_FP() definition if not defined + + * src/rtl/gtdos/gtdos.c + ! fixed old typo in one variable name + + - contrib/hbnf/tests/mouse2.prg + - deleted duplicate code + 2012-10-18 12:22 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/src/rtl/gtdos/gtdos.c ! fixed MK_FP() macro @@ -32,7 +76,7 @@ 2012-10-18 02:19 UTC+0200 Viktor Szakats (harbour syenar.net) * src/rtl/gtdos/gtdos.c * TOFIX added about duplicate macros with same functionality - but different name (POKE_BYTE/HB_POKE_BYTE) + but different name (POKE_BYTE/HB_POKE_BYTE) [DONE] ! fixed C++ comment ! fixed indenting/formatting in few places diff --git a/harbour/contrib/hbnf/aading.prg b/harbour/contrib/hbnf/aading.prg index 8524c656c3..a38eea2bc0 100644 --- a/harbour/contrib/hbnf/aading.prg +++ b/harbour/contrib/hbnf/aading.prg @@ -23,32 +23,23 @@ FUNCTION FT_AADDITION( aList1, aList2, lTrimmer, lCaseSens ) - LOCAL nElement, nPos, bScanCode + LOCAL nElement, bScanCode LOCAL aNewArray := AClone( aList1 ) - // Set default parameters as necessary. - IF lCaseSens == NIL - lCaseSens := .T. - ENDIF - - IF lTrimmer == NIL - lTrimmer := .T. - ENDIF + __defaultNIL( @lCaseSens, .T. ) + __defaultNIL( @lTrimmer, .T. ) // Assign code blocks according to case sensitivity and trim. IF lCaseSens - - IF lTrimmer // Ignore spaces. + IF lTrimmer // Ignore spaces bScanCode := {| x | ; AllTrim( x ) == ; AllTrim( aList2[ nElement ] ) } ELSE bScanCode := {| x | x == ( aList2[ nElement ] ) } ENDIF - - ELSE // Ignore case. - - IF lTrimmer // Ignore spaces. + ELSE // Ignore case + IF lTrimmer // Ignore spaces bScanCode := {| x | ; Upper( AllTrim( x ) ) == ; Upper( AllTrim( aList2[ nElement ] ) ) } @@ -61,14 +52,10 @@ FUNCTION FT_AADDITION( aList1, aList2, lTrimmer, lCaseSens ) // Add the unique elements of aList2 to aList1. FOR nElement := 1 TO Len( aList2 ) - - nPos := AScan( aList1, bScanCode ) - // If unique, then add element to new array. - IF nPos == 0 + IF AScan( aList1, bScanCode ) == 0 AAdd( aNewArray, aList2[ nElement ] ) ENDIF - NEXT RETURN aNewArray diff --git a/harbour/contrib/hbnf/acctadj.prg b/harbour/contrib/hbnf/acctadj.prg index 7b80a83e17..bd26fb08cd 100644 --- a/harbour/contrib/hbnf/acctadj.prg +++ b/harbour/contrib/hbnf/acctadj.prg @@ -38,8 +38,9 @@ FUNCTION FT_ACCTADJ( dGivenDate, lIsEnd ) dGivenDate := Date() ENDIF - lIsEnd := iif( HB_ISLOGICAL( lIsEnd ), lIsEnd, .F. ) - nTemp := FT_DAYTOBOW( dGivenDate ) + hb_default( @lIsEnd, .F. ) + + nTemp := FT_DAYTOBOW( dGivenDate ) IF nTemp > ( 2 + iif( lIsEnd, 0, 1 ) ) dGivenDate += 7 - nTemp // Next Week Start (This Week End + 1) diff --git a/harbour/contrib/hbnf/aemaxlen.prg b/harbour/contrib/hbnf/aemaxlen.prg index aa8d47642f..a808025076 100644 --- a/harbour/contrib/hbnf/aemaxlen.prg +++ b/harbour/contrib/hbnf/aemaxlen.prg @@ -25,18 +25,9 @@ FUNCTION FT_AEmaxlen( aArray, nDimension, nStart, nCount ) LOCAL i, nLast, nMaxlen := 0 - // Set default parameters as necessary. - IF nDimension == NIL - nDimension := 1 - ENDIF - - IF nStart == NIL - nStart := 1 - ENDIF - - IF nCount == NIL - nCount := Len( aArray ) - nStart + 1 - ENDIF + __defaultNIL( @nDimension, 1 ) + __defaultNIL( @nStart, 1 ) + __defaultNIL( @nCount, Len( aArray ) - nStart + 1 ) nLast := Min( nStart + nCount - 1, Len( aArray ) ) diff --git a/harbour/contrib/hbnf/aeminlen.prg b/harbour/contrib/hbnf/aeminlen.prg index 04cdb73a62..97b14db372 100644 --- a/harbour/contrib/hbnf/aeminlen.prg +++ b/harbour/contrib/hbnf/aeminlen.prg @@ -25,18 +25,9 @@ FUNCTION FT_AEminlen( aArray, nDimension, nStart, nCount ) LOCAL i, nLast, nMinlen := NIL, nLen - // Set default parameters as necessary. - IF nDimension == NIL - nDimension := 1 - ENDIF - - IF nStart == NIL - nStart := 1 - ENDIF - - IF nCount == NIL - nCount := Len( aArray ) - nStart + 1 - ENDIF + __defaultNIL( @nDimension, 1 ) + __defaultNIL( @nStart, 1 ) + __defaultNIL( @nCount, Len( aArray ) - nStart + 1 ) nLast := Min( nStart + nCount - 1, Len( aArray ) ) diff --git a/harbour/contrib/hbnf/at2.prg b/harbour/contrib/hbnf/at2.prg index 46eb9742df..ac6ee1c031 100644 --- a/harbour/contrib/hbnf/at2.prg +++ b/harbour/contrib/hbnf/at2.prg @@ -32,13 +32,8 @@ FUNCTION FT_AT2( cSearch, cTarget, nOccurs, lCaseSens ) LOCAL cSubstr := cTarget // Set default parameters as necessary. - IF lCaseSens == NIL - lCaseSens := .T. - ENDIF - - IF nOccurs == NIL - nOccurs := 1 - ENDIF + __defaultNIL( @lCaseSens, .T. ) + __defaultNIL( @nOccurs, 1 ) FOR nCount := 1 TO nOccurs @@ -70,13 +65,8 @@ FUNCTION FT_RAT2( cSearch, cTarget, nOccurs, lCaseSens ) LOCAL cSubstr := cTarget // Set default parameters as necessary. - IF lCaseSens == NIL - lCaseSens := .T. - ENDIF - - IF nOccurs == NIL - nOccurs := 1 - ENDIF + __defaultNIL( @lCaseSens, .T. ) + __defaultNIL( @nOccurs, 1 ) FOR nCount := 1 TO nOccurs diff --git a/harbour/contrib/hbnf/calendar.prg b/harbour/contrib/hbnf/calendar.prg index 062fef2c7e..5db026c427 100644 --- a/harbour/contrib/hbnf/calendar.prg +++ b/harbour/contrib/hbnf/calendar.prg @@ -30,17 +30,17 @@ FUNCTION FT_CALENDAR( nRow, nCol, cColor, lShadow, lShowHelp ) LOCAL aRetVal[ 8 ] LOCAL nHelpRow, cSaveHelp, lHelpIsDisplayed := .F. - nRow := iif( nRow != NIL, nRow, 1 ) //check display row - nCol := iif( nCol != NIL, nCol, 63 ) //check display col - cColor := iif( cColor != NIL, cColor, "W+/G" ) //check display color - lShadow := iif( lShadow == NIL, .F., lShadow ) //check shadow switch - lShowHelp := iif( lShowHelp == NIL, .F., lShowHelp )//check help switch + __defaultNIL( @nRow , 1 ) // check display row + __defaultNIL( @nCol , 63 ) // check display col + __defaultNIL( @cColor , "W+/G" ) // check display color + __defaultNIL( @lShadow , .F. ) // check shadow switch + __defaultNIL( @lShowHelp, .F. ) // check help switch - nRow := iif( nRow < 1 .OR. nRow > 21, 1, nRow ) //check row bounds - nCol := iif( nCol < 1 .OR. nCol > 63, 63, nCol ) //check col bounds + nRow := iif( nRow < 1 .OR. nRow > 21, 1, nRow ) // check row bounds + nCol := iif( nCol < 1 .OR. nCol > 63, 63, nCol ) // check col bounds - cSavColor := SetColor( cColor ) //save current and set display color - cSaveScreen := SaveScreen( nRow - 1, nCol - 1, nRow + 3, nCol + 17 ) //save screen + cSavColor := SetColor( cColor ) // save current and set display color + cSaveScreen := SaveScreen( nRow - 1, nCol - 1, nRow + 3, nCol + 17 ) // save screen cSaveCursor := SetCursor( SC_NONE ) // save current and turn off cursor IF lShadow diff --git a/harbour/contrib/hbnf/dfile.prg b/harbour/contrib/hbnf/dfile.prg index b3fdcb48f3..27ba3b8bf4 100644 --- a/harbour/contrib/hbnf/dfile.prg +++ b/harbour/contrib/hbnf/dfile.prg @@ -37,20 +37,18 @@ FUNCTION FT_DFSETUP( cInFile, nTop, nLeft, nBottom, nRight, ; LOCAL rval IF hb_FileExists( cInFile ) - nTop := iif( HB_ISNUMERIC( nTop ) , nTop, 0 ) - nLeft := iif( HB_ISNUMERIC( nLeft ) , nLeft, 0 ) - nBottom := iif( HB_ISNUMERIC( nBottom ), nBottom, MaxRow() ) - nRight := iif( HB_ISNUMERIC( nRight ) , nRight, MaxCol() ) - nCNormal := iif( HB_ISNUMERIC( nCNormal ) , nCNormal, 7 ) - nCHighlight := iif( HB_ISNUMERIC( nCHighlight ), nCHighlight, 15 ) - - nStart := iif( HB_ISNUMERIC( nStart ) , nStart, 1 ) - nColSkip := iif( HB_ISNUMERIC( nColSkip ) , nColSkip, 1 ) - lBrowse := iif( HB_ISLOGICAL( lBrowse ) , lBrowse, .F. ) - - nRMargin := iif( HB_ISNUMERIC( nRMargin ) , nRMargin, 255 ) - nBuffSize := iif( HB_ISNUMERIC( nBuffSize ), nBuffSize, 4096 ) + hb_default( @nTop , 0 ) + hb_default( @nLeft , 0 ) + hb_default( @nBottom , MaxRow() ) + hb_default( @nRight , MaxCol() ) + hb_default( @nCNormal , 7 ) + hb_default( @nCHighlight , 15 ) + hb_default( @nStart , 1 ) + hb_default( @nColSkip , 1 ) + hb_default( @lBrowse , .F. ) + hb_default( @nRMargin , 255 ) + hb_default( @nBuffSize , 4096 ) IF HB_ISARRAY( cExitKeys ) /* Harbour extension */ IF Len( cExitKeys ) > 25 diff --git a/harbour/contrib/hbnf/dispmsg.prg b/harbour/contrib/hbnf/dispmsg.prg index 83497aef6a..be980fe166 100644 --- a/harbour/contrib/hbnf/dispmsg.prg +++ b/harbour/contrib/hbnf/dispmsg.prg @@ -98,7 +98,7 @@ FUNCTION FT_DispMsg( aInfo, cKey, nBoxTop, nBoxLeft, cnBoxString, lShadow ) cnBoxString := hb_UTF8ToStrBox( "┌─┐│┘─└│ " ) ENDIF - lShadow := iif( lShadow == NIL, .T., lShadow ) + __defaultNIL( @lShadow, .T. ) cOldScreen := SaveScreen( nBoxTop, nBoxLeft, nBoxBottom + 1, nBoxRight + 2 ) diff --git a/harbour/contrib/hbnf/hbnf.hbx b/harbour/contrib/hbnf/hbnf.hbx index de47206b5f..98546ad8b9 100644 --- a/harbour/contrib/hbnf/hbnf.hbx +++ b/harbour/contrib/hbnf/hbnf.hbx @@ -240,8 +240,6 @@ DYNAMIC _FT_DFINIT DYNAMIC _FT_NWKSTAT DYNAMIC _FT_TEMPFIL DYNAMIC _MSET_SENSITIVE -DYNAMIC _MSE_MHIDECRS -DYNAMIC _MSE_SHOWCURS DYNAMIC _M_RESET #if defined( __HBEXTREQ__ ) .OR. defined( __HBEXTERN__HBNF__REQUEST ) diff --git a/harbour/contrib/hbnf/lastday.prg b/harbour/contrib/hbnf/lastday.prg index a70bd79bc6..ad8b44b137 100644 --- a/harbour/contrib/hbnf/lastday.prg +++ b/harbour/contrib/hbnf/lastday.prg @@ -29,10 +29,8 @@ FUNCTION ft_lday( dDate ) - LOCAL d := dDate - IF dDate == NIL - d := Date() + dDate := Date() ENDIF - RETURN ( d += 45 - Day( d ) ) - Day( d ) + RETURN ( dDate += 45 - Day( dDate ) ) - Day( dDate ) diff --git a/harbour/contrib/hbnf/menu1.prg b/harbour/contrib/hbnf/menu1.prg index bb04af9b09..48f9389cbe 100644 --- a/harbour/contrib/hbnf/menu1.prg +++ b/harbour/contrib/hbnf/menu1.prg @@ -109,7 +109,7 @@ FUNCTION FT_MENU1( aBar, aOptions, aColors, nTopRow, lShadow ) t_nMaxCol := MaxCol() // row for menu bar - nTopRow := iif( nTopRow == NIL, 0, nTopRow ) + __defaultNIL( @nTopRow, 0 ) AFill( aLastSel, 1 ) t_aChoices := aOptions diff --git a/harbour/contrib/hbnf/menuto.prg b/harbour/contrib/hbnf/menuto.prg index 251dcb936c..46cc50d448 100644 --- a/harbour/contrib/hbnf/menuto.prg +++ b/harbour/contrib/hbnf/menuto.prg @@ -78,9 +78,7 @@ FUNCTION FT_Prompt( nRow, nCol, cPrompt, cColor, ; nUp, nDown, nLeft, nRight, bExecute ) // If the prompt color setting is not specified, use default - IF cColor == NIL - cColor := SetColor() - ENDIF + __defaultNIL( @cColor, SetColor() ) // If no message is supplied, set message values to NIL @@ -89,11 +87,8 @@ FUNCTION FT_Prompt( nRow, nCol, cPrompt, cColor, ; nMsgRow := nMsgCol := cMsgColor := NIL ELSE - // If message row not supplied, use the default - IF nMsgRow == NIL - nMsgRow := Set( _SET_MESSAGE ) - ENDIF + __defaultNIL( @nMsgRow, Set( _SET_MESSAGE ) ) // If message column not supplied, use the default IF nMsgCol == NIL @@ -105,18 +100,12 @@ FUNCTION FT_Prompt( nRow, nCol, cPrompt, cColor, ; ENDIF // If message color not specified, use the default - IF cMsgColor == NIL - cMsgColor := cColor - ENDIF + __defaultNIL( @cMsgColor, cColor ) ENDIF // If trigger values not specifed, set the defaults - IF nTrigger == NIL - nTrigger := 1 - ENDIF - IF cTriggerColor == NIL - cTriggerColor := cColor - ENDIF + __defaultNIL( @nTrigger, 1 ) + __defaultNIL( @cTriggerColor, cColor ) // Now add elements to the static arrays -- t_nLevel indicates the recursion // level, which allows for nested menus. @@ -175,7 +164,7 @@ FUNCTION FT_MenuTo( bGetSet, cReadVar, lCold ) nActive := Eval( bGetSet ) - IF ( nActive < 1 .OR. nActive > nCount ) + IF nActive < 1 .OR. nActive > nCount nActive := 1 ENDIF diff --git a/harbour/contrib/hbnf/metaph.prg b/harbour/contrib/hbnf/metaph.prg index 3572357d6c..f71e004681 100644 --- a/harbour/contrib/hbnf/metaph.prg +++ b/harbour/contrib/hbnf/metaph.prg @@ -95,8 +95,8 @@ FUNCTION FT_METAPH( cName, nSize ) // Calculates the metaphone of a character s LOCAL cMeta - cName := iif( cName == NIL, "", cName ) // catch-all - nSize := iif( nSize == NIL, 4, nSize ) // default size: 4-bytes + __defaultNIL( @cName, "" ) // catch-all + __defaultNIL( @nSize, 4 ) // default size: 4-bytes // Remove non-alpha characters and make upper case. // The string is padded with 1 space at the beginning & end. diff --git a/harbour/contrib/hbnf/mouse.c b/harbour/contrib/hbnf/mouse.c index 63c4d99b1e..75b6b28d3f 100644 --- a/harbour/contrib/hbnf/mouse.c +++ b/harbour/contrib/hbnf/mouse.c @@ -60,7 +60,7 @@ HB_FUNC( FT_MGETPAGE ) { int iPage; -#if defined( HB_OS_DOS ) +#if defined( HB_OS_DOS ) && 0 { union REGS regs; regs.HB_XREGS.ax = 0x1E; @@ -78,7 +78,7 @@ HB_FUNC( FT_MGETPAGE ) HB_FUNC( FT_MSETPAGE ) { -#if defined( HB_OS_DOS ) +#if defined( HB_OS_DOS ) && 0 { union REGS regs; regs.HB_XREGS.ax = 0x1D; @@ -224,28 +224,6 @@ HB_FUNC( _M_RESET ) hb_retl( fMouse ); } -HB_FUNC( _MSE_SHOWCURS ) -{ -#if defined( HB_OS_DOS ) - { - union REGS regs; - regs.HB_XREGS.ax = 1; - HB_DOS_INT86( 0x33, ®s, ®s ); - } -#endif -} - -HB_FUNC( _MSE_MHIDECRS ) -{ -#if defined( HB_OS_DOS ) - { - union REGS regs; - regs.HB_XREGS.ax = 2; - HB_DOS_INT86( 0x33, ®s, ®s ); - } -#endif -} - HB_FUNC( FT_MGETPOS ) { int iX; @@ -275,46 +253,6 @@ HB_FUNC( FT_MGETPOS ) hb_retni( iButton ); } -HB_FUNC( FT_MGETX ) -{ - int iRow; - -#if defined( HB_OS_DOS ) - { - union REGS regs; - regs.HB_XREGS.ax = 3; - HB_DOS_INT86( 0x33, ®s, ®s ); - iRow = regs.HB_XREGS.dx / 8; - } -#else - { - iRow = 0; - } -#endif - - hb_retni( iRow ); -} - -HB_FUNC( FT_MGETY ) -{ - int iCol; - -#if defined( HB_OS_DOS ) - { - union REGS regs; - regs.HB_XREGS.ax = 3; - HB_DOS_INT86( 0x33, ®s, ®s ); - iCol = regs.HB_XREGS.cx / 8; - } -#else - { - iCol = 0; - } -#endif - - hb_retni( iCol ); -} - HB_FUNC( FT_MSETPOS ) { #if defined( HB_OS_DOS ) @@ -477,3 +415,9 @@ HB_FUNC( FT_MGETCOORD ) 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 5850eea469..ad2e759d34 100644 --- a/harbour/contrib/hbnf/mouse1.prg +++ b/harbour/contrib/hbnf/mouse1.prg @@ -12,35 +12,16 @@ FUNCTION FT_MDBLCLK( nClick, nButton, nInterval, nRow, nCol, nStart ) LOCAL lDone // loop flag LOCAL nPrs // number of presses which occurred - // Initialize any empty arguments - - IF nClick == NIL - nClick := 1 - ENDIF - - IF nButton == NIL - nButton := 0 - ENDIF - - IF nRow == NIL - nRow := FT_MGETX() - ENDIF - - IF nCol == NIL - nCol := FT_MGETY() - ENDIF - - IF nInterval == NIL - nInterval := 0.5 - ENDIF - - IF nStart == NIL - nStart := Seconds() - ENDIF + __defaultNIL( @nClick, 1 ) + __defaultNIL( @nButton, 0 ) + __defaultNIL( @nInterval, 0.5 ) + __defaultNIL( @nRow, MRow() ) + __defaultNIL( @nCol, MCol() ) + __defaultNIL( @nStart, Seconds() ) nVert := nRow nHorz := nCol - lDouble := lDone := nClick == 0 + lDouble := lDone := ( nClick == 0 ) // Wait for first press if requested @@ -73,7 +54,7 @@ FUNCTION FT_MDBLCLK( nClick, nButton, nInterval, nRow, nCol, nStart ) lDouble := lDone := .F. - DO WHILE !lDone + DO WHILE ! lDone FT_MBUTPRS( nButton, @nPrs, @nVert, @nHorz ) nVert := Int( nVert / 8 ) @@ -94,8 +75,8 @@ FUNCTION FT_MDBLCLK( nClick, nButton, nInterval, nRow, nCol, nStart ) FUNCTION FT_MINREGION( nTR, nLC, nBR, nRC ) RETURN ; - FT_MGETX() >= nTR .AND. FT_MGETX() <= nBR .AND. ; - FT_MGETY() >= nLC .AND. FT_MGETY() <= nRC + MRow() >= nTR .AND. MRow() <= nBR .AND. ; + MCol() >= nLC .AND. MCol() <= nRC FUNCTION FT_MSETSENS( nHoriz, nVert, nDouble ) @@ -104,16 +85,9 @@ FUNCTION FT_MSETSENS( nHoriz, nVert, nDouble ) // Get current values FT_MGETSENS( @nCurHoriz, @nCurVert, @nCurDouble ) - // Set defaults if necessary - IF ! HB_ISNUMERIC( nHoriz ) - nHoriz := nCurHoriz - ENDIF - IF ! HB_ISNUMERIC( nVert ) - nVert := nCurVert - ENDIF - IF ! HB_ISNUMERIC( nDouble ) - nDouble := nCurDouble - ENDIF + hb_default( @nHoriz, nCurHoriz ) + hb_default( @nVert, nCurVert ) + hb_default( @nDouble, nCurDouble ) // Fill the registers _mset_sensitive( nHoriz, nVert, nDouble ) @@ -127,9 +101,7 @@ FUNCTION FT_MINIT() IF ! t_lMinit t_lMinit := ( FT_MRESET() != 0 ) ELSE - // Reset maximum x and y limits - FT_MYLIMIT( 0, 8 * 24 ) - FT_MXLIMIT( 0, 8 * 80 ) + MSetBounds() ENDIF RETURN t_lMinit @@ -141,11 +113,9 @@ FUNCTION FT_MRESET() t_lCrsState := .F. // Cursor is off after reset lStatus := _m_reset() - // Reset maximum x and y limits - FT_MYLIMIT( 0, 8 * MaxRow() ) - FT_MXLIMIT( 0, 8 * MaxCol() ) + MSetBounds() - RETURN lStatus // return status code + RETURN lStatus FUNCTION FT_MCURSOR( lState ) @@ -153,9 +123,9 @@ FUNCTION FT_MCURSOR( lState ) IF HB_ISLOGICAL( lState ) IF ( t_lCrsState := lState ) - FT_MSHOWCRS() + MShow() ELSE - FT_MHIDECRS() + MHide() ENDIF ENDIF @@ -163,7 +133,7 @@ FUNCTION FT_MCURSOR( lState ) FUNCTION FT_MSHOWCRS() - _mse_showcurs() + MShow() t_lCrsState := .T. @@ -171,7 +141,7 @@ FUNCTION FT_MSHOWCRS() FUNCTION FT_MHIDECRS() // decrement internal cursor flag and hide cursor - _mse_mhidecrs() + MHide() t_lCrsState := .F. diff --git a/harbour/contrib/hbnf/netpv.prg b/harbour/contrib/hbnf/netpv.prg index 3b6045953d..56a1640e6a 100644 --- a/harbour/contrib/hbnf/netpv.prg +++ b/harbour/contrib/hbnf/netpv.prg @@ -27,7 +27,7 @@ FUNCTION FT_NETPV( nInitialInvestment, nInterestRate, aCashFlow, nNoOfCashFlows LOCAL nNetPresentValue := 0 - nNoOfCashFlows := iif( nNoOfCashFlows == NIL, Len( aCashFlow ), nNoOfCashFlows ) + __defaultNIL( @nNoOfCashFlows, Len( aCashFlow ) ) AEval( aCashFlow, ; {| nElement, nElementNo | ; @@ -36,3 +36,4 @@ FUNCTION FT_NETPV( nInitialInvestment, nInterestRate, aCashFlow, nNoOfCashFlows 1, nNoOfCashFlows ) RETURN nNetPresentValue -= nInitialInvestment + diff --git a/harbour/contrib/hbnf/nwuid.prg b/harbour/contrib/hbnf/nwuid.prg index 562161b545..cba3a8c087 100644 --- a/harbour/contrib/hbnf/nwuid.prg +++ b/harbour/contrib/hbnf/nwuid.prg @@ -40,7 +40,9 @@ FUNCTION FT_NWUID( nConn ) LOCAL cReqPkt LOCAL cRepPkt - nConn := iif( nConn == NIL, FT_NWLSTAT(), nConn ) + IF nConn == NIL + nConn := FT_NWLSTAT() + ENDIF // Set up request packet cReqPkt := hb_BChar( 22 ) // Get Connection Information diff --git a/harbour/contrib/hbnf/peek.c b/harbour/contrib/hbnf/peek.c index 8b1890c000..f110886765 100644 --- a/harbour/contrib/hbnf/peek.c +++ b/harbour/contrib/hbnf/peek.c @@ -38,24 +38,25 @@ #include #endif - #if defined( __DJGPP__ ) - #define outport outportw - #elif defined( __WATCOMC__ ) + #if ! defined( MK_FP ) + #define MK_FP( seg, off ) \ + ((void FAR *)(((unsigned long)(seg) << 4)|(unsigned)(off))) + #endif + + #if defined( __WATCOMC__ ) #define outportb outp - #define outport outpw - #define inport inpw #define inportb inp #endif #if defined( __WATCOMC__ ) && defined( __386__ ) #define HB_PEEK_BYTE(s,o) ( *( ( HB_UCHAR * ) ( ( (s) << 4 ) | (o) ) ) ) - #define HB_POKE_BYTE(s,o,b) *( ( HB_UCHAR * ) ( ( (s) << 4 ) | (o) ) ) = (b) + #define HB_POKE_BYTE(s,o,b) ( *( ( HB_UCHAR * ) ( ( (s) << 4 ) | (o) ) ) = ( HB_UCHAR ) (b) ) #elif defined( __DJGPP__ ) #define HB_PEEK_BYTE(s,o) _farpeekb( (s), (o) ) #define HB_POKE_BYTE(s,o,b) _farpokeb( (s), (o), (b) ) #else #define HB_PEEK_BYTE(s,o) ( *( ( HB_UCHAR FAR * ) MK_FP( (s), (o) ) ) ) - #define HB_POKE_BYTE(s,o,b) *( ( HB_UCHAR FAR * ) MK_FP( (s), (o) ) ) = (b) + #define HB_POKE_BYTE(s,o,b) ( *( ( HB_UCHAR FAR * ) MK_FP( (s), (o) ) ) = ( HB_UCHAR ) (b) ) #endif #endif diff --git a/harbour/contrib/hbnf/pending.prg b/harbour/contrib/hbnf/pending.prg index 70e87cdad9..179edff406 100644 --- a/harbour/contrib/hbnf/pending.prg +++ b/harbour/contrib/hbnf/pending.prg @@ -20,49 +20,47 @@ * */ +// cMsg Message to display +// nRow Row of displayed message +// nCol Col of displayed message +// nWait Wait in seconds between messages +// cColor Color of displayed message + FUNCTION FT_PENDING( cMsg, nRow, nCol, nWait, cColor ) - THREAD STATIC t_nLast_Time := 0 THREAD STATIC t_nRow1 := 24 THREAD STATIC t_nCol1 := 0 THREAD STATIC t_nWait1 := 5 THREAD STATIC t_cColor1 := "W+/R,X" - LOCAL nThis_Time, nTiny := 0.1 + THREAD STATIC t_nLast_Time := 0 - // - // cMsg Message to display - // nRow Row of displayed message - // nCol Col of displayed message - // nWait Wait in seconds between messages - // cColor Color of displayed message - // + LOCAL nThis_Time + + IF cMsg != NIL + + t_nRow1 := iif( nRow != NIL, nRow, t_nRow1 ) // reset display row + t_nCol1 := iif( nCol != NIL, nCol, t_nCol1 ) // reset display col + t_nWait1 := iif( nWait != NIL, nWait, t_nWait1 ) // reset display wait + t_cColor1 := iif( cColor != NIL, cColor, t_cColor1 ) // reset display color + + nThis_Time := Seconds() // time of current message + + IF t_nLast_Time == 0 + t_nLast_Time := nThis_Time - t_nWait1 // for first time round. + ENDIF + + IF ( nThis_Time - t_nLast_Time ) < 0.1 // if messages are coming too fast, + t_nLast_Time := nThis_Time + t_nWait1 // set time counter and then + Inkey( t_nWait1 ) // wait a few seconds. + ELSE + t_nLast_Time := nThis_Time // set time counter for next message. + ENDIF + + hb_Scroll( t_nRow1, 0, t_nRow1, 80 ) // clear the display line + + hb_DispOutAt( t_nRow1, t_nCol1, cMsg, t_cColor1 ) // display message - IF cMsg == NIL // if no message, no work - RETURN NIL ENDIF - t_nRow1 := iif( nRow != NIL, nRow, t_nRow1 ) // reset display row - t_nCol1 := iif( nCol != NIL, nCol, t_nCol1 ) // reset display col - - t_nWait1 := iif( nWait != NIL, nWait, t_nWait1 ) // reset display wait - t_cColor1 := iif( cColor != NIL, cColor, t_cColor1 ) // reset display color - - nThis_Time := Seconds() // time of current message - - IF t_nLast_Time == 0 - t_nLast_Time := nThis_Time - t_nWait1 // for first time round. - ENDIF - - IF ( nThis_Time - t_nLast_Time ) < nTiny // if messages are coming too fast, - t_nLast_Time := nThis_Time + t_nWait1 // set time counter and then - Inkey( t_nWait1 ) // wait a few seconds. - ELSE - t_nLast_Time := nThis_Time // set time counter for next message. - ENDIF - - hb_Scroll( t_nRow1, 0, t_nRow1, 80 ) // clear the display line - - hb_DispOutAt( t_nRow1, t_nCol1, cMsg, t_cColor1 ) // display message - RETURN NIL diff --git a/harbour/contrib/hbnf/popadder.prg b/harbour/contrib/hbnf/popadder.prg index ded76add8c..56e69c593a 100644 --- a/harbour/contrib/hbnf/popadder.prg +++ b/harbour/contrib/hbnf/popadder.prg @@ -263,7 +263,7 @@ FUNCTION FT_Adder() _ftAddHelp() CASE nKey == K_F10 // Quit - Return total IF lTotalOk // Did they finish the calculation - IF oGet != NIL .AND. oGet:TYPE == "N" + IF oGet != NIL .AND. oGet:type == "N" Set( _SET_DECIMALS, nOldDecim ) SetCursor( nOldCurs ) IF lTape @@ -681,7 +681,8 @@ STATIC FUNCTION _ftUpdateTrans( aAdder, lTypeTotal, nAmount ) LOCAL lUseTotal := ( nAmount == NIL ) - nAmount := iif( nAmount == NIL, 0, nAmount ) + __defaultNIL( @nAmount, 0 ) + IF lClAdder // Clear the adder (they pressed twice AAdd( aTrans, Str( 0, 22, nMaxDeci ) + " C" ) IF lTape // If there is a tape Show Clear @@ -726,7 +727,7 @@ STATIC FUNCTION _ftEraseTotSubTot( aAdder ) STATIC FUNCTION _ftRoundIt( nNumber, nPlaces ) - nPlaces := iif( nPlaces == NIL, 0, nPlaces ) + __defaultNIL( @nPlaces, 0 ) RETURN iif( nNumber < 0.0, -1.0, 1.0 ) * ; Int( Abs( nNumber ) * 10 ^ nPlaces + 0.50 + 10 ^ -12 ) / 10 ^ nPlaces @@ -849,7 +850,7 @@ STATIC FUNCTION _ftPushMessage( cMessage, lWait, cTitle, cBotTitle, xQuiet, nTop LOCAL nOldRow := Row() LOCAL nOldCol := Col() LOCAL nOldCurs := SetCursor( SC_NONE ) - LOCAL nWinColor := iif( nWinColor == NIL, W_CURR, nWinColor ) + LOCAL nWinColor := W_CURR cOldDevic := Set( _SET_DEVICE, "SCREEN" ) lOldPrint := Set( _SET_PRINTER, .F. ) @@ -863,7 +864,8 @@ STATIC FUNCTION _ftPushMessage( cMessage, lWait, cTitle, cBotTitle, xQuiet, nTop nBottom := nTop + nNumRows + 2 nLeft := Int( ( MaxCol() - nWide ) / 2 ) - 3 nRight := nLeft + nWide + 4 - lWait := iif( lWait == NIL, .F., lWait ) + + __defaultNIL( @lWait, .F. ) _ftPushWin( nTop, nLeft, nBottom, nRight, cTitle, cBotTitle, nWinColor ) DISPMESSAGE cMessage, nTop + 1, nLeft + 2, nBottom - 1, nRight - 2 @@ -917,7 +919,8 @@ STATIC FUNCTION _ftQuest( cMessage, xVarVal, cPict, bValid, lNoESC, nWinColor, n nOldCol := Col() nOldCurs := SetCursor( SC_NONE ) cOldColor := SetColor() - lNoESC := iif( lNoESC == NIL, .F., lNoESC ) + + __defaultNIL( @lNoESC, .F. ) nMessLen := Len( cMessage ) + nVarLen + 1 nWide := iif( nMessLen > 66, 66, iif( nMessLen < 12, 12, nMessLen ) ) @@ -945,11 +948,11 @@ STATIC FUNCTION _ftQuest( cMessage, xVarVal, cPict, bValid, lNoESC, nWinColor, n // If the input line is character & wider than window SCROLL IF lGetOnNextLine .AND. HB_ISSTRING( xVarVal ) .AND. nVarLen > nWide - oNewGet:Picture := "@S" + LTrim( Str( nWide, 4, 0 ) ) + iif( cPict == NIL, "", " " + cPict ) + oNewGet:Picture := "@S" + hb_ntos( nWide ) + iif( cPict == NIL, "", " " + cPict ) ENDIF IF cPict != NIL // Use the picture they passed - oNewGet:Picture := cPict + oNewGet:Picture := cPict ELSE // Else setup default pictures IF HB_ISDATE( xVarVal ) oNewGet:Picture := "99/99/99" @@ -1027,7 +1030,7 @@ STATIC FUNCTION _ftError( cMessage, xDontReset ) LOCAL nOldRow, nOldCol, nOldCurs, nTop, nLeft, nBot, nRight, cOldColor LOCAL nOldLastKey, cErrorScr, nMessLen, nWide, nNumRows, nKey LOCAL cOldDevic, lOldPrint - LOCAL lResetLKey := iif( xDontReset == NIL, .T., .F. ) + LOCAL lResetLKey := ( xDontReset == NIL ) nOldLastKey := LastKey() nOldRow := Row() @@ -1074,7 +1077,8 @@ STATIC FUNCTION _ftStuffComma( cStrToStuff, lTrimStuffedStr ) LOCAL nDecPosit, x - lTrimStuffedStr := iif( lTrimStuffedStr == NIL, .F., lTrimStuffedStr ) + __defaultNIL( @lTrimStuffedStr, .F. ) + IF !( "." $ cStrToStuff ) cStrToStuff := _ftPosIns( cStrToStuff, ".", iif( "C" $ cStrToStuff .OR. ; "E" $ cStrToStuff .OR. "+" $ cStrToStuff .OR. "-" $ cStrToStuff ; @@ -1114,11 +1118,11 @@ STATIC FUNCTION _ftSetSCRColor( nStd, nEnh, nBord, nBack, nUnsel ) _ftInitColors() ENDIF - nStd := iif( nStd == NIL, 8, nStd ) - nEnh := iif( nEnh == NIL, 8, nEnh ) - nBord := iif( nBord == NIL, 8, nBord ) - nBack := iif( nBack == NIL, 8, nBack ) - nUnsel := iif( nUnsel == NIL, nEnh, nUnsel ) + __defaultNIL( @nStd , 8 ) + __defaultNIL( @nEnh , 8 ) + __defaultNIL( @nBord , 8 ) + __defaultNIL( @nBack , 8 ) + __defaultNIL( @nUnsel, nEnh ) RETURN SetColor( ; t_aStdColor[ nStd ] + "," + ; @@ -1144,7 +1148,7 @@ STATIC FUNCTION _ftSetSCRColor( nStd, nEnh, nBord, nBack, nUnsel ) STATIC FUNCTION _ftPushWin( t, l, b, r, cTitle, cBotTitle, nWinColor ) - LOCAL lAutoWindow := nWinColor == NIL + LOCAL lAutoWindow := ( nWinColor == NIL ) nWinColor := iif( nWinColor == NIL, _ftNextWinColor(), nWinColor ) AAdd( t_aWindow, { t, l, b, r, nWinColor, SaveScreen( t, l, b + 1, r + 2 ), lAutoWindow } ) @@ -1205,12 +1209,12 @@ STATIC FUNCTION _ftPopWin() STATIC FUNCTION _ftSetWinColor( nWin, nStd, nEnh, nBord, nBack, nUnsel ) - nWin := iif( nWin == NIL, t_nWinColor, nWin ) - nStd := iif( nStd == NIL, 7, nStd ) - nEnh := iif( nEnh == NIL, 7, nEnh ) - nBord := iif( nBord == NIL, 7, nBord ) - nBack := iif( nBack == NIL, 7, nBack ) - nUnsel := iif( nUnsel == NIL, nEnh, nUnsel ) + __defaultNIL( @nWin , t_nWinColor ) + __defaultNIL( @nStd , 7 ) + __defaultNIL( @nEnh , 7 ) + __defaultNIL( @nBord , 7 ) + __defaultNIL( @nBack , 7 ) + __defaultNIL( @nUnsel, nEnh ) RETURN SetColor( ; t_aWinColor[ nStd, nWin ] + "," + ; diff --git a/harbour/contrib/hbnf/sqzn.prg b/harbour/contrib/hbnf/sqzn.prg index 8bf51bb6e2..ba13c66cc0 100644 --- a/harbour/contrib/hbnf/sqzn.prg +++ b/harbour/contrib/hbnf/sqzn.prg @@ -24,10 +24,11 @@ FUNCTION ft_sqzn( nValue, nSize, nDecimals ) LOCAL tmpstr, cCompressed, k - nSize := iif( nSize == NIL, 10, nSize ) - nDecimals := iif( nDecimals == NIL, 0, nDecimals ) + __defaultNIL( @nSize, 10 ) + __defaultNIL( @nDecimals, 0 ) + nValue := nValue * ( 10 ** nDecimals ) - nSize := iif( nSize / 2 != Int( nSize / 2 ), nSize + 1, nSize ) + nSize := iif( ( nSize / 2 ) != Int( nSize / 2 ), nSize + 1, nSize ) tmpstr := Str( Abs( nValue ), nSize ) tmpstr := StrTran( tmpstr, " ", "0" ) cCompressed := hb_BChar( Val( hb_BSubStr( tmpstr, 1, 2 ) ) + iif( nValue < 0, 128, 0 ) ) @@ -40,17 +41,18 @@ FUNCTION ft_sqzn( nValue, nSize, nDecimals ) FUNCTION ft_unsqzn( cCompressed, nSize, nDecimals ) - LOCAL tmp := "", k, cValue, multi := 1 + LOCAL tmp := "", k, cValue, multi - nSize := iif( nSize == NIL, 10, nSize ) - nDecimals := iif( nDecimals == NIL, 0, nDecimals ) - cCompressed := iif( multi == -1, hb_BSubStr( cCompressed, 2 ), cCompressed ) - nSize := iif( nSize / 2 != Int( nSize / 2 ), nSize + 1, nSize ) + __defaultNIL( @nSize, 10 ) + __defaultNIL( @nDecimals, 0 ) + + nSize := iif( ( nSize / 2 ) != Int( nSize / 2 ), nSize + 1, nSize ) IF hb_BCode( cCompressed ) > 127 tmp := Str( hb_BCode( cCompressed ) - 128, 2 ) multi := -1 ELSE tmp := Str( hb_BCode( cCompressed ), 2 ) + multi := 1 ENDIF FOR k := 2 TO hb_BLen( cCompressed ) diff --git a/harbour/contrib/hbnf/tbwhile.prg b/harbour/contrib/hbnf/tbwhile.prg index 60d8cbbc44..c1faa6753d 100644 --- a/harbour/contrib/hbnf/tbwhile.prg +++ b/harbour/contrib/hbnf/tbwhile.prg @@ -55,7 +55,6 @@ */ #include "inkey.ch" -#include "set.ch" #include "setcurs.ch" // diff --git a/harbour/contrib/hbnf/tests/mouse1.prg b/harbour/contrib/hbnf/tests/mouse1.prg index 296a26a825..416d5c6fc2 100644 --- a/harbour/contrib/hbnf/tests/mouse1.prg +++ b/harbour/contrib/hbnf/tests/mouse1.prg @@ -4,9 +4,9 @@ #require "hbnf" -PROCEDURE Main( nRow, nCol ) +// Pass valid row and column values for different video modes to change modes - // Pass valid row and column values for different video modes to change modes +PROCEDURE Main( nRow, nCol ) LOCAL nX, nY, cSavClr LOCAL cSavScr := SaveScreen( 0, 0, MaxRow(), MaxCol() ) @@ -27,9 +27,15 @@ PROCEDURE Main( nRow, nCol ) nCol := Val( nCol ) ENDIF - IF !FT_MINIT() - @ MaxRow(), 0 SAY "Mouse driver is not installed!" + IF ! SetMode( nRow, nCol ) + @ MaxRow(), 0 SAY "Mode Change unsuccessful:" + Str( nRow, 2, 0 ) + " by"; + + Str( nCol, 3, 0 ) + RETURN + ENDIF + IF Empty( FT_MINIT() ) + @ MaxRow(), 0 SAY "Mouse driver is not installed!" + SetMode( nSaveRow, nSaveCol ) RETURN ENDIF @@ -38,7 +44,7 @@ PROCEDURE Main( nRow, nCol ) @ 0, 0, MaxRow(), MaxCol() BOX hb_UTF8ToStr( "░░░░░░░░░" ) SetColor( "GR+/RB" ) -// Scroll( 7, 2, 19, 63, 0 ) + Scroll( 7, 2, 19, 63, 0 ) @ 7, 2 TO 20, 63 @ 17, 10 TO 19, 40 double diff --git a/harbour/contrib/hbnf/tests/mouse2.prg b/harbour/contrib/hbnf/tests/mouse2.prg deleted file mode 100644 index 416d5c6fc2..0000000000 --- a/harbour/contrib/hbnf/tests/mouse2.prg +++ /dev/null @@ -1,195 +0,0 @@ -/* - * $Id$ - */ - -#require "hbnf" - -// Pass valid row and column values for different video modes to change modes - -PROCEDURE Main( nRow, nCol ) - - LOCAL nX, nY, cSavClr - LOCAL cSavScr := SaveScreen( 0, 0, MaxRow(), MaxCol() ) - LOCAL nSaveRow := MaxRow() + 1, nSaveCol := MaxCol() + 1 - LOCAL nMinor, nType, nIRQ - LOCAL aType := { "Bus", "Serial", "InPort", "PS/2", "HP" } - LOCAL nHoriz, nVert, nDouble - - IF nRow == NIL - nRow := MaxRow() + 1 - ELSE - nRow := Val( nRow ) - ENDIF - - IF nCol == NIL - nCol := MaxCol() + 1 - ELSE - nCol := Val( nCol ) - ENDIF - - IF ! SetMode( nRow, nCol ) - @ MaxRow(), 0 SAY "Mode Change unsuccessful:" + Str( nRow, 2, 0 ) + " by"; - + Str( nCol, 3, 0 ) - RETURN - ENDIF - - IF Empty( FT_MINIT() ) - @ MaxRow(), 0 SAY "Mouse driver is not installed!" - SetMode( nSaveRow, nSaveCol ) - RETURN - ENDIF - - // ..... Set up the screen - cSavClr := SetColor( "w/n" ) - @ 0, 0, MaxRow(), MaxCol() BOX hb_UTF8ToStr( "░░░░░░░░░" ) - - SetColor( "GR+/RB" ) - Scroll( 7, 2, 19, 63, 0 ) - @ 7, 2 TO 20, 63 - - @ 17, 10 TO 19, 40 double - - SetColor( "N/W" ) - @ 18, 11 SAY " Double Click here to Quit " - - SetColor( "GR+/RB" ) - - // ..... Start the demo - - @ MaxRow(), 0 SAY "Driver version: " + ; - AllTrim( Str( FT_MVERSION( @nMinor, @nType, @nIRQ ), 2, 0 ) ) + "." + ; - AllTrim( Str( nMinor, 2, 0 ) ) - @ Row(), Col() SAY " " + aType[ nType ] + " mouse using IRQ " + Str( nIRQ, 1, 0 ) - - FT_MGETSENS( @nHoriz, @nVert, @nDouble ) // Get the current sensitivities - FT_MSETSENS( 70, 70, 60 ) // Bump up the sensitivity of the mouse - - FT_MSHOWCRS() - FT_MSETCOORD( 10, 20 ) // just an arbitrary place for demo - - // put the unchanging stuff - - DevPos( 9, 10 ) - DevOut( "FT_MMICKEYS :" ) - - DevPos( 10, 10 ) - DevOut( "FT_MGETPOS :" ) - - DevPos( 11, 10 ) - DevOut( "FT_MGETX :" ) - - DevPos( 12, 10 ) - DevOut( "FT_MGETY :" ) - - DevPos( 13, 10 ) - DevOut( "FT_MGETCOORD:" ) - - DevPos( 14, 10 ) - DevOut( "FT_MBUTPRS :" ) - - DevPos( 16, 10 ) - DevOut( "FT_MBUTREL :" ) - - nX := nY := 1 - DO WHILE .T. - - // If we are not moving then wait for movement. - // This whole demo is a bit artificial in its requirements when compared - // to a "normal" CLIPPER program so some of these examples are a bit out of - // the ordinary. - - DO WHILE nX == 0 .AND. nY == 0 - FT_MMICKEYS( @nX, @nY ) - ENDDO - // tell the mouse driver where updates will be taking place so it can hide - // the cursor when necessary. - - FT_MCONOFF( 9, 23, 16, 53 ) - - DevPos( 9, 23 ) - DevOut( nX ) - DevOut( nY ) - - DevPos( 10, 23 ) - DevOut( FT_MGETPOS( @nX, @nY ) ) - DevOut( nX ) - DevOut( nY ) - - DevPos( 11, 23 ) - DevOut( FT_MGETX() ) - - DevPos( 12, 23 ) - DevOut( FT_MGETY() ) - - DevPos( 13, 23 ) - DevOut( FT_MGETCOORD( @nX, @nY ) ) - DevOut( nX ) - DevOut( nY ) - - nX := nY := 0 - DevPos( 14, 23 ) - DevOut( FT_MBUTPRS( 1 ) ) - DevOut( FT_MBUTPRS( 0,, nX, nY ) ) - DevPos( 15, 23 ) - - // show only the last Press since it flashes by so quickly - - IF nX != 0 .OR. nY != 0 - DevOut( nX ) - DevOut( nY ) - ENDIF - - nX := nY := 0 - DevPos( 16, 23 ) - DevOut( FT_MBUTREL( 0,, @nX, @nY ) ) - - // show only the last release since it flashes by so quickly - - IF nX != 0 .OR. nY != 0 - DevOut( nX ) - DevOut( nY ) - ENDIF - - // Restore the cursor if it has been hidden - - FT_MSHOWCRS() - - IF FT_MINREGION( 18, 11, 18, 39 ) - - // Change the type of cursor when in the box. Just slightly different than the - // normal. The character is shown in high intensity. - - FT_MDEFCRS( 0, 32767, 32512 ) - IF FT_MDBLCLK( 2, 0, 0.8 ) - EXIT - ENDIF - ENDIF - - IF FT_MINREGION( 18, 11, 18, 39 ) - - // Change the type of cursor when in the box. Just slightly different than the - // normal. The character is shown in high intensity. - - FT_MDEFCRS( 0, 32767, 32512 ) - ELSE - - // Put the cursor back to normal mode - - FT_MDEFCRS( 0, 30719, 30464 ) - ENDIF - - FT_MMICKEYS( @nX, @nY ) - ENDDO - - FT_MHIDECRS() - - SetMode( nSaveRow, nSaveCol ) - SetColor( cSavClr ) - RestScreen( 0, 0, MaxRow(), MaxCol(), cSavScr ) - DevPos( MaxRow(), 0 ) - - // Reset sensitivity - - FT_MSETSENS( nHoriz, nVert, nDouble ) - - RETURN diff --git a/harbour/contrib/hbnf/xbox.prg b/harbour/contrib/hbnf/xbox.prg index ed618ada55..3552b7621d 100644 --- a/harbour/contrib/hbnf/xbox.prg +++ b/harbour/contrib/hbnf/xbox.prg @@ -54,24 +54,17 @@ FUNCTION FT_XBOX( cJustType, ; // "L" -> left, otherwise centered LOCAL nNumRows LOCAL aLines_[ 8 ] - IF cJustType == NIL - cJustType := "" - ENDIF - IF cRetWait == NIL - cRetWait := "" - ENDIF - IF cBorType == NIL - cBorType := "" - ENDIF + hb_default( @cJustType, "" ) + hb_default( @cRetWait , "" ) + hb_default( @cBorType , "" ) + hb_default( @cBorColor, "N/W" ) + hb_default( @cBoxColor, "W/N" ) + hb_default( @nStartRow, 99 ) + hb_default( @nStartCol, 99 ) - // validate parameters - cJustType := iif( HB_ISSTRING( cJustType ), Upper( cJustType ), "" ) - cRetWait := iif( HB_ISSTRING( cRetWait ) , Upper( cRetWait ), "" ) - cBorType := iif( HB_ISSTRING( cBorType ) , Upper( cBorType ), "" ) - cBorColor := iif( HB_ISSTRING( cBoxColor ), cBorColor, "N/W" ) - cBoxColor := iif( HB_ISSTRING( cBoxColor ), cBoxColor, "W/N" ) - nStartRow := iif( HB_ISNUMERIC( nStartRow ), nStartRow, 99 ) - nStartCol := iif( HB_ISNUMERIC( nStartCol ), nStartCol, 99 ) + cJustType := Upper( cJustType ) + cRetWait := Upper( cRetWait ) + cBorType := Upper( cBorType ) nNumRows := Min( PCount() - 7, 8 ) diff --git a/harbour/src/rtl/gtdos/gtdos.c b/harbour/src/rtl/gtdos/gtdos.c index 08c0dddac7..5365a3204c 100644 --- a/harbour/src/rtl/gtdos/gtdos.c +++ b/harbour/src/rtl/gtdos/gtdos.c @@ -135,7 +135,7 @@ #define MK_FP( seg, off ) \ ((void FAR *)(((unsigned long)(seg) << 4)|(unsigned)(off))) #endif - static unsigned char FAR * s_pScreenAddres; + static unsigned char FAR * s_pScreenAddress; #endif #if defined( __WATCOMC__ ) && defined( __386__ ) @@ -250,7 +250,7 @@ HB_BYTE FAR * hb_gt_dos_ScreenPtr( int iRow, int iCol ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_dos_ScreenPtr(%d, %d)", iRow, iCol)); - return s_pScreenAddres + ( ( ( iRow * s_iCols ) + iCol ) << 1 ); + return s_pScreenAddress + ( ( ( iRow * s_iCols ) + iCol ) << 1 ); } #endif @@ -261,7 +261,7 @@ static void hb_gt_dos_GetScreenContents( PHB_GT pGT ) HB_BYTE bAttr, bChar, bxAttr; HB_USHORT usChar; #if !defined( __DJGPP__ ) - HB_BYTE * pScreenPtr = s_pScreenAddres; + HB_BYTE * pScreenPtr = s_pScreenAddress; #endif HB_TRACE(HB_TR_DEBUG, ("hb_gt_dos_GetScreenContents(%p)", pGT)); @@ -808,7 +808,7 @@ static void hb_gt_dos_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil s_iScreenMode = hb_gt_dos_GetScreenMode(); #if !defined( __DJGPP__ ) - s_pScreenAddres = hb_gt_dos_ScreenAddress( pGT ); + s_pScreenAddress = hb_gt_dos_ScreenAddress( pGT ); #endif hb_gt_dos_GetScreenSize( &s_iRows, &s_iCols ); hb_gt_dos_GetCursorPosition( &s_iCurRow, &s_iCurCol ); @@ -1185,7 +1185,7 @@ static HB_BOOL hb_gt_dos_SetMode( PHB_GT pGT, int iRows, int iCols ) } s_iScreenMode = hb_gt_dos_GetScreenMode(); #if !defined( __DJGPP__ ) - s_pScreenAddres = hb_gt_dos_ScreenAddress( pGT ); + s_pScreenAddress = hb_gt_dos_ScreenAddress( pGT ); #endif hb_gt_dos_GetCursorPosition( &s_iCurRow, &s_iCurCol ); s_iCursorStyle = hb_gt_dos_GetCursorStyle(); @@ -1215,7 +1215,7 @@ static HB_BOOL hb_gt_dos_Resume( PHB_GT pGT ) s_iScreenMode = hb_gt_dos_GetScreenMode(); #if !defined( __DJGPP__ ) - s_pScreenAddres = hb_gt_dos_ScreenAddress( pGT ); + s_pScreenAddress = hb_gt_dos_ScreenAddress( pGT ); #endif hb_gt_dos_GetScreenSize( &s_iRows, &s_iCols ); hb_gt_dos_GetCursorPosition( &s_iCurRow, &s_iCurCol );