Search dialog: The project browsing is now done through a background task.

[DEVELOPMENT ENVIRONMENT]
* BUG: Code editor: The automatic completion now appears at the correct position when the view is splitted.
* NEW: Search dialog: The project browsing is now done through a background task.
* NEW: Redraw the module icons.
This commit is contained in:
gambas 2020-04-21 07:35:27 +02:00
parent a53acf81c7
commit 9c12c1f886
33 changed files with 1187 additions and 702 deletions

File diff suppressed because it is too large Load diff

View file

@ -42,20 +42,6 @@ Public Sub _new()
.AddColumn(("Function")) .AddColumn(("Function"))
End With End With
' With gvwFind
' .Columns.Count = 5
' .Columns[0].Width = DS * 16
' .Columns[0].Text = ("File")
' .Columns[1].Width = DS * 16
' .Columns[1].Text = ("Location")
' .Columns[2].Width = DS * 6
' .Columns[2].Text = ("Line")
' .Columns[3].Width = DS * 6
' .Columns[3].Text = ("Col.")
' .Columns[4].Width = 32
' .Columns[4].Text = ("Text")
' End With
With gvwFind With gvwFind
.AddColumn(("File")) .AddColumn(("File"))
.AddColumn(("Location")) .AddColumn(("Location"))
@ -628,6 +614,20 @@ Public Sub SetSearchListInfo(Optional sText As String)
End End
Public Sub StartSearch()
spnSearch.Start
spnSearch.Show
End
Public Sub StopSearch()
spnSearch.Stop
spnSearch.Hide
End
Public Sub btnShowSearch_Click() Public Sub btnShowSearch_Click()
FSearch.WakeUp(False, True) FSearch.WakeUp(False, True)

View file

