mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-29 15:02:51 +02:00
find in files: implemented searching all occurrences in a line
git-svn-id: trunk@9178 -
This commit is contained in:
parent
afbdd20e99
commit
ba393ecbb5
@ -1,26 +1,28 @@
|
||||
object LazFindInFilesDialog: TLazFindInFilesDialog
|
||||
ActiveControl = TextToFindComboBox
|
||||
Caption = 'Find in files'
|
||||
ClientHeight = 402
|
||||
ClientWidth = 368
|
||||
ClientHeight = 423
|
||||
ClientWidth = 385
|
||||
Constraints.MinHeight = 400
|
||||
Constraints.MinWidth = 260
|
||||
OnCreate = FormCreate
|
||||
PixelsPerInch = 112
|
||||
Position = poScreenCenter
|
||||
HorzScrollBar.Page = 367
|
||||
VertScrollBar.Page = 401
|
||||
HorzScrollBar.Page = 384
|
||||
VertScrollBar.Page = 422
|
||||
Left = 391
|
||||
Height = 402
|
||||
Height = 423
|
||||
Top = 158
|
||||
Width = 368
|
||||
Width = 385
|
||||
object TextToFindLabel: TLabel
|
||||
Caption = 'Text To Find:'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
AnchorSideTop.Control = TextToFindComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 6
|
||||
Height = 13
|
||||
Top = 11
|
||||
Top = 10
|
||||
Width = 74
|
||||
end
|
||||
object TextToFindComboBox: TComboBox
|
||||
@ -31,7 +33,7 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
||||
Left = 102
|
||||
Height = 21
|
||||
Top = 6
|
||||
Width = 260
|
||||
Width = 277
|
||||
end
|
||||
object OptionsCheckGroupBox: TCheckGroup
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
@ -56,8 +58,8 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
||||
TabOrder = 1
|
||||
Left = 6
|
||||
Height = 86
|
||||
Top = 36
|
||||
Width = 356
|
||||
Top = 65
|
||||
Width = 373
|
||||
Data = {
|
||||
03000000020202
|
||||
}
|
||||
@ -86,20 +88,20 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
||||
TabOrder = 2
|
||||
Left = 6
|
||||
Height = 82
|
||||
Top = 132
|
||||
Width = 356
|
||||
Top = 155
|
||||
Width = 373
|
||||
end
|
||||
object DirectoryOptionsGroupBox: TGroupBox
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
Caption = 'Directory Options'
|
||||
ClientHeight = 123
|
||||
ClientWidth = 352
|
||||
ClientHeight = 120
|
||||
ClientWidth = 369
|
||||
Enabled = False
|
||||
TabOrder = 3
|
||||
Left = 6
|
||||
Height = 140
|
||||
Top = 222
|
||||
Width = 356
|
||||
Height = 137
|
||||
Top = 240
|
||||
Width = 373
|
||||
object DirectoryLabel: TLabel
|
||||
Caption = 'Directory:'
|
||||
Color = clNone
|
||||
@ -126,7 +128,7 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
||||
Left = 88
|
||||
Height = 21
|
||||
Top = 6
|
||||
Width = 228
|
||||
Width = 245
|
||||
end
|
||||
object DirectoryBrowse: TBitBtn
|
||||
Anchors = [akTop, akRight]
|
||||
@ -136,7 +138,7 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
||||
NumGlyphs = 0
|
||||
OnClick = DirectoryBrowseClick
|
||||
TabOrder = 1
|
||||
Left = 322
|
||||
Left = 339
|
||||
Height = 21
|
||||
Top = 6
|
||||
Width = 21
|
||||
@ -150,7 +152,7 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 56
|
||||
Width = 310
|
||||
Width = 327
|
||||
end
|
||||
object IncludeSubDirsCheckBox: TCheckBox
|
||||
Caption = 'Include sub directories'
|
||||
@ -169,9 +171,9 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
||||
Default = True
|
||||
ModalResult = 1
|
||||
TabOrder = 4
|
||||
Left = 204
|
||||
Left = 221
|
||||
Height = 25
|
||||
Top = 370
|
||||
Top = 391
|
||||
Width = 75
|
||||
end
|
||||
object CancelButton: TButton
|
||||
@ -182,17 +184,40 @@ object LazFindInFilesDialog: TLazFindInFilesDialog
|
||||
Caption = 'Cancel'
|
||||
ModalResult = 2
|
||||
TabOrder = 5
|
||||
Left = 287
|
||||
Left = 304
|
||||
Height = 25
|
||||
Top = 370
|
||||
Top = 391
|
||||
Width = 75
|
||||
end
|
||||
object ReplaceTextComboBox: TComboBox
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
|
||||
Enabled = False
|
||||
MaxLength = 0
|
||||
TabOrder = 6
|
||||
Left = 102
|
||||
Height = 25
|
||||
Top = 33
|
||||
Width = 277
|
||||
end
|
||||
object ReplaceCheckBox: TCheckBox
|
||||
Caption = 'Replace'
|
||||
Enabled = False
|
||||
OnChange = ReplaceCheckBoxChange
|
||||
TabOrder = 7
|
||||
AnchorSideTop.Control = ReplaceTextComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 5
|
||||
Height = 24
|
||||
Top = 33
|
||||
Width = 73
|
||||
end
|
||||
object SelectDirectoryDialog: TSelectDirectoryDialog
|
||||
Options = [ofFileMustExist, ofEnableSizing, ofViewDetail]
|
||||
Title = 'Select Directory'
|
||||
FilterIndex = 0
|
||||
Title = 'Select Directory'
|
||||
left = 324
|
||||
top = 204
|
||||
left = 260
|
||||
top = 215
|
||||
end
|
||||
end
|
||||
|
@ -64,68 +64,76 @@ LazarusResources.Add('TFindInFilesDialog','FORMDATA',[
|
||||
|
||||
LazarusResources.Add('TLazFindInFilesDialog','FORMDATA',[
|
||||
'TPF0'#21'TLazFindInFilesDialog'#20'LazFindInFilesDialog'#13'ActiveControl'#7
|
||||
+#18'TextToFindComboBox'#7'Caption'#6#13'Find in files'#12'ClientHeight'#3#146
|
||||
+#1#11'ClientWidth'#3'p'#1#21'Constraints.MinHeight'#3#144#1#20'Constraints.M'
|
||||
+'inWidth'#3#4#1#8'OnCreate'#7#10'FormCreate'#13'PixelsPerInch'#2'p'#8'Positi'
|
||||
+'on'#7#14'poScreenCenter'#18'HorzScrollBar.Page'#3'o'#1#18'VertScrollBar.Pag'
|
||||
+'e'#3#145#1#4'Left'#3#135#1#6'Height'#3#146#1#3'Top'#3#158#0#5'Width'#3'p'#1
|
||||
+#0#6'TLabel'#15'TextToFindLabel'#7'Caption'#6#13'Text To Find:'#5'Color'#7#6
|
||||
+'clNone'#11'ParentColor'#8#4'Left'#2#6#6'Height'#2#13#3'Top'#2#11#5'Width'#2
|
||||
+'J'#0#0#9'TComboBox'#18'TextToFindComboBox'#7'Anchors'#11#5'akTop'#6'akLeft'
|
||||
+#7'akRight'#0#16'AutoCompleteText'#11#22'cbactEndOfLineComplete'#20'cbactSea'
|
||||
+'rchAscending'#0#9'MaxLength'#2#0#8'TabOrder'#2#0#4'Left'#2'f'#6'Height'#2#21
|
||||
+#3'Top'#2#6#5'Width'#3#4#1#0#0#11'TCheckGroup'#20'OptionsCheckGroupBox'#7'An'
|
||||
+'chors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoFill'#9#25'BorderSpacing.In'
|
||||
+'nerBorder'#2#6#7'Caption'#6#7'Options'#28'ChildSizing.LeftRightSpacing'#2#6
|
||||
+#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizing.HorizontalSpacing'#2#6
|
||||
+#27'ChildSizing.VerticalSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24
|
||||
+'crsHomogenousChildResize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenou'
|
||||
+'sChildResize'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'Chil'
|
||||
+'dSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cc'
|
||||
+'lLeftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#1#13'Items.S'
|
||||
+'trings'#1#6#14'Case sensitive'#6#16'Whole words only'#6#19'Regular expressi'
|
||||
+'ons'#0#8'TabOrder'#2#1#4'Left'#2#6#6'Height'#2'V'#3'Top'#2'$'#5'Width'#3'd'
|
||||
+#1#4'Data'#10#7#0#0#0#3#0#0#0#2#2#2#0#0#11'TRadioGroup'#15'WhereRadioGroup'#7
|
||||
+'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoFill'#9#7'Caption'#6#5'Wh'
|
||||
+'ere'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSpacing'#2
|
||||
+#6#29'ChildSizing.HorizontalSpacing'#2#6#27'ChildSizing.VerticalSpacing'#2#6
|
||||
+#29'ChildSizing.EnlargeHorizontal'#7#24'crsHomogenousChildResize'#27'ChildSi'
|
||||
+'zing.EnlargeVertical'#7#24'crsHomogenousChildResize'#28'ChildSizing.ShrinkH'
|
||||
+'orizontal'#7#14'crsScaleChilds'#26'ChildSizing.ShrinkVertical'#7#14'crsScal'
|
||||
+'eChilds'#18'ChildSizing.Layout'#7#29'cclLeftToRightThenTopToBottom'#27'Chil'
|
||||
+'dSizing.ControlsPerLine'#2#1#9'ItemIndex'#2#1#13'Items.Strings'#1#6#27'sear'
|
||||
+'ch all files in project'#6#21'search all open files'#6#21'search in directo'
|
||||
+'ries'#0#7'OnClick'#7#20'WhereRadioGroupClick'#8'TabOrder'#2#2#4'Left'#2#6#6
|
||||
+'Height'#2'R'#3'Top'#3#132#0#5'Width'#3'd'#1#0#0#9'TGroupBox'#24'DirectoryOp'
|
||||
+'tionsGroupBox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#7
|
||||
+'Caption'#6#17'Directory Options'#12'ClientHeight'#2'{'#11'ClientWidth'#3'`'
|
||||
+#1#7'Enabled'#8#8'TabOrder'#2#3#4'Left'#2#6#6'Height'#3#140#0#3'Top'#3#222#0
|
||||
+#5'Width'#3'd'#1#0#6'TLabel'#14'DirectoryLabel'#7'Caption'#6#10'Directory:'#5
|
||||
+'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2#6#6'Height'#2#13#3'Top'#2#8#5
|
||||
+'Width'#2'7'#0#0#6'TLabel'#13'FileMaskLabel'#7'Caption'#6#25'File mask (*;*.'
|
||||
+'*;*.bak?):'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2#6#6'Height'#2
|
||||
+#13#3'Top'#2'&'#5'Width'#3#128#0#0#0#9'TComboBox'#17'DirectoryComboBox'#7'An'
|
||||
+'chors'#11#5'akTop'#6'akLeft'#7'akRight'#0#16'AutoCompleteText'#11#22'cbactE'
|
||||
+'ndOfLineComplete'#20'cbactSearchAscending'#0#9'MaxLength'#2#0#8'TabOrder'#2
|
||||
+#0#4'Left'#2'X'#6'Height'#2#21#3'Top'#2#6#5'Width'#3#228#0#0#0#7'TBitBtn'#15
|
||||
+'DirectoryBrowse'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.Inner'
|
||||
+'Border'#2#2#7'Caption'#6#3'...'#6'Layout'#7#10'blGlyphTop'#9'NumGlyphs'#2#0
|
||||
+#7'OnClick'#7#20'DirectoryBrowseClick'#8'TabOrder'#2#1#4'Left'#3'B'#1#6'Heig'
|
||||
+'ht'#2#21#3'Top'#2#6#5'Width'#2#21#0#0#9'TComboBox'#16'FileMaskComboBox'#7'A'
|
||||
+'nchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#16'AutoCompleteText'#11#22'cbact'
|
||||
+'EndOfLineComplete'#20'cbactSearchAscending'#0#9'MaxLength'#2#0#8'TabOrder'#2
|
||||
+#2#4'Text'#6#16'*.pas;*.pp;*.inc'#4'Left'#2#6#6'Height'#2#21#3'Top'#2'8'#5'W'
|
||||
+'idth'#3'6'#1#0#0#9'TCheckBox'#22'IncludeSubDirsCheckBox'#7'Caption'#6#23'In'
|
||||
+'clude sub directories'#8'TabOrder'#2#3#4'Left'#2#6#6'Height'#2#24#3'Top'#2
|
||||
+'\'#5'Width'#3#154#0#0#0#0#7'TButton'#8'OKButton'#7'Anchors'#11#7'akRight'#8
|
||||
+'akBottom'#0#20'BorderSpacing.Around'#2#6#25'BorderSpacing.InnerBorder'#2#2#7
|
||||
+'Caption'#6#2'OK'#7'Default'#9#11'ModalResult'#2#1#8'TabOrder'#2#4#4'Left'#3
|
||||
+#204#0#6'Height'#2#25#3'Top'#3'r'#1#5'Width'#2'K'#0#0#7'TButton'#12'CancelBu'
|
||||
+'tton'#7'Anchors'#11#7'akRight'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#25
|
||||
+'BorderSpacing.InnerBorder'#2#2#6'Cancel'#9#7'Caption'#6#6'Cancel'#11'ModalR'
|
||||
+'esult'#2#2#8'TabOrder'#2#5#4'Left'#3#31#1#6'Height'#2#25#3'Top'#3'r'#1#5'Wi'
|
||||
+'dth'#2'K'#0#0#22'TSelectDirectoryDialog'#21'SelectDirectoryDialog'#7'Option'
|
||||
+'s'#11#15'ofFileMustExist'#14'ofEnableSizing'#12'ofViewDetail'#0#5'Title'#6
|
||||
+#16'Select Directory'#11'FilterIndex'#2#0#5'Title'#6#16'Select Directory'#4
|
||||
,'left'#3'D'#1#3'top'#3#204#0#0#0#0
|
||||
+#18'TextToFindComboBox'#7'Caption'#6#13'Find in files'#12'ClientHeight'#3#167
|
||||
+#1#11'ClientWidth'#3#129#1#21'Constraints.MinHeight'#3#144#1#20'Constraints.'
|
||||
+'MinWidth'#3#4#1#8'OnCreate'#7#10'FormCreate'#13'PixelsPerInch'#2'p'#8'Posit'
|
||||
+'ion'#7#14'poScreenCenter'#18'HorzScrollBar.Page'#3#128#1#18'VertScrollBar.P'
|
||||
+'age'#3#166#1#4'Left'#3#135#1#6'Height'#3#167#1#3'Top'#3#158#0#5'Width'#3#129
|
||||
+#1#0#6'TLabel'#15'TextToFindLabel'#7'Caption'#6#13'Text To Find:'#5'Color'#7
|
||||
+#6'clNone'#11'ParentColor'#8#21'AnchorSideTop.Control'#7#18'TextToFindComboB'
|
||||
+'ox'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2#6#6'Height'#2#13#3'Top'
|
||||
+#2#10#5'Width'#2'J'#0#0#9'TComboBox'#18'TextToFindComboBox'#7'Anchors'#11#5
|
||||
+'akTop'#6'akLeft'#7'akRight'#0#16'AutoCompleteText'#11#22'cbactEndOfLineComp'
|
||||
+'lete'#20'cbactSearchAscending'#0#9'MaxLength'#2#0#8'TabOrder'#2#0#4'Left'#2
|
||||
+'f'#6'Height'#2#21#3'Top'#2#6#5'Width'#3#21#1#0#0#11'TCheckGroup'#20'Options'
|
||||
+'CheckGroupBox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoFill'#9
|
||||
+#25'BorderSpacing.InnerBorder'#2#6#7'Caption'#6#7'Options'#28'ChildSizing.Le'
|
||||
+'ftRightSpacing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizing.Hor'
|
||||
+'izontalSpacing'#2#6#27'ChildSizing.VerticalSpacing'#2#6#29'ChildSizing.Enla'
|
||||
+'rgeHorizontal'#7#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeVertica'
|
||||
+'l'#7#24'crsHomogenousChildResize'#28'ChildSizing.ShrinkHorizontal'#7#14'crs'
|
||||
+'ScaleChilds'#26'ChildSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'ChildSi'
|
||||
+'zing.Layout'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSizing.ControlsPer'
|
||||
+'Line'#2#1#13'Items.Strings'#1#6#14'Case sensitive'#6#16'Whole words only'#6
|
||||
+#19'Regular expressions'#0#8'TabOrder'#2#1#4'Left'#2#6#6'Height'#2'V'#3'Top'
|
||||
+#2'A'#5'Width'#3'u'#1#4'Data'#10#7#0#0#0#3#0#0#0#2#2#2#0#0#11'TRadioGroup'#15
|
||||
+'WhereRadioGroup'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoFill'#9
|
||||
+#7'Caption'#6#5'Where'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.T'
|
||||
+'opBottomSpacing'#2#6#29'ChildSizing.HorizontalSpacing'#2#6#27'ChildSizing.V'
|
||||
+'erticalSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24'crsHomogenousChi'
|
||||
+'ldResize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenousChildResize'#28
|
||||
+'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'ChildSizing.ShrinkVer'
|
||||
+'tical'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclLeftToRightThenT'
|
||||
+'opToBottom'#27'ChildSizing.ControlsPerLine'#2#1#9'ItemIndex'#2#1#13'Items.S'
|
||||
+'trings'#1#6#27'search all files in project'#6#21'search all open files'#6#21
|
||||
+'search in directories'#0#7'OnClick'#7#20'WhereRadioGroupClick'#8'TabOrder'#2
|
||||
+#2#4'Left'#2#6#6'Height'#2'R'#3'Top'#3#155#0#5'Width'#3'u'#1#0#0#9'TGroupBox'
|
||||
+#24'DirectoryOptionsGroupBox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8
|
||||
+'akBottom'#0#7'Caption'#6#17'Directory Options'#12'ClientHeight'#2'x'#11'Cli'
|
||||
+'entWidth'#3'q'#1#7'Enabled'#8#8'TabOrder'#2#3#4'Left'#2#6#6'Height'#3#137#0
|
||||
+#3'Top'#3#240#0#5'Width'#3'u'#1#0#6'TLabel'#14'DirectoryLabel'#7'Caption'#6
|
||||
+#10'Directory:'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2#6#6'Height'
|
||||
+#2#13#3'Top'#2#8#5'Width'#2'7'#0#0#6'TLabel'#13'FileMaskLabel'#7'Caption'#6
|
||||
+#25'File mask (*;*.*;*.bak?):'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'
|
||||
+#2#6#6'Height'#2#13#3'Top'#2'&'#5'Width'#3#128#0#0#0#9'TComboBox'#17'Directo'
|
||||
+'ryComboBox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#16'AutoCompleteTe'
|
||||
+'xt'#11#22'cbactEndOfLineComplete'#20'cbactSearchAscending'#0#9'MaxLength'#2
|
||||
+#0#8'TabOrder'#2#0#4'Left'#2'X'#6'Height'#2#21#3'Top'#2#6#5'Width'#3#245#0#0
|
||||
+#0#7'TBitBtn'#15'DirectoryBrowse'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'Bor'
|
||||
+'derSpacing.InnerBorder'#2#2#7'Caption'#6#3'...'#6'Layout'#7#10'blGlyphTop'#9
|
||||
+'NumGlyphs'#2#0#7'OnClick'#7#20'DirectoryBrowseClick'#8'TabOrder'#2#1#4'Left'
|
||||
+#3'S'#1#6'Height'#2#21#3'Top'#2#6#5'Width'#2#21#0#0#9'TComboBox'#16'FileMask'
|
||||
+'ComboBox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#16'AutoCompleteText'
|
||||
+#11#22'cbactEndOfLineComplete'#20'cbactSearchAscending'#0#9'MaxLength'#2#0#8
|
||||
+'TabOrder'#2#2#4'Text'#6#16'*.pas;*.pp;*.inc'#4'Left'#2#6#6'Height'#2#21#3'T'
|
||||
+'op'#2'8'#5'Width'#3'G'#1#0#0#9'TCheckBox'#22'IncludeSubDirsCheckBox'#7'Capt'
|
||||
+'ion'#6#23'Include sub directories'#8'TabOrder'#2#3#4'Left'#2#6#6'Height'#2
|
||||
+#24#3'Top'#2'\'#5'Width'#3#154#0#0#0#0#7'TButton'#8'OKButton'#7'Anchors'#11#7
|
||||
+'akRight'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#25'BorderSpacing.InnerB'
|
||||
+'order'#2#2#7'Caption'#6#2'OK'#7'Default'#9#11'ModalResult'#2#1#8'TabOrder'#2
|
||||
+#4#4'Left'#3#221#0#6'Height'#2#25#3'Top'#3#135#1#5'Width'#2'K'#0#0#7'TButton'
|
||||
+#12'CancelButton'#7'Anchors'#11#7'akRight'#8'akBottom'#0#20'BorderSpacing.Ar'
|
||||
+'ound'#2#6#25'BorderSpacing.InnerBorder'#2#2#6'Cancel'#9#7'Caption'#6#6'Canc'
|
||||
+'el'#11'ModalResult'#2#2#8'TabOrder'#2#5#4'Left'#3'0'#1#6'Height'#2#25#3'Top'
|
||||
+#3#135#1#5'Width'#2'K'#0#0#9'TComboBox'#19'ReplaceTextComboBox'#7'Anchors'#11
|
||||
+#5'akTop'#6'akLeft'#7'akRight'#0#16'AutoCompleteText'#11#22'cbactEndOfLineCo'
|
||||
,'mplete'#20'cbactSearchAscending'#0#7'Enabled'#8#9'MaxLength'#2#0#8'TabOrder'
|
||||
+#2#6#4'Left'#2'f'#6'Height'#2#25#3'Top'#2'!'#5'Width'#3#21#1#0#0#9'TCheckBox'
|
||||
+#15'ReplaceCheckBox'#7'Caption'#6#7'Replace'#7'Enabled'#8#8'OnChange'#7#21'R'
|
||||
+'eplaceCheckBoxChange'#8'TabOrder'#2#7#21'AnchorSideTop.Control'#7#19'Replac'
|
||||
+'eTextComboBox'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2#5#6'Height'#2
|
||||
+#24#3'Top'#2'!'#5'Width'#2'I'#0#0#22'TSelectDirectoryDialog'#21'SelectDirect'
|
||||
+'oryDialog'#7'Options'#11#15'ofFileMustExist'#14'ofEnableSizing'#12'ofViewDe'
|
||||
+'tail'#0#5'Title'#6#16'Select Directory'#11'FilterIndex'#2#0#5'Title'#6#16'S'
|
||||
+'elect Directory'#4'left'#3#4#1#3'top'#3#215#0#0#0#0
|
||||
]);
|
||||
|
@ -31,6 +31,8 @@ type
|
||||
{ TLazFindInFilesDialog }
|
||||
|
||||
TLazFindInFilesDialog = class(TForm)
|
||||
ReplaceCheckBox: TCheckBox;
|
||||
ReplaceTextComboBox: TComboBox;
|
||||
IncludeSubDirsCheckBox: TCheckBox;
|
||||
FileMaskComboBox: TComboBox;
|
||||
DirectoryBrowse: TBitBtn;
|
||||
@ -47,18 +49,23 @@ type
|
||||
WhereRadioGroup: TRadioGroup;
|
||||
procedure DirectoryBrowseClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure ReplaceCheckBoxChange(Sender: TObject);
|
||||
procedure WhereRadioGroupClick(Sender: TObject);
|
||||
procedure SetOptions(NewOptions: TLazFindInFileSearchOptions);
|
||||
function GetOptions: TLazFindInFileSearchOptions;
|
||||
function GetSynOptions: TSynSearchOptions;
|
||||
procedure SetSynOptions(NewOptions: TSynSearchOptions);
|
||||
private
|
||||
function GetFindText: string;
|
||||
function GetOptions: TLazFindInFileSearchOptions;
|
||||
function GetReplaceText: string;
|
||||
function GetSynOptions: TSynSearchOptions;
|
||||
procedure SetFindText(const NewFindText: string);
|
||||
procedure SetOptions(NewOptions: TLazFindInFileSearchOptions);
|
||||
procedure SetReplaceText(const AValue: string);
|
||||
procedure SetSynOptions(NewOptions: TSynSearchOptions);
|
||||
procedure UpdateReplaceCheck;
|
||||
public
|
||||
property Options: TLazFindInFileSearchOptions read GetOptions
|
||||
write SetOptions;
|
||||
property FindText: string read GetFindText write SetFindText;
|
||||
property ReplaceText: string read GetReplaceText write SetReplaceText;
|
||||
property SynSearchOptions: TSynSearchOptions read GetSynOptions
|
||||
write SetSynOptions;
|
||||
end;
|
||||
@ -83,6 +90,11 @@ begin
|
||||
Result := TextToFindComboBox.Text;
|
||||
end;
|
||||
|
||||
function TLazFindInFilesDialog.GetReplaceText: string;
|
||||
begin
|
||||
Result:=ReplaceTextComboBox.Text;
|
||||
end;
|
||||
|
||||
procedure TLazFindInFilesDialog.WhereRadioGroupClick(Sender: TObject);
|
||||
begin
|
||||
DirectoryOptionsGroupBox.Enabled := (WhereRadioGroup.ItemIndex = 2)
|
||||
@ -100,6 +112,7 @@ begin
|
||||
Caption := srkmecFindInFiles;
|
||||
|
||||
TextToFindLabel.Caption := lisFindFileTextToFind;
|
||||
ReplaceCheckBox.Caption := lisMenuReplace;
|
||||
|
||||
OptionsCheckGroupBox.Caption := dlgFROpts;
|
||||
OptionsCheckGroupBox.Items[0] := lisFindFileCaseSensitive;
|
||||
@ -119,6 +132,13 @@ begin
|
||||
|
||||
OkButton.Caption := lisLazBuildOk;
|
||||
CancelButton.Caption := dlgCancel;
|
||||
|
||||
UpdateReplaceCheck;
|
||||
end;
|
||||
|
||||
procedure TLazFindInFilesDialog.ReplaceCheckBoxChange(Sender: TObject);
|
||||
begin
|
||||
UpdateReplaceCheck;
|
||||
end;
|
||||
|
||||
procedure TLazFindInFilesDialog.SetOptions(NewOptions: TLazFindInFileSearchOptions);
|
||||
@ -128,10 +148,13 @@ begin
|
||||
OptionsCheckGroupBox.Checked[2] := fifRegExpr in NewOptions;
|
||||
DirectoryOptionsGroupBox.Enabled := fifSearchDirectories in NewOptions;
|
||||
IncludeSubDirsCheckBox.Checked := fifIncludeSubDirs in NewOptions;
|
||||
ReplaceCheckBox.Checked := [fifReplace,fifReplaceAll]*NewOptions<>[];
|
||||
|
||||
if fifSearchProject in NewOptions then WhereRadioGroup.ItemIndex := 0;
|
||||
if fifSearchOpen in NewOptions then WhereRadioGroup.ItemIndex := 1;
|
||||
if fifSearchDirectories in NewOptions then WhereRadioGroup.ItemIndex := 2;
|
||||
|
||||
UpdateReplaceCheck;
|
||||
end;
|
||||
|
||||
function TLazFindInFilesDialog.GetOptions: TLazFindInFileSearchOptions;
|
||||
@ -141,6 +164,7 @@ begin
|
||||
if OptionsCheckGroupBox.Checked[1] then Include(Result, fifWholeWord);
|
||||
if OptionsCheckGroupBox.Checked[2] then Include(Result, fifRegExpr);
|
||||
if IncludeSubDirsCheckBox.Checked then Include(Result, fifIncludeSubDirs);
|
||||
if ReplaceCheckBox.Checked then Include(Result, fifReplace);
|
||||
|
||||
case WhereRadioGroup.ItemIndex of
|
||||
0: Include(Result, fifSearchProject);
|
||||
@ -155,15 +179,33 @@ begin
|
||||
if OptionsCheckGroupBox.Checked[0] then Include(Result, ssoMatchCase);
|
||||
if OptionsCheckGroupBox.Checked[1] then Include(Result, ssoWholeWord);
|
||||
if OptionsCheckGroupBox.Checked[2] then Include(Result, ssoRegExpr);
|
||||
if ReplaceCheckBox.Checked then Include(Result, ssoReplace);
|
||||
end;//GetSynOptions
|
||||
|
||||
procedure TLazFindInFilesDialog.SetReplaceText(const AValue: string);
|
||||
begin
|
||||
ReplaceTextComboBox.Text := AValue;
|
||||
end;
|
||||
|
||||
procedure TLazFindInFilesDialog.SetSynOptions(NewOptions: TSynSearchOptions);
|
||||
begin
|
||||
OptionsCheckGroupBox.Checked[0] := ssoMatchCase in NewOptions;
|
||||
OptionsCheckGroupBox.Checked[1] := ssoWholeWord in NewOptions;
|
||||
OptionsCheckGroupBox.Checked[2] := ssoRegExpr in NewOptions;
|
||||
ReplaceCheckBox.Checked := ([ssoReplace,ssoReplaceAll]*NewOptions <> []);
|
||||
|
||||
UpdateReplaceCheck;
|
||||
end;//SetSynOptions
|
||||
|
||||
procedure TLazFindInFilesDialog.UpdateReplaceCheck;
|
||||
begin
|
||||
ReplaceTextComboBox.Enabled:=ReplaceCheckBox.Checked;
|
||||
if ReplaceCheckBox.Checked then
|
||||
OKButton.Caption:=lisMenuReplace
|
||||
else
|
||||
OKButton.Caption:=lisMenuFind;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I findinfilesdlg.lrs}
|
||||
FindInFilesDialog := nil;
|
||||
|
@ -195,11 +195,12 @@ begin
|
||||
CodeToolBoss.GetIdentifierAt(DeclarationCode,
|
||||
DeclarationCaretXY.X,DeclarationCaretXY.Y,Identifier);
|
||||
// create a search result page
|
||||
SearchPageIndex:=SearchResultsView.AddResult(
|
||||
SearchPageIndex:=SearchResultsView.AddSearch(
|
||||
'References of '+Identifier,
|
||||
Identifier,
|
||||
'',
|
||||
ExtractFilePath(DeclarationCode.Filename),
|
||||
'*.pas;*.pp;*.inc',
|
||||
'*.pas;*.pp;*.p;*.inc',
|
||||
[fifWholeWord,fifSearchDirectories]);
|
||||
if SearchPageIndex<0 then exit;
|
||||
|
||||
|
@ -6,7 +6,7 @@ object SearchForm: TSearchForm
|
||||
OnCreate = SearchFormCREATE
|
||||
OnDestroy = SearchFormDESTROY
|
||||
ParentFont = True
|
||||
PixelsPerInch = 96
|
||||
PixelsPerInch = 112
|
||||
Position = poOwnerFormCenter
|
||||
HorzScrollBar.Page = 427
|
||||
VertScrollBar.Page = 148
|
||||
@ -16,7 +16,6 @@ object SearchForm: TSearchForm
|
||||
Width = 428
|
||||
object Panel2: TPanel
|
||||
Align = alClient
|
||||
BorderSpacing.OnChange = nil
|
||||
BevelInner = bvLowered
|
||||
ClientHeight = 149
|
||||
ClientWidth = 428
|
||||
@ -27,51 +26,51 @@ object SearchForm: TSearchForm
|
||||
Height = 149
|
||||
Width = 428
|
||||
object lblMatches: TLabel
|
||||
BorderSpacing.OnChange = nil
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
Left = 96
|
||||
Height = 17
|
||||
Top = 80
|
||||
Width = 321
|
||||
end
|
||||
object MatchesLabel: TLabel
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Matches'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
Left = 16
|
||||
Height = 17
|
||||
Top = 80
|
||||
Width = 64
|
||||
end
|
||||
object lblProgress: TLabel
|
||||
BorderSpacing.OnChange = nil
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
Left = 96
|
||||
Height = 17
|
||||
Top = 48
|
||||
Width = 320
|
||||
end
|
||||
object SearchingLabel: TLabel
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Searching:'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
Left = 16
|
||||
Height = 17
|
||||
Top = 48
|
||||
Width = 64
|
||||
end
|
||||
object SearchTextLabel: TLabel
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Search Text:'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
Left = 16
|
||||
Height = 17
|
||||
Top = 16
|
||||
Width = 80
|
||||
end
|
||||
object lblSearchText: TLabel
|
||||
BorderSpacing.OnChange = nil
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
Left = 96
|
||||
Height = 17
|
||||
Top = 16
|
||||
@ -79,7 +78,7 @@ object SearchForm: TSearchForm
|
||||
end
|
||||
object btnCancel: TButton
|
||||
AutoSize = True
|
||||
BorderSpacing.OnChange = nil
|
||||
BorderSpacing.InnerBorder = 2
|
||||
Caption = 'Cancel'
|
||||
Default = True
|
||||
OnClick = btnAbortCLICK
|
||||
|
@ -4,25 +4,24 @@ 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#8'OnCr'
|
||||
+'eate'#7#16'SearchFormCREATE'#9'OnDestroy'#7#17'SearchFormDESTROY'#10'Parent'
|
||||
+'Font'#9#13'PixelsPerInch'#2'`'#8'Position'#7#17'poOwnerFormCenter'#18'HorzS'
|
||||
+'Font'#9#13'PixelsPerInch'#2'p'#8'Position'#7#17'poOwnerFormCenter'#18'HorzS'
|
||||
+'crollBar.Page'#3#171#1#18'VertScrollBar.Page'#3#148#0#4'Left'#3#205#1#6'Hei'
|
||||
+'ght'#3#149#0#3'Top'#3'!'#1#5'Width'#3#172#1#0#6'TPanel'#6'Panel2'#5'Align'#7
|
||||
+#8'alClient'#22'BorderSpacing.OnChange'#13#10'BevelInner'#7#9'bvLowered'#12
|
||||
+'ClientHeight'#3#149#0#11'ClientWidth'#3#172#1#11'FullRepaint'#8#10'ParentFo'
|
||||
+'nt'#9#8'TabOrder'#2#0#7'TabStop'#9#6'Height'#3#149#0#5'Width'#3#172#1#0#6'T'
|
||||
+'Label'#10'lblMatches'#22'BorderSpacing.OnChange'#13#5'Color'#7#6'clNone'#4
|
||||
+'Left'#2'`'#6'Height'#2#17#3'Top'#2'P'#5'Width'#3'A'#1#0#0#6'TLabel'#12'Matc'
|
||||
+'hesLabel'#22'BorderSpacing.OnChange'#13#7'Caption'#6#7'Matches'#5'Color'#7#6
|
||||
+'clNone'#4'Left'#2#16#6'Height'#2#17#3'Top'#2'P'#5'Width'#2'@'#0#0#6'TLabel'
|
||||
+#11'lblProgress'#22'BorderSpacing.OnChange'#13#5'Color'#7#6'clNone'#4'Left'#2
|
||||
+'`'#6'Height'#2#17#3'Top'#2'0'#5'Width'#3'@'#1#0#0#6'TLabel'#14'SearchingLab'
|
||||
+'el'#22'BorderSpacing.OnChange'#13#7'Caption'#6#10'Searching:'#5'Color'#7#6
|
||||
+'clNone'#4'Left'#2#16#6'Height'#2#17#3'Top'#2'0'#5'Width'#2'@'#0#0#6'TLabel'
|
||||
+#15'SearchTextLabel'#22'BorderSpacing.OnChange'#13#7'Caption'#6#12'Search Te'
|
||||
+'xt:'#5'Color'#7#6'clNone'#4'Left'#2#16#6'Height'#2#17#3'Top'#2#16#5'Width'#2
|
||||
+'P'#0#0#6'TLabel'#13'lblSearchText'#22'BorderSpacing.OnChange'#13#5'Color'#7
|
||||
+#6'clNone'#4'Left'#2'`'#6'Height'#2#17#3'Top'#2#16#5'Width'#3'@'#1#0#0#7'TBu'
|
||||
+'tton'#9'btnCancel'#8'AutoSize'#9#22'BorderSpacing.OnChange'#13#7'Caption'#6
|
||||
+#6'Cancel'#7'Default'#9#7'OnClick'#7#13'btnAbortCLICK'#8'TabOrder'#2#0#4'Lef'
|
||||
+'t'#3#177#0#6'Height'#2#25#3'Top'#2'p'#5'Width'#2'K'#0#0#0#0
|
||||
+#8'alClient'#10'BevelInner'#7#9'bvLowered'#12'ClientHeight'#3#149#0#11'Clien'
|
||||
+'tWidth'#3#172#1#11'FullRepaint'#8#10'ParentFont'#9#8'TabOrder'#2#0#7'TabSto'
|
||||
+'p'#9#6'Height'#3#149#0#5'Width'#3#172#1#0#6'TLabel'#10'lblMatches'#5'Color'
|
||||
+#7#6'clNone'#11'ParentColor'#8#4'Left'#2'`'#6'Height'#2#17#3'Top'#2'P'#5'Wid'
|
||||
+'th'#3'A'#1#0#0#6'TLabel'#12'MatchesLabel'#7'Caption'#6#7'Matches'#5'Color'#7
|
||||
+#6'clNone'#11'ParentColor'#8#4'Left'#2#16#6'Height'#2#17#3'Top'#2'P'#5'Width'
|
||||
+#2'@'#0#0#6'TLabel'#11'lblProgress'#5'Color'#7#6'clNone'#11'ParentColor'#8#4
|
||||
+'Left'#2'`'#6'Height'#2#17#3'Top'#2'0'#5'Width'#3'@'#1#0#0#6'TLabel'#14'Sear'
|
||||
+'chingLabel'#7'Caption'#6#10'Searching:'#5'Color'#7#6'clNone'#11'ParentColor'
|
||||
+#8#4'Left'#2#16#6'Height'#2#17#3'Top'#2'0'#5'Width'#2'@'#0#0#6'TLabel'#15'Se'
|
||||
+'archTextLabel'#7'Caption'#6#12'Search Text:'#5'Color'#7#6'clNone'#11'Parent'
|
||||
+'Color'#8#4'Left'#2#16#6'Height'#2#17#3'Top'#2#16#5'Width'#2'P'#0#0#6'TLabel'
|
||||
+#13'lblSearchText'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2'`'#6'Hei'
|
||||
+'ght'#2#17#3'Top'#2#16#5'Width'#3'@'#1#0#0#7'TButton'#9'btnCancel'#8'AutoSiz'
|
||||
+'e'#9#25'BorderSpacing.InnerBorder'#2#2#7'Caption'#6#6'Cancel'#7'Default'#9#7
|
||||
+'OnClick'#7#13'btnAbortCLICK'#8'TabOrder'#2#0#4'Left'#3#177#0#6'Height'#2#25
|
||||
+#3'Top'#2'p'#5'Width'#2'K'#0#0#0#0
|
||||
]);
|
||||
|
@ -32,8 +32,8 @@ interface
|
||||
|
||||
uses
|
||||
// LCL
|
||||
Classes, SysUtils, LResources, LCLType, LCLIntf, Forms, Controls, Graphics,
|
||||
Dialogs, ExtCtrls, StdCtrls, Buttons, FileUtil,
|
||||
Classes, SysUtils, LCLProc, LResources, LCLType, LCLIntf, Forms, Controls,
|
||||
Graphics, Dialogs, ExtCtrls, StdCtrls, Buttons, FileUtil,
|
||||
// synedit, codetools
|
||||
SynRegExpr, SourceLog, KeywordFuncLists,
|
||||
// ide
|
||||
@ -57,26 +57,26 @@ type
|
||||
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 parsed masks.
|
||||
fMatches: longint;
|
||||
fAbort: boolean;
|
||||
fAbortString: string;
|
||||
fAborting: boolean;
|
||||
fSearchProject: boolean;
|
||||
fSearchOpen: boolean;
|
||||
fSearchFileList: TStringList;
|
||||
fSearchFiles: boolean;
|
||||
fAbortString: string;
|
||||
fCaseSensitive: Boolean;
|
||||
fmask: string;
|
||||
fMatches: longint;
|
||||
fPad: string;
|
||||
fParsedMasks: TStringList; //Holds the parsed masks.
|
||||
frecursive: boolean;
|
||||
fRegExp: Boolean;
|
||||
FReplaceText: string;
|
||||
fResultsList: TStrings;
|
||||
fResultsWindow: integer;
|
||||
fPad: string;
|
||||
fSearchFileList: TStringList;
|
||||
fSearchFiles: boolean;
|
||||
fSearchFor: String;
|
||||
fSearchOpen: boolean;
|
||||
fSearchProject: boolean;
|
||||
fTheDirectory: string;
|
||||
fWholeWord: Boolean;
|
||||
procedure SearchFile(TheFileName: string);
|
||||
procedure DoFindInFiles(TheFileName: string);
|
||||
procedure DoFindInSearchList;
|
||||
@ -90,6 +90,7 @@ type
|
||||
Procedure DoSearch;
|
||||
property SearchDirectory: string read fTheDirectory write fTheDirectory;
|
||||
property SearchText: string read fSearchFor write fSearchFor;
|
||||
property ReplaceText: string read FReplaceText write FReplaceText;
|
||||
property SearchOptions: TLazFindInFileSearchOptions read GetOptions
|
||||
write SetOptions;
|
||||
property SearchFileList: TStringList read fSearchFileList
|
||||
@ -189,7 +190,7 @@ procedure TSearchForm.SearchFile(TheFileName: string);
|
||||
WhiteSpaceChars = [' ',#10,#13,#9];
|
||||
|
||||
function SearchInLine(const SearchStr: string; SrcLog: TSourceLog;
|
||||
LineNumber: integer; WholeWords: boolean;
|
||||
LineNumber: integer; WholeWords: boolean; StartInLine: integer;
|
||||
var MatchStartInLine: integer): boolean;
|
||||
// search SearchStr in SrcLog line
|
||||
// returns MatchStartInLine=1 for start of line
|
||||
@ -212,7 +213,7 @@ procedure TSearchForm.SearchFile(TheFileName: string);
|
||||
Src:=SrcLog.Source;
|
||||
SearchLen:=length(SearchStr);
|
||||
LineStartPos:=@Src[LineRange.StartPos];
|
||||
StartPos:=LineStartPos;
|
||||
StartPos:=LineStartPos+StartInLine-1;
|
||||
EndPos:=@Src[LineRange.EndPos-SearchLen+1];
|
||||
FirstChar:=SearchStr[1];
|
||||
while (StartPos<EndPos) do begin
|
||||
@ -261,22 +262,36 @@ procedure TSearchForm.SearchFile(TheFileName: string);
|
||||
dec(APosition,StartPos-1);
|
||||
Result:=copy(Line,StartPos,EndPos-StartPos);
|
||||
end;
|
||||
|
||||
procedure DoReplaceLine;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
{Start SearchFile ============================================================}
|
||||
var
|
||||
ThisFile: TSourceLog; //The original File being searched
|
||||
UpperFile: TSourceLog; //The working File being searched
|
||||
Lines: integer; //Loop Counter
|
||||
Line: integer; //Loop Counter
|
||||
Match: integer; //Position of match in line.
|
||||
TempSearch: string; //Temp Storage for the search string.
|
||||
MatchLen: integer;
|
||||
CurLine: String;
|
||||
RE: TRegExpr;
|
||||
Found: Boolean;
|
||||
TrimmedMatch: LongInt;
|
||||
LastMatchStart: LongInt;
|
||||
LastMatchEnd: Integer;
|
||||
WorkLine: String;
|
||||
TrimmedCurLine: String;
|
||||
Replace: boolean;
|
||||
SearchAllHitsInLine: boolean;
|
||||
begin
|
||||
ThisFile:=nil;
|
||||
UpperFile:=nil;
|
||||
RE:=nil;
|
||||
Replace:=[fifReplace,fifReplaceAll]*SearchOptions<>[];
|
||||
SearchAllHitsInLine:=Replace;
|
||||
fResultsList.BeginUpdate;
|
||||
try
|
||||
MatchLen:= Length(fSearchFor);
|
||||
@ -304,31 +319,56 @@ begin
|
||||
|
||||
//writeln('TheFileName=',TheFileName,' len=',ThisFile.SourceLength,' Cnt=',ThisFile.LineCount,' TempSearch=',TempSearch);
|
||||
Application.ProcessMessages;
|
||||
for Lines:= 0 to ThisFile.LineCount -1 do
|
||||
CurLine:='';
|
||||
for Line:= 0 to ThisFile.LineCount -1 do
|
||||
begin
|
||||
if (Lines and $ff)=$ff then
|
||||
if (Line and $fff)=0 then
|
||||
Application.ProcessMessages;
|
||||
Found:=false;
|
||||
if fRegExp then begin
|
||||
// search every line for regular expression
|
||||
CurLine:=ThisFile.GetLine(Lines);
|
||||
if RE.Exec(CurLine) then begin
|
||||
Found:=true;
|
||||
Match:= RE.MatchPos[0];
|
||||
MatchLen:= Re.MatchLen[0];
|
||||
Match:=1;
|
||||
MatchLen:=0;
|
||||
repeat
|
||||
LastMatchStart:=Match;
|
||||
LastMatchEnd:=Match+MatchLen;
|
||||
|
||||
// search
|
||||
Found:=false;
|
||||
if fRegExp then begin
|
||||
// search every line for regular expression
|
||||
if LastMatchStart=LastMatchEnd then begin
|
||||
CurLine:=ThisFile.GetLine(Line);
|
||||
WorkLine:=CurLine;
|
||||
end else begin
|
||||
WorkLine:=copy(CurLine,LastMatchEnd,length(CurLine));
|
||||
end;
|
||||
if RE.Exec(WorkLine) then begin
|
||||
Found:=true;
|
||||
Match:= RE.MatchPos[0]+LastMatchEnd-1;
|
||||
MatchLen:= Re.MatchLen[0];
|
||||
end;
|
||||
end else begin
|
||||
Found:=SearchInLine(TempSearch,UpperFile,Line,
|
||||
fWholeWord,LastMatchEnd,Match);
|
||||
if Found then begin
|
||||
CurLine:=ThisFile.GetLine(Line);
|
||||
MatchLen:=length(TempSearch);
|
||||
end;
|
||||
end;
|
||||
end else begin
|
||||
Found:=SearchInLine(TempSearch,UpperFile,Lines,fWholeWord,Match);
|
||||
if Found then
|
||||
CurLine:=ThisFile.GetLine(Lines);
|
||||
end;
|
||||
if Found then begin
|
||||
CurLine:=TrimLineAndMatch(CurLine,Match);
|
||||
SearchResultsView.AddMatch(fResultsWindow,
|
||||
TheFileName,Point(Match,lines+1),
|
||||
CurLine, Match, MatchLen);
|
||||
UpdateMatches;
|
||||
end;
|
||||
|
||||
// add found place
|
||||
if Found then begin
|
||||
DebugLn('TSearchForm.SearchFile CurLine="',CurLine,'" Found=',dbgs(Found),' Match=',dbgs(Match),' MatchLen=',dbgs(MatchLen),' Line=',dbgs(Line));
|
||||
if Replace then begin
|
||||
DoReplaceLine;
|
||||
end;
|
||||
TrimmedMatch:=Match;
|
||||
TrimmedCurLine:=TrimLineAndMatch(CurLine,TrimmedMatch);
|
||||
SearchResultsView.AddMatch(fResultsWindow,
|
||||
TheFileName,Point(Match,Line+1),
|
||||
TrimmedCurLine, TrimmedMatch, MatchLen);
|
||||
UpdateMatches;
|
||||
end else
|
||||
break;
|
||||
until (not SearchAllHitsInLine) or (MatchLen<1);
|
||||
|
||||
// check abort
|
||||
if fAbort and not fAborting then
|
||||
|
@ -153,7 +153,9 @@ type
|
||||
fifSearchProject, // search in all project files
|
||||
fifSearchOpen, // search in all open files in editor
|
||||
fifSearchDirectories,// search in directories
|
||||
fifIncludeSubDirs
|
||||
fifIncludeSubDirs,
|
||||
fifReplace, // replace and ask user before each replace
|
||||
fifReplaceAll // replace without asking user
|
||||
);
|
||||
TLazFindInFileSearchOptions = set of TLazFindInFileSearchOption;
|
||||
|
||||
@ -267,7 +269,9 @@ const
|
||||
'SearchProject',
|
||||
'SearchOpen',
|
||||
'SearchDirectories',
|
||||
'IncludeSubDirs'
|
||||
'IncludeSubDirs',
|
||||
'Replace',
|
||||
'ReplaceAll'
|
||||
);
|
||||
|
||||
var
|
||||
|
@ -6,7 +6,7 @@ object SearchResultsView: TSearchResultsView
|
||||
OnCreate = Form1Create
|
||||
OnDestroy = SearchResultsViewDestroy
|
||||
OnKeyDown = ListBoxKeyDown
|
||||
PixelsPerInch = 96
|
||||
PixelsPerInch = 112
|
||||
Position = poScreenCenter
|
||||
HorzScrollBar.Page = 798
|
||||
VertScrollBar.Page = 228
|
||||
|
@ -4,7 +4,7 @@ LazarusResources.Add('TSearchResultsView','FORMDATA',[
|
||||
'TPF0'#18'TSearchResultsView'#17'SearchResultsView'#13'ActiveControl'#7#14'bt'
|
||||
+'nSearchAgain'#7'Caption'#6#17'SearchResultsView'#12'ClientHeight'#3#229#0#11
|
||||
+'ClientWidth'#3#31#3#8'OnCreate'#7#11'Form1Create'#9'OnDestroy'#7#24'SearchR'
|
||||
+'esultsViewDestroy'#9'OnKeyDown'#7#14'ListBoxKeyDown'#13'PixelsPerInch'#2'`'
|
||||
+'esultsViewDestroy'#9'OnKeyDown'#7#14'ListBoxKeyDown'#13'PixelsPerInch'#2'p'
|
||||
+#8'Position'#7#14'poScreenCenter'#18'HorzScrollBar.Page'#3#30#3#18'VertScrol'
|
||||
+'lBar.Page'#3#228#0#4'Left'#3#11#1#6'Height'#3#229#0#3'Top'#3#226#1#5'Width'
|
||||
+#3#31#3#0#9'TNotebook'#15'ResultsNoteBook'#5'Align'#7#8'alBottom'#7'Anchors'
|
||||
|
@ -67,12 +67,14 @@ type
|
||||
|
||||
TLazSearch = Class(TObject)
|
||||
private
|
||||
FReplaceText: string;
|
||||
fSearchString: string;
|
||||
fSearchOptions: TLazFindInFileSearchOptions;
|
||||
fSearchDirectory: string;
|
||||
fSearchMask: string;
|
||||
public
|
||||
property SearchString: string read fSearchString write fSearchString;
|
||||
property ReplaceText: string read FReplaceText write FReplaceText;
|
||||
property SearchOptions: TLazFindInFileSearchOptions read fSearchOptions
|
||||
write fSearchOptions;
|
||||
property SearchDirectory: string read fSearchDirectory
|
||||
@ -109,7 +111,6 @@ type
|
||||
ResultsNoteBook: TNotebook;
|
||||
procedure Form1Create(Sender: TObject);
|
||||
procedure ListBoxKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure ResultsNoteBookChangebounds(Sender: TObject);
|
||||
procedure ResultsNoteBookClosetabclicked(Sender: TObject);
|
||||
procedure SearchResultsViewDestroy(Sender: TObject);
|
||||
procedure btnSearchAgainClick(Sender: TObject);
|
||||
@ -121,6 +122,7 @@ type
|
||||
Procedure LazLBMouseWheel(Sender: TObject; Shift: TShiftState;
|
||||
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
||||
private
|
||||
FMaxItems: integer;
|
||||
function PageExists(const APageName: string): boolean;
|
||||
function GetPageIndex(const APageName: string): integer;
|
||||
function GetListBox(APageIndex: integer): TLazSearchResultLB;
|
||||
@ -131,9 +133,11 @@ type
|
||||
fOnSelectionChanged: TNotifyEvent;
|
||||
fListBoxFont: TFont;
|
||||
fMouseOverIndex: integer;
|
||||
procedure SetMaxItems(const AValue: integer);
|
||||
public
|
||||
function AddResult(const ResultsName: string;
|
||||
function AddSearch(const ResultsName: string;
|
||||
const SearchText: string;
|
||||
const ReplaceText: string;
|
||||
const ADirectory: string;
|
||||
const AMask: string;
|
||||
const TheOptions: TLazFindInFileSearchOptions): integer;
|
||||
@ -152,6 +156,7 @@ type
|
||||
property OnSelectionChanged: TNotifyEvent read fOnSelectionChanged
|
||||
write fOnSelectionChanged;
|
||||
property Items[Index: integer]: TStrings read GetItems write SetItems;
|
||||
property MaxItems: integer read FMaxItems write SetMaxItems;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -168,12 +173,14 @@ procedure TSearchResultsView.Form1Create(Sender: TObject);
|
||||
var
|
||||
ALayout: TIDEWindowLayout;
|
||||
begin
|
||||
FMaxItems:=10;
|
||||
|
||||
ResultsNoteBook.Options:= ResultsNoteBook.Options+[nboShowCloseButtons];
|
||||
ResultsNoteBook.Update;
|
||||
|
||||
Caption:=lisMenuViewSearchResults;
|
||||
btnSearchAgain.Caption:=lisSearchAgain;
|
||||
|
||||
|
||||
Name := NonModalIDEWindowNames[nmiwSearchResultsViewName];
|
||||
ALayout:=EnvironmentOptions.IDEWindowLayoutList.
|
||||
ItemByEnum(nmiwSearchResultsViewName);
|
||||
@ -188,11 +195,6 @@ begin
|
||||
fMouseOverIndex:= -1;
|
||||
end;//Create
|
||||
|
||||
procedure TSearchResultsView.ResultsNoteBookChangebounds(Sender: TObject);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
{Keeps track of the Index of the Item the mouse is over, Sets ShowHint to true
|
||||
if the Item length is longer than the Listbox client width.}
|
||||
procedure TSearchResultsView.LazLBMousemove(Sender: TObject; Shift: TShiftState;
|
||||
@ -237,6 +239,11 @@ begin
|
||||
CurrentLB:= GetListBox(AIndex);
|
||||
if Assigned(CurrentLB) then
|
||||
begin
|
||||
if CurrentLB.UpdateState then begin
|
||||
if CurrentLB.UpdateItems.Count>=MaxItems then exit;
|
||||
end else begin
|
||||
if CurrentLB.Items.Count>=MaxItems then exit;
|
||||
end;
|
||||
SearchPos:= TLazSearchMatchPos.Create;
|
||||
SearchPos.MatchStart:= MatchStart;
|
||||
SearchPos.MatchLen:= MatchLen;
|
||||
@ -329,6 +336,12 @@ begin
|
||||
end;//if
|
||||
end;//GetItems
|
||||
|
||||
procedure TSearchResultsView.SetMaxItems(const AValue: integer);
|
||||
begin
|
||||
if FMaxItems=AValue then exit;
|
||||
FMaxItems:=AValue;
|
||||
end;
|
||||
|
||||
procedure TSearchResultsView.ResultsNoteBookCloseTabclicked(Sender: TObject);
|
||||
begin
|
||||
if (Sender is TPage) then
|
||||
@ -388,8 +401,9 @@ end;
|
||||
|
||||
{Add Result will create a tab in the Results view window with an new
|
||||
list box or focus an existing listbox and update it's searchoptions.}
|
||||
function TSearchResultsView.AddResult(const ResultsName: string;
|
||||
function TSearchResultsView.AddSearch(const ResultsName: string;
|
||||
const SearchText: string;
|
||||
const ReplaceText: string;
|
||||
const ADirectory: string;
|
||||
const AMask: string;
|
||||
const TheOptions: TLazFindInFileSearchOptions): integer;
|
||||
@ -397,6 +411,7 @@ var
|
||||
NewListBox: TLazSearchResultLB;
|
||||
NewPage: LongInt;
|
||||
i: integer;
|
||||
SearchObj: TLazSearch;
|
||||
begin
|
||||
result:= -1;
|
||||
if Assigned(ResultsNoteBook) then
|
||||
@ -439,14 +454,15 @@ begin
|
||||
end;//if
|
||||
end;//else
|
||||
end;//with
|
||||
with NewListBox.SearchObject do
|
||||
begin
|
||||
SearchString:= SearchText;
|
||||
SearchDirectory:= ADirectory;
|
||||
SearchMask:= AMask;
|
||||
SearchOptions:= TheOptions;
|
||||
end;//with
|
||||
result:= ResultsNoteBook.PageIndex;
|
||||
SearchObj:=NewListBox.SearchObject;
|
||||
if SearchObj<>nil then begin
|
||||
SearchObj.SearchString:= SearchText;
|
||||
SearchObj.ReplaceText := ReplaceText;
|
||||
SearchObj.SearchDirectory:= ADirectory;
|
||||
SearchObj.SearchMask:= AMask;
|
||||
SearchObj.SearchOptions:= TheOptions;
|
||||
end;
|
||||
Result:= ResultsNoteBook.PageIndex;
|
||||
end;//if
|
||||
end;//AddResult
|
||||
|
||||
|
@ -4138,6 +4138,7 @@ begin
|
||||
begin
|
||||
//DebugLn('TSourceNotebook.LoadFindInFilesHistory ',dbgsName(TextToFindComboBox),' ',dbgsName(FindHistory));
|
||||
TextToFindComboBox.Items.Assign(FindHistory);
|
||||
ReplaceTextComboBox.Items.Assign(ReplaceHistory);
|
||||
if not EditorOpts.FindTextAtCursor then begin
|
||||
if TextToFindComboBox.Items.Count>0 then begin
|
||||
//debugln('TSourceNotebook.LoadFindInFilesHistory A TextToFindComboBox.Text=',TextToFindComboBox.Text);
|
||||
@ -4214,11 +4215,12 @@ var
|
||||
ListIndex: integer;
|
||||
begin
|
||||
ShowSearchResultsView;
|
||||
ListIndex:=SearchResultsView.AddResult(lisSearchFor+ASearchForm.SearchText,
|
||||
ASearchForm.SearchText,
|
||||
ASearchForm.SearchDirectory,
|
||||
ASearchForm.SearchMask,
|
||||
ASearchForm.SearchOptions);
|
||||
ListIndex:=SearchResultsView.AddSearch(lisSearchFor+ASearchForm.SearchText,
|
||||
ASearchForm.SearchText,
|
||||
ASearchForm.ReplaceText,
|
||||
ASearchForm.SearchDirectory,
|
||||
ASearchForm.SearchMask,
|
||||
ASearchForm.SearchOptions);
|
||||
|
||||
try
|
||||
SearchResultsView.BeginUpdate(ListIndex);
|
||||
@ -4275,6 +4277,7 @@ begin
|
||||
begin
|
||||
SearchOptions:= ADialog.Options;
|
||||
SearchText:= ADialog.FindText;
|
||||
ReplaceText:= ADialog.ReplaceText;
|
||||
SearchMask:= ADialog.FileMaskComboBox.Text;
|
||||
SearchDirectory:= ADialog.DirectoryComboBox.Text;
|
||||
end;//with
|
||||
@ -4321,9 +4324,9 @@ begin
|
||||
if FindInFilesDialog.FindText <>'' then
|
||||
begin
|
||||
case FindInFilesDialog.WhereRadioGroup.ItemIndex of
|
||||
Integer(0): FIFSearchProject(AProject, FindInFilesDialog);
|
||||
integer(1): FIFSearchOpenFiles(FindInFilesDialog);
|
||||
integer(2): FIFSearchDir(FindInFilesDialog);
|
||||
0: FIFSearchProject(AProject, FindInFilesDialog);
|
||||
1: FIFSearchOpenFiles(FindInFilesDialog);
|
||||
2: FIFSearchDir(FindInFilesDialog);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user