mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 09:36:10 +02:00
IDE: renamed TSearchForm to TSearchProgressForm
git-svn-id: trunk@29340 -
This commit is contained in:
parent
0c89e90faf
commit
e0eb9f4e41
@ -371,7 +371,7 @@ end;
|
|||||||
procedure TLazFindInFilesDialog.FindInFiles(AProject: TProject;
|
procedure TLazFindInFilesDialog.FindInFiles(AProject: TProject;
|
||||||
const AFindText: string);
|
const AFindText: string);
|
||||||
var
|
var
|
||||||
SearchForm: TSearchForm;
|
SearchForm: TSearchProgressForm;
|
||||||
begin
|
begin
|
||||||
LoadHistory;
|
LoadHistory;
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
SaveHistory;
|
SaveHistory;
|
||||||
|
|
||||||
SearchForm:= TSearchForm.Create(SearchResultsView);
|
SearchForm:= TSearchProgressForm.Create(SearchResultsView);
|
||||||
with SearchForm do begin
|
with SearchForm do begin
|
||||||
SearchOptions := self.Options;
|
SearchOptions := self.Options;
|
||||||
SearchText := self.FindText;
|
SearchText := self.FindText;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
object SearchForm: TSearchForm
|
object SearchProgressForm: TSearchProgressForm
|
||||||
Left = 422
|
Left = 422
|
||||||
Height = 149
|
Height = 149
|
||||||
Top = 267
|
Top = 267
|
||||||
@ -10,7 +10,7 @@ object SearchForm: TSearchForm
|
|||||||
OnCreate = SearchFormCREATE
|
OnCreate = SearchFormCREATE
|
||||||
OnDestroy = SearchFormDESTROY
|
OnDestroy = SearchFormDESTROY
|
||||||
Position = poOwnerFormCenter
|
Position = poOwnerFormCenter
|
||||||
LCLVersion = '0.9.27'
|
LCLVersion = '0.9.31'
|
||||||
object Panel2: TPanel
|
object Panel2: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 149
|
Height = 149
|
||||||
@ -25,7 +25,7 @@ object SearchForm: TSearchForm
|
|||||||
TabStop = True
|
TabStop = True
|
||||||
object lblMatches: TLabel
|
object lblMatches: TLabel
|
||||||
Left = 121
|
Left = 121
|
||||||
Height = 14
|
Height = 1
|
||||||
Top = 80
|
Top = 80
|
||||||
Width = 1
|
Width = 1
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -34,15 +34,15 @@ object SearchForm: TSearchForm
|
|||||||
AnchorSideTop.Control = lblMatches
|
AnchorSideTop.Control = lblMatches
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 14
|
Height = 18
|
||||||
Top = 80
|
Top = 71
|
||||||
Width = 41
|
Width = 58
|
||||||
Caption = 'Matches'
|
Caption = 'Matches'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object lblProgress: TLabel
|
object lblProgress: TLabel
|
||||||
Left = 121
|
Left = 121
|
||||||
Height = 14
|
Height = 1
|
||||||
Top = 48
|
Top = 48
|
||||||
Width = 1
|
Width = 1
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -51,9 +51,9 @@ object SearchForm: TSearchForm
|
|||||||
AnchorSideTop.Control = lblProgress
|
AnchorSideTop.Control = lblProgress
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 14
|
Height = 18
|
||||||
Top = 48
|
Top = 39
|
||||||
Width = 52
|
Width = 71
|
||||||
Caption = 'Searching:'
|
Caption = 'Searching:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
@ -61,24 +61,24 @@ object SearchForm: TSearchForm
|
|||||||
AnchorSideTop.Control = lblSearchText
|
AnchorSideTop.Control = lblSearchText
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 14
|
Height = 18
|
||||||
Top = 16
|
Top = 7
|
||||||
Width = 63
|
Width = 82
|
||||||
Caption = 'Search Text:'
|
Caption = 'Search Text:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object lblSearchText: TLabel
|
object lblSearchText: TLabel
|
||||||
Left = 121
|
Left = 121
|
||||||
Height = 14
|
Height = 1
|
||||||
Top = 16
|
Top = 16
|
||||||
Width = 1
|
Width = 1
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object btnCancel: TBitBtn
|
object btnCancel: TBitBtn
|
||||||
Left = 177
|
Left = 177
|
||||||
Height = 26
|
Height = 32
|
||||||
Top = 112
|
Top = 112
|
||||||
Width = 77
|
Width = 89
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Cancel = True
|
Cancel = True
|
||||||
Caption = 'Cancel'
|
Caption = 'Cancel'
|
||||||
|
@ -33,7 +33,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
// LCL
|
// LCL
|
||||||
Classes, SysUtils, LCLProc, LCLType, LCLIntf, Forms, Controls,
|
Classes, SysUtils, LCLProc, LCLType, LCLIntf, Forms, Controls,
|
||||||
Graphics, Dialogs, ExtCtrls, StdCtrls, Buttons, FileUtil, ComCtrls,
|
Graphics, Dialogs, ExtCtrls, StdCtrls, Buttons, FileProcs, FileUtil, ComCtrls,
|
||||||
// synedit, codetools
|
// synedit, codetools
|
||||||
SynEditSearch, SynRegExpr, SourceLog, KeywordFuncLists, BasicCodeTools,
|
SynEditSearch, SynRegExpr, SourceLog, KeywordFuncLists, BasicCodeTools,
|
||||||
// IDEIntf
|
// IDEIntf
|
||||||
@ -43,9 +43,9 @@ uses
|
|||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TSearchForm }
|
{ TSearchProgressForm }
|
||||||
|
|
||||||
TSearchForm = class(TForm)
|
TSearchProgressForm = class(TForm)
|
||||||
btnCancel: TBitBtn;
|
btnCancel: TBitBtn;
|
||||||
MatchesLabel: TLABEL;
|
MatchesLabel: TLABEL;
|
||||||
SearchingLabel: TLABEL;
|
SearchingLabel: TLABEL;
|
||||||
@ -112,7 +112,7 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
SearchForm: TSearchForm;
|
SearchProgressForm: TSearchProgressForm;
|
||||||
|
|
||||||
function SearchInText(const TheFileName: string;
|
function SearchInText(const TheFileName: string;
|
||||||
var TheText: string;// if TheFileName='' then use TheText
|
var TheText: string;// if TheFileName='' then use TheText
|
||||||
@ -604,14 +604,14 @@ begin
|
|||||||
end;//SearchFile
|
end;//SearchFile
|
||||||
|
|
||||||
|
|
||||||
{ TSearchForm }
|
{ TSearchProgressForm }
|
||||||
|
|
||||||
procedure TSearchForm.btnAbortCLICK(Sender: TObject);
|
procedure TSearchProgressForm.btnAbortCLICK(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Progress.Abort:= true;
|
Progress.Abort:= true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSearchForm.SearchFormCREATE(Sender: TObject);
|
procedure TSearchProgressForm.SearchFormCREATE(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
//Set Defaults
|
//Set Defaults
|
||||||
MatchesLabel.Caption:=lissMatches;
|
MatchesLabel.Caption:=lissMatches;
|
||||||
@ -634,7 +634,7 @@ begin
|
|||||||
fSearchFiles:= false;
|
fSearchFiles:= false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSearchForm.OnAddMatch(const Filename: string; const StartPos,
|
procedure TSearchProgressForm.OnAddMatch(const Filename: string; const StartPos,
|
||||||
EndPos: TPoint; const Lines: string);
|
EndPos: TPoint; const Lines: string);
|
||||||
var
|
var
|
||||||
MatchLen: Integer;
|
MatchLen: Integer;
|
||||||
@ -654,12 +654,12 @@ begin
|
|||||||
UpdateMatches;
|
UpdateMatches;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSearchForm.SearchFormDESTROY(Sender: TObject);
|
procedure TSearchProgressForm.SearchFormDESTROY(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
FreeAndNil(fProgress);
|
FreeAndNil(fProgress);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSearchForm.SetOptions(TheOptions: TLazFindInFileSearchOptions);
|
procedure TSearchProgressForm.SetOptions(TheOptions: TLazFindInFileSearchOptions);
|
||||||
begin
|
begin
|
||||||
SetFlag(sesoWholeWord,fifWholeWord in TheOptions);
|
SetFlag(sesoWholeWord,fifWholeWord in TheOptions);
|
||||||
SetFlag(sesoReplace,fifReplace in TheOptions);
|
SetFlag(sesoReplace,fifReplace in TheOptions);
|
||||||
@ -673,7 +673,7 @@ begin
|
|||||||
fSearchFiles:= (fifSearchDirectories in TheOptions);
|
fSearchFiles:= (fifSearchDirectories in TheOptions);
|
||||||
end;//SetOptions
|
end;//SetOptions
|
||||||
|
|
||||||
function TSearchForm.GetOptions: TLazFindInFileSearchOptions;
|
function TSearchProgressForm.GetOptions: TLazFindInFileSearchOptions;
|
||||||
begin
|
begin
|
||||||
Result:=[];
|
Result:=[];
|
||||||
if sesoWholeWord in fFlags then include(Result,fifWholeWord);
|
if sesoWholeWord in fFlags then include(Result,fifWholeWord);
|
||||||
@ -688,7 +688,7 @@ begin
|
|||||||
if fSearchFiles then include(Result,fifSearchDirectories);
|
if fSearchFiles then include(Result,fifSearchDirectories);
|
||||||
end;//GetOptions
|
end;//GetOptions
|
||||||
|
|
||||||
function TSearchForm.DoSearch: integer;
|
function TSearchProgressForm.DoSearch: integer;
|
||||||
// Search the text and then return the number of found items.
|
// Search the text and then return the number of found items.
|
||||||
begin
|
begin
|
||||||
Result:= 0;
|
Result:= 0;
|
||||||
@ -729,14 +729,15 @@ type
|
|||||||
|
|
||||||
TLazFileSearcher = class(TFileSearcher)
|
TLazFileSearcher = class(TFileSearcher)
|
||||||
private
|
private
|
||||||
FParent: TSearchForm;
|
FParent: TSearchProgressForm;
|
||||||
procedure CheckAbort;
|
procedure CheckAbort;
|
||||||
protected
|
protected
|
||||||
procedure DoDirectoryEnter; override;
|
procedure DoDirectoryEnter; override;
|
||||||
procedure DoDirectoryFound; override;
|
procedure DoDirectoryFound; override;
|
||||||
procedure DoFileFound; override;
|
procedure DoFileFound; override;
|
||||||
public
|
public
|
||||||
constructor Create(AParent: TSearchForm);
|
constructor Create(AParent: TSearchProgressForm);
|
||||||
|
destructor Destroy; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TLazFileSearcher }
|
{ TLazFileSearcher }
|
||||||
@ -771,7 +772,7 @@ var
|
|||||||
begin
|
begin
|
||||||
F := FileName;
|
F := FileName;
|
||||||
//DebugLn(['TLazFileSearcher.DoFileFound ',Filename]);
|
//DebugLn(['TLazFileSearcher.DoFileFound ',Filename]);
|
||||||
if FileIsReadable(F) and FileIsText(F) then
|
if FileProcs.FileIsTextCached(F) then
|
||||||
begin
|
begin
|
||||||
//DebugLn('TLazFileSearcher.DoFileFound text file: ' + F);
|
//DebugLn('TLazFileSearcher.DoFileFound text file: ' + F);
|
||||||
FParent.UpdateProgress(F);
|
FParent.UpdateProgress(F);
|
||||||
@ -781,16 +782,22 @@ begin
|
|||||||
CheckAbort;
|
CheckAbort;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TLazFileSearcher.Create(AParent: TSearchForm);
|
constructor TLazFileSearcher.Create(AParent: TSearchProgressForm);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
|
|
||||||
FParent := AParent;
|
FParent := AParent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TSearchForm }
|
destructor TLazFileSearcher.Destroy;
|
||||||
|
begin
|
||||||
|
FParent:=nil;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSearchForm.DoFindInFiles(TheFileName: string);
|
{ TSearchProgressForm }
|
||||||
|
|
||||||
|
procedure TSearchProgressForm.DoFindInFiles(TheFileName: string);
|
||||||
var
|
var
|
||||||
Searcher: TLazFileSearcher;
|
Searcher: TLazFileSearcher;
|
||||||
begin
|
begin
|
||||||
@ -803,10 +810,10 @@ begin
|
|||||||
finally
|
finally
|
||||||
Searcher.Free;
|
Searcher.Free;
|
||||||
end;
|
end;
|
||||||
end;//if
|
end;
|
||||||
end;//DoFindInFiles
|
end;
|
||||||
|
|
||||||
procedure TSearchForm.DoFindInSearchList;
|
procedure TSearchProgressForm.DoFindInSearchList;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
@ -820,7 +827,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSearchForm.SetResultsList(const AValue: TStrings);
|
procedure TSearchProgressForm.SetResultsList(const AValue: TStrings);
|
||||||
begin
|
begin
|
||||||
if fResultsList=AValue then exit;
|
if fResultsList=AValue then exit;
|
||||||
if fResultsListUpdating then
|
if fResultsListUpdating then
|
||||||
@ -831,14 +838,14 @@ begin
|
|||||||
fResultsList:=AValue;
|
fResultsList:=AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSearchForm.UpdateMatches;
|
procedure TSearchProgressForm.UpdateMatches;
|
||||||
begin
|
begin
|
||||||
inc(fMatches);
|
inc(fMatches);
|
||||||
//DebugLn(['TSearchForm.UpdateMatches ',lblMatches.Caption]);
|
//DebugLn(['TSearchForm.UpdateMatches ',lblMatches.Caption]);
|
||||||
lblMatches.Caption:=IntToStr(fMatches);
|
lblMatches.Caption:=IntToStr(fMatches);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSearchForm.UpdateProgress(FileName: string);
|
procedure TSearchProgressForm.UpdateProgress(FileName: string);
|
||||||
var
|
var
|
||||||
DisplayFileName: string;
|
DisplayFileName: string;
|
||||||
ShorterFileName: String;
|
ShorterFileName: String;
|
||||||
@ -853,10 +860,10 @@ begin
|
|||||||
DisplayFileName:=ShorterFileName;
|
DisplayFileName:=ShorterFileName;
|
||||||
//DebugLn(['TSearchForm.UpdateProgress Padded DisplayFileName="',dbgstr(DisplayFileName),'"']);
|
//DebugLn(['TSearchForm.UpdateProgress Padded DisplayFileName="',dbgstr(DisplayFileName),'"']);
|
||||||
lblProgress.Caption := DisplayFileName;
|
lblProgress.Caption := DisplayFileName;
|
||||||
end;//while
|
end;
|
||||||
end;//UpdateProgress
|
end;
|
||||||
|
|
||||||
procedure TSearchForm.SearchFile(const aFilename: string);
|
procedure TSearchProgressForm.SearchFile(const aFilename: string);
|
||||||
var
|
var
|
||||||
Src: String;
|
Src: String;
|
||||||
begin
|
begin
|
||||||
@ -870,7 +877,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSearchForm.SetFlag(Flag: TSrcEditSearchOption; AValue: boolean);
|
procedure TSearchProgressForm.SetFlag(Flag: TSrcEditSearchOption; AValue: boolean);
|
||||||
begin
|
begin
|
||||||
if AValue then
|
if AValue then
|
||||||
Include(fFlags,Flag)
|
Include(fFlags,Flag)
|
||||||
@ -878,7 +885,7 @@ begin
|
|||||||
Exclude(fFlags,Flag);
|
Exclude(fFlags,Flag);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSearchForm.DoSearchAndAddToSearchResults;
|
procedure TSearchProgressForm.DoSearchAndAddToSearchResults;
|
||||||
var
|
var
|
||||||
ListPage: TTabSheet;
|
ListPage: TTabSheet;
|
||||||
Cnt: integer;
|
Cnt: integer;
|
||||||
@ -912,7 +919,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSearchForm.DoSearchOpenFiles;
|
procedure TSearchProgressForm.DoSearchOpenFiles;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
TheFileList: TStringList;
|
TheFileList: TStringList;
|
||||||
@ -925,7 +932,7 @@ begin
|
|||||||
//only if file exists on disk
|
//only if file exists on disk
|
||||||
SrcEdit := SourceEditorManagerIntf.UniqueSourceEditors[i];
|
SrcEdit := SourceEditorManagerIntf.UniqueSourceEditors[i];
|
||||||
if FilenameIsAbsolute(SrcEdit.FileName) and
|
if FilenameIsAbsolute(SrcEdit.FileName) and
|
||||||
FileExistsUTF8(SrcEdit.FileName) then
|
FileExistsCached(SrcEdit.FileName) then
|
||||||
begin
|
begin
|
||||||
TheFileList.Add(SrcEdit.FileName);
|
TheFileList.Add(SrcEdit.FileName);
|
||||||
end;
|
end;
|
||||||
@ -937,13 +944,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSearchForm.DoSearchDir;
|
procedure TSearchProgressForm.DoSearchDir;
|
||||||
begin
|
begin
|
||||||
SearchFileList:= Nil;
|
SearchFileList:= Nil;
|
||||||
DoSearchAndAddToSearchResults;
|
DoSearchAndAddToSearchResults;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSearchForm.DoSearchProject(AProject: TProject);
|
procedure TSearchProgressForm.DoSearchProject(AProject: TProject);
|
||||||
var
|
var
|
||||||
AnUnitInfo: TUnitInfo;
|
AnUnitInfo: TUnitInfo;
|
||||||
TheFileList: TStringList;
|
TheFileList: TStringList;
|
||||||
@ -954,7 +961,7 @@ begin
|
|||||||
while AnUnitInfo<>nil do begin
|
while AnUnitInfo<>nil do begin
|
||||||
//Only if file exists on disk.
|
//Only if file exists on disk.
|
||||||
if FilenameIsAbsolute(AnUnitInfo.FileName)
|
if FilenameIsAbsolute(AnUnitInfo.FileName)
|
||||||
and FileExistsUTF8(AnUnitInfo.FileName) then
|
and FileExistsCached(AnUnitInfo.FileName) then
|
||||||
TheFileList.Add(AnUnitInfo.FileName);
|
TheFileList.Add(AnUnitInfo.FileName);
|
||||||
AnUnitInfo:=AnUnitInfo.NextPartOfProject;
|
AnUnitInfo:=AnUnitInfo.NextPartOfProject;
|
||||||
end;
|
end;
|
||||||
@ -965,7 +972,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSearchForm.PadAndShorten(FileName: string): string;
|
function TSearchProgressForm.PadAndShorten(FileName: string): string;
|
||||||
var
|
var
|
||||||
FoundAt: integer;
|
FoundAt: integer;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user