@ -184,7 +184,7 @@
Index = 5 Index = 5
Text = ("Search result") Text = ("Search result")
{ panSearch HBox { panSearch HBox
MoveScaled(1,0,83,4) MoveScaled(1,0,97,4)
{ btnCancelSearch ToolButton { btnCancelSearch ToolButton
MoveScaled(0,0,10,4) MoveScaled(0,0,10,4)
Visible = False Visible = False
@ -193,36 +193,41 @@
Text = ("Cancel") Text = ("Cancel")
Picture = Picture["icon:/small/halt"] Picture = Picture["icon:/small/halt"]
} }
{ spnSearch Spinner
MoveScaled(6,0,4,4)
Visible = False
Padding = 4
}
{ btnCloseSearch ToolButton { btnCloseSearch ToolButton
MoveScaled(11,0,10,4) MoveScaled(11,0,10,4)
AutoResize = True AutoResize = True
Text = ("Close") Text = ("Close")
Picture = Picture["icon:/small/close"] Picture = Picture["icon:/small/close"]
} }
{ btnRefreshSearch ToolButton
MoveScaled(22,0,18,4)
AutoResize = True
Text = ("Search again")
Picture = Picture["icon:/small/refresh"]
}
{ btnShowSearch ToolButton { btnShowSearch ToolButton
MoveScaled(41,0,19,4) MoveScaled(21,0,21,4)
AutoResize = True AutoResize = True
Text = ("Show search window") Text = ("Show search window")
Picture = Picture["icon:/small/find"] Picture = Picture["icon:/small/find"]
} }
{ btnRefreshSearch ToolButton
MoveScaled(43,0,18,4)
AutoResize = True
Text = ("Search again")
Picture = Picture["icon:/small/refresh"]
}
{ Panel1 Panel { Panel1 Panel
MoveScaled(62,0,2,4) MoveScaled(62,0,2,4)
Expand = True Expand = True
} }
{ lblBrowse Label { lblBrowse Label
MoveScaled(66,0,11,4) MoveScaled(77,0,11,4)
Font = Font["Italic"] Font = Font["Italic"]
Padding = 4 Padding = 4
AutoResize = True AutoResize = True
} }
{ panButtonSearch Panel { panButtonSearch Panel
MoveScaled(78,0,4,4) MoveScaled(90,0,4,4)
} }
} }
{ Separator5 Separator { Separator5 Separator

View file

@ -225,6 +225,7 @@ Public Sub Open(hForm As Object, sMode As String, Optional sClass As String, Opt
panResizeTop.Hide panResizeTop.Hide
Endif Endif
iY += $hEditor.Y
hCont = $hEditor.Parent hCont = $hEditor.Parent
Do Do
If hCont Is Form Then Break If hCont Is Form Then Break

View file

@ -750,7 +750,7 @@ Public Sub GetPosition() As Integer
End End
Public Sub SetPosition(hResult As CFindResult, Optional bJustCheck As Boolean) As Boolean Public Sub SetPosition(hResult As CSearchResult, Optional bJustCheck As Boolean) As Boolean
Return $hEditor.SetPosition(hResult, bJustCheck) Return $hEditor.SetPosition(hResult, bJustCheck)

View file

@ -267,16 +267,13 @@ Public Sub Modify(Optional bReset As Boolean)
If Me.ReadOnly Then Return If Me.ReadOnly Then Return
$bModify = True
Inc Project.TimeStamp Inc Project.TimeStamp
Inc Age Inc Age
FSearch.OnFileChange(Me.Path)
FDebugInfo.RefreshTabs(Me.Path, Me.Name) FDebugInfo.RefreshTabs(Me.Path, Me.Name)
If bReset Then $bModify = Not bReset
$bModify = False If $bModify Then FSearch.OnFileChange(Me.Path)
Endif
DrawTitle DrawTitle
@ -3345,9 +3342,10 @@ Public Sub GetPosition() As Integer
End End
Public Sub SetPosition(hResult As CFindResult, Optional bJustCheck As Boolean) As Boolean Public Sub SetPosition(hResult As CSearchResult, Optional bJustCheck As Boolean) As Boolean
Dim bResult As Boolean Dim bResult As Boolean
Dim sWhere As String
If FSearch.CurrentProcedure Then If FSearch.CurrentProcedure Then
bResult = $hEditor.SetPosition(hResult, True) bResult = $hEditor.SetPosition(hResult, True)
@ -3358,6 +3356,13 @@ Public Sub SetPosition(hResult As CFindResult, Optional bJustCheck As Boolean) A
Else Else
bResult = $hEditor.SetPosition(hResult, bJustCheck) bResult = $hEditor.SetPosition(hResult, bJustCheck)
Endif Endif
If bJustCheck And If Not bResult Then
sWhere = GetProcAt(hResult.Line)
If Not sWhere Then sWhere = ("Declarations")
hResult.Location = sWhere
Endif
Return bResult Return bResult
End End

View file

@ -265,14 +265,11 @@ Public Sub Modify(Optional bReset As Boolean)
If Project.ReadOnly Then Return If Project.ReadOnly Then Return
$bModify = True
Inc Project.TimeStamp Inc Project.TimeStamp
Inc Age Inc Age
FSearch.OnFileChange(Me.Path)
If bReset Then $bModify = Not bReset
$bModify = False If $bModify Then FSearch.OnFileChange(Me.Path)
Endif
DrawTitle DrawTitle
@ -871,7 +868,11 @@ Public Sub GetPosition() As Integer
End End
Public Sub SetPosition(hResult As CFindResult, Optional bJustCheck As Boolean) As Boolean Public Sub SetPosition(hResult As CSearchResult, Optional bJustCheck As Boolean) As Boolean
If bJustCheck Then
hResult.Location = GetProcAt(hResult.Line)
Endif
Return $hEditor.SetPosition(hResult, bJustCheck) Return $hEditor.SetPosition(hResult, bJustCheck)

View file

@ -1928,9 +1928,9 @@ Public Sub Modify(Optional bReset As Boolean)
Inc Project.TimeStamp Inc Project.TimeStamp
Inc Age Inc Age
FSearch.OnFileChange(Me.Path)
$bModify = Not bReset $bModify = Not bReset
If $bModify Then FSearch.OnFileChange(Me.Path)
DrawTitle DrawTitle
End End
@ -3752,15 +3752,15 @@ Public Sub GetPosition() As Integer
End End
Public Sub SetPosition(hResult As CFindResult, Optional bJustCheck As Boolean) As Boolean Public Sub SetPosition(hResult As CSearchResult, Optional bJustCheck As Boolean) As Boolean
Dim sName As String = hResult.GetLocation()
Dim aName As String[] Dim aName As String[]
If bJustCheck Then If bJustCheck Then
If Not sName Then Return True FindLocation(hResult)
If Not hResult.Location Then Return True
Else Else
aName = Split(sName, ".") aName = Split(hResult.Location, ".")
Try SelectControl(aName[0]) Try SelectControl(aName[0])
If Not Error Then FProperty.FocusOn(aName[1]) If Not Error Then FProperty.FocusOn(aName[1])
Endif Endif
@ -4392,34 +4392,50 @@ Public Sub dwgInfo_Draw()
End End
Public Sub GetLocation(iLine As Integer) As String Private Sub FindLocation(hResult As CSearchResult)
Dim aText As String[]
Dim sLine As String Dim sLine As String
Dim iPos As Integer Dim iPos As Integer
Dim sProperty As String Dim sProperty As String
Dim iLevel As Integer Dim iLevel As Integer
Dim sText As String
Dim iPos2 As Integer
aText = Split(GetText(), "\n") sText = GetText()
Dec iLine
If iLine > aText.Max Then Return
sLine = Trim(aText[iLine])
iPos = InStr(sLine, " = ")
If iPos = 0 Then Return
sProperty = Left(sLine, iPos - 1)
While iLine >= 0 iPos = RInStr(sText, "\n", hResult.Pos) + 1
sLine = Trim(aText[iLine])
iPos2 = InStr(sText, "\n", iPos + 1)
If iPos2 = 0 Then iPos2 = Len(sText) + 1
sLine = Mid$(sText, iPos, iPos2 - iPos)
hResult.Column = hResult.Pos - iPos + 1
hResult.Text = sLine
sLine = Trim(sLine)
iPos2 = InStr(sLine, " = ")
If iPos2 = 0 Then Return
sProperty = Left(sLine, iPos2 - 1)
While iPos > 1
iPos2 = iPos - 1
If iPos = 2 Then
iPos = 1
Else
iPos = RInStr(sText, "\n", iPos - 2) + 1
Endif
sLine = Trim(Mid$(sText, iPos, iPos2 - iPos))
If sLine = "}" Then If sLine = "}" Then
Inc iLevel Inc iLevel
Else If sLine Begins "{ " Then Else If sLine Begins "{ " Then
If iLevel Then If iLevel Then
Dec iLevel Dec iLevel
Else Else
Return Split(sLine, " ")[1] & "." & sProperty hResult.Location = Split(sLine, " ")[1] & "." & sProperty
Break
Endif Endif
Endif Endif
Dec iLine
Wend Wend
End End

View file

@ -12,13 +12,15 @@ Private $iEndColumn As Integer
Private $hLabel As TextLabel Private $hLabel As TextLabel
Private $hLabelTimer As Timer Private $hLabelTimer As Timer
Private $hObserver As Observer Private $hObserver As Observer
Private $iLastLine As Integer = -1
Private $bLabelBottom As Boolean Private $bLabelBottom As Boolean
Static Private $sFindPrefix As String Static Private $sFindPrefix As String
Static Private $aFind As Integer[] Static Private $aFind As Integer[]
Private $iLastLine As Integer
Private $iLastLineOffset As Integer
Public Sub _new() Public Sub _new()
$hObserver = New Observer(Me) As "Editor" $hObserver = New Observer(Me) As "Editor"
@ -77,69 +79,56 @@ Public Sub GetPosition() As Integer
End End
Fast Private Sub CalcPos(iPos As Integer) As Integer[] Fast Private Sub GetLineOffset(iLine As Integer) As Integer
Dim iLine As Integer Dim I As Integer
Dim iLen As Integer Dim iOffset As Integer
While iLine < Me.Count If $iLastLine >= 0 And If iLine >= $iLastLine Then
I = $iLastLine
iLen = Len(Me[iLine].Text) iOffset = $iLastLineOffset
If iPos <= iLen Then Break Endif
iPos -= iLen + 1
Inc iLine
While I < iLine
iOffset += Len(Me[I].Text) + 1
Inc I
Wend Wend
Return [iLine, iPos] $iLastLine = iLine
$iLastLineOffset = iOffset
Return iOffset
End End
Public Sub SetPosition(hResult As CSearchResult, bJustCheck As Boolean) As Boolean
Public Sub SetPosition(hFindResult As CFindResult, bJustCheck As Boolean) As Boolean
Dim iLine, iColumn As Integer Dim iLine, iColumn As Integer
Dim sLine As String Dim sLine As String
Dim iPos As Integer Dim iOffset As Integer
Dim aPos As Integer[]
' If hFindResult.Line Or If hFindResult.Column Then iLine = hResult.Line - 1
'
' iLine = hFindResult.Line
' iColumn = hFindResult.Column
' sLine = Me.Lines[iLine].Text
'
' Else
aPos = CalcPos(hFindResult.Pos)
iLine = aPos[0]
iPos = aPos[1]
If iLine >= Me.Count Then Return True
sLine = Me[iLine].Text
iColumn = String.Len(Left$(sLine, iPos))
If Me.Highlight Then
If InStr(String.Mid$(Me[iLine].Purge(Not FSearch.IgnoreComments, Not FSearch.IgnoreStrings, Chr$(1)), iColumn + 1, hFindResult.Length), Chr$(1)) Then Return True
Endif
hFindResult.Line = iLine
hFindResult.Column = iColumn
If bJustCheck Then If bJustCheck Then
'If iColumn >= 40 And If Me[iLine].Length > 80 Then
' sLine = "…" & Html(String.Mid$(sLine, iColumn - 31, 32)) & "<u>" & Html(String.Mid$(sLine, iColumn + 1, hFindResult.Length)) & "</u>" & Html(String.Mid$(sLine, iColumn + hFindResult.Length + 1, 160)) iOffset = GetLineOffset(iLine)
'Else 'If iLine >= Me.Count Then Return True
' sLine = Html(String.Left(sLine, iColumn)) & "<u>" & Html(String.Mid$(sLine, iColumn + 1, hFindResult.Length)) & "</u>" & Html(String.Mid$(sLine, iColumn + hFindResult.Length + 1, 160))
'Endif sLine = Me[iLine].Text
'sLine = Replace(sLine, " ", "&nbsp;") iColumn = String.Len(Left$(sLine, hResult.Pos - iOffset))
hFindResult.Text = sLine
If Me.Highlight Then
If InStr(String.Mid$(Me[iLine].Purge(Not FSearch.IgnoreComments, Not FSearch.IgnoreStrings, Chr$(1)), iColumn + 1, hResult.Length), Chr$(1)) Then Return True
Endif
hResult.Column = iColumn
hResult.Text = sLine
Else Else
' TODO Me[iLine].Expanded = True ' TODO Me[iLine].Expanded = True
Me.GotoCenter(iColumn, iLine) Me.GotoCenter(hResult.Column, iLine)
Me.Goto(iColumn + hFindResult.Length, iLine, True) Me.Goto(hResult.Column + hResult.Length, iLine, True)
Endif Endif
End End
@ -286,7 +275,7 @@ End
Public Sub Editor_GotFocus() Public Sub Editor_GotFocus()
$iLastLine = -1 '$iLastLine = -1
$aFind = Null $aFind = Null
$sFindPrefix = "" $sFindPrefix = ""
@ -296,12 +285,12 @@ Public Sub Editor_Cursor()
HideMessageLabel HideMessageLabel
If Me.Line <> $iLastLine Then ' If Me.Line <> $iLastLine Then
$iLastLine = Me.Line ' $iLastLine = Me.Line
'$aFind = Null ' '$aFind = Null
'$sFindPrefix = "" ' '$sFindPrefix = ""
'Raise LineChange ' 'Raise LineChange
Endif ' Endif
End End
@ -475,3 +464,9 @@ Public Sub FillWithHistory(sPath As String)
Dec Application.Busy Dec Application.Busy
End End
Public Sub Editor_Change()
$iLastLine = -1
End

View file

@ -31,7 +31,6 @@ Private $bFirstShowDebug As Boolean
Static Private $sCompressMessage As String Static Private $sCompressMessage As String
Public Sub _new() Public Sub _new()
'Me.ResizeScaled(86, 97) 'Me.ResizeScaled(86, 97)
@ -1943,7 +1942,7 @@ Public Sub Form_KeyPress()
If FSignature.VisibleFrom(hEditor.GetEditor()) Then Return If FSignature.VisibleFrom(hEditor.GetEditor()) Then Return
Endif Endif
If FSearch.InBrowse Then If FSearch.IsSearching() Then
FSearch.Cancel FSearch.Cancel
Return Return
Endif Endif

View file

@ -1946,6 +1946,7 @@ Public Sub IsPatchFile(sPath As String) As Boolean
Dim hFile As File Dim hFile As File
Dim sHead As String Dim sHead As String
If Not IsTextFile(sPath) Then Return
hFile = Open sPath hFile = Open sPath
sHead = Read #hFile, -4 sHead = Read #hFile, -4
Return sHead = "diff" Return sHead = "diff"
@ -1963,7 +1964,7 @@ Public Function LoadFile(sPath As String, Optional bNoErrorIfUnknown As Boolean)
If Not hForm Then If Not hForm Then
Inc Application.Busy 'Inc Application.Busy
'If VersionControl.InConflict(sPath) Then Error.Raise("File in conflict") 'If VersionControl.InConflict(sPath) Then Error.Raise("File in conflict")
If IsConflict(sPath) Then If IsConflict(sPath) Then
@ -1994,7 +1995,7 @@ Public Function LoadFile(sPath As String, Optional bNoErrorIfUnknown As Boolean)
Else If IsConnectionPath(sPath) Then Else If IsConnectionPath(sPath) Then
If MConnection.CheckPassword(sPath) Then If MConnection.CheckPassword(sPath) Then
Dec Application.Busy 'Dec Application.Busy
Return Return
Endif Endif
hForm = New FConnectionEditor(sPath) hForm = New FConnectionEditor(sPath)
@ -2019,7 +2020,7 @@ Public Function LoadFile(sPath As String, Optional bNoErrorIfUnknown As Boolean)
Else Else
Dec Application.Busy 'Dec Application.Busy
Files[sPath] = Null Files[sPath] = Null
If bNoErrorIfUnknown Then If bNoErrorIfUnknown Then
$bFileIsUnknown = True $bFileIsUnknown = True
@ -2042,7 +2043,7 @@ Public Function LoadFile(sPath As String, Optional bNoErrorIfUnknown As Boolean)
If bError Then If bError Then
Files[sPath] = Null Files[sPath] = Null
Try hForm.Delete Try hForm.Delete
Dec Application.Busy 'Dec Application.Busy
Return Return
Endif Endif
hForm.Icon = GetFileIcon(sPath) hForm.Icon = GetFileIcon(sPath)
@ -2050,7 +2051,7 @@ Public Function LoadFile(sPath As String, Optional bNoErrorIfUnknown As Boolean)
If hForm Then FSearch.OnNewForm(hForm) If hForm Then FSearch.OnNewForm(hForm)
Dec Application.Busy 'Dec Application.Busy
Endif Endif
@ -2060,7 +2061,7 @@ Catch
sErr = Error.Text & "\n" & Error.Backtrace.Join(" ") sErr = Error.Text & "\n" & Error.Backtrace.Join(" ")
If hForm Then Try hForm.Delete If hForm Then Try hForm.Delete
Dec Application.Busy 'Dec Application.Busy
Try Files[sPath] = Null Try Files[sPath] = Null
FMain.ShowError(("Cannot open file.") & "\n\n" & sErr, sPath) FMain.ShowError(("Cannot open file.") & "\n\n" & sErr, sPath)

View file

@ -1,37 +0,0 @@
' Gambas class file
Public Path As String
Public (File) As String
Public (Line) As Integer
Public Pos As Integer
Public Column As Integer
Public Text As String
Public Bytes As Integer
Public Length As Integer
Public Dark As Boolean
Public Control As String
Public {Property} As String
Public (Highlight) As String
Public RichText As String
Private $sWhere As String
Public Sub GetLocation() As String
Dim hFile As Object
If Not Project.IsSourcePath(Path) Then Return
If $sWhere Then Return $sWhere
$sWhere = "-"
Try hFile = Project.LoadFile(Path)
If hFile Then
If hFile Is FEditor Or If hFile Is FTextEditor Then
$sWhere = hFile.GetProcAt({Line})
Else If hFile Is FForm Then
$sWhere = hFile.GetLocation({Line})
Endif
Endif
Return $sWhere
End

View file

@ -3,4 +3,4 @@
Public Path As String Public Path As String
Public Age As Integer Public Age As Integer
Public Command As String Public Command As String
Public Result As CFindResult[] Public Result As CSearchResult[]

View file

@ -0,0 +1,47 @@
' Gambas class file
Public Path As String
Public (File) As String
Public (Line) As Integer
Public Pos As Integer
Public Column As Integer
Public Text As String
Public Bytes As Integer
Public Length As Integer
Public Dark As Boolean
Public Control As String
Public {Property} As String
Public (Highlight) As String
Public RichText As String
Public Location As String
'Private $sWhere As String
' Public Sub GetLocation() As String
'
' Dim hFile As Object
' Dim sPath As String
'
' sPath = Project.Dir &/ Path
'
' If Not Project.IsSourcePath(sPath) Then Return
' If $sWhere Then Return $sWhere
'
' $sWhere = "-"
' Try hFile = Project.LoadFile(sPath)
' If hFile Then
' If hFile Is FEditor Or If hFile Is FTextEditor Then
' $sWhere = hFile.GetProcAt({Line})
' If Not $sWhere Then $sWhere = ("(Declarations)")
' Else If hFile Is FForm Then
' $sWhere = hFile.GetLocation({Line})
' Endif
' Endif
' Return $sWhere
'
' Catch
'
' $sWhere = "?"
' Return $sWhere
'
' End

View file

@ -2,8 +2,255 @@
Inherits Task Inherits Task
Public Search As String
Public IgnoreCase As Boolean
Public WordsOnly As Boolean
Public RegularExpression As Boolean
Public Where As String
Public Update As String[]
Public Const ALL_FILES As String = "*"
Public Const SOURCE_FILES As String = "$"
Public Const DATA_FILES As String = "@"
Private $aExt As String[] = ["jpg", "jpeg", "bmp", "gif", "png", "ico", "xpm", "tga", "gambas", "wav", "ogg", "mp3", "mp4", "avi", "webm"]
Public Sub Main() Public Sub Main()
Dim sDir As String
Dim sFile As String
Dim sPath As String
Dim sName As String
Dim sExt As String
Dim aFile As String[]
Dim aSort As String[]
Application.Priority = 10
If Update Then
sDir = ""
aFile = Update
Else
Select Case Where
Case ALL_FILES, DATA_FILES
sDir = Project.Dir
Case SOURCE_FILES
sDir = Project.SourceDir
Case Else
sDir = File.Dir(Where)
aFile = [File.Name(Where)]
End Select
Endif
If Not aFile Then
aFile = RDir(sDir).Sort(gb.Natural)
aSort = New String[]
For Each sPath In aFile
aSort.Add(File.Name(sPath))
Next
aFile.SortUsing(aSort)
Endif
For Each sFile In aFile
If Right(sFile) = "~" Then Continue
sPath = sDir &/ sFile
sFile = Mid$(sPath, Len(Project.Dir) + 1)
If Left(sFile) = "/" Then sFile = Mid$(sFile, 2)
If Left(sFile) = "." And If sFile Not Begins ".public/" Then
If Where = DATA_FILES Then Continue
If sFile Not Begins ".src/" Then Continue
Endif
If IsDir(sPath) Then Continue
If InStr(sPath, "/.svn/") Then Continue
sExt = LCase(File.Ext(sFile))
If $aExt.Exist(sExt) Then Continue
sName = File.Name(sPath)
If sName Begins "core." Then Continue
If sName Begins "vgcore." Then Continue
If sName Begins "callgrind.out." Then Continue
If sName Begins "cachegrind.out." Then Continue
If Not Project.IsTextFile(sPath) Then Continue
' TODO: If bReplace And If Not Access(sPath) Then Continue
Print "/" &/ Mid$(sPath, Len(Project.Dir) + 1)
' If sFile Begins ".src/" Then
' FDebugInfo.SetSearchListInfo(sName)
' Else
' FDebugInfo.SetSearchListInfo(sFile)
' Endif
GrepFile(sPath) ', bReplace)
'Debug sName
Next
End End
Private Sub GrepQuote(sStr As String) As String
Dim I As Integer
Dim sCar As String
Dim sResult As String
For I = 1 To String.Len(sStr)
sCar = String.Mid$(sStr, I, 1)
If Len(sCar) > 1 Or If IsLetter(sCar) Or If IsDigit(sCar) Then
sResult &= sCar
Else
sResult &= "\\" & sCar
Endif
Next
Return sResult
End
Private Sub GrepFile(sPath As String, Optional bUseReplaceString As Boolean)
Dim sText As String
Dim aGrep As String[]
Dim sGrep As String
Dim sFind As String
Dim sTemp As String
' Dim iAge As Integer
' Dim hGrepResult As CGrepResult
Dim iPos As Integer
Dim sSearch As String
Dim hFile As Object
Dim sResult As String
Dim iFilePos As Integer
hFile = Project.Files[sPath]
If sPath Then
If Not hFile Or If Not hFile.IsModified() Then
sTemp = sPath
Endif
Endif
If Not sTemp Then
Try sText = hFile.GetText()
If Error Then Return
sTemp = Temp$("grep")
File.Save(sTemp, sText)
Endif
aGrep = ["grep", "-nobs"]
If bUseReplaceString Then
' aGrep.Add("-F")
' aGrep.Add("--")
' aGrep.Add(ReplaceString)
Else
If IgnoreCase Then aGrep.Add("-i")
If RegularExpression Then
aGrep.Add("-E")
Else If WordsOnly Then
aGrep.Add("-E")
Else
aGrep.Add("-F")
Endif
aGrep.Add("--")
sSearch = Search
If WordsOnly Then sSearch = "(^|[^_$[:alnum:]])" & GrepQuote(Search) & "($|[^_$[:alnum:]])"
aGrep.Add(sSearch)
Endif
aGrep.Add(sTemp)
' If sPath Then
' hGrepResult = $cGrepCache[sPath]
'
' If hGrepResult Then
' Try iAge = hFile.Age
' If iAge = hGrepResult.Age Then
' If aGrep.Join("\n") = hGrepResult.Command Then
' Return hGrepResult.Result
' Endif
' Endif
' Endif
' Endif
'grep -nR -F -I -i -w -ob --exclude=*~ --exclude-dir=.svn -s -- "Date" * .src
Exec aGrep To sGrep
For Each sFind In Split(sGrep, "\n", "", True)
If hFile Then
' If hFile Is FOutput Then
' hResult.Path = ""
' hResult.File = "Console"
' Else
'hResult.Path = sPath
''hResult.File = hFile.Name
'Endif
Else
'hResult.Path = sPath
''hResult.File = If(Project.IsSourcePath(sPath), File.BaseName(sPath), File.Name(sPath))
Endif
'hResult.Highlight = TextEditor.GetModeFromPath(sPath)
iPos = InStr(sFind, ":")
If iPos = 0 Then Continue
sResult = CStr(CInt(Left(sFind, iPos - 1)))
sFind = Mid$(sFind, iPos + 1)
iPos = InStr(sFind, ":")
If iPos = 0 Then Continue
iFilePos = CInt(Left(sFind, iPos - 1))
sFind = Mid$(sFind, iPos + 1)
If WordsOnly Then
If String.Left(sFind) <> String.Left(Search) Then iFilePos += String.Len(String.Left(sFind))
sFind = Search
Endif
sResult &= ":" & CStr(iFilePos)
sResult &= ":" & CStr(Len(sFind)) & ":" & CStr(String.Len(sFind)) '& ":" & sFind
Print sResult
Flush
'Sleep 0.005
Next
' If sPath Then
' If hFile Then Try iAge = hFile.Age
' hGrepResult = New CGrepResult
' With hGrepResult
' .Result = aResult.Copy()
' .Age = iAge
' .Path = sPath
' .Command = aGrep.Join("\n")
' End With
' $cGrepCache[sPath] = hGrepResult
' Endif
End

File diff suppressed because it is too large Load diff

View file

@ -58,7 +58,7 @@
MoveScaled(0,3,25,4) MoveScaled(0,3,25,4)
Text = Shortcut(("Case sensitive"), "C") Text = Shortcut(("Case sensitive"), "C")
} }
{ chkWordOnly CheckBox { chkWordsOnly CheckBox
MoveScaled(0,6,25,4) MoveScaled(0,6,25,4)
Text = Shortcut(("Words only"), "W") Text = Shortcut(("Words only"), "W")
} }
@ -90,7 +90,7 @@
{ radCurrentProcedure RadioButton radSearch { radCurrentProcedure RadioButton radSearch
Name = "radCurrentProcedure" Name = "radCurrentProcedure"
MoveScaled(0,4,25,4) MoveScaled(0,4,25,4)
Text = Shortcut(("Current procedure"), "u") Text = Shortcut(("Current function"), "u")
} }
{ radCurrentFile RadioButton radSearch { radCurrentFile RadioButton radSearch
Name = "radCurrentFile" Name = "radCurrentFile"
@ -146,11 +146,11 @@
Picture = Picture["icon:/small/wizard"] Picture = Picture["icon:/small/wizard"]
} }
{ Panel1 Panel { Panel1 Panel
MoveScaled(7,22,3,3) MoveScaled(7,28,3,3)
Expand = True Expand = True
} }
{ chkHighlight CheckBox { chkHighlight CheckBox
MoveScaled(0,29,25,4) MoveScaled(0,30,25,4)
Text = Shortcut(("Highlight search"), "H") Text = Shortcut(("Highlight search"), "H")
} }
} }
@ -158,6 +158,10 @@
#MoveScaled(53,2) #MoveScaled(53,2)
Delay = 500 Delay = 500
} }
{ timFillList #Timer
#MoveScaled(88,6)
Delay = 100
}
} }
# Gambas Action File 3.0 # Gambas Action File 3.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 311 B

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 311 B

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 B

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 B

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 B

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 598 B

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 637 B

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 304 B