UPD: descriptions of Editor and Find files commands

ADD: primitive realization of search in opened tabs(without excluding repeated placed of search)
This commit is contained in:
meteu 2016-03-02 13:13:49 +00:00
commit 28bdfb9259
5 changed files with 167 additions and 61 deletions

View file

@ -2,10 +2,10 @@ object frmFindDlg: TfrmFindDlg
Left = 275
Height = 397
Top = 176
Width = 839
Width = 875
Caption = 'Find files'
ClientHeight = 397
ClientWidth = 839
ClientWidth = 875
Constraints.MinHeight = 360
Constraints.MinWidth = 585
KeyPreview = True
@ -23,18 +23,18 @@ object frmFindDlg: TfrmFindDlg
Left = 3
Height = 391
Top = 3
Width = 833
Width = 869
Align = alClient
BorderSpacing.Around = 3
BevelOuter = bvNone
ClientHeight = 391
ClientWidth = 833
ClientWidth = 869
TabOrder = 0
object pgcSearch: TPageControl
Left = 0
Height = 391
Top = 0
Width = 724
Width = 760
ActivePage = tsStandard
Align = alClient
TabIndex = 0
@ -45,7 +45,7 @@ object frmFindDlg: TfrmFindDlg
ChildSizing.LeftRightSpacing = 3
ChildSizing.TopBottomSpacing = 3
ClientHeight = 363
ClientWidth = 716
ClientWidth = 752
OnEnter = tsStandardEnter
object gbDirectories: TGroupBox
AnchorSideLeft.Control = tsStandard
@ -55,13 +55,13 @@ object frmFindDlg: TfrmFindDlg
Left = 3
Height = 116
Top = 3
Width = 710
Width = 746
Anchors = [akTop, akLeft, akRight]
AutoSize = True
Caption = 'Directories'
ChildSizing.LeftRightSpacing = 5
ClientHeight = 96
ClientWidth = 706
ClientWidth = 742
TabOrder = 0
OnResize = gbDirectoriesResize
object lblFindPathStart: TLabel
@ -81,7 +81,7 @@ object frmFindDlg: TfrmFindDlg
AnchorSideTop.Control = gbDirectories
AnchorSideRight.Control = gbDirectories
AnchorSideRight.Side = asrBottom
Left = 597
Left = 633
Height = 19
Top = 0
Width = 104
@ -97,7 +97,7 @@ object frmFindDlg: TfrmFindDlg
Left = 5
Height = 23
Top = 19
Width = 670
Width = 706
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
@ -127,7 +127,7 @@ object frmFindDlg: TfrmFindDlg
Height = 23
Hint = 'Enter directories names that should be excluded from search separated with ";"'
Top = 60
Width = 491
Width = 527
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Right = 5
BorderSpacing.Bottom = 5
@ -140,7 +140,7 @@ object frmFindDlg: TfrmFindDlg
AnchorSideTop.Control = lblExcludeDirectories
AnchorSideRight.Control = gbDirectories
AnchorSideRight.Side = asrBottom
Left = 501
Left = 537
Height = 51
Top = 45
Width = 200
@ -176,7 +176,7 @@ object frmFindDlg: TfrmFindDlg
AnchorSideRight.Control = cbFollowSymLinks
AnchorSideBottom.Control = cbFollowSymLinks
AnchorSideBottom.Side = asrBottom
Left = 422
Left = 458
Height = 19
Top = 0
Width = 169
@ -186,6 +186,20 @@ object frmFindDlg: TfrmFindDlg
OnChange = cbSelectedFilesChange
TabOrder = 4
end
object cbOpenedTabs: TCheckBox
AnchorSideRight.Control = cbSelectedFiles
AnchorSideBottom.Control = cbSelectedFiles
AnchorSideBottom.Side = asrBottom
Left = 365
Height = 19
Top = 0
Width = 87
Anchors = [akRight, akBottom]
BorderSpacing.Right = 6
Caption = 'Opened tabs'
OnChange = cbOpenedTabsChange
TabOrder = 5
end
end
object gbFiles: TGroupBox
AnchorSideLeft.Control = tsStandard
@ -196,13 +210,13 @@ object frmFindDlg: TfrmFindDlg
Left = 3
Height = 108
Top = 119
Width = 710
Width = 746
Anchors = [akTop, akLeft, akRight]
AutoSize = True
Caption = 'Files'
ChildSizing.LeftRightSpacing = 5
ClientHeight = 88
ClientWidth = 706
ClientWidth = 742
TabOrder = 1
object lblFindFileMask: TLabel
AnchorSideLeft.Control = gbFiles
@ -229,7 +243,7 @@ object frmFindDlg: TfrmFindDlg
Height = 23
Hint = 'Enter files names separated with ";"'
Top = 19
Width = 696
Width = 732
Anchors = [akTop, akLeft, akRight]
ItemHeight = 15
ParentShowHint = False
@ -260,7 +274,7 @@ object frmFindDlg: TfrmFindDlg
Height = 23
Hint = 'Enter files names that should be excluded from search separated with ";"'
Top = 60
Width = 696
Width = 732
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Bottom = 5
ItemHeight = 15
@ -272,7 +286,7 @@ object frmFindDlg: TfrmFindDlg
AnchorSideRight.Control = cbRegExp
AnchorSideBottom.Control = cbRegExp
AnchorSideBottom.Side = asrBottom
Left = 414
Left = 450
Height = 19
Top = 0
Width = 163
@ -288,7 +302,7 @@ object frmFindDlg: TfrmFindDlg
AnchorSideTop.Control = gbFiles
AnchorSideRight.Control = gbFiles
AnchorSideRight.Side = asrBottom
Left = 583
Left = 619
Height = 19
Top = 0
Width = 118
@ -301,7 +315,7 @@ object frmFindDlg: TfrmFindDlg
AnchorSideRight.Control = cbPartialNameSearch
AnchorSideBottom.Control = cbPartialNameSearch
AnchorSideBottom.Side = asrBottom
Left = 294
Left = 330
Height = 19
Top = 0
Width = 114
@ -321,13 +335,13 @@ object frmFindDlg: TfrmFindDlg
Left = 3
Height = 123
Top = 227
Width = 710
Width = 746
Anchors = [akTop, akLeft, akRight]
AutoSize = True
Caption = 'Find Data'
ChildSizing.TopBottomSpacing = 2
ClientHeight = 103
ClientWidth = 706
ClientWidth = 742
TabOrder = 2
object lblEncoding: TLabel
AnchorSideLeft.Control = gbFindData
@ -398,7 +412,7 @@ object frmFindDlg: TfrmFindDlg
Left = 112
Height = 23
Top = 2
Width = 591
Width = 627
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 3
BorderSpacing.Right = 3
@ -414,7 +428,7 @@ object frmFindDlg: TfrmFindDlg
Left = 112
Height = 23
Top = 28
Width = 591
Width = 627
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 3
BorderSpacing.Right = 3
@ -706,6 +720,8 @@ object frmFindDlg: TfrmFindDlg
Date = 40598
Time = 0.925837488422985
UseDefaultSeparators = True
HideDateTimeParts = []
MonthNames = 'Long'
OnChange = ZVDateFromChange
end
object ZVDateTo: TDateTimePicker
@ -732,6 +748,8 @@ object frmFindDlg: TfrmFindDlg
Date = 40598
Time = 0.927234872688132
UseDefaultSeparators = True
HideDateTimeParts = []
MonthNames = 'Long'
OnChange = ZVDateToChange
end
object ZVTimeFrom: TDateTimePicker
@ -760,6 +778,8 @@ object frmFindDlg: TfrmFindDlg
Date = 40598
Time = 0.930765335644537
UseDefaultSeparators = True
HideDateTimeParts = []
MonthNames = 'Long'
OnChange = ZVTimeFromChange
end
object ZVTimeTo: TDateTimePicker
@ -788,6 +808,8 @@ object frmFindDlg: TfrmFindDlg
Date = 40598
Time = 0.930765335644537
UseDefaultSeparators = True
HideDateTimeParts = []
MonthNames = 'Long'
OnChange = ZVTimeToChange
end
object lblAttributes: TLabel
@ -1251,7 +1273,7 @@ object frmFindDlg: TfrmFindDlg
end
end
object pnlButtons: TPanel
Left = 730
Left = 766
Height = 351
Top = 40
Width = 103
@ -1389,55 +1411,68 @@ object frmFindDlg: TfrmFindDlg
object actList: TActionList
left = 424
object actIntelliFocus: TAction
Caption = 'actIntelliFocus'
Caption = 'Find Data'
OnExecute = actExecute
end
object actStart: TAction
Caption = 'actStart'
Caption = 'Start'
OnExecute = actExecute
end
object actCancel: TAction
Caption = 'actCancel'
Caption = 'Cancel'
OnExecute = actExecute
end
object actClose: TAction
Caption = 'actClose'
Caption = 'Close'
OnExecute = actExecute
end
object actNewSearch: TAction
Caption = 'actNewSearch'
Caption = 'New search'
OnExecute = actExecute
end
object actLastSearch: TAction
Caption = 'actLastSearch'
Caption = 'Last search'
OnExecute = actExecute
end
object actView: TAction
Caption = 'actView'
Caption = 'View'
OnExecute = actExecute
end
object actEdit: TAction
Caption = 'actEdit'
Caption = 'Edit'
OnExecute = actExecute
end
object actGoToFile: TAction
Caption = 'actGoToFile'
Caption = 'Go to file'
OnExecute = actExecute
end
object actFeedToListbox: TAction
Caption = 'actFeedToListbox'
Caption = 'Feed to listbox'
OnExecute = actExecute
end
object actPageStandard: TAction
Caption = 'actPageStandard'
Caption = 'Go to page "Standard"'
OnExecute = actExecute
end
object actPageAdvanced: TAction
Caption = 'actPageAdvanced'
Caption = 'Go to page "Advanced"'
OnExecute = actExecute
end
object actPagePlugins: TAction
Caption = 'actPagePlugins'
Caption = 'Go to page "Plugins"'
OnExecute = actExecute
end
object actPageLoadSave: TAction
Caption = 'actPageLoadSave'
Caption = 'Go to page "Load/Save"'
OnExecute = actExecute
end
object actPageResults: TAction
Caption = 'actPageResults'
Caption = 'Go to page "Results"'
OnExecute = actExecute
end
object actCancelClose: TAction
Caption = 'Cancel search and close window'
OnExecute = actExecute
end
end
end

