mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 16:40:54 +02:00
IDE: Add "Active File" to Search in Files where-selections. Issue #7686
git-svn-id: trunk@38924 -
This commit is contained in:
parent
4593c8f87f
commit
0839a029db
@ -1,18 +1,18 @@
|
|||||||
object LazFindInFilesDialog: TLazFindInFilesDialog
|
object LazFindInFilesDialog: TLazFindInFilesDialog
|
||||||
Left = 408
|
Left = 408
|
||||||
Height = 400
|
Height = 437
|
||||||
Top = 154
|
Top = 154
|
||||||
Width = 441
|
Width = 461
|
||||||
ActiveControl = TextToFindComboBox
|
ActiveControl = TextToFindComboBox
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'Find in files'
|
Caption = 'Find in files'
|
||||||
ClientHeight = 400
|
ClientHeight = 437
|
||||||
ClientWidth = 441
|
ClientWidth = 461
|
||||||
Constraints.MinHeight = 380
|
Constraints.MinHeight = 430
|
||||||
Constraints.MinWidth = 400
|
Constraints.MinWidth = 400
|
||||||
OnClose = FormClose
|
OnClose = FormClose
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
LCLVersion = '0.9.31'
|
LCLVersion = '1.1'
|
||||||
object OptionsCheckGroupBox: TCheckGroup
|
object OptionsCheckGroupBox: TCheckGroup
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = ReplaceTextComboBox
|
AnchorSideTop.Control = ReplaceTextComboBox
|
||||||
@ -20,9 +20,9 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 70
|
Height = 83
|
||||||
Top = 60
|
Top = 76
|
||||||
Width = 429
|
Width = 449
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
AutoFill = True
|
AutoFill = True
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
@ -38,6 +38,8 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
ChildSizing.ControlsPerLine = 2
|
ChildSizing.ControlsPerLine = 2
|
||||||
|
ClientHeight = 62
|
||||||
|
ClientWidth = 441
|
||||||
Columns = 2
|
Columns = 2
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'Case sensitive'
|
'Case sensitive'
|
||||||
@ -57,9 +59,9 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 93
|
Height = 83
|
||||||
Top = 136
|
Top = 165
|
||||||
Width = 429
|
Width = 449
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
AutoFill = True
|
AutoFill = True
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
@ -74,14 +76,16 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
ChildSizing.ControlsPerLine = 1
|
ChildSizing.ControlsPerLine = 2
|
||||||
ClientHeight = 75
|
ClientHeight = 62
|
||||||
ClientWidth = 425
|
ClientWidth = 441
|
||||||
|
Columns = 2
|
||||||
ItemIndex = 1
|
ItemIndex = 1
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'search all files in project'
|
'search all files in project'
|
||||||
'search all open files'
|
'search all open files'
|
||||||
'search in directories'
|
'search in directories'
|
||||||
|
'search in active file'
|
||||||
)
|
)
|
||||||
OnClick = WhereRadioGroupClick
|
OnClick = WhereRadioGroupClick
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
@ -93,15 +97,15 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 110
|
Height = 131
|
||||||
Top = 235
|
Top = 254
|
||||||
Width = 429
|
Width = 449
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'Directory Options'
|
Caption = 'Directory Options'
|
||||||
ClientHeight = 92
|
ClientHeight = 110
|
||||||
ClientWidth = 425
|
ClientWidth = 441
|
||||||
Enabled = False
|
Enabled = False
|
||||||
TabOrder = 5
|
TabOrder = 5
|
||||||
object DirectoryLabel: TLabel
|
object DirectoryLabel: TLabel
|
||||||
@ -109,9 +113,9 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
AnchorSideTop.Control = DirectoryComboBox
|
AnchorSideTop.Control = DirectoryComboBox
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 14
|
Height = 17
|
||||||
Top = 9
|
Top = 12
|
||||||
Width = 49
|
Width = 61
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
Caption = 'Directory:'
|
Caption = 'Directory:'
|
||||||
FocusControl = DirectoryComboBox
|
FocusControl = DirectoryComboBox
|
||||||
@ -122,9 +126,9 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
AnchorSideTop.Control = DirectoryComboBox
|
AnchorSideTop.Control = DirectoryComboBox
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 14
|
Height = 17
|
||||||
Top = 39
|
Top = 47
|
||||||
Width = 44
|
Width = 59
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Top = 12
|
BorderSpacing.Top = 12
|
||||||
Caption = 'File mask'
|
Caption = 'File mask'
|
||||||
@ -136,15 +140,15 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = DirectoryOptionsGroupBox
|
AnchorSideTop.Control = DirectoryOptionsGroupBox
|
||||||
AnchorSideRight.Control = DirectoryBrowse
|
AnchorSideRight.Control = DirectoryBrowse
|
||||||
Left = 61
|
Left = 73
|
||||||
Height = 21
|
Height = 29
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 314
|
Width = 330
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
ItemHeight = 13
|
ItemHeight = 0
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object DirectoryBrowse: TBitBtn
|
object DirectoryBrowse: TBitBtn
|
||||||
@ -152,16 +156,15 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
AnchorSideTop.Control = DirectoryComboBox
|
AnchorSideTop.Control = DirectoryComboBox
|
||||||
AnchorSideRight.Control = DirectoryOptionsGroupBox
|
AnchorSideRight.Control = DirectoryOptionsGroupBox
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 381
|
Left = 409
|
||||||
Height = 23
|
Height = 28
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 38
|
Width = 26
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
Caption = '...'
|
Caption = '...'
|
||||||
Layout = blGlyphTop
|
Layout = blGlyphTop
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = DirectoryBrowseClick
|
OnClick = DirectoryBrowseClick
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
@ -172,13 +175,13 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = DirectoryComboBox
|
AnchorSideRight.Control = DirectoryComboBox
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 56
|
Left = 71
|
||||||
Height = 21
|
Height = 29
|
||||||
Top = 36
|
Top = 41
|
||||||
Width = 319
|
Width = 332
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
ItemHeight = 13
|
ItemHeight = 0
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
Text = '*.pas;*.pp;*.inc'
|
Text = '*.pas;*.pp;*.inc'
|
||||||
end
|
end
|
||||||
@ -187,9 +190,9 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
AnchorSideTop.Control = FileMaskComboBox
|
AnchorSideTop.Control = FileMaskComboBox
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 17
|
Height = 22
|
||||||
Top = 69
|
Top = 82
|
||||||
Width = 126
|
Width = 170
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Top = 12
|
BorderSpacing.Top = 12
|
||||||
BorderSpacing.Bottom = 6
|
BorderSpacing.Bottom = 6
|
||||||
@ -201,16 +204,20 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
end
|
end
|
||||||
object ButtonPanel1: TButtonPanel
|
object ButtonPanel1: TButtonPanel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 26
|
Height = 33
|
||||||
Top = 368
|
Top = 398
|
||||||
Width = 429
|
Width = 449
|
||||||
OKButton.Name = 'OKButton'
|
OKButton.Name = 'OKButton'
|
||||||
|
OKButton.DefaultCaption = True
|
||||||
OKButton.OnClick = OKButtonClick
|
OKButton.OnClick = OKButtonClick
|
||||||
HelpButton.Name = 'HelpButton'
|
HelpButton.Name = 'HelpButton'
|
||||||
|
HelpButton.DefaultCaption = True
|
||||||
HelpButton.OnClick = HelpButtonClick
|
HelpButton.OnClick = HelpButtonClick
|
||||||
CloseButton.Name = 'CloseButton'
|
CloseButton.Name = 'CloseButton'
|
||||||
|
CloseButton.DefaultCaption = True
|
||||||
CloseButton.Enabled = False
|
CloseButton.Enabled = False
|
||||||
CancelButton.Name = 'CancelButton'
|
CancelButton.Name = 'CancelButton'
|
||||||
|
CancelButton.DefaultCaption = True
|
||||||
TabOrder = 6
|
TabOrder = 6
|
||||||
ShowButtons = [pbOK, pbCancel, pbHelp]
|
ShowButtons = [pbOK, pbCancel, pbHelp]
|
||||||
ShowBevel = False
|
ShowBevel = False
|
||||||
@ -222,9 +229,9 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 68
|
Left = 88
|
||||||
Height = 21
|
Height = 29
|
||||||
Top = 33
|
Top = 41
|
||||||
Width = 367
|
Width = 367
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
AutoComplete = True
|
AutoComplete = True
|
||||||
@ -234,7 +241,7 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
BorderSpacing.Bottom = 6
|
BorderSpacing.Bottom = 6
|
||||||
Enabled = False
|
Enabled = False
|
||||||
ItemHeight = 13
|
ItemHeight = 0
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object ReplaceCheckBox: TCheckBox
|
object ReplaceCheckBox: TCheckBox
|
||||||
@ -242,9 +249,9 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
AnchorSideTop.Control = ReplaceTextComboBox
|
AnchorSideTop.Control = ReplaceTextComboBox
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 17
|
Height = 22
|
||||||
Top = 35
|
Top = 44
|
||||||
Width = 56
|
Width = 76
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
Caption = 'Replace'
|
Caption = 'Replace'
|
||||||
Enabled = False
|
Enabled = False
|
||||||
@ -256,9 +263,9 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
AnchorSideTop.Control = TextToFindComboBox
|
AnchorSideTop.Control = TextToFindComboBox
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 14
|
Height = 17
|
||||||
Top = 9
|
Top = 12
|
||||||
Width = 65
|
Width = 75
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
Caption = 'Text To Find:'
|
Caption = 'Text To Find:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -269,17 +276,17 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
|||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 77
|
Left = 87
|
||||||
Height = 21
|
Height = 29
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 358
|
Width = 368
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
AutoComplete = True
|
AutoComplete = True
|
||||||
AutoCompleteText = [cbactEnabled, cbactEndOfLineComplete, cbactRetainPrefixCase, cbactSearchAscending]
|
AutoCompleteText = [cbactEnabled, cbactEndOfLineComplete, cbactRetainPrefixCase, cbactSearchAscending]
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
ItemHeight = 13
|
ItemHeight = 0
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object SelectDirectoryDialog: TSelectDirectoryDialog
|
object SelectDirectoryDialog: TSelectDirectoryDialog
|
||||||
|
@ -83,6 +83,12 @@ function FindInFilesDialog: TLazFindInFilesDialog;
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
const // WhereRadioGroup's ItemIndex in a more informative form.
|
||||||
|
ItemIndProject = 0;
|
||||||
|
ItemIndOpenFiles = 1;
|
||||||
|
ItemIndDirectories = 2;
|
||||||
|
ItemIndActiveFile = 3;
|
||||||
|
|
||||||
var
|
var
|
||||||
FindInFilesDialogSingleton: TLazFindInFilesDialog = nil;
|
FindInFilesDialogSingleton: TLazFindInFilesDialog = nil;
|
||||||
|
|
||||||
@ -116,7 +122,7 @@ end;
|
|||||||
|
|
||||||
procedure TLazFindInFilesDialog.WhereRadioGroupClick(Sender: TObject);
|
procedure TLazFindInFilesDialog.WhereRadioGroupClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
DirectoryOptionsGroupBox.Enabled := (WhereRadioGroup.ItemIndex = 2)
|
DirectoryOptionsGroupBox.Enabled := (WhereRadioGroup.ItemIndex = ItemIndDirectories)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLazFindInFilesDialog.DirectoryBrowseClick(Sender: TObject);
|
procedure TLazFindInFilesDialog.DirectoryBrowseClick(Sender: TObject);
|
||||||
@ -154,9 +160,10 @@ begin
|
|||||||
OptionsCheckGroupBox.Items[3] := lisFindFileMultiLinePattern;
|
OptionsCheckGroupBox.Items[3] := lisFindFileMultiLinePattern;
|
||||||
|
|
||||||
WhereRadioGroup.Caption:=lisFindFileWhere;
|
WhereRadioGroup.Caption:=lisFindFileWhere;
|
||||||
WhereRadioGroup.Items[0] := lisFindFilesearchAllFilesInProject;
|
WhereRadioGroup.Items[ItemIndProject] := lisFindFilesearchAllFilesInProject;
|
||||||
WhereRadioGroup.Items[1] := lisFindFilesearchAllOpenFiles;
|
WhereRadioGroup.Items[ItemIndOpenFiles] := lisFindFilesearchAllOpenFiles;
|
||||||
WhereRadioGroup.Items[2] := lisFindFilesearchInDirectories;
|
WhereRadioGroup.Items[ItemIndDirectories] := lisFindFilesearchInDirectories;
|
||||||
|
WhereRadioGroup.Items[ItemIndActiveFile] := lisFindFilesearchInActiveFile;
|
||||||
|
|
||||||
DirectoryOptionsGroupBox.Caption := lisFindFileDirectoryOptions;
|
DirectoryOptionsGroupBox.Caption := lisFindFileDirectoryOptions;
|
||||||
DirectoryLabel.Caption := lisFindFileDirectory;
|
DirectoryLabel.Caption := lisFindFileDirectory;
|
||||||
@ -170,7 +177,7 @@ begin
|
|||||||
ReplaceCheckBox.Enabled:=true;
|
ReplaceCheckBox.Enabled:=true;
|
||||||
|
|
||||||
UpdateReplaceCheck;
|
UpdateReplaceCheck;
|
||||||
DirectoryOptionsGroupBox.Enabled:=WhereRadioGroup.ItemIndex=2;
|
DirectoryOptionsGroupBox.Enabled:=WhereRadioGroup.ItemIndex=ItemIndDirectories;
|
||||||
|
|
||||||
AutoSize:=IDEDialogLayoutList.Find(Self,false)=nil;
|
AutoSize:=IDEDialogLayoutList.Find(Self,false)=nil;
|
||||||
IDEDialogLayoutList.ApplyLayout(Self);
|
IDEDialogLayoutList.ApplyLayout(Self);
|
||||||
@ -186,7 +193,7 @@ var
|
|||||||
Dir: String;
|
Dir: String;
|
||||||
begin
|
begin
|
||||||
Dir:=GetResolvedDirectory;
|
Dir:=GetResolvedDirectory;
|
||||||
if (WhereRadioGroup.ItemIndex=2) and (not DirectoryExistsUTF8(Dir)) then
|
if (WhereRadioGroup.ItemIndex=ItemIndDirectories) and not DirectoryExistsUTF8(Dir) then
|
||||||
begin
|
begin
|
||||||
MessageDlg(lisEnvOptDlgDirectoryNotFound,
|
MessageDlg(lisEnvOptDlgDirectoryNotFound,
|
||||||
Format(dlgSeachDirectoryNotFound,[Dir]),
|
Format(dlgSeachDirectoryNotFound,[Dir]),
|
||||||
@ -210,9 +217,10 @@ begin
|
|||||||
IncludeSubDirsCheckBox.Checked := fifIncludeSubDirs in NewOptions;
|
IncludeSubDirsCheckBox.Checked := fifIncludeSubDirs in NewOptions;
|
||||||
ReplaceCheckBox.Checked := [fifReplace,fifReplaceAll]*NewOptions<>[];
|
ReplaceCheckBox.Checked := [fifReplace,fifReplaceAll]*NewOptions<>[];
|
||||||
|
|
||||||
if fifSearchProject in NewOptions then WhereRadioGroup.ItemIndex := 0;
|
if fifSearchProject in NewOptions then WhereRadioGroup.ItemIndex := ItemIndProject;
|
||||||
if fifSearchOpen in NewOptions then WhereRadioGroup.ItemIndex := 1;
|
if fifSearchOpen in NewOptions then WhereRadioGroup.ItemIndex := ItemIndOpenFiles;
|
||||||
if fifSearchDirectories in NewOptions then WhereRadioGroup.ItemIndex := 2;
|
if fifSearchDirectories in NewOptions then WhereRadioGroup.ItemIndex := ItemIndDirectories;
|
||||||
|
if fifSearchActive in NewOptions then WhereRadioGroup.ItemIndex := ItemIndActiveFile;
|
||||||
|
|
||||||
UpdateReplaceCheck;
|
UpdateReplaceCheck;
|
||||||
end;
|
end;
|
||||||
@ -228,9 +236,10 @@ begin
|
|||||||
if ReplaceCheckBox.Checked then Include(Result, fifReplace);
|
if ReplaceCheckBox.Checked then Include(Result, fifReplace);
|
||||||
|
|
||||||
case WhereRadioGroup.ItemIndex of
|
case WhereRadioGroup.ItemIndex of
|
||||||
0: Include(Result, fifSearchProject);
|
ItemIndProject : Include(Result, fifSearchProject);
|
||||||
1: Include(Result, fifSearchOpen);
|
ItemIndOpenFiles : Include(Result, fifSearchOpen);
|
||||||
2: Include(Result, fifSearchDirectories);
|
ItemIndDirectories: Include(Result, fifSearchDirectories);
|
||||||
|
ItemIndActiveFile : Include(Result, fifSearchActive);
|
||||||
end;//case
|
end;//case
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -373,8 +382,7 @@ begin
|
|||||||
FileMaskComboBox.Text:= TLazSearch(Sender).SearchMask;
|
FileMaskComboBox.Text:= TLazSearch(Sender).SearchMask;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLazFindInFilesDialog.FindInFiles(AProject: TProject;
|
procedure TLazFindInFilesDialog.FindInFiles(AProject: TProject; const AFindText: string);
|
||||||
const AFindText: string);
|
|
||||||
var
|
var
|
||||||
SearchForm: TSearchProgressForm;
|
SearchForm: TSearchProgressForm;
|
||||||
begin
|
begin
|
||||||
@ -392,22 +400,23 @@ begin
|
|||||||
begin
|
begin
|
||||||
SaveHistory;
|
SaveHistory;
|
||||||
|
|
||||||
SearchForm:= TSearchProgressForm.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;
|
||||||
ReplaceText := self.ReplaceText;
|
ReplaceText := self.ReplaceText;
|
||||||
SearchMask := self.FileMaskComboBox.Text;
|
SearchMask := self.FileMaskComboBox.Text;
|
||||||
SearchDirectory := self.GetResolvedDirectory;
|
SearchDirectory := self.GetResolvedDirectory;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
try
|
try
|
||||||
if FindText <> '' then
|
if FindText <> '' then
|
||||||
begin
|
begin
|
||||||
case WhereRadioGroup.ItemIndex of
|
case WhereRadioGroup.ItemIndex of
|
||||||
0: SearchForm.DoSearchProject(AProject);
|
ItemIndProject : SearchForm.DoSearchProject(AProject);
|
||||||
1: SearchForm.DoSearchOpenFiles;
|
ItemIndOpenFiles : SearchForm.DoSearchOpenFiles;
|
||||||
2: SearchForm.DoSearchDir;
|
ItemIndDirectories: SearchForm.DoSearchDir;
|
||||||
|
ItemIndActiveFile : SearchForm.DoSearchActiveFile;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
|
@ -166,9 +166,10 @@ type
|
|||||||
fifMultiLine,
|
fifMultiLine,
|
||||||
fifSearchProject, // search in all project files
|
fifSearchProject, // search in all project files
|
||||||
fifSearchOpen, // search in all open files in editor
|
fifSearchOpen, // search in all open files in editor
|
||||||
|
fifSearchActive, // search in active open file in editor
|
||||||
fifSearchDirectories,// search in directories
|
fifSearchDirectories,// search in directories
|
||||||
fifIncludeSubDirs,
|
fifIncludeSubDirs,
|
||||||
fifReplace, // replace and ask user before each replace
|
fifReplace, // replace and ask user before each replace
|
||||||
fifReplaceAll // replace without asking user
|
fifReplaceAll // replace without asking user
|
||||||
);
|
);
|
||||||
TLazFindInFileSearchOptions = set of TLazFindInFileSearchOption;
|
TLazFindInFileSearchOptions = set of TLazFindInFileSearchOption;
|
||||||
|
@ -3682,6 +3682,7 @@ resourcestring
|
|||||||
lisFindFileWhere = 'Where';
|
lisFindFileWhere = 'Where';
|
||||||
lisFindFilesearchAllFilesInProject = 'search all files in &project';
|
lisFindFilesearchAllFilesInProject = 'search all files in &project';
|
||||||
lisFindFilesearchAllOpenFiles = 'search all &open files';
|
lisFindFilesearchAllOpenFiles = 'search all &open files';
|
||||||
|
lisFindFilesearchInActiveFile = 'search in &active file';
|
||||||
lisFindFilesearchInDirectories = 'search in &directories';
|
lisFindFilesearchInDirectories = 'search in &directories';
|
||||||
lisFindFileDirectoryOptions = 'Directory options';
|
lisFindFileDirectoryOptions = 'Directory options';
|
||||||
lisFindFileDirectory = 'D&irectory';
|
lisFindFileDirectory = 'D&irectory';
|
||||||
|
@ -10,7 +10,7 @@ object SearchProgressForm: TSearchProgressForm
|
|||||||
OnCreate = SearchFormCREATE
|
OnCreate = SearchFormCREATE
|
||||||
OnDestroy = SearchFormDESTROY
|
OnDestroy = SearchFormDESTROY
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '0.9.31'
|
LCLVersion = '1.1'
|
||||||
Visible = True
|
Visible = True
|
||||||
object Panel2: TPanel
|
object Panel2: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
@ -29,7 +29,7 @@ object SearchProgressForm: TSearchProgressForm
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 121
|
Left = 121
|
||||||
Height = 1
|
Height = 1
|
||||||
Top = 91
|
Top = 98
|
||||||
Width = 1
|
Width = 1
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
ShowAccelChar = False
|
ShowAccelChar = False
|
||||||
@ -38,9 +38,9 @@ object SearchProgressForm: TSearchProgressForm
|
|||||||
AnchorSideTop.Control = SearchingLabel
|
AnchorSideTop.Control = SearchingLabel
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 14
|
Height = 17
|
||||||
Top = 84
|
Top = 90
|
||||||
Width = 41
|
Width = 54
|
||||||
BorderSpacing.Top = 18
|
BorderSpacing.Top = 18
|
||||||
Caption = 'Matches'
|
Caption = 'Matches'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -50,7 +50,7 @@ object SearchProgressForm: TSearchProgressForm
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 121
|
Left = 121
|
||||||
Height = 1
|
Height = 1
|
||||||
Top = 59
|
Top = 63
|
||||||
Width = 1
|
Width = 1
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
ShowAccelChar = False
|
ShowAccelChar = False
|
||||||
@ -59,9 +59,9 @@ object SearchProgressForm: TSearchProgressForm
|
|||||||
AnchorSideTop.Control = SearchTextLabel
|
AnchorSideTop.Control = SearchTextLabel
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 14
|
Height = 17
|
||||||
Top = 52
|
Top = 55
|
||||||
Width = 52
|
Width = 68
|
||||||
BorderSpacing.Top = 18
|
BorderSpacing.Top = 18
|
||||||
Caption = 'Searching:'
|
Caption = 'Searching:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -69,9 +69,9 @@ object SearchProgressForm: TSearchProgressForm
|
|||||||
object SearchTextLabel: TLabel
|
object SearchTextLabel: TLabel
|
||||||
AnchorSideTop.Control = Panel2
|
AnchorSideTop.Control = Panel2
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 14
|
Height = 17
|
||||||
Top = 20
|
Top = 20
|
||||||
Width = 63
|
Width = 78
|
||||||
BorderSpacing.Top = 18
|
BorderSpacing.Top = 18
|
||||||
Caption = 'Search Text:'
|
Caption = 'Search Text:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -81,7 +81,7 @@ object SearchProgressForm: TSearchProgressForm
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 121
|
Left = 121
|
||||||
Height = 1
|
Height = 1
|
||||||
Top = 27
|
Top = 28
|
||||||
Width = 1
|
Width = 1
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
ShowAccelChar = False
|
ShowAccelChar = False
|
||||||
@ -93,10 +93,10 @@ object SearchProgressForm: TSearchProgressForm
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = Panel2
|
AnchorSideBottom.Control = Panel2
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 312
|
Left = 306
|
||||||
Height = 26
|
Height = 31
|
||||||
Top = 133
|
Top = 128
|
||||||
Width = 77
|
Width = 89
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Top = 12
|
BorderSpacing.Top = 12
|
||||||
@ -105,7 +105,6 @@ object SearchProgressForm: TSearchProgressForm
|
|||||||
Caption = 'Cancel'
|
Caption = 'Cancel'
|
||||||
Kind = bkCancel
|
Kind = bkCancel
|
||||||
ModalResult = 2
|
ModalResult = 2
|
||||||
NumGlyphs = 0
|
|
||||||
OnClick = btnAbortCLICK
|
OnClick = btnAbortCLICK
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
|
@ -75,9 +75,10 @@ type
|
|||||||
fSearchFileList: TStringList;
|
fSearchFileList: TStringList;
|
||||||
fSearchFiles: boolean;
|
fSearchFiles: boolean;
|
||||||
fSearchFor: String;
|
fSearchFor: String;
|
||||||
fSearchOpen: boolean;
|
|
||||||
fSearchProject: boolean;
|
|
||||||
fTheDirectory: string;
|
fTheDirectory: string;
|
||||||
|
fSearchOpen: boolean;
|
||||||
|
fSearchActive: boolean;
|
||||||
|
fSearchProject: boolean;
|
||||||
fAborting: boolean;
|
fAborting: boolean;
|
||||||
fLastUpdateProgress: DWORD;
|
fLastUpdateProgress: DWORD;
|
||||||
procedure DoFindInFiles(ADirectory: string);
|
procedure DoFindInFiles(ADirectory: string);
|
||||||
@ -94,6 +95,7 @@ type
|
|||||||
function DoSearch: integer;
|
function DoSearch: integer;
|
||||||
public
|
public
|
||||||
procedure DoSearchOpenFiles;
|
procedure DoSearchOpenFiles;
|
||||||
|
procedure DoSearchActiveFile;
|
||||||
procedure DoSearchDir;
|
procedure DoSearchDir;
|
||||||
procedure DoSearchProject(AProject: TProject);
|
procedure DoSearchProject(AProject: TProject);
|
||||||
public
|
public
|
||||||
@ -675,6 +677,7 @@ begin
|
|||||||
fRecursive:= (fifIncludeSubDirs in TheOptions);
|
fRecursive:= (fifIncludeSubDirs in TheOptions);
|
||||||
fSearchProject:= (fifSearchProject in TheOptions);
|
fSearchProject:= (fifSearchProject in TheOptions);
|
||||||
fSearchOpen:= (fifSearchOpen in TheOptions);
|
fSearchOpen:= (fifSearchOpen in TheOptions);
|
||||||
|
fSearchActive:= (fifSearchActive in TheOptions);
|
||||||
fSearchFiles:= (fifSearchDirectories in TheOptions);
|
fSearchFiles:= (fifSearchDirectories in TheOptions);
|
||||||
end;//SetOptions
|
end;//SetOptions
|
||||||
|
|
||||||
@ -690,6 +693,7 @@ begin
|
|||||||
if fRecursive then include(Result,fifIncludeSubDirs);
|
if fRecursive then include(Result,fifIncludeSubDirs);
|
||||||
if fSearchProject then include(Result, fifSearchProject);
|
if fSearchProject then include(Result, fifSearchProject);
|
||||||
if fSearchOpen then include(Result,fifSearchOpen);
|
if fSearchOpen then include(Result,fifSearchOpen);
|
||||||
|
if fSearchActive then include(Result,fifSearchActive);
|
||||||
if fSearchFiles then include(Result,fifSearchDirectories);
|
if fSearchFiles then include(Result,fifSearchDirectories);
|
||||||
end;//GetOptions
|
end;//GetOptions
|
||||||
|
|
||||||
@ -711,7 +715,7 @@ begin
|
|||||||
try
|
try
|
||||||
if fSearchFiles then
|
if fSearchFiles then
|
||||||
DoFindInFiles(fTheDirectory);
|
DoFindInFiles(fTheDirectory);
|
||||||
if fSearchProject or fSearchOpen then
|
if fSearchProject or fSearchOpen or fSearchActive then
|
||||||
DoFindInSearchList;
|
DoFindInSearchList;
|
||||||
if Assigned(fResultsList) then begin
|
if Assigned(fResultsList) then begin
|
||||||
Result:=fResultsList.Count; // Return the real item count.
|
Result:=fResultsList.Count; // Return the real item count.
|
||||||
@ -942,8 +946,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)
|
if FilenameIsAbsolute(SrcEdit.FileName)
|
||||||
and (not FileExistsCached(SrcEdit.FileName))
|
and (not FileExistsCached(SrcEdit.FileName)) then
|
||||||
then
|
|
||||||
continue;
|
continue;
|
||||||
TheFileList.Add(SrcEdit.FileName);
|
TheFileList.Add(SrcEdit.FileName);
|
||||||
end;
|
end;
|
||||||
@ -954,6 +957,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSearchProgressForm.DoSearchActiveFile;
|
||||||
|
var
|
||||||
|
TheFileList: TStringList;
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
TheFileList:= TStringList.Create; // Add a single file to the list
|
||||||
|
TheFileList.Add(SourceEditorManagerIntf.ActiveEditor.FileName);
|
||||||
|
SearchFileList:= TheFileList;
|
||||||
|
DoSearchAndAddToSearchResults;
|
||||||
|
finally
|
||||||
|
FreeAndNil(TheFileList);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSearchProgressForm.DoSearchDir;
|
procedure TSearchProgressForm.DoSearchDir;
|
||||||
begin
|
begin
|
||||||
SearchFileList:= Nil;
|
SearchFileList:= Nil;
|
||||||
|
Loading…
Reference in New Issue
Block a user