mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-11 13:28:04 +02:00
added state window from Bob
git-svn-id: trunk@4785 -
This commit is contained in:
parent
1b40fbe743
commit
7ad8ccaa88
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -397,6 +397,9 @@ ide/filereferencelist.pas svneol=native#text/pascal
|
||||
ide/findinfilesdlg.pas svneol=native#text/pascal
|
||||
ide/findreplacedialog.pp svneol=native#text/pascal
|
||||
ide/formeditor.pp svneol=native#text/pascal
|
||||
ide/frmsearch.lfm svneol=native#text/plain
|
||||
ide/frmsearch.lrs svneol=native#text/pascal
|
||||
ide/frmsearch.pas svneol=native#text/pascal
|
||||
ide/global.inc svneol=native#text/pascal
|
||||
ide/global.pp svneol=native#text/pascal
|
||||
ide/idedefs.pas svneol=native#text/pascal
|
||||
|
108
ide/frmsearch.lfm
Normal file
108
ide/frmsearch.lfm
Normal file
@ -0,0 +1,108 @@
|
||||
object SearchForm: TSearchForm
|
||||
BORDERSTYLE = bsdialog
|
||||
CAPTION = 'Searching....'
|
||||
CLIENTHEIGHT = 149
|
||||
CLIENTWIDTH = 428
|
||||
COLOR = -2147483647
|
||||
ONCREATE = SearchFormCREATE
|
||||
ONDESTROY = SearchFormDESTROY
|
||||
PARENTFONT = True
|
||||
POSITION = poownerformcenter
|
||||
HORZSCROLLBAR.PAGE = 429
|
||||
VERTSCROLLBAR.PAGE = 150
|
||||
LEFT = 461
|
||||
HEIGHT = 149
|
||||
TOP = 289
|
||||
WIDTH = 428
|
||||
object Panel2: TPANEL
|
||||
ALIGN = alclient
|
||||
ANCHORS = [aktop, akleft]
|
||||
BEVELINNER = bvlowered
|
||||
CLIENTHEIGHT = 149
|
||||
CLIENTWIDTH = 428
|
||||
PARENTFONT = True
|
||||
TABORDER = 0
|
||||
TABSTOP = True
|
||||
HEIGHT = 149
|
||||
WIDTH = 428
|
||||
object lblMatches: TLABEL
|
||||
ANCHORS = [aktop, akleft]
|
||||
COLOR = -2147483647
|
||||
LAYOUT = tltop
|
||||
LEFT = 96
|
||||
HEIGHT = 17
|
||||
TOP = 80
|
||||
WIDTH = 321
|
||||
end
|
||||
object Label1: TLABEL
|
||||
ANCHORS = [aktop, akleft]
|
||||
CAPTION = 'Matches'
|
||||
COLOR = -2147483647
|
||||
LAYOUT = tltop
|
||||
LEFT = 16
|
||||
HEIGHT = 17
|
||||
TOP = 80
|
||||
WIDTH = 64
|
||||
end
|
||||
object lblProgress: TLABEL
|
||||
ANCHORS = [aktop, akleft]
|
||||
COLOR = -2147483647
|
||||
LAYOUT = tltop
|
||||
LEFT = 96
|
||||
HEIGHT = 17
|
||||
TOP = 48
|
||||
WIDTH = 320
|
||||
end
|
||||
object Label2: TLABEL
|
||||
ANCHORS = [aktop, akleft]
|
||||
CAPTION = 'Searching:'
|
||||
COLOR = -2147483647
|
||||
LAYOUT = tltop
|
||||
LEFT = 16
|
||||
HEIGHT = 17
|
||||
TOP = 48
|
||||
WIDTH = 64
|
||||
end
|
||||
object Label4: TLABEL
|
||||
ANCHORS = [aktop, akleft]
|
||||
CAPTION = 'Search Text:'
|
||||
COLOR = -2147483647
|
||||
LAYOUT = tltop
|
||||
LEFT = 16
|
||||
HEIGHT = 17
|
||||
TOP = 16
|
||||
WIDTH = 80
|
||||
end
|
||||
object lblSearchText: TLABEL
|
||||
ANCHORS = [aktop, akleft]
|
||||
COLOR = -2147483647
|
||||
LAYOUT = tltop
|
||||
LEFT = 96
|
||||
HEIGHT = 17
|
||||
TOP = 16
|
||||
WIDTH = 320
|
||||
end
|
||||
object btnCancel: TBUTTON
|
||||
ANCHORS = [aktop, akleft]
|
||||
DEFAULT = True
|
||||
CAPTION = 'Cancel'
|
||||
TABSTOP = True
|
||||
TABORDER = 6
|
||||
ONCLICK = btnAbortCLICK
|
||||
LEFT = 177
|
||||
HEIGHT = 25
|
||||
TOP = 112
|
||||
WIDTH = 75
|
||||
end
|
||||
end
|
||||
object Label3: TLABEL
|
||||
ANCHORS = [aktop, akleft]
|
||||
CAPTION = 'Search Text:'
|
||||
COLOR = -2147483647
|
||||
LAYOUT = tltop
|
||||
LEFT = 8
|
||||
HEIGHT = 17
|
||||
TOP = 56
|
||||
WIDTH = 80
|
||||
end
|
||||
end
|
32
ide/frmsearch.lrs
Normal file
32
ide/frmsearch.lrs
Normal file
@ -0,0 +1,32 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TSearchForm','FORMDATA',[
|
||||
'TPF0'#11'TSearchForm'#10'SearchForm'#11'BORDERSTYLE'#7#8'bsdialog'#7'CAPTION'
|
||||
+#6#13'Searching....'#12'CLIENTHEIGHT'#3#149#0#11'CLIENTWIDTH'#3#172#1#5'COLO'
|
||||
+'R'#4#1#0#0#128#8'ONCREATE'#7#16'SearchFormCREATE'#9'ONDESTROY'#7#17'SearchF'
|
||||
+'ormDESTROY'#10'PARENTFONT'#9#8'POSITION'#7#17'poownerformcenter'#18'HORZSCR'
|
||||
+'OLLBAR.PAGE'#3#173#1#18'VERTSCROLLBAR.PAGE'#3#150#0#4'LEFT'#3#205#1#6'HEIGH'
|
||||
+'T'#3#149#0#3'TOP'#3'!'#1#5'WIDTH'#3#172#1#0#6'TPANEL'#6'Panel2'#5'ALIGN'#7#8
|
||||
+'alclient'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#10'BEVELINNER'#7#9'bvlowered'
|
||||
+#12'CLIENTHEIGHT'#3#149#0#11'CLIENTWIDTH'#3#172#1#10'PARENTFONT'#9#8'TABORDE'
|
||||
+'R'#2#0#7'TABSTOP'#9#6'HEIGHT'#3#149#0#5'WIDTH'#3#172#1#0#6'TLABEL'#10'lblMa'
|
||||
+'tches'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#5'COLOR'#4#1#0#0#128#6'LAYOUT'#7#5
|
||||
+'tltop'#4'LEFT'#2'`'#6'HEIGHT'#2#17#3'TOP'#2'P'#5'WIDTH'#3'A'#1#0#0#6'TLABEL'
|
||||
+#6'Label1'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#7'CAPTION'#6#7'Matches'#5'COLO'
|
||||
+'R'#4#1#0#0#128#6'LAYOUT'#7#5'tltop'#4'LEFT'#2#16#6'HEIGHT'#2#17#3'TOP'#2'P'
|
||||
+#5'WIDTH'#2'@'#0#0#6'TLABEL'#11'lblProgress'#7'ANCHORS'#11#5'aktop'#6'akleft'
|
||||
+#0#5'COLOR'#4#1#0#0#128#6'LAYOUT'#7#5'tltop'#4'LEFT'#2'`'#6'HEIGHT'#2#17#3'T'
|
||||
+'OP'#2'0'#5'WIDTH'#3'@'#1#0#0#6'TLABEL'#6'Label2'#7'ANCHORS'#11#5'aktop'#6'a'
|
||||
+'kleft'#0#7'CAPTION'#6#10'Searching:'#5'COLOR'#4#1#0#0#128#6'LAYOUT'#7#5'tlt'
|
||||
+'op'#4'LEFT'#2#16#6'HEIGHT'#2#17#3'TOP'#2'0'#5'WIDTH'#2'@'#0#0#6'TLABEL'#6'L'
|
||||
+'abel4'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#7'CAPTION'#6#12'Search Text:'#5'C'
|
||||
+'OLOR'#4#1#0#0#128#6'LAYOUT'#7#5'tltop'#4'LEFT'#2#16#6'HEIGHT'#2#17#3'TOP'#2
|
||||
+#16#5'WIDTH'#2'P'#0#0#6'TLABEL'#13'lblSearchText'#7'ANCHORS'#11#5'aktop'#6'a'
|
||||
+'kleft'#0#5'COLOR'#4#1#0#0#128#6'LAYOUT'#7#5'tltop'#4'LEFT'#2'`'#6'HEIGHT'#2
|
||||
+#17#3'TOP'#2#16#5'WIDTH'#3'@'#1#0#0#7'TBUTTON'#9'btnCancel'#7'ANCHORS'#11#5
|
||||
+'aktop'#6'akleft'#0#7'DEFAULT'#9#7'CAPTION'#6#6'Cancel'#7'TABSTOP'#9#8'TABOR'
|
||||
+'DER'#2#6#7'ONCLICK'#7#13'btnAbortCLICK'#4'LEFT'#3#177#0#6'HEIGHT'#2#25#3'TO'
|
||||
+'P'#2'p'#5'WIDTH'#2'K'#0#0#0#6'TLABEL'#6'Label3'#7'ANCHORS'#11#5'aktop'#6'ak'
|
||||
+'left'#0#7'CAPTION'#6#12'Search Text:'#5'COLOR'#4#1#0#0#128#6'LAYOUT'#7#5'tl'
|
||||
+'top'#4'LEFT'#2#8#6'HEIGHT'#2#17#3'TOP'#2'8'#5'WIDTH'#2'P'#0#0#0
|
||||
]);
|
486
ide/frmsearch.pas
Normal file
486
ide/frmsearch.pas
Normal file
@ -0,0 +1,486 @@
|
||||
{
|
||||
/***************************************************************************
|
||||
frmSearch.pas
|
||||
-------------------
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* This source is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This code is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* A copy of the GNU General Public License is available on the World *
|
||||
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
|
||||
* obtain it by writing to the Free Software Foundation, *
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************
|
||||
}
|
||||
unit frmSearch;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
||||
StdCtrls, Buttons, FindInFilesDlg;
|
||||
|
||||
type
|
||||
TSearchForm = class(TForm)
|
||||
btnCancel: TBUTTON;
|
||||
Label1: TLABEL;
|
||||
Label2: TLABEL;
|
||||
Label3: TLABEL;
|
||||
Label4: TLABEL;
|
||||
lblMatches: TLABEL;
|
||||
lblProgress: TLABEL;
|
||||
lblSearchText: TLABEL;
|
||||
Panel2: TPANEL;
|
||||
procedure SearchFormCREATE(Sender: TObject);
|
||||
procedure SearchFormDESTROY(Sender: TObject);
|
||||
procedure btnAbortCLICK(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
fSearchFor: String;
|
||||
fWholeWord: Boolean;
|
||||
fCaseSensitive: Boolean;
|
||||
fRegExp: Boolean;
|
||||
fTheDirectory: string;
|
||||
fmask: string;
|
||||
frecursive: boolean;
|
||||
fParsedMasks: TStringList; //Holds the pasrsed masks.
|
||||
fMatches: longint;
|
||||
fAbort: boolean;
|
||||
fAbortString: string;
|
||||
fAborting: boolean;
|
||||
fCharWidth: longint;
|
||||
fSearchProject: boolean;
|
||||
fSearchOpen: boolean;
|
||||
fSearchFileList: TStringList;
|
||||
fSearchFiles: boolean;
|
||||
fResultsList: TStrings;
|
||||
fPad: string;
|
||||
procedure SearchFile(TheFileName: string);
|
||||
procedure DoFindInFiles(TheFileName: string);
|
||||
procedure DoFindInSearchList;
|
||||
procedure ParseMask;
|
||||
procedure UpdateMatches;
|
||||
procedure UpdateProgress(FileName: string);
|
||||
function PadAndShorten(FileName: string): string;
|
||||
procedure SetOptions(TheOptions: TLazFindInFileSearchOptions);
|
||||
function GetOptions: TLazFindInFileSearchOptions;
|
||||
public
|
||||
Procedure DoSearch;
|
||||
property SearchDirectory: string read fTheDirectory write fTheDirectory;
|
||||
property SearchText: string read fSearchFor write fSearchFor;
|
||||
property SearchOptions: TLazFindInFileSearchOptions read GetOptions
|
||||
write SetOptions;
|
||||
property SearchFileList: TStringList read fSearchFileList
|
||||
write fSearchFileList;
|
||||
property ResultsList: TStrings read fResultsList write fResultsList;
|
||||
property SearchMask: string read fMask write fMask;
|
||||
property Pad: string read fPad write fPad;
|
||||
end;
|
||||
|
||||
var
|
||||
SearchForm: TSearchForm;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
SynRegExpr, FileCtrl, LCLType, LCLIntf, LazarusIDEStrConsts;
|
||||
|
||||
const
|
||||
{$IFDEF Win32}
|
||||
FindMask = '*.*';
|
||||
{$ELSE}
|
||||
FindMask = '*';
|
||||
{$ENDIF}
|
||||
|
||||
{ TSearchForm }
|
||||
|
||||
procedure TSearchForm.btnAbortCLICK(Sender: TObject);
|
||||
begin
|
||||
fAbort:= true;
|
||||
end;
|
||||
|
||||
procedure TSearchForm.SearchFormCREATE(Sender: TObject);
|
||||
var
|
||||
FormFont: THandle;
|
||||
tm : TTextmetric;
|
||||
DC: HDC;
|
||||
begin
|
||||
//Set Defaults
|
||||
fWholeWord:= false;
|
||||
fCaseSensitive:= false;
|
||||
fRecursive:= True;
|
||||
fAbort:= false;
|
||||
fAbortString:= dlgSearchAbort;
|
||||
fPad:= '...';
|
||||
fRegExp:= false;
|
||||
fAborting:= false;
|
||||
fSearchProject:= false;
|
||||
fSearchOpen:= false;
|
||||
fSearchFiles:= false;
|
||||
self.Caption:= dlgSearchCaption;
|
||||
try
|
||||
DC:= GetDC(0);
|
||||
FormFont:= SelectObject(DC, Font.Handle);
|
||||
GetTextMetrics(DC, tm);
|
||||
fCharWidth:= tm.tmAveCharWidth;
|
||||
finally
|
||||
SelectObject(DC, FormFont);
|
||||
ReleaseDC(0, DC);
|
||||
end;//finally
|
||||
end;//SearchFormCreate
|
||||
|
||||
procedure TSearchForm.SearchFormDESTROY(Sender: TObject);
|
||||
begin
|
||||
FreeAndNil(fParsedMasks);
|
||||
end;
|
||||
|
||||
procedure TSearchForm.SetOptions(TheOptions: TLazFindInFileSearchOptions);
|
||||
begin
|
||||
fWholeWord:= (fifWholeWord in TheOptions);
|
||||
fCaseSensitive:= (fifMatchCase in TheOptions);
|
||||
fRegExp := (fifRegExpr in TheOptions);
|
||||
frecursive:= (fifIncludeSubDirs in TheOptions);
|
||||
fSearchProject:= (fifSearchProject in TheOptions);
|
||||
fSearchOpen:= (fifSearchOpen in TheOptions);
|
||||
fSearchFiles:= (fifSearchFiles in TheOptions);
|
||||
end;//SetOptions
|
||||
|
||||
function TSearchForm.GetOptions: TLazFindInFileSearchOptions;
|
||||
begin
|
||||
Result:=[];
|
||||
if fWholeWord then include(Result,fifWholeWord);
|
||||
if fCaseSensitive then include(Result,fifMatchCase);
|
||||
if fRegExp then include(Result,fifRegExpr);
|
||||
if fRecursive then include(Result,fifIncludeSubDirs);
|
||||
if fSearchProject then include(Result, fifSearchProject);
|
||||
if fSearchOpen then include(Result,fifSearchOpen);
|
||||
if fSearchFiles then include(Result,fifSearchFiles);
|
||||
end;//GetOptions
|
||||
|
||||
procedure TSearchForm.DoSearch;
|
||||
begin
|
||||
lblSearchText.Caption:= fSearchFor;
|
||||
fMatches:= 0;
|
||||
if Assigned(fResultsList) then
|
||||
begin
|
||||
if fSearchFiles then
|
||||
begin
|
||||
ParseMask;
|
||||
DoFindInFiles(fTheDirectory);
|
||||
end;//if
|
||||
if fSearchProject or fSearchOpen then
|
||||
DoFindInSearchList;
|
||||
end;//if
|
||||
if Assigned(fResultsList) and (fResultsList.Count = 0) then
|
||||
fResultsList.Add(lisFileNotFound);
|
||||
Self.Close;
|
||||
end;//DoSearch
|
||||
|
||||
procedure TSearchForm.SearchFile(TheFileName: string);
|
||||
{DoNormalSearch is called if the search is not a Regular expression}
|
||||
procedure DoNormalSearch;
|
||||
var
|
||||
ThisFile: TStringList; //The File being searched
|
||||
Lines: integer; //Loop Counter
|
||||
Match: integer; //Position of match in line.
|
||||
StartWord: boolean; //Does the word start with a sperator charater?
|
||||
EndWord: boolean; //Does the word end with a seperator charater?
|
||||
TheLine: string; //Temp Storage for the current line in the file.
|
||||
TempSearch: string; //Temp Storage for the search string.
|
||||
|
||||
const
|
||||
WordBreakChars = ['.', ',', ';', ':', '"', '''', '!', '?', '[', ']', '(',
|
||||
')', '{', '}', '^', '-', '=', '+', '*', '/', '\', '|', ' '];
|
||||
begin
|
||||
try
|
||||
ThisFile:= TStringList.Create;
|
||||
//if this is not a regular expression search
|
||||
if (Not fCaseSensitive) then
|
||||
TempSearch:= UpperCase(fSearchFor)
|
||||
else
|
||||
TempSearch:= fSearchFor;
|
||||
ThisFile.LoadFromFile(TheFileName);
|
||||
for Lines:= 0 to ThisFile.Count -1 do
|
||||
begin
|
||||
TheLine:= ThisFile.Strings[Lines];
|
||||
if not fCaseSensitive then
|
||||
TheLine:= UpperCase(TheLine);
|
||||
Match:= pos(TempSearch,TheLine);
|
||||
//look at the char before and after the match to see if they are in
|
||||
//our list of word seperator charaters.
|
||||
if fWholeWord and (Match > 0) then
|
||||
begin //is this the first word on the line or does the word start with
|
||||
//one of the word seperator charaters.
|
||||
if (Match = 1) or (TheLine[Match-1] in WordBreakChars) then
|
||||
StartWord := True
|
||||
else
|
||||
StartWord := False;
|
||||
EndWord:= False;
|
||||
if StartWord then // evaluate end only if start is true.
|
||||
begin
|
||||
if (Match + length(TempSearch) >= length(TheLine)) or
|
||||
(TheLine[Match + Length(TempSearch)] in WordBreakChars) then
|
||||
EndWord:= True
|
||||
end;//if
|
||||
if StartWord And EndWord then
|
||||
begin
|
||||
fResultsList.Add(TheFileName +'('+IntToStr(lines+1)+ ',' +
|
||||
IntToStr(match) + ')' + ' ' +
|
||||
copy(ThisFile.Strings[Lines],Match,60));
|
||||
UpdateMatches;
|
||||
end;//if
|
||||
end;//if
|
||||
if not fWholeWord and (Match > 0) then
|
||||
begin
|
||||
fResultsList.Add(TheFileName +'('+IntToStr(lines+1)+ ','+
|
||||
IntToStr(match) +')' + ' ' +
|
||||
copy(ThisFile.Strings[Lines],Match,60));
|
||||
UpdateMatches;
|
||||
end;//if
|
||||
if fAbort and not fAborting then
|
||||
begin
|
||||
fResultsList.Insert(0,fAbortString);
|
||||
fAborting:= True;
|
||||
break;
|
||||
end
|
||||
else if fAbort then
|
||||
begin
|
||||
break;
|
||||
end;//if
|
||||
end;//for
|
||||
finally
|
||||
FreeAndNil(ThisFile);
|
||||
end;//Try-finally
|
||||
end;//DoNormalSearch
|
||||
|
||||
{DoRegExpSearch is called if the search is a regular expression}
|
||||
procedure DoRegExpSearch;
|
||||
var
|
||||
ThisFile: TStringList;
|
||||
Lines: integer; //Loop Counter
|
||||
Match: integer; //Position of match in line.
|
||||
TheLine: string; //Temp Storage for the current line in the file.
|
||||
RE: TRegExpr; //Regular expression search engin
|
||||
begin
|
||||
try
|
||||
ThisFile:= TStringList.Create;
|
||||
RE:= TRegExpr.Create;
|
||||
//Set up the search engine.
|
||||
With RE do
|
||||
begin
|
||||
Expression:= fSearchFor;
|
||||
ModifierI:= not fCaseSensitive;
|
||||
ModifierM:= False; //for now
|
||||
end;//with
|
||||
ThisFile.LoadFromFile(TheFileName);
|
||||
for Lines:= 0 to ThisFile.Count - 1 do
|
||||
begin
|
||||
TheLine:= ThisFile[Lines];
|
||||
if RE.Exec(TheLine) then
|
||||
begin
|
||||
Match:= RE.MatchPos[0];
|
||||
fResultsList.Add(TheFileName +'('+IntToStr(lines+1) +
|
||||
','+ IntToStr(Match) + ')' +
|
||||
copy(TheLine,Match,60));
|
||||
UpdateMatches;
|
||||
end;//if
|
||||
if fAbort and not fAborting then
|
||||
begin
|
||||
fResultsList.Insert(0,fAbortString);
|
||||
fAborting:= True;
|
||||
break;
|
||||
end
|
||||
else if fAbort then
|
||||
begin
|
||||
break;
|
||||
end;//if
|
||||
end;//for
|
||||
finally
|
||||
FreeAndNil(ThisFile);
|
||||
FreeAndNil(RE);
|
||||
end;//try-finally
|
||||
end;//DoRegExpSearch
|
||||
|
||||
{Start SearchFile ============================================================}
|
||||
begin
|
||||
if not fRegExp then
|
||||
DoNormalSearch
|
||||
else
|
||||
DoRegExpSearch;
|
||||
end;//SearchFile
|
||||
|
||||
|
||||
procedure TSearchForm.DoFindInFiles(TheFileName: string);
|
||||
var
|
||||
//Loop counter
|
||||
i: integer;
|
||||
//Result of FindFirst, FindNext
|
||||
FileInfo: TSearchRec;
|
||||
//Temp Storage for The search Directoru
|
||||
TempDir: string;
|
||||
begin
|
||||
//if we have a list and a valid directory
|
||||
if (DirectoryExists(TheFileName)) then
|
||||
begin //make sure path ends with delimiter
|
||||
TempDir:= AppendPathDelim(TheFileName);
|
||||
for i:= 0 to fParsedMasks.Count -1 do
|
||||
begin
|
||||
if SysUtils.FindFirst(TempDir + fParsedMasks[i],
|
||||
faAnyFile,FileInfo)=0 then
|
||||
begin
|
||||
repeat
|
||||
// check if special file, skip directories this time
|
||||
if (FileInfo.Name='.') or (FileInfo.Name='..')
|
||||
or ((faDirectory and FileInfo.Attr)>0) then continue;
|
||||
//Make sure this is a text file as it will be searched
|
||||
if FileIsReadable(TempDir + FileInfo.Name)and FileIsText(TempDir + FileInfo.Name) then
|
||||
begin
|
||||
UpdateProgress(TempDir + FileInfo.Name);
|
||||
SearchFile(TempDir + FileInfo.Name);
|
||||
end;//if
|
||||
if fAbort and not fAborting then
|
||||
begin
|
||||
fAborting:= True;
|
||||
fResultsList.Insert(0,fAbortString);
|
||||
break;
|
||||
end
|
||||
else if fAbort then
|
||||
begin
|
||||
break;
|
||||
end;
|
||||
until SysUtils.FindNext(FileInfo)<>0;
|
||||
end;//if
|
||||
SysUtils.FindClose(FileInfo);
|
||||
end;//for
|
||||
//If selected then Look for and search subdirectories
|
||||
if (frecursive) then begin
|
||||
if (SysUtils.FindFirst(TempDir+FindMask,faAnyFile,FileInfo)=0) then
|
||||
begin
|
||||
repeat
|
||||
// check if directory and not special file
|
||||
if ((faDirectory and FileInfo.Attr)>0)
|
||||
and (FileInfo.Name<>'.') and (FileInfo.Name<>'..')
|
||||
then DoFindInFiles(TempDir + FileInfo.Name);
|
||||
if fAbort and not fAborting then
|
||||
begin
|
||||
fAborting:= True;
|
||||
fResultsList.Insert(0,fAbortString);
|
||||
break;
|
||||
end
|
||||
else if fAbort then
|
||||
begin
|
||||
break;
|
||||
end;
|
||||
until SysUtils.FindNext(FileInfo)<>0;
|
||||
end;//if
|
||||
SysUtils.FindClose(FileInfo);
|
||||
end;//if
|
||||
end;//if
|
||||
end;//DoFindInFiles
|
||||
|
||||
procedure TSearchForm.DoFindInSearchList;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
if Assigned(fSearchFileList) then
|
||||
begin
|
||||
for i:= 0 to fSearchFileList.Count -1 do
|
||||
begin
|
||||
UpdateProgress(fSearchFileList[i]);
|
||||
SearchFile(fSearchFileList[i]);
|
||||
end;//for
|
||||
end;//if
|
||||
end;//DoFindInSearchList
|
||||
|
||||
procedure TSearchForm.ParseMask;
|
||||
var
|
||||
//Position Tracking wihtin the string.
|
||||
curpos,startpos: integer;
|
||||
//Used as mask seperator
|
||||
const
|
||||
MaskSeperator = ';';
|
||||
begin
|
||||
if not Assigned(fParsedMasks) then
|
||||
fParsedMasks:= TStringList.Create;
|
||||
if fmask<>'' then
|
||||
begin
|
||||
fParsedMasks.Clear;
|
||||
//do we have multiple masks
|
||||
if (pos(MaskSeperator,fMask)>0) then
|
||||
begin
|
||||
startpos:=1;
|
||||
curpos:=1;
|
||||
repeat //loop through the string and get the masks.
|
||||
while (curpos<=length(fmask)) and (fmask[curpos] <> MaskSeperator) do
|
||||
inc(curpos);
|
||||
//add the mask to the list
|
||||
fParsedMasks.Add(copy(fmask,startpos,curpos-startpos));
|
||||
inc(curpos);//skip the seperator
|
||||
startpos:= curpos;//start on next mask
|
||||
until curpos > length(fmask);
|
||||
end//if
|
||||
else
|
||||
begin
|
||||
fParsedMasks.Add(fmask);
|
||||
end;//else
|
||||
end//if
|
||||
else
|
||||
begin
|
||||
fParsedMasks.Add(FindMask) //OS Independent Mask
|
||||
end;//else
|
||||
end;//ParseMask
|
||||
|
||||
|
||||
procedure TSearchForm.UpdateMatches;
|
||||
begin
|
||||
Application.ProcessMessages;
|
||||
inc(fMatches);
|
||||
lblMatches.Caption:= IntToStr(fMatches);
|
||||
Application.ProcessMessages;
|
||||
end;//UpdateMatches
|
||||
|
||||
|
||||
procedure TSearchForm.UpdateProgress(FileName: string);
|
||||
var
|
||||
DisplayFileName: string;
|
||||
begin
|
||||
Application.ProcessMessages;
|
||||
DisplayFileName:= FileName;
|
||||
While ((Length(DisplayFileName) * fCharWidth) >= lblProgress.Width) do
|
||||
begin
|
||||
DisplayFileName:= PadAndShorten(DisplayFileName);
|
||||
end;//while
|
||||
lblProgress.Caption:= DisplayFileName;
|
||||
Application.ProcessMessages;
|
||||
end;//UpdateProgress
|
||||
|
||||
function TSearchForm.PadAndShorten(FileName: string): string;
|
||||
var
|
||||
FoundAt: integer;
|
||||
begin
|
||||
result:= '';
|
||||
FoundAt:= pos(PathDelim,FileName);
|
||||
inc(FoundAt);
|
||||
result:= copy(FileName,FoundAt,Length(FileName));
|
||||
result:= fPad + result;
|
||||
end;//PadAndShorten
|
||||
|
||||
initialization
|
||||
{$I frmsearch.lrs}
|
||||
|
||||
end.
|
||||
|
246
ide/ideprocs.pp
246
ide/ideprocs.pp
@ -115,13 +115,6 @@ function GetNextDirectoryInSearchPath(const SearchPath: string;
|
||||
function SearchDirectoryInSearchPath(const SearchPath, Directory: string;
|
||||
DirStartPos: integer): integer;
|
||||
|
||||
// find in files
|
||||
procedure FindMatchingTextFiles(FileList: TStringList; TheDirectory: string;
|
||||
mask: string; recursive: boolean);
|
||||
function FindInFiles(TheFileList: TStringList; Searchfor: String;
|
||||
WholeWord: Boolean; CaseSensitive: Boolean;
|
||||
RegExp: Boolean): TStringList;
|
||||
|
||||
// XMLConfig
|
||||
procedure LoadRecentList(XMLConfig: TXMLConfig; List: TStringList;
|
||||
const Path: string);
|
||||
@ -2067,244 +2060,5 @@ begin
|
||||
Result[DestPos]:='$';
|
||||
end;
|
||||
|
||||
{FindMatchingTextFiles Adds filenames that match a mask to a user supplied
|
||||
string list. Procedure will optionally search subdirectories.
|
||||
|
||||
FileList: TStringList //List to put the matching file names.
|
||||
TheDirectory: String //Directory to start search
|
||||
Mask: String //Search mask,
|
||||
//multiple mask seperater by ; ie '*.pas;*.pp;...'
|
||||
Recursive: boolean //search subdirectories?
|
||||
}
|
||||
procedure FindMatchingTextFiles(FileList: TStringList; TheDirectory: string;
|
||||
mask: string; recursive: boolean);
|
||||
var
|
||||
//List of File masks to use in the search.
|
||||
MaskList: TStringList;
|
||||
//Loop counter
|
||||
i: integer;
|
||||
//Result of FindFirst, FindNext
|
||||
FileInfo: TSearchRec;
|
||||
//Temp Storage for The search Directoru
|
||||
TempDir: string;
|
||||
|
||||
{Function GetMasks: TStringList
|
||||
returns a list of mask from a string seperater by ;}
|
||||
function GetMasks: TStringList;
|
||||
var
|
||||
//Position Tracking wihtin the string.
|
||||
curpos,startpos: integer;
|
||||
//Used as mask seperator
|
||||
const
|
||||
MaskSeperator = ';';
|
||||
|
||||
begin
|
||||
Result:= TStringList.Create;
|
||||
if mask<>'' then
|
||||
begin
|
||||
//do we have multiple masks
|
||||
if (pos(MaskSeperator,Mask)>0) then
|
||||
begin
|
||||
startpos:=1;
|
||||
curpos:=1;
|
||||
repeat //loop through the string and get the masks.
|
||||
while (curpos<=length(mask)) and (mask[curpos] <> MaskSeperator) do
|
||||
inc(curpos);
|
||||
//add the mask to the list
|
||||
Result.Add(copy(mask,startpos,curpos-startpos));
|
||||
inc(curpos);//skip the seperator
|
||||
startpos:= curpos;//start on next mask
|
||||
until curpos > length(mask);
|
||||
end//if
|
||||
else
|
||||
begin
|
||||
result.Add(mask);
|
||||
end;//else
|
||||
end//if
|
||||
else
|
||||
begin
|
||||
Result.Add(FindMask) //OS Independent Mask
|
||||
end;//else
|
||||
end;//GetMasks
|
||||
|
||||
begin
|
||||
//if we have a list and a valid directory
|
||||
if ((FileList<>(nil)) and (DirectoryExists(TheDirectory))) then
|
||||
begin //make sure path ends with delimiter
|
||||
TempDir:= AppendPathDelim(TheDirectory);
|
||||
try
|
||||
MaskList:= GetMasks;//Returns a list of file masks.
|
||||
for i:= 0 to MaskList.Count -1 do
|
||||
begin
|
||||
if SysUtils.FindFirst(TempDir + MaskList[i],
|
||||
faAnyFile,FileInfo)=0 then
|
||||
begin
|
||||
repeat
|
||||
// check if special file, skip directories this time
|
||||
if (FileInfo.Name='.') or (FileInfo.Name='..')
|
||||
or ((faDirectory and FileInfo.Attr)>0) then continue;
|
||||
//Make sure this is a text file as it will be searched
|
||||
if FileIsReadable(TempDir + FileInfo.Name)
|
||||
and FileIsText(TempDir + FileInfo.Name)
|
||||
then FileList.Add(TempDir + FileInfo.Name);
|
||||
until SysUtils.FindNext(FileInfo)<>0;
|
||||
end;//if
|
||||
SysUtils.FindClose(FileInfo);
|
||||
end;//for
|
||||
finally
|
||||
MaskList.Free;
|
||||
end;//try-finally
|
||||
//If selected then Look for and search subdirectories
|
||||
if (recursive) then begin
|
||||
if (SysUtils.FindFirst(TempDir+FindMask,faAnyFile,FileInfo)=0) then
|
||||
begin
|
||||
repeat
|
||||
// check if directory and not special file
|
||||
if ((faDirectory and FileInfo.Attr)>0)
|
||||
and (FileInfo.Name<>'.') and (FileInfo.Name<>'..')
|
||||
then FindMatchingTextFiles(FileList,
|
||||
TempDir + FileInfo.Name,mask,recursive);
|
||||
until SysUtils.FindNext(FileInfo)<>0;
|
||||
end;//if
|
||||
SysUtils.FindClose(FileInfo);
|
||||
end;//if
|
||||
end;//if
|
||||
end;//FindMatchingFiles
|
||||
|
||||
{FindInFiles Search for the first occurence of a string in a text file, returns
|
||||
a list of files with a match.
|
||||
TheFileList: TStringList List of files to be searched.
|
||||
SearchFor: String The string to search for.
|
||||
WholeWord: Boolean Search for whole word matches.
|
||||
CaseSensitive: Boolean Case sensitive search.
|
||||
RegExp: Boolean SearchFor is to be treated as a regular expression
|
||||
}
|
||||
function FindInFiles(TheFileList: TStringList; Searchfor: String;
|
||||
WholeWord: Boolean; CaseSensitive: Boolean;
|
||||
RegExp: Boolean): TStringList;
|
||||
|
||||
{DoNormalSearch is called if the search is not a Regular expression}
|
||||
function DoNormalSearch: TStringList;
|
||||
var
|
||||
ThisFile: TStringList; //The File being searched
|
||||
i: integer; //Loop Counter
|
||||
Lines: integer; //Loop Counter
|
||||
Match: integer; //Position of match in line.
|
||||
StartWord: boolean; //Does the word start with a sperator charater?
|
||||
EndWord: boolean; //Does the word end with a seperator charater?
|
||||
TheLine: string; //Temp Storage for the current line in the file.
|
||||
TempSearch: string; //Temp Storage for the search string.
|
||||
|
||||
const
|
||||
WordBreakChars = ['.', ',', ';', ':', '"', '''', '!', '?', '[', ']', '(',
|
||||
')', '{', '}', '^', '-', '=', '+', '*', '/', '\', '|', ' '];
|
||||
begin
|
||||
Result:= TStringList.Create;
|
||||
try
|
||||
ThisFile:= TStringList.Create;
|
||||
//if this is not a regular expression search
|
||||
if (Not CaseSensitive) then
|
||||
TempSearch:= UpperCase(SearchFor)
|
||||
else
|
||||
TempSearch:= SearchFor;
|
||||
for i:= 0 to TheFileList.Count -1 do
|
||||
begin
|
||||
ThisFile.LoadFromFile(TheFileList.Strings[i]);
|
||||
for Lines:= 0 to ThisFile.Count -1 do
|
||||
begin
|
||||
TheLine:= ThisFile.Strings[Lines];
|
||||
if not CaseSensitive then
|
||||
TheLine:= UpperCase(TheLine);
|
||||
Match:= pos(TempSearch,TheLine);
|
||||
//look at the char before and after the match to see if they are in
|
||||
//our list of word seperator charaters.
|
||||
if WholeWord and (Match > 0) then
|
||||
begin //is this the first word on the line or does the word start with
|
||||
//one of the word seperator charaters.
|
||||
if (Match = 1) or (TheLine[Match-1] in WordBreakChars) then
|
||||
StartWord := True
|
||||
else
|
||||
StartWord := False;
|
||||
if StartWord then // evaluate end only if start is true.
|
||||
begin
|
||||
if (Match + length(TempSearch) >= length(TheLine)) or
|
||||
(TheLine[Match + Length(TempSearch)] in WordBreakChars) then
|
||||
EndWord:= True
|
||||
else
|
||||
EndWord:= False;
|
||||
end;//if
|
||||
if StartWord And EndWord then
|
||||
begin
|
||||
Result.Add(TheFileList.Strings[i]+'('+IntToStr(lines+1)+
|
||||
','+ IntToStr(match) + ')'+' '+'None:'+' '+
|
||||
copy(ThisFile.Strings[Lines],Match,60));
|
||||
break;//junp out we found our match
|
||||
end;//if
|
||||
end;//if
|
||||
if not WholeWord and (Match > 0) then
|
||||
begin
|
||||
Result.Add(TheFileList.Strings[i]+'('+IntToStr(lines+1)+
|
||||
','+IntToStr(match)+')'+' '+'None:'+' '+
|
||||
copy(ThisFile.Strings[Lines],Match,60));
|
||||
break;//junp out we found our match
|
||||
end;//if
|
||||
end;//for
|
||||
end;//for
|
||||
finally
|
||||
ThisFile.Free;
|
||||
end;//Try-finally
|
||||
end;//DoNormalSearch
|
||||
|
||||
{DoRegExpSearch is called if the search is a regular expression}
|
||||
function DoRegExpSearch: TStringList;
|
||||
var
|
||||
ThisFile: TStringList;
|
||||
i: integer; //Loop Counter
|
||||
Lines: integer; //Loop Counter
|
||||
Match: integer; //Position of match in line.
|
||||
TheLine: string; //Temp Storage for the current line in the file.
|
||||
RE: TRegExpr; //Regular expression search engin
|
||||
begin
|
||||
Result:= TStringList.Create;
|
||||
try
|
||||
ThisFile:= TStringList.Create;
|
||||
RE:= TRegExpr.Create;
|
||||
//Set up the search engine.
|
||||
With RE do
|
||||
begin
|
||||
Expression:= SearchFor;
|
||||
ModifierI:= not CaseSensitive;
|
||||
ModifierM:= False; //for now
|
||||
end;//with
|
||||
for i:= 0 to TheFileList.Count - 1 do
|
||||
begin
|
||||
ThisFile.LoadFromFile(TheFileList.Strings[i]);
|
||||
for Lines:= 0 to ThisFile.Count - 1 do
|
||||
begin
|
||||
TheLine:= ThisFile[Lines];
|
||||
if RE.Exec(TheLine) then
|
||||
begin
|
||||
Match:= RE.MatchPos[0];
|
||||
Result.Add(TheFileList.Strings[i]+'('+IntToStr(lines+1)+
|
||||
','+ IntToStr(Match) + ')'+' '+'None:'+' '+
|
||||
copy(TheLine,Match,60));
|
||||
break; //We found one so check the next file.
|
||||
end;//if
|
||||
end;//for
|
||||
end;//for
|
||||
finally
|
||||
ThisFile.free;
|
||||
RE.free;
|
||||
end;//try-finally
|
||||
end;//DoRegExpSearch
|
||||
|
||||
{Start FindInFiles ========================================================}
|
||||
begin
|
||||
if not RegExp then
|
||||
Result:= DoNormalSearch
|
||||
else
|
||||
Result:= DoRegExpSearch;
|
||||
end;//FindInFiles
|
||||
|
||||
end.
|
||||
|
||||
|
@ -556,6 +556,10 @@ resourcestring
|
||||
//Environment dialog
|
||||
dlgBakDirectory='(no subdirectoy)';
|
||||
|
||||
//Search dialog
|
||||
dlgSearchCaption = 'Searching...';
|
||||
dlgSearchAbort = 'Search terminated by user.';
|
||||
|
||||
dlgDesktop = 'Desktop';
|
||||
dlgWindows = 'Windows';
|
||||
dlgFrmEditor = 'Form Editor';
|
||||
|
@ -634,6 +634,9 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
frmSearch;
|
||||
|
||||
var
|
||||
Highlighters: array[TLazSyntaxHighlighter] of TSynCustomHighlighter;
|
||||
// aCompletion:
|
||||
@ -3349,11 +3352,10 @@ End;
|
||||
Procedure TSourceNotebook.FindInFiles(AProject: TProject);
|
||||
var
|
||||
TheFileList: TStringList; //List of Files to be searched.
|
||||
TheMatchedFiles: TStringList; //List of files that contain a match
|
||||
i: integer; //loop counter
|
||||
AnUnitInfo: TUnitInfo;
|
||||
LocalFindText: String; //Text to search for
|
||||
AText: string; //Formated message string
|
||||
SearchForm: TSearchForm; //
|
||||
Begin
|
||||
if FindInFilesDialog=nil then
|
||||
FindInFilesDialog:=TLazFindInFilesDialog.Create(Application);
|
||||
@ -3377,106 +3379,61 @@ Begin
|
||||
begin
|
||||
try
|
||||
TheFileList:= TStringList.Create;
|
||||
// find in project files
|
||||
if FindInFilesDialog.WhereRadioGroup.ItemIndex = 0 then
|
||||
if (FindInFilesDialog.WhereRadioGroup.ItemIndex = 1) or
|
||||
(FindInFilesDialog.WhereRadioGroup.ItemIndex = 0) then
|
||||
begin
|
||||
AnUnitInfo:=AProject.FirstPartOfProject;
|
||||
while AnUnitInfo<>nil do begin
|
||||
//Only if file exists on disk.
|
||||
if FilenameIsAbsolute(AnUnitInfo.FileName)
|
||||
and FileExists(AnUnitInfo.FileName) then
|
||||
TheFileList.Add(AnUnitInfo.FileName);
|
||||
AnUnitInfo:=AnUnitInfo.NextPartOfProject;
|
||||
end;
|
||||
end;//if
|
||||
// find in open files
|
||||
if FindInFilesDialog.WhereRadioGroup.ItemIndex = 1 then
|
||||
begin
|
||||
for i:= 0 to self.EditorCount -1 do
|
||||
if FindInFilesDialog.WhereRadioGroup.ItemIndex = 0 then
|
||||
begin
|
||||
AnUnitInfo:=AProject.FirstPartOfProject;
|
||||
while AnUnitInfo<>nil do begin
|
||||
//Only if file exists on disk.
|
||||
if FilenameIsAbsolute(AnUnitInfo.FileName)
|
||||
and FileExists(AnUnitInfo.FileName) then
|
||||
TheFileList.Add(AnUnitInfo.FileName);
|
||||
AnUnitInfo:=AnUnitInfo.NextPartOfProject;
|
||||
end;//while
|
||||
end//if
|
||||
else
|
||||
begin
|
||||
for i:= 0 to self.EditorCount -1 do
|
||||
begin
|
||||
//only if file exists on disk
|
||||
if FilenameIsAbsolute(Editors[i].FileName)
|
||||
and FileExists(Editors[i].FileName) then
|
||||
TheFileList.Add(Editors[i].FileName);
|
||||
if FilenameIsAbsolute(Editors[i].FileName) and
|
||||
FileExists(Editors[i].FileName) then
|
||||
begin
|
||||
TheFileList.Add(Editors[i].FileName);
|
||||
end;//if
|
||||
end;//for
|
||||
end;//else
|
||||
end;//if
|
||||
//Find in Directories
|
||||
if FindInFilesDialog.WhereRadioGroup.ItemIndex = 2 then
|
||||
begin
|
||||
FindMatchingTextFiles(TheFileList,
|
||||
FindInFilesDialog.DirectoryComboBox.Text,
|
||||
FindInFilesDialog.FileMaskComboBox.Text,
|
||||
FindInFilesDialog.IncludeSubDirsCheckBox.Checked);
|
||||
end;//if
|
||||
//if the file search returned any files then look for the search
|
||||
//text in each file.
|
||||
if TheFileList.Count > 0 then
|
||||
begin
|
||||
{ MessagesView.Clear;
|
||||
MessagesView.ShowOnTop; }
|
||||
try
|
||||
SearchForm:= TSearchForm.Create(SearchResultsView);
|
||||
SearchResultsView.Clear;
|
||||
SearchResultsView.ShowOnTop;
|
||||
with SearchForm do
|
||||
begin
|
||||
SearchOptions:= FindInFilesDialog.Options;
|
||||
SearchText:= LocalFindText;
|
||||
SearchFileList:= TheFileList;
|
||||
ResultsList:= SearchResultsView.SearchResultView.Items;
|
||||
SearchMask:= FindInFilesDialog.FileMaskComboBox.Text;
|
||||
SearchDirectory:= FindInFilesDialog.DirectoryComboBox.Text;
|
||||
end;//with
|
||||
try
|
||||
try
|
||||
TheMatchedFiles:= IDEProcs.FindInFiles(TheFileList,
|
||||
LocalFindText,
|
||||
FindInFilesDialog.WholeWordsOnlyCheckBox.Checked,
|
||||
FindInFilesDialog.CaseSensitiveCheckBox.Checked,
|
||||
FindInFilesDialog.RegularExpressionsCheckBox.Checked);
|
||||
except
|
||||
on E: ERegExpr do begin
|
||||
MessageDlg(lisUEErrorInRegularExpression,
|
||||
E.Message,mtError,[mbCancel],0);
|
||||
exit;
|
||||
end;//on except
|
||||
end;//try-except
|
||||
//if we matched any files add them to the message window
|
||||
if (TheMatchedFiles<>nil) and (TheMatchedFiles.Count>0) then
|
||||
begin
|
||||
SearchResultsView.AddSeparator;
|
||||
for i:= 0 to TheMatchedFiles.Count -1 do
|
||||
begin
|
||||
SearchResultsView.Add(TheMatchedFiles.Strings[i],'',false);
|
||||
end;//for
|
||||
//Hand off the search to the FindAndReplace Function in the
|
||||
//unit editor.
|
||||
with FindReplaceDlg do
|
||||
begin
|
||||
FindText:=LocalFindText;
|
||||
Options:= FindInFilesDialog.SynSearchOptions;
|
||||
//Multiline RegExpr?
|
||||
Options:= Options-[ssoRegExprMultiLine];
|
||||
end;//with
|
||||
end//if
|
||||
else
|
||||
begin
|
||||
SearchResultsView.Clear;
|
||||
SearchResultsView.ShowOnTop;
|
||||
SearchResultsView.AddSeparator;
|
||||
AText:=Format(lisUESearchStringNotFound,[LocalFindText]);
|
||||
SearchResultsView.Add(AText,'',false);
|
||||
end;//else
|
||||
finally
|
||||
TheMatchedFiles.Free;
|
||||
end;//try-finally
|
||||
end//if
|
||||
else
|
||||
begin
|
||||
SearchResultsView.Clear;
|
||||
SearchResultsView.ShowOnTop;
|
||||
SearchResultsView.AddSeparator;
|
||||
SearchResultsView.Add(lisFileNotFound,'',false);
|
||||
end;//else
|
||||
SearchForm.Show;
|
||||
SearchForm.DoSearch;
|
||||
except
|
||||
on E: ERegExpr do
|
||||
MessageDlg(lisUEErrorInRegularExpression, E.Message,mtError,
|
||||
[mbCancel],0);
|
||||
end;//try-except
|
||||
finally
|
||||
FreeAndNil(SearchForm);
|
||||
end;//finally
|
||||
finally
|
||||
TheFileList.Free;
|
||||
end;//try-finally
|
||||
end//if
|
||||
else
|
||||
begin
|
||||
SearchResultsView.Clear;
|
||||
SearchResultsView.ShowOnTop;
|
||||
SearchResultsView.AddSeparator;
|
||||
AText:=Format(lisUESearchStringNotFound,[LocalFindText]);
|
||||
SearchResultsView.Add(AText,'',false);
|
||||
end;//else
|
||||
FreeAndNil(TheFileList);
|
||||
end;//finally
|
||||
end;//if
|
||||
end;//if
|
||||
End;//FindInFilesClicked
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user