View file

@ -7,6 +7,7 @@ TFRMFINDDLG.LBLEXCLUDEDIRECTORIES.CAPTION=E&xclude subdirectories
TFRMFINDDLG.CMBEXCLUDEDIRECTORIES.HINT=Enter directories names that should be excluded from search separated with ";"
TFRMFINDDLG.LBLSEARCHDEPTH.CAPTION=Search su&bdirectories:
TFRMFINDDLG.CBSELECTEDFILES.CAPTION=Selected directories and &files
TFRMFINDDLG.CBOPENEDTABS.CAPTION=Opened tabs
TFRMFINDDLG.GBFILES.CAPTION=Files
TFRMFINDDLG.LBLFINDFILEMASK.CAPTION=&File mask
TFRMFINDDLG.CMBFINDFILEMASK.HINT=Enter files names separated with ";"
@ -60,18 +61,19 @@ TFRMFINDDLG.MISHOWINVIEWER.CAPTION=Show In Viewer
TFRMFINDDLG.MISHOWINEDITOR.CAPTION=Show In Editor
TFRMFINDDLG.MIREMOVEFROMLLIST.CAPTION=Remove from list
TFRMFINDDLG.MISHOWALLFOUND.CAPTION=Show all found items
TFRMFINDDLG.ACTINTELLIFOCUS.CAPTION=actIntelliFocus
TFRMFINDDLG.ACTSTART.CAPTION=actStart
TFRMFINDDLG.ACTCANCEL.CAPTION=actCancel
TFRMFINDDLG.ACTCLOSE.CAPTION=actClose
TFRMFINDDLG.ACTNEWSEARCH.CAPTION=actNewSearch
TFRMFINDDLG.ACTLASTSEARCH.CAPTION=actLastSearch
TFRMFINDDLG.ACTVIEW.CAPTION=actView
TFRMFINDDLG.ACTEDIT.CAPTION=actEdit
TFRMFINDDLG.ACTGOTOFILE.CAPTION=actGoToFile
TFRMFINDDLG.ACTFEEDTOLISTBOX.CAPTION=actFeedToListbox
TFRMFINDDLG.ACTPAGESTANDARD.CAPTION=actPageStandard
TFRMFINDDLG.ACTPAGEADVANCED.CAPTION=actPageAdvanced
TFRMFINDDLG.ACTPAGEPLUGINS.CAPTION=actPagePlugins
TFRMFINDDLG.ACTPAGELOADSAVE.CAPTION=actPageLoadSave
TFRMFINDDLG.ACTPAGERESULTS.CAPTION=actPageResults
TFRMFINDDLG.ACTINTELLIFOCUS.CAPTION=Find Data
TFRMFINDDLG.ACTSTART.CAPTION=Start
TFRMFINDDLG.ACTCANCEL.CAPTION=Cancel
TFRMFINDDLG.ACTCLOSE.CAPTION=Close
TFRMFINDDLG.ACTNEWSEARCH.CAPTION=New search
TFRMFINDDLG.ACTLASTSEARCH.CAPTION=Last search
TFRMFINDDLG.ACTVIEW.CAPTION=View
TFRMFINDDLG.ACTEDIT.CAPTION=Edit
TFRMFINDDLG.ACTGOTOFILE.CAPTION=Go to file
TFRMFINDDLG.ACTFEEDTOLISTBOX.CAPTION=Feed to listbox
TFRMFINDDLG.ACTPAGESTANDARD.CAPTION=Go to page "Standard"
TFRMFINDDLG.ACTPAGEADVANCED.CAPTION=Go to page "Advanced"
TFRMFINDDLG.ACTPAGEPLUGINS.CAPTION=Go to page "Plugins"
TFRMFINDDLG.ACTPAGELOADSAVE.CAPTION=Go to page "Load/Save"
TFRMFINDDLG.ACTPAGERESULTS.CAPTION=Go to page "Results"
TFRMFINDDLG.ACTCANCELCLOSE.CAPTION=Cancel search and close window

