diff --git a/harbour/source/debug/debugger.prg b/harbour/source/debug/debugger.prg index 872633dc68..c7f34b5180 100644 --- a/harbour/source/debug/debugger.prg +++ b/harbour/source/debug/debugger.prg @@ -39,14 +39,27 @@ static oDebugger -function Debugger( cModuleName ) +function Debugger( uParam ) - if oDebugger == nil - oDebugger = TDebugger():New() - oDebugger:Activate( cModuleName ) - else - oDebugger:ShowCode( cModuleName ) - endif + do case + case ValType( uParam ) == "C" + if oDebugger == nil + oDebugger = TDebugger():New() + oDebugger:Activate( uParam ) + endif + + case ValType( uParam ) == "N" + if oDebugger != nil + oDebugger:cAppImage = SaveScreen() + oDebugger:nAppRow = Row() + oDebugger:nAppCol = Col() + oDebugger:cAppColors = SetColor() + RestScreen( 0, 0, MaxRow(), MaxCol(), oDebugger:cImage ) + DispEnd() + oDebugger:GoToLine( uParam ) + oDebugger:HandleEvent() + endif + endcase return nil @@ -55,8 +68,9 @@ CLASS TDebugger DATA oPullDown DATA oWndCode, oWndCommand DATA oBar, oBrwText - DATA cBackImage, nOldCursor + DATA cImage, nOldCursor DATA lEnd + DATA cAppImage, nAppRow, nAppCol, cAppColors METHOD New() METHOD Activate( cModuleName ) @@ -69,6 +83,8 @@ CLASS TDebugger METHOD InputBox( cMsg, uValue ) METHOD Exit() INLINE ::lEnd := .t. + METHOD GoToLine( nLine ) + ENDCLASS METHOD New() CLASS TDebugger @@ -86,7 +102,7 @@ METHOD Activate( cModuleName ) CLASS TDebugger ::Show() ::ShowCode( cModuleName ) ::HandleEvent() - ::Hide() + // ::Hide() return nil @@ -94,6 +110,8 @@ METHOD HandleEvent() CLASS TDebugger local nPopup + ::lEnd = .f. + while ! ::lEnd nKey = InKey( 0 ) @@ -121,6 +139,20 @@ METHOD HandleEvent() CLASS TDebugger ::oBrwText:GoBottom() ::oBrwText:ForceStable() + case nKey == K_F4 + ::cImage = SaveScreen() + RestScreen( 0, 0, MaxRow(), MaxCol(), ::cAppImage ) + InKey( 0 ) + RestScreen( 0, 0, MaxRow(), MaxCol(), ::cImage ) + + case nKey == K_F8 + ::cImage = SaveScreen() + DispBegin() + RestScreen( 0, 0, MaxRow(), MaxCol(), ::cAppImage ) + SetPos( ::nAppRow, ::nAppCol ) + SetColor( ::cAppColors ) + ::Exit() + otherwise if ( nPopup := ::oPullDown:GetHotKeyPos( AltToKey( nKey ) ) ) != 0 ::oPullDown:ShowPopup( nPopup ) @@ -132,8 +164,8 @@ return nil METHOD Hide() CLASS TDebugger - RestScreen( ,,,, ::cBackImage ) - ::cBackImage = nil + RestScreen( ,,,, ::cAppImage ) + ::cAppImage = nil SetCursor( ::nOldCursor ) SetColor( "N/W" ) @@ -142,7 +174,10 @@ return nil METHOD Show() CLASS TDebugger ::nOldCursor = SetCursor( 0 ) - ::cBackImage = SaveScreen() + ::cAppImage = SaveScreen() + ::nAppRow = Row() + ::nAppCol = Col() + ::cAppColors = SetColor() ::oPullDown:Display() ::oWndCode:Show( .t. ) ::oWndCommand:Show() @@ -208,6 +243,12 @@ METHOD InputBox( cMsg, uValue ) CLASS TDebugger return If( LastKey() != K_ESC, uTemp, uValue ) +METHOD GotoLine( nLine ) CLASS TDebugger + + ::oBrwText:GotoLine( nLine ) + +return nil + CLASS TDbWindow // Debugger windows DATA nTop, nLeft, nBottom, nRight diff --git a/harbour/source/debug/tbrwtext.prg b/harbour/source/debug/tbrwtext.prg index c80f292a43..3549b81dcf 100644 --- a/harbour/source/debug/tbrwtext.prg +++ b/harbour/source/debug/tbrwtext.prg @@ -20,6 +20,8 @@ CLASS TBrwText FROM TBrowse METHOD GoBottom() METHOD Skipper( nLines ) + METHOD GotoLine( nLine ) + ENDCLASS METHOD New( nTop, nLeft, nBottom, nRight, cFileName, cColors ) CLASS TBrwText @@ -95,6 +97,22 @@ METHOD Skipper( nLines ) CLASS TBrwText return nSkipped +METHOD GotoLine( nLine ) CLASS TBrwText + + if nLine > ::nLine + while ::nLine < nLine + ::Down() + ::ForceStable() + end + else + while ::nLine > nLine + ::Up() + ::ForceStable() + end + endif + +return nil + static function FReadLn( nHandle, cBuffer ) local nEOL, ; // End Of Line Postion