From 6fcc3e4b1760c1e97d3ff45daee6e31527bea8cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sun, 15 Jun 2014 12:45:03 +0000 Subject: [PATCH] [DEVELOPMENT ENVIRONMENT] * NEW: Make debugging positions in the output window links to the source code. I should make that optional by the way... git-svn-id: svn://localhost/gambas/trunk@6320 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- app/src/gambas3/.src/Debug/FDebugInfo.class | 10 +-- app/src/gambas3/.src/Debug/FOutput.class | 85 +++++++++++++++++++++ app/src/gambas3/.src/Debug/FOutput.form | 2 + app/src/gambas3/.src/Project.module | 17 +++++ 4 files changed, 105 insertions(+), 9 deletions(-) diff --git a/app/src/gambas3/.src/Debug/FDebugInfo.class b/app/src/gambas3/.src/Debug/FDebugInfo.class index e62bae191..4ccb29c97 100644 --- a/app/src/gambas3/.src/Debug/FDebugInfo.class +++ b/app/src/gambas3/.src/Debug/FDebugInfo.class @@ -202,15 +202,7 @@ Public Sub lvwStack_Click() sLoc = lvwStack.Current.Text If InStr(sLoc, "(") Then Return - iPos = InStr(sLoc, ".") - If iPos = 0 Then Return - sFile = Left$(sLoc, iPos - 1) - - iPos = RInStr(sLoc, ".") - If iPos = 0 Then Return - iLine = Val(Mid$(sLoc, iPos + 1)) - - If Project.ExistClass(sFile) Then Project.OpenFile(sFile, iLine) + Project.Goto(sLoc) Catch diff --git a/app/src/gambas3/.src/Debug/FOutput.class b/app/src/gambas3/.src/Debug/FOutput.class index 747fd63dd..947e3bb84 100644 --- a/app/src/gambas3/.src/Debug/FOutput.class +++ b/app/src/gambas3/.src/Debug/FOutput.class @@ -5,6 +5,10 @@ Private $bGotError As Boolean Private $iHistory As Integer Private $sCurrent As String +Private $iLinkY As Integer +Private $iLinkX As Integer +Private $iLinkLen As Integer + 'PUBLIC Shown AS Boolean Public Sub _new() @@ -19,6 +23,10 @@ Public Sub _new() btnAbove.Value = Settings["/FOutput/KeepAbove", False] btnEcho.Value = Settings["/FOutput/Echo", False] OnProjectDebug + + edtOutput.Styles[Highlight.Keyword].Underline = True + edtOutput.Styles[Highlight.Keyword].Bold = False + edtOutput.Styles[Highlight.Keyword].Foreground = Color.Blue End @@ -380,3 +388,80 @@ Public Sub btnEcho_Click() Settings["/FOutput/Echo"] = btnEcho.Value End + +Public Sub edtOutput_Highlight() + + If $iLinkLen = 0 Then Return + If $iLinkY <> Highlight.Line Then Return + + Highlight.Add(Highlight.Keyword, $iLinkLen) + +End + +Public Sub edtOutput_MouseMove() + + Dim X, Y As Integer + Dim sText As String + Dim iPos As Integer + Dim aScan As String[] + Dim iNewX As Integer + Dim iNewY As Integer + Dim iNewLen As Integer + + X = edtOutput.PosToColumn(Mouse.X, Mouse.Y) + Y = edtOutput.PosToLine(Mouse.Y) + + If Y >= 0 And If X >= 0 Then + + sText = edtOutput.Lines[Y].Text + + iPos = InStr(sText, ": ") + If iPos Then + aScan = Scan(Left(sText, iPos - 1), "*.*.*") + If aScan.Count = 3 And If IsDigit(aScan[2]) Then + iNewY = Y + iNewX = 0 + iNewLen = iPos - 1 + Endif + Endif + Endif + + If $iLinkLen Then + $iLinkLen = 0 + edtOutput.Lines[$iLinkY].Refresh + Endif + + If iNewLen Then + $iLinkX = iNewX + $iLinkY = iNewY + $iLinkLen = iNewLen + edtOutput.Lines[iNewY].Refresh + Endif + + If $iLinkLen Then + edtOutput.Mouse = Mouse.Pointing + Else + edtOutput.Mouse = Mouse.Default + Endif + +End + +Public Sub edtOutput_Leave() + + If $iLinkLen Then + $iLinkLen = 0 + edtOutput.Lines[$iLinkY].Refresh + Endif + +End + +Public Sub edtOutput_MouseDown() + + If $iLinkLen And If Mouse.Normal Then + If Not Project.Goto(Left$(edtOutput.Lines[$iLinkY].Text, $iLinkLen)) Then + Stop Event + Endif + Endif + +End + diff --git a/app/src/gambas3/.src/Debug/FOutput.form b/app/src/gambas3/.src/Debug/FOutput.form index dd1e1a43b..cae312c2a 100644 --- a/app/src/gambas3/.src/Debug/FOutput.form +++ b/app/src/gambas3/.src/Debug/FOutput.form @@ -127,9 +127,11 @@ } { edtOutput Editor MoveScaled(1,9,38,34) + Tracking = True NoTabFocus = True Expand = True Border = False + Highlight = Highlight.Custom ReadOnly = True } { Separator2 Separator diff --git a/app/src/gambas3/.src/Project.module b/app/src/gambas3/.src/Project.module index fa92defe1..d2e64eafc 100644 --- a/app/src/gambas3/.src/Project.module +++ b/app/src/gambas3/.src/Project.module @@ -5666,3 +5666,20 @@ Catch Message.Error("Unable to update all forms!

" & Error.Text & "
" & Error.Where) End + +Public Sub Goto(sPosition As String) As Boolean + + Dim aScan As String[] + Dim sClass As String + Dim iLine As Integer + + aScan = Scan(sPosition, "*.*.*") + If aScan.Count <> 3 Then Return True + + sClass = aScan[0] + Try iLine = CInt(aScan[2]) + If Error Then Return True + + If ExistClass(sClass) Then OpenFile(sClass, iLine) + +End