View file

@ -52,6 +52,7 @@ type
actEdit: TAction;
actGoToFile: TAction;
actFeedToListbox: TAction;
actCancelClose: TAction;
actPageResults: TAction;
actPageLoadSave: TAction;
actPagePlugins: TAction;
@ -96,6 +97,7 @@ type
cbSelectedFiles: TCheckBox;
cbTextRegExp: TCheckBox;
cbFindInArchive: TCheckBox;
cbOpenedTabs: TCheckBox;
cmbExcludeDirectories: TComboBoxWithDelItems;
cmbNotOlderThanUnit: TComboBox;
cmbFileSizeUnit: TComboBox;
@ -173,6 +175,7 @@ type
procedure cbDateFromChange(Sender: TObject);
procedure cbDateToChange(Sender: TObject);
procedure cbFindInArchiveChange(Sender: TObject);
procedure cbOpenedTabsChange(Sender: TObject);
procedure cbPartialNameSearchChange(Sender: TObject);
procedure cbRegExpChange(Sender: TObject);
procedure cbTextRegExpChange(Sender: TObject);
@ -803,6 +806,13 @@ begin
cbReplaceTextChange(cbReplaceText);
end;
procedure TfrmFindDlg.cbOpenedTabsChange(Sender: TObject);
begin
cbSelectedFiles.Enabled:=not cbOpenedTabs.Checked;
cbFollowSymLinks.Enabled:=not cbOpenedTabs.Checked;
edtFindPathStart.Enabled:=not cbOpenedTabs.Checked;
end;
procedure TfrmFindDlg.cbPartialNameSearchChange(Sender: TObject);
begin
if cbPartialNameSearch.Checked then cbRegExp.Checked:=False;
@ -1179,8 +1189,14 @@ begin
end
else
begin
if cbSelectedFiles.Checked then
if cbSelectedFiles.Checked then PassedSelectedFiles := FSelectedFiles;
if cbOpenedTabs.Checked then
begin
frmMain.GetListOpenedPaths(FSelectedFiles);
PassedSelectedFiles := FSelectedFiles;
end;
FFindThread := TFindThread.Create(SearchTemplate, PassedSelectedFiles);
with FFindThread do
begin
@ -1192,6 +1208,8 @@ begin
FFindThread.Start;
FUpdateTimer.Enabled := True;
FUpdateTimer.OnTimer(FUpdateTimer);
FRButtonPanelSender:=nil;
end;
except
StopSearch;

