2012-09-27 17:06 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbnf/menu1.prg
* contrib/hbnf/menutonf.prg
* contrib/hbnf/pegs.prg
* contrib/hbnf/pending.prg
* contrib/hbnf/popadder.prg
* Renamed THREAD STATIC variables to all have a t_ prefix
This commit is contained in:
@@ -16,6 +16,14 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-09-27 17:06 UTC+0200 Viktor Szakats (harbour syenar.net)
|
||||
* contrib/hbnf/menu1.prg
|
||||
* contrib/hbnf/menutonf.prg
|
||||
* contrib/hbnf/pegs.prg
|
||||
* contrib/hbnf/pending.prg
|
||||
* contrib/hbnf/popadder.prg
|
||||
* Renamed THREAD STATIC variables to all have a t_ prefix
|
||||
|
||||
2012-09-27 16:01 UTC+0200 Viktor Szakats (harbour syenar.net)
|
||||
* contrib/rddads/rddads.h
|
||||
! fixed version detection for ADS 6.00 and 6.10/6.11
|
||||
|
||||
@@ -42,12 +42,12 @@
|
||||
#define DISABLE 0
|
||||
#define ENABLE 1
|
||||
|
||||
THREAD STATIC aChoices := {}
|
||||
THREAD STATIC aValidKeys := {}
|
||||
THREAD STATIC nHPos
|
||||
THREAD STATIC nVPos
|
||||
THREAD STATIC nMaxRow
|
||||
THREAD STATIC nMaxCol
|
||||
THREAD STATIC t_aChoices := {}
|
||||
THREAD STATIC t_aValidKeys := {}
|
||||
THREAD STATIC t_nHPos
|
||||
THREAD STATIC t_nVPos
|
||||
THREAD STATIC t_nMaxRow
|
||||
THREAD STATIC t_nMaxCol
|
||||
|
||||
// BEGINNING OF DEMO PROGRAM
|
||||
#ifdef FT_TEST
|
||||
@@ -135,26 +135,26 @@ PROCEDURE CALLMENU( cCmdLine )
|
||||
IF "VGA" $ Upper( cCmdLine )
|
||||
SetMode( 50, 80 )
|
||||
ENDIF
|
||||
nMaxRow := MaxRow()
|
||||
t_nMaxRow := MaxRow()
|
||||
SetBlink( .F. )
|
||||
SetColor( cWindN + "*" )
|
||||
CLS
|
||||
SetColor( cNormN )
|
||||
@ nMaxRow, 0
|
||||
@ nMaxRow, 0 SAY hb_UTF8ToStr( " FT_MENU1 1.0 │ " )
|
||||
@ NMAXROW, 16 SAY "WRITTEN BY PAUL FERRARA [76702,556] FOR NANFORUM.LIB"
|
||||
@ NMAXROW, 69 SAY hb_UTF8ToStr( "│ " ) + DToC( Date() )
|
||||
@ t_nMaxRow, 0
|
||||
@ t_nMaxRow, 0 SAY hb_UTF8ToStr( " FT_MENU1 1.0 │ " )
|
||||
@ t_nMaxRow, 16 SAY "WRITTEN BY PAUL FERRARA [76702,556] FOR NANFORUM.LIB"
|
||||
@ t_nMaxRow, 69 SAY hb_UTF8ToStr( "│ " ) + DToC( Date() )
|
||||
|
||||
SetColor( cErrH )
|
||||
@ nMaxRow - 11, 23, nMaxRow - 3, 56 BOX hb_UTF8ToStr( "┌─┐│┘─└│ " )
|
||||
@ nMaxRow - 9, 23 SAY hb_UTF8ToStr( "├────────────────────────────────┤" )
|
||||
@ t_nMaxRow - 11, 23, t_nMaxRow - 3, 56 BOX hb_UTF8ToStr( "┌─┐│┘─└│ " )
|
||||
@ t_nMaxRow - 9, 23 SAY hb_UTF8ToStr( "├────────────────────────────────┤" )
|
||||
SetColor( cErrN )
|
||||
@ nMaxRow - 10, 33 SAY "Navigation Keys"
|
||||
@ nMaxRow - 8, 25 SAY "LeftArrow RightArrow Alt-E"
|
||||
@ nMaxRow - 7, 25 SAY "Home End Alt-R"
|
||||
@ nMaxRow - 6, 25 SAY "Tab Shift-Tab Alt-D"
|
||||
@ nMaxRow - 5, 25 SAY "PgUp PgDn Alt-M"
|
||||
@ nMaxRow - 4, 25 SAY "Enter ESCape Alt-Q"
|
||||
@ t_nMaxRow - 10, 33 SAY "Navigation Keys"
|
||||
@ t_nMaxRow - 8, 25 SAY "LeftArrow RightArrow Alt-E"
|
||||
@ t_nMaxRow - 7, 25 SAY "Home End Alt-R"
|
||||
@ t_nMaxRow - 6, 25 SAY "Tab Shift-Tab Alt-D"
|
||||
@ t_nMaxRow - 5, 25 SAY "PgUp PgDn Alt-M"
|
||||
@ t_nMaxRow - 4, 25 SAY "Enter ESCape Alt-Q"
|
||||
SetColor( cNormN )
|
||||
|
||||
FT_MENU1( aBar, aOptions, aColors )
|
||||
@@ -216,14 +216,14 @@ FUNCTION FT_MENU1( aBar, aOptions, aColors, nTopRow, lShadow )
|
||||
LOCAL cCurrent := aColors[ 4 ]
|
||||
LOCAL cUnSelec := aColors[ 5 ]
|
||||
|
||||
nMaxRow := MaxRow()
|
||||
nMaxCol := MaxCol()
|
||||
t_nMaxRow := MaxRow()
|
||||
t_nMaxCol := MaxCol()
|
||||
|
||||
// row for menu bar
|
||||
nTopRow := iif( nTopRow == NIL, 0, nTopRow )
|
||||
|
||||
AFill( aLastSel, 1 )
|
||||
aChoices := aOptions
|
||||
t_aChoices := aOptions
|
||||
|
||||
// this is the routine that calculates the position of each item
|
||||
// on the menu bar.
|
||||
@@ -237,16 +237,16 @@ FUNCTION FT_MENU1( aBar, aOptions, aColors, nTopRow, lShadow )
|
||||
// calculates widest element for each pulldown menu
|
||||
// see below for _ftWidest()
|
||||
AFill( aBarWidth, 1 )
|
||||
AEval( aChoices, {| x, i | HB_SYMBOL_UNUSED( x ), _ftWidest( @i, aChoices, @aBarWidth ) } )
|
||||
AEval( t_aChoices, {| x, i | HB_SYMBOL_UNUSED( x ), _ftWidest( @i, t_aChoices, @aBarWidth ) } )
|
||||
|
||||
// box location for each pulldown menu
|
||||
// see below for _ftLocat()
|
||||
AEval( aChoices, {| x, i | HB_SYMBOL_UNUSED( x ), _ftLocat( i, aBarCol, aBarWidth, @aBoxLoc, nMaxCol ) } )
|
||||
AEval( t_aChoices, {| x, i | HB_SYMBOL_UNUSED( x ), _ftLocat( i, aBarCol, aBarWidth, @aBoxLoc, t_nMaxCol ) } )
|
||||
|
||||
// valid keys for each pulldown menu
|
||||
// see below for _ftValKeys()
|
||||
AEval( aChoices, {| x, i | HB_SYMBOL_UNUSED( x ), AAdd( aValidkeys, "" ), ;
|
||||
_ftValKeys( i, aChoices, @aValidKeys ) } )
|
||||
AEval( t_aChoices, {| x, i | HB_SYMBOL_UNUSED( x ), AAdd( t_aValidKeys, "" ), ;
|
||||
_ftValKeys( i, t_aChoices, @t_aValidKeys ) } )
|
||||
|
||||
// display the menu bar
|
||||
SetColor( cBar )
|
||||
@@ -264,41 +264,41 @@ FUNCTION FT_MENU1( aBar, aOptions, aColors, nTopRow, lShadow )
|
||||
// main menu loop
|
||||
SAVE SCREEN TO sMainScrn
|
||||
// which menu and which menu item
|
||||
nHpos := 1
|
||||
nVpos := 1
|
||||
t_nHPos := 1
|
||||
t_nVPos := 1
|
||||
DO WHILE lLooping
|
||||
RESTORE SCREEN FROM sMainScrn
|
||||
SetColor( cCurrent )
|
||||
@ nTopRow, aBarCol[ nHpos ] SAY aBar[ nHpos ]
|
||||
@ nTopRow, aBarCol[ t_nHPos ] SAY aBar[ t_nHPos ]
|
||||
IF lShadow == NIL .OR. lShadow
|
||||
FT_SHADOW( nTopRow + 1, aBoxLoc[ nHpos ], Len( aChoices[ nHpos, 1 ] ) + nTopRow + 2, aBarWidth[ nHpos ] + 3 + aBoxLoc[ nHpos ] )
|
||||
FT_SHADOW( nTopRow + 1, aBoxLoc[ t_nHPos ], Len( t_aChoices[ t_nHPos, 1 ] ) + nTopRow + 2, aBarWidth[ t_nHPos ] + 3 + aBoxLoc[ t_nHPos ] )
|
||||
ENDIF
|
||||
SetColor( cBorder )
|
||||
@ nTopRow + 1, aBoxLoc[ nHpos ], Len( aChoices[ nHpos, 1 ] ) + nTopRow + 2, aBarWidth[ nHpos ] + 3 + aBoxLoc[ nHpos ] BOX hb_UTF8ToStr( "╔═╗║╝═╚║ " )
|
||||
@ nTopRow + 1, aBoxLoc[ t_nHPos ], Len( t_aChoices[ t_nHPos, 1 ] ) + nTopRow + 2, aBarWidth[ t_nHPos ] + 3 + aBoxLoc[ t_nHPos ] BOX hb_UTF8ToStr( "╔═╗║╝═╚║ " )
|
||||
SetColor( cBox + "," + cCurrent + ",,," + cUnselec )
|
||||
nVpos := AChoice( nTopRow + 2, aBoxLoc[ nHpos ] + 2, Len( aChoices[ nHpos, 1 ] ) + nTopRow + 2, aBarWidth[ nHpos ] + 1 + aBoxLoc[ nHpos ], aChoices[ nHpos, 1 ], aChoices[ nHpos, 3 ], "__ftAcUdf", aLastSel[ nHpos ] )
|
||||
t_nVPos := AChoice( nTopRow + 2, aBoxLoc[ t_nHPos ] + 2, Len( t_aChoices[ t_nHPos, 1 ] ) + nTopRow + 2, aBarWidth[ t_nHPos ] + 1 + aBoxLoc[ t_nHPos ], t_aChoices[ t_nHPos, 1 ], t_aChoices[ t_nHPos, 3 ], "__ftAcUdf", aLastSel[ t_nHPos ] )
|
||||
DO CASE
|
||||
CASE LastKey() == K_RIGHT .OR. LastKey() == K_TAB
|
||||
nHpos := iif( nHpos == Len( aChoices ), 1, nHpos + 1 )
|
||||
t_nHPos := iif( t_nHPos == Len( t_aChoices ), 1, t_nHPos + 1 )
|
||||
CASE LastKey() == K_LEFT .OR. LastKey() == K_SH_TAB
|
||||
nHpos := iif( nHpos == 1, Len( aChoices ), nHpos - 1 )
|
||||
t_nHPos := iif( t_nHPos == 1, Len( t_aChoices ), t_nHPos - 1 )
|
||||
CASE LastKey() == K_ESC
|
||||
lLooping := _ftBailOut( cBorder, cBox )
|
||||
CASE LastKey() == K_HOME
|
||||
nHpos := 1
|
||||
t_nHPos := 1
|
||||
CASE LastKey() == K_END
|
||||
nHpos := Len( aChoices )
|
||||
t_nHPos := Len( t_aChoices )
|
||||
CASE LastKey() == K_ENTER
|
||||
aLastSel[ nHpos ] := nVpos
|
||||
IF aChoices[ nHpos, 2, nVpos ] != NIL
|
||||
aLastSel[ t_nHPos ] := t_nVPos
|
||||
IF t_aChoices[ t_nHPos, 2, t_nVPos ] != NIL
|
||||
SetCancel( lCancMode )
|
||||
AltD( ENABLE )
|
||||
lLooping := Eval( aChoices[ nHpos, 2, nVpos ] )
|
||||
lLooping := Eval( t_aChoices[ t_nHPos, 2, t_nVPos ] )
|
||||
AltD( DISABLE )
|
||||
SetCancel( .F. )
|
||||
ENDIF
|
||||
CASE AScan( aBarKeys, LastKey() ) > 0
|
||||
nHpos := AScan( aBarKeys, LastKey() )
|
||||
t_nHPos := AScan( aBarKeys, LastKey() )
|
||||
ENDCASE
|
||||
ENDDO
|
||||
SetCancel( lCancMode )
|
||||
@@ -317,8 +317,8 @@ FUNCTION __ftAcUdf( nMode )
|
||||
CASE nMode == AC_HITBOTTOM
|
||||
hb_keyPut( K_CTRL_HOME )
|
||||
CASE nMode == AC_EXCEPT
|
||||
IF Upper( hb_keyChar( LastKey() ) ) $ aValidKeys[ nHpos ]
|
||||
IF aChoices[ nHpos, 3, At( Upper( hb_keyChar( LastKey() ) ), aValidKeys[ nHpos ] ) ]
|
||||
IF Upper( hb_keyChar( LastKey() ) ) $ t_aValidKeys[ t_nHPos ]
|
||||
IF t_aChoices[ t_nHPos, 3, At( Upper( hb_keyChar( LastKey() ) ), t_aValidKeys[ t_nHPos ] ) ]
|
||||
hb_keyPut( K_ENTER )
|
||||
nRtnVal := AC_GOTO
|
||||
ENDIF
|
||||
@@ -329,17 +329,17 @@ FUNCTION __ftAcUdf( nMode )
|
||||
|
||||
RETURN nRtnVal
|
||||
|
||||
STATIC FUNCTION _ftWidest( i, aChoices, aBarWidth )
|
||||
STATIC FUNCTION _ftWidest( i, t_aChoices, aBarWidth )
|
||||
|
||||
AEval( aChoices[ i, 1 ], {| a, b | HB_SYMBOL_UNUSED( a ), aBarWidth[ i ] := ;
|
||||
Max( aBarWidth[ i ], Len( aChoices[ i, 1, b ] ) ) } )
|
||||
AEval( t_aChoices[ i, 1 ], {| a, b | HB_SYMBOL_UNUSED( a ), aBarWidth[ i ] := ;
|
||||
Max( aBarWidth[ i ], Len( t_aChoices[ i, 1, b ] ) ) } )
|
||||
|
||||
RETURN NIL
|
||||
|
||||
STATIC FUNCTION _ftLocat( i, aBarCol, aBarWidth, aBoxLoc, nMaxCol )
|
||||
STATIC FUNCTION _ftLocat( i, aBarCol, aBarWidth, aBoxLoc, t_nMaxCol )
|
||||
|
||||
aBoxLoc[ i ] := iif( aBarCol[ i ] + aBarWidth[ i ] + 4 > nMaxCol + 1, ;
|
||||
nMaxCol - 3 - aBarWidth[ i ], aBarCol[ i ] )
|
||||
aBoxLoc[ i ] := iif( aBarCol[ i ] + aBarWidth[ i ] + 4 > t_nMaxCol + 1, ;
|
||||
t_nMaxCol - 3 - aBarWidth[ i ], aBarCol[ i ] )
|
||||
|
||||
RETURN NIL
|
||||
|
||||
@@ -348,23 +348,23 @@ STATIC FUNCTION _ftBailOut( cBorder, cBox )
|
||||
LOCAL cOldColor, sOldScreen, nKeyPress, nOldCursor
|
||||
|
||||
nOldCursor := SetCursor( SC_NONE )
|
||||
sOldScreen := SaveScreen( nMaxRow / 2 - 1, 24, nMaxRow / 2 + 2, 55 )
|
||||
sOldScreen := SaveScreen( t_nMaxRow / 2 - 1, 24, t_nMaxRow / 2 + 2, 55 )
|
||||
cOldColor := SetColor( cBorder )
|
||||
FT_SHADOW( nMaxRow / 2 - 1, 24, nMaxRow / 2 + 2, 55 )
|
||||
@ nMaxRow / 2 - 1, 24, nMaxRow/2 + 2, 55 BOX hb_UTF8ToStr( "╔═╗║╝═╚║ " )
|
||||
FT_SHADOW( t_nMaxRow / 2 - 1, 24, t_nMaxRow / 2 + 2, 55 )
|
||||
@ t_nMaxRow / 2 - 1, 24, t_nMaxRow/2 + 2, 55 BOX hb_UTF8ToStr( "╔═╗║╝═╚║ " )
|
||||
SetColor( cBox )
|
||||
@ nMaxRow / 2, 26 SAY "Press ESCape To Confirm Exit"
|
||||
@ nMaxRow / 2 + 1, 27 SAY "Or Any Other Key To Resume"
|
||||
@ t_nMaxRow / 2, 26 SAY "Press ESCape To Confirm Exit"
|
||||
@ t_nMaxRow / 2 + 1, 27 SAY "Or Any Other Key To Resume"
|
||||
nKeyPress := Inkey( 0 )
|
||||
SetColor( cOldColor )
|
||||
RestScreen( nMaxRow / 2 - 1, 24, nMaxRow / 2 + 2, 55, sOldScreen )
|
||||
RestScreen( t_nMaxRow / 2 - 1, 24, t_nMaxRow / 2 + 2, 55, sOldScreen )
|
||||
SetCursor( nOldCursor )
|
||||
|
||||
RETURN !( nKeyPress == K_ESC )
|
||||
|
||||
STATIC FUNCTION _ftValKeys( nNum, aChoices, aValidkeys )
|
||||
STATIC FUNCTION _ftValKeys( nNum, t_aChoices, t_aValidKeys )
|
||||
|
||||
AEval( aChoices[ nNum, 1 ], {| x | aValidKeys[ nNum ] += Left( x, 1 ) } )
|
||||
AEval( t_aChoices[ nNum, 1 ], {| x | t_aValidKeys[ nNum ] += Left( x, 1 ) } )
|
||||
|
||||
RETURN NIL
|
||||
|
||||
|
||||
@@ -55,25 +55,25 @@
|
||||
|
||||
// These arrays hold information about each menu item
|
||||
|
||||
THREAD STATIC aRow := { {} }
|
||||
THREAD STATIC aCol := { {} }
|
||||
THREAD STATIC aPrompt := { {} }
|
||||
THREAD STATIC aColor := { {} }
|
||||
THREAD STATIC aMsgRow := { {} }
|
||||
THREAD STATIC aMsgCol := { {} }
|
||||
THREAD STATIC aMessage := { {} }
|
||||
THREAD STATIC aMsgColor := { {} }
|
||||
THREAD STATIC aTrigger := { {} }
|
||||
THREAD STATIC aTriggerInkey := { {} }
|
||||
THREAD STATIC aTriggerColor := { {} }
|
||||
THREAD STATIC aHome := { {} }
|
||||
THREAD STATIC aEnd := { {} }
|
||||
THREAD STATIC aUp := { {} }
|
||||
THREAD STATIC aDown := { {} }
|
||||
THREAD STATIC aLeft := { {} }
|
||||
THREAD STATIC aRight := { {} }
|
||||
THREAD STATIC aExecute := { {} }
|
||||
THREAD STATIC nLevel := 1
|
||||
THREAD STATIC t_aRow := { {} }
|
||||
THREAD STATIC t_aCol := { {} }
|
||||
THREAD STATIC t_aPrompt := { {} }
|
||||
THREAD STATIC t_aColor := { {} }
|
||||
THREAD STATIC t_aMsgRow := { {} }
|
||||
THREAD STATIC t_aMsgCol := { {} }
|
||||
THREAD STATIC t_aMessage := { {} }
|
||||
THREAD STATIC t_aMsgColor := { {} }
|
||||
THREAD STATIC t_aTrigger := { {} }
|
||||
THREAD STATIC t_aTriggerInkey := { {} }
|
||||
THREAD STATIC t_aTriggerColor := { {} }
|
||||
THREAD STATIC t_aHome := { {} }
|
||||
THREAD STATIC t_aEnd := { {} }
|
||||
THREAD STATIC t_aUp := { {} }
|
||||
THREAD STATIC t_aDown := { {} }
|
||||
THREAD STATIC t_aLeft := { {} }
|
||||
THREAD STATIC t_aRight := { {} }
|
||||
THREAD STATIC t_aExecute := { {} }
|
||||
THREAD STATIC t_nLevel := 1
|
||||
|
||||
FUNCTION FT_Prompt( nRow, nCol, cPrompt, cColor, ;
|
||||
nMsgRow, nMsgCol, cMessage, cMsgColor, ;
|
||||
@@ -126,27 +126,27 @@ FUNCTION FT_Prompt( nRow, nCol, cPrompt, cColor, ;
|
||||
cTriggerColor := cColor
|
||||
ENDIF
|
||||
|
||||
// Now add elements to the static arrays -- nLevel indicates the recursion
|
||||
// Now add elements to the static arrays -- t_nLevel indicates the recursion
|
||||
// level, which allows for nested menus.
|
||||
|
||||
AAdd( aRow[ nLevel ], nRow )
|
||||
AAdd( aCol[ nLevel ], nCol )
|
||||
AAdd( aPrompt[ nLevel ], cPrompt )
|
||||
AAdd( aColor[ nLevel ], cColor )
|
||||
AAdd( aMsgRow[ nLevel ], nMsgRow )
|
||||
AAdd( aMsgCol[ nLevel ], nMsgCol )
|
||||
AAdd( aMessage[ nLevel ], cMessage )
|
||||
AAdd( aMsgColor[ nLevel ], cMsgColor )
|
||||
AAdd( aTrigger[ nLevel ], nTrigger )
|
||||
AAdd( aTriggerInkey[ nLevel ], nTriggerInkey )
|
||||
AAdd( aTriggerColor[ nLevel ], cTriggerColor )
|
||||
AAdd( aHome[ nLevel ], nHome )
|
||||
AAdd( aEnd[ nLevel ], nEnd )
|
||||
AAdd( aUp[ nLevel ], nUp )
|
||||
AAdd( aDown[ nLevel ], nDown )
|
||||
AAdd( aLeft[ nLevel ], nLeft )
|
||||
AAdd( aRight[ nLevel ], nRight )
|
||||
AAdd( aExecute[ nLevel ], bExecute )
|
||||
AAdd( t_aRow[ t_nLevel ], nRow )
|
||||
AAdd( t_aCol[ t_nLevel ], nCol )
|
||||
AAdd( t_aPrompt[ t_nLevel ], cPrompt )
|
||||
AAdd( t_aColor[ t_nLevel ], cColor )
|
||||
AAdd( t_aMsgRow[ t_nLevel ], nMsgRow )
|
||||
AAdd( t_aMsgCol[ t_nLevel ], nMsgCol )
|
||||
AAdd( t_aMessage[ t_nLevel ], cMessage )
|
||||
AAdd( t_aMsgColor[ t_nLevel ], cMsgColor )
|
||||
AAdd( t_aTrigger[ t_nLevel ], nTrigger )
|
||||
AAdd( t_aTriggerInkey[ t_nLevel ], nTriggerInkey )
|
||||
AAdd( t_aTriggerColor[ t_nLevel ], cTriggerColor )
|
||||
AAdd( t_aHome[ t_nLevel ], nHome )
|
||||
AAdd( t_aEnd[ t_nLevel ], nEnd )
|
||||
AAdd( t_aUp[ t_nLevel ], nUp )
|
||||
AAdd( t_aDown[ t_nLevel ], nDown )
|
||||
AAdd( t_aLeft[ t_nLevel ], nLeft )
|
||||
AAdd( t_aRight[ t_nLevel ], nRight )
|
||||
AAdd( t_aExecute[ t_nLevel ], bExecute )
|
||||
|
||||
// Now display the prompt for the sake of compatibility
|
||||
|
||||
@@ -159,9 +159,9 @@ FUNCTION FT_Prompt( nRow, nCol, cPrompt, cColor, ;
|
||||
|
||||
FUNCTION FT_MenuTo( bGetSet, cReadVar, lCold )
|
||||
|
||||
LOCAL nMenu := nLevel++
|
||||
LOCAL nMenu := t_nLevel++
|
||||
LOCAL nActive
|
||||
LOCAL nCount := Len( aRow[ nMenu ] )
|
||||
LOCAL nCount := Len( t_aRow[ nMenu ] )
|
||||
LOCAL lChoice := .F.
|
||||
LOCAL nCursor := Set( _SET_CURSOR, SC_NONE )
|
||||
LOCAL nKey, bKey, nScan, lWrap, cScreen, nPrev
|
||||
@@ -193,22 +193,22 @@ FUNCTION FT_MenuTo( bGetSet, cReadVar, lCold )
|
||||
// calls FT_Prompt(). This will cause a new set of prompts
|
||||
// to be created without disturbing the current set.
|
||||
|
||||
AAdd( aRow, {} )
|
||||
AAdd( aCol, {} )
|
||||
AAdd( aPrompt, {} )
|
||||
AAdd( aColor, {} )
|
||||
AAdd( aMsgRow, {} )
|
||||
AAdd( aMsgCol, {} )
|
||||
AAdd( aMessage, {} )
|
||||
AAdd( aMsgColor, {} )
|
||||
AAdd( aTrigger, {} )
|
||||
AAdd( aTriggerInkey, {} )
|
||||
AAdd( aTriggerColor, {} )
|
||||
AAdd( aUp, {} )
|
||||
AAdd( aDown, {} )
|
||||
AAdd( aLeft, {} )
|
||||
AAdd( aRight, {} )
|
||||
AAdd( aExecute, {} )
|
||||
AAdd( t_aRow, {} )
|
||||
AAdd( t_aCol, {} )
|
||||
AAdd( t_aPrompt, {} )
|
||||
AAdd( t_aColor, {} )
|
||||
AAdd( t_aMsgRow, {} )
|
||||
AAdd( t_aMsgCol, {} )
|
||||
AAdd( t_aMessage, {} )
|
||||
AAdd( t_aMsgColor, {} )
|
||||
AAdd( t_aTrigger, {} )
|
||||
AAdd( t_aTriggerInkey, {} )
|
||||
AAdd( t_aTriggerColor, {} )
|
||||
AAdd( t_aUp, {} )
|
||||
AAdd( t_aDown, {} )
|
||||
AAdd( t_aLeft, {} )
|
||||
AAdd( t_aRight, {} )
|
||||
AAdd( t_aExecute, {} )
|
||||
|
||||
// Loop until Enter or Esc is pressed
|
||||
|
||||
@@ -229,13 +229,13 @@ FUNCTION FT_MenuTo( bGetSet, cReadVar, lCold )
|
||||
|
||||
DispBegin()
|
||||
|
||||
IF aMessage[ nCurrent ] != NIL
|
||||
cScreen := SaveScreen( aMsgRow[ nCurrent ], aMsgCol[ nCurrent ], ;
|
||||
aMsgRow[ nCurrent ], aMsgCol[ nCurrent ] + ;
|
||||
Len( aMessage[ nCurrent ] ) - 1 )
|
||||
IF t_aMessage[ nCurrent ] != NIL
|
||||
cScreen := SaveScreen( t_aMsgRow[ nCurrent ], t_aMsgCol[ nCurrent ], ;
|
||||
t_aMsgRow[ nCurrent ], t_aMsgCol[ nCurrent ] + ;
|
||||
Len( t_aMessage[ nCurrent ] ) - 1 )
|
||||
|
||||
DISPLAY( aMsgRow[ nCurrent ], aMsgCol[ nCurrent ], ;
|
||||
aMessage[ nCurrent ], aMsgColor[ nCurrent ] )
|
||||
DISPLAY( t_aMsgRow[ nCurrent ], t_aMsgCol[ nCurrent ], ;
|
||||
t_aMessage[ nCurrent ], t_aMsgColor[ nCurrent ] )
|
||||
|
||||
ELSE
|
||||
cScreen := NIL
|
||||
@@ -244,13 +244,13 @@ FUNCTION FT_MenuTo( bGetSet, cReadVar, lCold )
|
||||
// Display the prompt using the designated colors for the prompt and
|
||||
// the trigger character.
|
||||
|
||||
DISPLAY( aRow[ nCurrent ], aCol[ nCurrent ], ;
|
||||
aPrompt[ nCurrent ], EnhColor( aColor[ nCurrent ] ) )
|
||||
DISPLAY( t_aRow[ nCurrent ], t_aCol[ nCurrent ], ;
|
||||
t_aPrompt[ nCurrent ], EnhColor( t_aColor[ nCurrent ] ) )
|
||||
|
||||
DISPLAY( aRow[ nCurrent ], ;
|
||||
aCol[ nCurrent ] - 1 + aTrigger[ nCurrent ], ;
|
||||
SubStr( aPrompt[ nCurrent ], aTrigger[ nCurrent ], 1 ), ;
|
||||
EnhColor( aTriggerColor[ nCurrent ] ) )
|
||||
DISPLAY( t_aRow[ nCurrent ], ;
|
||||
t_aCol[ nCurrent ] - 1 + t_aTrigger[ nCurrent ], ;
|
||||
SubStr( t_aPrompt[ nCurrent ], t_aTrigger[ nCurrent ], 1 ), ;
|
||||
EnhColor( t_aTriggerColor[ nCurrent ] ) )
|
||||
|
||||
DispEnd()
|
||||
|
||||
@@ -279,8 +279,8 @@ FUNCTION FT_MenuTo( bGetSet, cReadVar, lCold )
|
||||
// associated code block.
|
||||
|
||||
CASE nKey == K_ENTER
|
||||
IF aExecute[ nCurrent ] != NIL
|
||||
Eval( aExecute[ nCurrent ] )
|
||||
IF t_aExecute[ nCurrent ] != NIL
|
||||
Eval( t_aExecute[ nCurrent ] )
|
||||
ELSE
|
||||
lChoice := .T.
|
||||
ENDIF
|
||||
@@ -294,69 +294,69 @@ FUNCTION FT_MenuTo( bGetSet, cReadVar, lCold )
|
||||
// If Home was pressed, go to the designated menu item.
|
||||
|
||||
CASE nKey == K_HOME
|
||||
nActive := iif( aHome[ nCurrent ] == NIL, 1, aHome[ nCurrent ] )
|
||||
nActive := iif( t_aHome[ nCurrent ] == NIL, 1, t_aHome[ nCurrent ] )
|
||||
|
||||
// If End was pressed, go to the designated menu item.
|
||||
|
||||
CASE nKey == K_END
|
||||
nActive := iif( aEnd[ nCurrent ] == NIL, nCount, aEnd[ nCurrent ] )
|
||||
nActive := iif( t_aEnd[ nCurrent ] == NIL, nCount, t_aEnd[ nCurrent ] )
|
||||
|
||||
// If Up Arrow was pressed, go to the designated menu item.
|
||||
|
||||
CASE nKey == K_UP
|
||||
IF aUp[ nCurrent ] == NIL
|
||||
IF t_aUp[ nCurrent ] == NIL
|
||||
if --nActive < 1
|
||||
nActive := iif( lWrap, nCount, 1 )
|
||||
ENDIF
|
||||
ELSE
|
||||
IF isOkay( aUp[ nCurrent ] )
|
||||
nActive := aUp[ nCurrent ]
|
||||
IF isOkay( t_aUp[ nCurrent ] )
|
||||
nActive := t_aUp[ nCurrent ]
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
// If Down Arrow was pressed, go to the designated menu item.
|
||||
|
||||
CASE nKey == K_DOWN
|
||||
IF aDown[ nCurrent ] == NIL
|
||||
IF t_aDown[ nCurrent ] == NIL
|
||||
if ++nActive > nCount
|
||||
nActive := iif( lWrap, 1, nCount )
|
||||
ENDIF
|
||||
ELSE
|
||||
IF isOkay( aDown[ nCurrent ] )
|
||||
nActive := aDown[ nCurrent ]
|
||||
IF isOkay( t_aDown[ nCurrent ] )
|
||||
nActive := t_aDown[ nCurrent ]
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
// If Left Arrow was pressed, go to the designated menu item.
|
||||
|
||||
CASE nKey == K_LEFT
|
||||
IF aLeft[ nCurrent ] == NIL
|
||||
IF t_aLeft[ nCurrent ] == NIL
|
||||
if --nActive < 1
|
||||
nActive := iif( lWrap, nCount, 1 )
|
||||
ENDIF
|
||||
ELSE
|
||||
IF isOkay( aLeft[ nCurrent ] )
|
||||
nActive := aLeft[ nCurrent ]
|
||||
IF isOkay( t_aLeft[ nCurrent ] )
|
||||
nActive := t_aLeft[ nCurrent ]
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
// If Right Arrow was pressed, go to the designated menu item.
|
||||
|
||||
CASE nKey == K_RIGHT
|
||||
IF aRight[ nCurrent ] == NIL
|
||||
IF t_aRight[ nCurrent ] == NIL
|
||||
if ++nActive > nCount
|
||||
nActive := iif( lWrap, 1, nCount )
|
||||
ENDIF
|
||||
ELSE
|
||||
IF isOkay( aRight[ nCurrent ] )
|
||||
nActive := aRight[ nCurrent ]
|
||||
IF isOkay( t_aRight[ nCurrent ] )
|
||||
nActive := t_aRight[ nCurrent ]
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
// If a trigger letter was pressed, handle it based on the COLD
|
||||
// parameter.
|
||||
|
||||
CASE ( nScan := AScan( aTriggerInkey[ nMenu ], nKey ) ) > 0
|
||||
CASE ( nScan := AScan( t_aTriggerInkey[ nMenu ], nKey ) ) > 0
|
||||
nActive := nScan
|
||||
IF ! lCold
|
||||
FT_PutKey( K_ENTER )
|
||||
@@ -367,19 +367,19 @@ FUNCTION FT_MenuTo( bGetSet, cReadVar, lCold )
|
||||
|
||||
IF ! lChoice
|
||||
DispBegin()
|
||||
DISPLAY( aRow[ nLast ], aCol[ nLast ], ;
|
||||
aPrompt[ nLast ], aColor[ nLast ] )
|
||||
DISPLAY( t_aRow[ nLast ], t_aCol[ nLast ], ;
|
||||
t_aPrompt[ nLast ], t_aColor[ nLast ] )
|
||||
|
||||
DISPLAY( aRow[ nLast ], aCol[ nLast ] - 1 + aTrigger[ nLast ], ;
|
||||
SubStr( aPrompt[ nLast ], aTrigger[ nLast ], 1 ), ;
|
||||
aTriggerColor[ nLast ] )
|
||||
DISPLAY( t_aRow[ nLast ], t_aCol[ nLast ] - 1 + t_aTrigger[ nLast ], ;
|
||||
SubStr( t_aPrompt[ nLast ], t_aTrigger[ nLast ], 1 ), ;
|
||||
t_aTriggerColor[ nLast ] )
|
||||
|
||||
IF cScreen != NIL
|
||||
RestScreen( aMsgRow[ nLast ], ;
|
||||
aMsgCol[ nLast ], ;
|
||||
aMsgRow[ nLast ], ;
|
||||
aMsgCol[ nLast ] ;
|
||||
+ Len( aMessage[ nLast ] ) - 1, ;
|
||||
RestScreen( t_aMsgRow[ nLast ], ;
|
||||
t_aMsgCol[ nLast ], ;
|
||||
t_aMsgRow[ nLast ], ;
|
||||
t_aMsgCol[ nLast ] ;
|
||||
+ Len( t_aMessage[ nLast ] ) - 1, ;
|
||||
cScreen )
|
||||
ENDIF
|
||||
DispEnd()
|
||||
@@ -389,41 +389,41 @@ FUNCTION FT_MenuTo( bGetSet, cReadVar, lCold )
|
||||
// Now that we're exiting, decrement the recursion level and erase all
|
||||
// the prompt information for the current invocation.
|
||||
|
||||
nLevel--
|
||||
t_nLevel--
|
||||
|
||||
ASize( aRow, nLevel )
|
||||
ASize( aCol, nLevel )
|
||||
ASize( aPrompt, nLevel )
|
||||
ASize( aColor, nLevel )
|
||||
ASize( aMsgRow, nLevel )
|
||||
ASize( aMsgCol, nLevel )
|
||||
ASize( aMessage, nLevel )
|
||||
ASize( aMsgColor, nLevel )
|
||||
ASize( aTrigger, nLevel )
|
||||
ASize( aTriggerInkey, nLevel )
|
||||
ASize( aTriggerColor, nLevel )
|
||||
ASize( aUp, nLevel )
|
||||
ASize( aDown, nLevel )
|
||||
ASize( aLeft, nLevel )
|
||||
ASize( aRight, nLevel )
|
||||
ASize( aExecute, nLevel )
|
||||
ASize( t_aRow, t_nLevel )
|
||||
ASize( t_aCol, t_nLevel )
|
||||
ASize( t_aPrompt, t_nLevel )
|
||||
ASize( t_aColor, t_nLevel )
|
||||
ASize( t_aMsgRow, t_nLevel )
|
||||
ASize( t_aMsgCol, t_nLevel )
|
||||
ASize( t_aMessage, t_nLevel )
|
||||
ASize( t_aMsgColor, t_nLevel )
|
||||
ASize( t_aTrigger, t_nLevel )
|
||||
ASize( t_aTriggerInkey, t_nLevel )
|
||||
ASize( t_aTriggerColor, t_nLevel )
|
||||
ASize( t_aUp, t_nLevel )
|
||||
ASize( t_aDown, t_nLevel )
|
||||
ASize( t_aLeft, t_nLevel )
|
||||
ASize( t_aRight, t_nLevel )
|
||||
ASize( t_aExecute, t_nLevel )
|
||||
|
||||
aRow[ nLevel ] := {}
|
||||
aCol[ nLevel ] := {}
|
||||
aPrompt[ nLevel ] := {}
|
||||
aColor[ nLevel ] := {}
|
||||
aMsgRow[ nLevel ] := {}
|
||||
aMsgCol[ nLevel ] := {}
|
||||
aMessage[ nLevel ] := {}
|
||||
aMsgColor[ nLevel ] := {}
|
||||
aTrigger[ nLevel ] := {}
|
||||
aTriggerInkey[ nLevel ] := {}
|
||||
aTriggerColor[ nLevel ] := {}
|
||||
aUp[ nLevel ] := {}
|
||||
aDown[ nLevel ] := {}
|
||||
aLeft[ nLevel ] := {}
|
||||
aRight[ nLevel ] := {}
|
||||
aExecute[ nLevel ] := {}
|
||||
t_aRow[ t_nLevel ] := {}
|
||||
t_aCol[ t_nLevel ] := {}
|
||||
t_aPrompt[ t_nLevel ] := {}
|
||||
t_aColor[ t_nLevel ] := {}
|
||||
t_aMsgRow[ t_nLevel ] := {}
|
||||
t_aMsgCol[ t_nLevel ] := {}
|
||||
t_aMessage[ t_nLevel ] := {}
|
||||
t_aMsgColor[ t_nLevel ] := {}
|
||||
t_aTrigger[ t_nLevel ] := {}
|
||||
t_aTriggerInkey[ t_nLevel ] := {}
|
||||
t_aTriggerColor[ t_nLevel ] := {}
|
||||
t_aUp[ t_nLevel ] := {}
|
||||
t_aDown[ t_nLevel ] := {}
|
||||
t_aLeft[ t_nLevel ] := {}
|
||||
t_aRight[ t_nLevel ] := {}
|
||||
t_aExecute[ t_nLevel ] := {}
|
||||
|
||||
Set( _SET_CURSOR, nCursor )
|
||||
|
||||
|
||||
@@ -45,7 +45,8 @@ MEMVAR getlist
|
||||
board_[xx, 4] - is the location occupied or not? .T. -> Yes, .F. -> No
|
||||
*/
|
||||
|
||||
THREAD STATIC board_ := { { { 0, 29, 2, 34 }, { 2, 4 }, { 3, 9 }, .T. } , ;
|
||||
THREAD STATIC t_board_ := {;
|
||||
{ { 0, 29, 2, 34 }, { 2, 4 }, { 3, 9 }, .T. } , ;
|
||||
{ { 0, 37, 2, 42 }, { 5 }, { 10 }, .T. } , ;
|
||||
{ { 0, 45, 2, 50 }, { 2, 6 }, { 1, 11 }, .T. } , ;
|
||||
{ { 3, 29, 5, 34 }, { 5, 9 }, { 6, 16 }, .T. } , ;
|
||||
@@ -94,7 +95,7 @@ FUNCTION FT_PEGS()
|
||||
SetColor( "w/r" )
|
||||
SINGLEBOX( 22, 31, 24, 48 )
|
||||
@ 23, 33 SAY "Your move:"
|
||||
AEval( board_, {| a, x | HB_SYMBOL_UNUSED( a ), drawbox( x ) } )
|
||||
AEval( t_board_, {| a, x | HB_SYMBOL_UNUSED( a ), drawbox( x ) } )
|
||||
DO WHILE LastKey() != K_ESC .AND. moremoves()
|
||||
move := 1
|
||||
SetColor( "w/n" )
|
||||
@@ -102,23 +103,23 @@ FUNCTION FT_PEGS()
|
||||
READ
|
||||
IF move > 0
|
||||
DO CASE
|
||||
CASE ! board_[ move ][ 4 ]
|
||||
CASE ! t_board_[ move ][ 4 ]
|
||||
err_msg( "No piece there!" )
|
||||
OTHERWISE
|
||||
possible_ := {}
|
||||
FOR xx := 1 TO Len( board_[ move ][ 2 ] )
|
||||
IF board_[ board_[ move ][ 2, xx ] ][ 4 ] .AND. ;
|
||||
! board_[ board_[ move ][ 3, xx ] ][ 4 ]
|
||||
AAdd( possible_, { board_[ move ][ 2, xx ], board_[ move ][ 3, xx ] } )
|
||||
FOR xx := 1 TO Len( t_board_[ move ][ 2 ] )
|
||||
IF t_board_[ t_board_[ move ][ 2, xx ] ][ 4 ] .AND. ;
|
||||
! t_board_[ t_board_[ move ][ 3, xx ] ][ 4 ]
|
||||
AAdd( possible_, { t_board_[ move ][ 2, xx ], t_board_[ move ][ 3, xx ] } )
|
||||
ENDIF
|
||||
NEXT
|
||||
// only one available move -- do it
|
||||
DO CASE
|
||||
CASE Len( possible_ ) == 1
|
||||
// clear out original position and the position you jumped over
|
||||
board_[ move ][ 4 ] := board_[ possible_[ 1, 1 ] ][ 4 ] := .F.
|
||||
board_[ possible_[ 1, 2 ] ][ 4 ] := .T.
|
||||
drawbox( move, board_[move] )
|
||||
t_board_[ move ][ 4 ] := t_board_[ possible_[ 1, 1 ] ][ 4 ] := .F.
|
||||
t_board_[ possible_[ 1, 2 ] ][ 4 ] := .T.
|
||||
drawbox( move, t_board_[move] )
|
||||
drawbox( possible_[ 1, 1 ] )
|
||||
drawbox( possible_[ 1, 2 ] )
|
||||
CASE Len( possible_ ) == 0
|
||||
@@ -141,8 +142,8 @@ FUNCTION FT_PEGS()
|
||||
Set( _SET_SCOREBOARD, oldscore )
|
||||
mpos := AScan( possible_, {| a | move2 == a[ 2 ] } )
|
||||
// clear out original position and the position you jumped over
|
||||
board_[ move ][ 4 ] := board_[ possible_[ mpos, 1 ] ][ 4 ] := .F.
|
||||
board_[ move2 ][ 4 ] := .T.
|
||||
t_board_[ move ][ 4 ] := t_board_[ possible_[ mpos, 1 ] ][ 4 ] := .F.
|
||||
t_board_[ move2 ][ 4 ] := .T.
|
||||
drawbox( move )
|
||||
drawbox( possible_[ mpos, 1 ] )
|
||||
drawbox( move2 )
|
||||
@@ -161,10 +162,10 @@ FUNCTION FT_PEGS()
|
||||
|
||||
STATIC FUNCTION DrawBox( nelement )
|
||||
|
||||
SetColor( iif( board_[ nelement ][ 4 ], "+w/rb", "w/n" ) )
|
||||
@ board_[ nelement ][ 1, 1 ], board_[ nelement ][1,2], board_[ nelement ][ 1, 3 ], ;
|
||||
board_[ nelement ][ 1, 4 ] BOX hb_UTF8ToStr( "┌─┐│┘─└│ " )
|
||||
DevPos( board_[ nelement ][ 1, 1 ] + 1, board_[ nelement ][ 1, 2 ] + 2 )
|
||||
SetColor( iif( t_board_[ nelement ][ 4 ], "+w/rb", "w/n" ) )
|
||||
@ t_board_[ nelement ][ 1, 1 ], t_board_[ nelement ][1,2], t_board_[ nelement ][ 1, 3 ], ;
|
||||
t_board_[ nelement ][ 1, 4 ] BOX hb_UTF8ToStr( "┌─┐│┘─└│ " )
|
||||
DevPos( t_board_[ nelement ][ 1, 1 ] + 1, t_board_[ nelement ][ 1, 2 ] + 2 )
|
||||
DevOut( hb_ntos( nelement ) )
|
||||
|
||||
RETURN NIL
|
||||
@@ -191,16 +192,16 @@ STATIC FUNCTION moremoves()
|
||||
LOCAL xx, yy, canmove := .F. , piecesleft := 0, buffer
|
||||
|
||||
FOR xx := 1 TO 33
|
||||
FOR yy := 1 TO Len( board_[ xx ][ 2 ] )
|
||||
IF board_[ xx ][ 4 ] .AND. ; // if current location is filled
|
||||
board_[ board_[ xx ][ 2, yy ] ][ 4 ] .AND. ; // adjacent must be filled
|
||||
! board_[ board_[ xx ][ 3, yy ] ][ 4 ] // target must be empty
|
||||
FOR yy := 1 TO Len( t_board_[ xx ][ 2 ] )
|
||||
IF t_board_[ xx ][ 4 ] .AND. ; // if current location is filled
|
||||
t_board_[ t_board_[ xx ][ 2, yy ] ][ 4 ] .AND. ; // adjacent must be filled
|
||||
! t_board_[ t_board_[ xx ][ 3, yy ] ][ 4 ] // target must be empty
|
||||
canmove := .T.
|
||||
EXIT
|
||||
ENDIF
|
||||
NEXT
|
||||
// increment number of pieces left
|
||||
IF board_[ xx ][ 4 ]
|
||||
IF t_board_[ xx ][ 4 ]
|
||||
piecesleft++
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
@@ -38,8 +38,12 @@ PROCEDURE Main()
|
||||
|
||||
FUNCTION FT_PENDING( cMsg, nRow, nCol, nWait, cColor )
|
||||
|
||||
THREAD STATIC nLast_Time := 0, nRow1 := 24, nCol1 := 0
|
||||
THREAD STATIC nWait1 := 5, cColor1 := "W+/R,X"
|
||||
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, cSavColor
|
||||
|
||||
//
|
||||
@@ -50,35 +54,35 @@ FUNCTION FT_PENDING( cMsg, nRow, nCol, nWait, cColor )
|
||||
// cColor Color of displayed message
|
||||
//
|
||||
|
||||
IF cMsg == NIL //if no message, no work
|
||||
IF cMsg == NIL // if no message, no work
|
||||
RETURN NIL
|
||||
ENDIF
|
||||
|
||||
nRow1 := iif( nRow != NIL, nRow, nRow1 ) //reset display row
|
||||
nCol1 := iif( nCol != NIL, nCol, nCol1 ) //reset display col
|
||||
t_nRow1 := iif( nRow != NIL, nRow, t_nRow1 ) // reset display row
|
||||
t_nCol1 := iif( nCol != NIL, nCol, t_nCol1 ) // reset display col
|
||||
|
||||
nWait1 := iif( nWait != NIL, nWait, nWait1 ) //reset display wait
|
||||
cColor1 := iif( cColor != NIL, cColor, cColor1 ) //reset display color
|
||||
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
|
||||
nThis_Time := Seconds() // time of current message
|
||||
|
||||
IF nLast_Time == 0
|
||||
nLast_Time := nThis_Time - nWait1 //for first time round.
|
||||
IF t_nLast_Time == 0
|
||||
t_nLast_Time := nThis_Time - t_nWait1 // for first time round.
|
||||
ENDIF
|
||||
|
||||
IF ( nThis_Time - nLast_Time ) < nTiny //if messages are coming too fast,
|
||||
nLast_Time := nThis_Time + nWait1 //set time counter and then
|
||||
Inkey ( nWait1 ) //wait a few seconds.
|
||||
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
|
||||
nLast_Time := nThis_Time //set time counter for next message.
|
||||
t_nLast_Time := nThis_Time // set time counter for next message.
|
||||
ENDIF
|
||||
|
||||
@ nRow1, 0 CLEAR TO nRow1, 80 //clear the display line
|
||||
@ t_nRow1, 0 CLEAR TO t_nRow1, 80 // clear the display line
|
||||
|
||||
cSavColor := SetColor( cColor1 ) //save current and set display color
|
||||
cSavColor := SetColor( t_cColor1 ) // save current and set display color
|
||||
|
||||
@ nRow1, nCol1 SAY cMsg //display message
|
||||
@ t_nRow1, t_nCol1 SAY cMsg // display message
|
||||
|
||||
SetColor( cSavColor ) //restore colors.
|
||||
SetColor( cSavColor ) // restore colors.
|
||||
|
||||
RETURN NIL
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "setcurs.ch"
|
||||
#include "achoice.ch"
|
||||
|
||||
// Set up manifest constants to access the window colors in the array aWinColor
|
||||
// Set up manifest constants to access the window colors in the array t_aWinColor
|
||||
#define W_BORDER 1
|
||||
#define W_ACCENT 2
|
||||
#define W_PROMPT 3
|
||||
@@ -45,7 +45,7 @@
|
||||
#define W_CURR NIL
|
||||
|
||||
// Set up manifest constants to access the Standard screen colors in the array
|
||||
// aStdColor
|
||||
// t_aStdColor
|
||||
#define STD_ACCENT 1
|
||||
#define STD_ERROR 2
|
||||
#define STD_PROMPT 3
|
||||
@@ -107,8 +107,12 @@
|
||||
#define cTapeScr aAdder[ 23 ]
|
||||
|
||||
// I still use a few of STATICS, but most are set to NIL when quiting...
|
||||
THREAD STATIC lAdderOpen := .F.
|
||||
THREAD STATIC aKeys, aWindow, nWinColor, aWinColor, aStdColor
|
||||
THREAD STATIC t_lAdderOpen := .F.
|
||||
THREAD STATIC t_aKeys
|
||||
THREAD STATIC t_aWindow
|
||||
THREAD STATIC t_nWinColor
|
||||
THREAD STATIC t_aWinColor
|
||||
THREAD STATIC t_aStdColor
|
||||
|
||||
#ifdef FT_TEST
|
||||
|
||||
@@ -184,10 +188,10 @@ FUNCTION FT_Adder()
|
||||
LOCAL aAdder := Array( 23 )
|
||||
|
||||
// Must prevent recursive calls
|
||||
IF lAdderOpen
|
||||
IF t_lAdderOpen
|
||||
RETURN NIL
|
||||
ELSE
|
||||
lAdderOpen := .T.
|
||||
t_lAdderOpen := .T.
|
||||
ENDIF
|
||||
|
||||
aTrans := { " 0.00 C " }
|
||||
@@ -212,9 +216,9 @@ FUNCTION FT_Adder()
|
||||
nTapeSpace := iif( lShowRight, 0, 40 ) + nLeftOS
|
||||
|
||||
// Set Up the STATIC variables
|
||||
aKeys := {}
|
||||
aWindow := {}
|
||||
nWinColor := 0
|
||||
t_aKeys := {}
|
||||
t_aWindow := {}
|
||||
t_nWinColor := 0
|
||||
|
||||
_ftAddScreen( aAdder )
|
||||
|
||||
@@ -247,7 +251,7 @@ FUNCTION FT_Adder()
|
||||
SetPos( nOldRow, nOldCol )
|
||||
_ftSetLastKey( nOldLastKey )
|
||||
SetKey( K_F10, bOldF10 )
|
||||
lAdderOpen := .F. // Reset the recursive flag
|
||||
t_lAdderOpen := .F. // Reset the recursive flag
|
||||
lDone := .T.
|
||||
CASE nKey == 68 .OR. nKey == 100 // <D> Change number of decimal places
|
||||
_ftChangeDec( aAdder )
|
||||
@@ -321,8 +325,8 @@ FUNCTION FT_Adder()
|
||||
_ftSetLastKey( nOldLastKey )
|
||||
SetKey( K_F10, bOldF10 )
|
||||
oGet:VARPUT( nSavTotal )
|
||||
lAdderOpen := .F. // Reset the recursive flag
|
||||
lDone := .T.
|
||||
t_lAdderOpen := .F. // Reset the recursive flag
|
||||
lDone := .T.
|
||||
ELSE
|
||||
_ftError( "but I can not return the total from the " + ;
|
||||
"adder to this variable. You must quit the adder using" + ;
|
||||
@@ -336,7 +340,7 @@ FUNCTION FT_Adder()
|
||||
ENDDO
|
||||
|
||||
// Reset the STATICS to NIL
|
||||
aKeys := aWindow := aWinColor := aStdColor := NIL
|
||||
t_aKeys := t_aWindow := t_aWinColor := t_aStdColor := NIL
|
||||
|
||||
RETURN NIL
|
||||
|
||||
@@ -1044,7 +1048,7 @@ STATIC FUNCTION _ftSetLastKey( nLastKey )
|
||||
|
||||
/*+- Function ---------------------------------------------------------------+
|
||||
| Name: _ftPushKeys Docs: Keith A. Wire |
|
||||
| Description: Push any keys in the Keyboard buffer on the array aKeys[] |
|
||||
| Description: Push any keys in the Keyboard buffer on the array t_aKeys[]|
|
||||
| Author: Keith A. Wire |
|
||||
| Date created: 10-03-93 Date updated: 10-03-93 |
|
||||
| Time created: 12:16:09pm Time updated: 12:16:09pm |
|
||||
@@ -1059,7 +1063,7 @@ STATIC FUNCTION _ftSetLastKey( nLastKey )
|
||||
STATIC FUNCTION _ftPushKeys
|
||||
|
||||
DO WHILE NextKey() != 0
|
||||
AAdd( aKeys, Inkey() )
|
||||
AAdd( t_aKeys, Inkey() )
|
||||
ENDDO
|
||||
|
||||
RETURN NIL
|
||||
@@ -1080,10 +1084,10 @@ STATIC FUNCTION _ftPushKeys
|
||||
|
||||
STATIC FUNCTION _ftPopKeys
|
||||
|
||||
IF ! Empty( aKeys )
|
||||
hb_keyPut( aKeys )
|
||||
IF ! Empty( t_aKeys )
|
||||
hb_keyPut( t_aKeys )
|
||||
ENDIF
|
||||
aKeys := {}
|
||||
t_aKeys := {}
|
||||
|
||||
RETURN NIL
|
||||
|
||||
@@ -1443,27 +1447,29 @@ STATIC FUNCTION _ftStuffComma( cStrToStuff, lTrimStuffedStr )
|
||||
| : nBord |
|
||||
| : nBack |
|
||||
| : nUnsel |
|
||||
| Return Value: SETCOLOR(aStdColor[nStd] + "," + aStdColor[nEnh] + "," + ; |
|
||||
| : aStdColor[nBord] + "," + aStdColor[nBack] + "," + ; |
|
||||
| : aStdColor[nUnsel]) |
|
||||
| Return Value: see code |
|
||||
| See Also: _ftSetWinColor() |
|
||||
+--------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
STATIC FUNCTION _ftSetSCRColor( nStd, nEnh, nBord, nBack, nUnsel )
|
||||
|
||||
IF Empty( aWinColor )
|
||||
IF Empty( t_aWinColor )
|
||||
_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 )
|
||||
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 )
|
||||
|
||||
RETURN SetColor( aStdColor[nStd] + "," + aStdColor[nEnh] + "," + aStdColor[nBord] + "," + ;
|
||||
aStdColor[nBack] + "," + aStdColor[nUnsel] )
|
||||
RETURN SetColor( ;
|
||||
t_aStdColor[ nStd ] + "," + ;
|
||||
t_aStdColor[ nEnh ] + "," + ;
|
||||
t_aStdColor[ nBord ] + "," + ;
|
||||
t_aStdColor[ nBack ] + "," + ;
|
||||
t_aStdColor[ nUnsel ] )
|
||||
|
||||
/*+- Function ---------------------------------------------------------------+
|
||||
| Name: _ftPushWin() Docs: Keith A. Wire |
|
||||
@@ -1504,7 +1510,7 @@ STATIC FUNCTION _ftPushWin( t, l, b, r, cTitle, cBotTitle, nWinColor )
|
||||
LOCAL lAutoWindow := nWinColor == NIL
|
||||
|
||||
nWinColor := iif( nWinColor == NIL, _ftNextWinColor(), nWinColor )
|
||||
AAdd( aWindow, { t, l, b, r, nWinColor, SaveScreen( t,l,b + 1,r + 2 ), lAutoWindow } )
|
||||
AAdd( t_aWindow, { t, l, b, r, nWinColor, SaveScreen( t,l,b + 1,r + 2 ), lAutoWindow } )
|
||||
_ftShadow( b + 1, l + 2, b + 1, r + 2 )
|
||||
_ftShadow( t + 1, r + 1, b, r + 2 )
|
||||
_ftSetWinColor( nWinColor, W_BORDER )
|
||||
@@ -1536,7 +1542,7 @@ STATIC FUNCTION _ftPushWin( t, l, b, r, cTitle, cBotTitle, nWinColor )
|
||||
| Arguments: None |
|
||||
| Return Value: NIL |
|
||||
| Notes: Pop the currently active window off the screen by restoring|
|
||||
| : it from the aWindow Array and if they pushed a new window|
|
||||
| : it from the t_aWindow Array and if they pushed a new window|
|
||||
| : automatically selecting the color we will roll back the |
|
||||
| : current window setting using _ftLastWinColor() and reset |
|
||||
| : the color to the color setting when window was pushed. |
|
||||
@@ -1545,19 +1551,19 @@ STATIC FUNCTION _ftPushWin( t, l, b, r, cTitle, cBotTitle, nWinColor )
|
||||
|
||||
STATIC FUNCTION _ftPopWin
|
||||
|
||||
LOCAL nNumWindow := Len( aWindow )
|
||||
LOCAL nNumWindow := Len( t_aWindow )
|
||||
|
||||
RestScreen( aWindow[nNumWindow,1], aWindow[nNumWindow,2], ;
|
||||
aWindow[nNumWindow,3] + 1, aWindow[nNumWindow,4] + 2, ;
|
||||
aWindow[nNumWindow,6] )
|
||||
RestScreen( t_aWindow[ nNumWindow, 1 ], t_aWindow[ nNumWindow, 2 ], ;
|
||||
t_aWindow[ nNumWindow, 3 ] + 1, t_aWindow[ nNumWindow, 4 ] + 2, ;
|
||||
t_aWindow[ nNumWindow, 6 ] )
|
||||
|
||||
IF aWindow[nNumWindow,7]
|
||||
IF t_aWindow[ nNumWindow, 7 ]
|
||||
_ftLastWinColor()
|
||||
ENDIF
|
||||
|
||||
ASHRINK( aWindow )
|
||||
ASHRINK( t_aWindow )
|
||||
|
||||
IF !Empty( aWindow )
|
||||
IF ! Empty( t_aWindow )
|
||||
_ftSetWinColor( W_CURR, W_SCREEN, W_VARIAB )
|
||||
ELSE
|
||||
_ftSetSCRColor( STD_SCREEN, STD_VARIABLE )
|
||||
@@ -1579,9 +1585,7 @@ STATIC FUNCTION _ftPopWin
|
||||
| : nBord |
|
||||
| : nBack |
|
||||
| : nUnsel |
|
||||
| Return Value:SETCOLOR(aWinColor[nStd,nWin]+","+aWinColor[nEnh,nWin]+","+;|
|
||||
| : aWinColor[nBord,nWin]+","+aWinColor[nBack,nWin]+","+ ;|
|
||||
| : aWinColor[nUnsel,nWin]) |
|
||||
| Return Value: see code |
|
||||
| See Also: _ftSetSCRColor() |
|
||||
| Notes: If the window number is not passed use the currently active|
|
||||
| : window number nWinColor. |
|
||||
@@ -1590,15 +1594,19 @@ STATIC FUNCTION _ftPopWin
|
||||
|
||||
STATIC FUNCTION _ftSetWinColor( nWin, nStd, nEnh, nBord, nBack, nUnsel )
|
||||
|
||||
nWin := iif( nWin == NIL, 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 )
|
||||
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 )
|
||||
|
||||
RETURN SetColor( aWinColor[nStd,nWin] + "," + aWinColor[nEnh,nWin] + "," + ;
|
||||
aWinColor[nBord,nWin] + "," + aWinColor[nBack,nWin] + "," + aWinColor[nUnsel,nWin] )
|
||||
RETURN SetColor( ;
|
||||
t_aWinColor[ nStd, nWin ] + "," + ;
|
||||
t_aWinColor[ nEnh, nWin ] + "," + ;
|
||||
t_aWinColor[ nBord, nWin ] + "," + ;
|
||||
t_aWinColor[ nBack, nWin ] + "," + ;
|
||||
t_aWinColor[ nUnsel, nWin ] )
|
||||
|
||||
/*+- Function ---------------------------------------------------------------+
|
||||
| Name: _ftShadow() Docs: Keith A. Wire |
|
||||
@@ -1636,14 +1644,14 @@ STATIC FUNCTION _ftShadow( nTop, nLeft, nBottom, nRight )
|
||||
| Copyright: None - Public Domain |
|
||||
+--------------------------------------------------------------------------+
|
||||
| Arguments: None |
|
||||
| Return Value: nWinColor := iif(nWinColor==1,4,nWinColor-1) |
|
||||
| Return Value: t_nWinColor := iif(t_nWinColor==1,4,t_nWinColor-1) |
|
||||
| Notes: If we are already on window #1 restart count by using # 4. |
|
||||
+--------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
STATIC FUNCTION _ftLastWinColor
|
||||
STATIC FUNCTION _ftLastWinColor()
|
||||
|
||||
RETURN nWinColor := iif( nWinColor == 1, 4, nWinColor - 1 )
|
||||
RETURN t_nWinColor := iif( t_nWinColor == 1, 4, t_nWinColor - 1 )
|
||||
|
||||
/*+- Function ---------------------------------------------------------------+
|
||||
| Name: _ftNextWinColor Docs: Keith A. Wire |
|
||||
@@ -1655,18 +1663,18 @@ STATIC FUNCTION _ftLastWinColor
|
||||
| Copyright: None - Public Domain |
|
||||
+--------------------------------------------------------------------------+
|
||||
| Arguments: None |
|
||||
| Return Value: nWinColor := (iif(nWinColor<4,nWinColor+1,1)) |
|
||||
| Return Value: t_nWinColor := (iif(t_nWinColor<4,t_nWinColor+1,1)) |
|
||||
| Notes: If we are already on window #4 restart count by using # 1. |
|
||||
+--------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
STATIC FUNCTION _ftNextWinColor
|
||||
STATIC FUNCTION _ftNextWinColor()
|
||||
|
||||
IF Empty( aWinColor )
|
||||
IF Empty( t_aWinColor )
|
||||
_ftInitColors()
|
||||
ENDIF
|
||||
|
||||
RETURN nWinColor := ( iif( nWinColor < 4,nWinColor + 1,1 ) )
|
||||
RETURN t_nWinColor := ( iif( t_nWinColor < 4, t_nWinColor + 1, 1 ) )
|
||||
|
||||
/*+- Function ---------------------------------------------------------------+
|
||||
| Name: _ftWinTitle() Docs: Keith A. Wire |
|
||||
@@ -1685,11 +1693,11 @@ STATIC FUNCTION _ftNextWinColor
|
||||
|
||||
STATIC FUNCTION _ftWinTitle( cTheTitle, cTopOrBot )
|
||||
|
||||
LOCAL nCurWin := Len( aWindow )
|
||||
LOCAL nCurWin := Len( t_aWindow )
|
||||
LOCAL nLenTitle := Len( cTheTitle )
|
||||
|
||||
@ aWindow[ nCurWin, iif( cTopOrBot == NIL, 1 , 3 ) ], ( aWindow[ nCurWin, 4 ] - ;
|
||||
aWindow[ nCurWin, 2 ] - nLenTitle ) / 2 + aWindow[ nCurWin, 2 ] SAY " " + cTheTitle + " "
|
||||
@ t_aWindow[ nCurWin, iif( cTopOrBot == NIL, 1, 3 ) ], ( t_aWindow[ nCurWin, 4 ] - ;
|
||||
t_aWindow[ nCurWin, 2 ] - nLenTitle ) / 2 + t_aWindow[ nCurWin, 2 ] SAY " " + cTheTitle + " "
|
||||
|
||||
RETURN NIL
|
||||
|
||||
@@ -1708,7 +1716,7 @@ STATIC FUNCTION _ftWinTitle( cTheTitle, cTopOrBot )
|
||||
|
||||
STATIC FUNCTION _ftInitColors
|
||||
|
||||
aWinColor := { ;
|
||||
t_aWinColor := { ;
|
||||
{ "GR+/BG","GR+/G", "B+/RB", "G+/R" } , ;
|
||||
{ "R+/N", "W+/RB", "W+/BG", "GR+/B" } , ;
|
||||
{ "GR+/N", "GR+/N", "GR+/N", "GR+/N" } , ;
|
||||
@@ -1717,7 +1725,8 @@ STATIC FUNCTION _ftInitColors
|
||||
{ "GR+/B", "GR+/R", "R+/B", "W+/BG" }, ;
|
||||
{ "N/N", "N/N", "N/N", "N/N" } }
|
||||
|
||||
aStdColor := { "BG+*/RB" , ;
|
||||
t_aStdColor := { ;
|
||||
"BG+*/RB" , ;
|
||||
"GR+/R" , ;
|
||||
"GR+/N" , ;
|
||||
"W/B" , ;
|
||||
|
||||
Reference in New Issue
Block a user