View file

@ -721,6 +721,7 @@ type
function FrameLeft: TFileView;
function FrameRight: TFileView;
procedure ForEachView(CallbackFunction: TForEachViewFunction; UserData: Pointer);
procedure GetListOpenedPaths(out APaths:TStringList);
//check selected count and generate correct msg, parameters is lng indexs
Function GetFileDlgStr(sLngOne, sLngMulti : String; Files: TFiles):String;
procedure HotDirSelected(Sender:TObject);
@ -2514,6 +2515,23 @@ begin
EnumerateNotebook(nbRight);
end;
procedure TfrmMain.GetListOpenedPaths(out APaths: TStringList);
procedure GetNotebookPaths(ANoteBook: TFileViewNotebook;out notePaths: TStringList);
var
i: Integer;
s :string;
begin
for i := 0 to ANoteBook.PageCount - 1 do
begin
s:=ANoteBook.View[i].CurrentPath;
notePaths.Add(s);
end;
end;
begin
GetNotebookPaths(nbLeft,APaths);
GetNotebookPaths(nbRight,APaths);
end;
procedure TfrmMain.AppException(Sender: TObject; E: Exception);
begin
WriteExceptionToErrorFile;

View file

@ -130,6 +130,7 @@ end;
destructor TFindThread.Destroy;
begin
// FItems.Add('End');
FreeAndNil(FFilesMasks);
FreeAndNil(FExcludeFiles);
FreeThenNil(FLinkTargets);
@ -166,12 +167,22 @@ begin
// Search only selected directories.
for I := 0 to FSelectedFiles.Count - 1 do
begin
if FindFirstEx(FSelectedFiles[I], faAnyFile, sr) = 0 then
sTemp:=FSelectedFiles[I];
while sTemp <> EmptyStr do
begin
if FPS_ISDIR(sr.Attr) then
WalkAdr(FSelectedFiles[I])
else
DoFile(ExtractFileDir(FSelectedFiles[I]), sr);
sPath:= Copy2SymbDel(sTemp, ';');
sPath:= ExcludeBackPathDelimiter(sPath);
if FindFirstEx(sPath, faAnyFile, sr) = 0 then
begin
if FPS_ISDIR(sr.Attr) then
WalkAdr(FSelectedFiles[I])
else
DoFile(ExtractFileDir(FSelectedFiles[I]), sr);
end;
// WalkAdr(sPath);
end;
FindCloseEx(sr);
end;
@ -714,6 +725,28 @@ begin
begin
FFoundFile := sNewDir + PathDelim + sr.Name;
Synchronize(@AddFile);
{
Move(sNewDir[1] ,FPool[FPoolOfs],length(sNewDir));
inc(FPoolOfs,length(sNewDir));
FPool[FPoolOfs]:=PathDelim;
inc(FPoolOfs,length(PathDelim));
Move(sr.Name[1],FPool[FPoolOfs],length(sr.Name));
inc(FPoolOfs,length(sr.Name));
FPool[FPoolOfs]:=',';
inc(FPoolOfs,1);
// FPool[FPoolOfs]:=#10;
// inc(FPoolOfs,1);
if FPoolOfs>970000 then FPoolOfs:=1;
}
Inc(FFilesFound);
end;