mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Option to delay loading file list in a tab until it is activated.
This commit is contained in:
parent
4567cab875
commit
0848df215e
9 changed files with 226 additions and 123 deletions
|
|
@ -174,6 +174,7 @@ object frmMain: TfrmMain
|
|||
Constraints.MinHeight = 24
|
||||
NumGlyphs = 0
|
||||
OnMouseUp = btnDriveMouseUp
|
||||
ShowCaption = False
|
||||
end
|
||||
object btnLeftHome: TSpeedButton
|
||||
Left = 465
|
||||
|
|
@ -306,6 +307,7 @@ object frmMain: TfrmMain
|
|||
Constraints.MinHeight = 24
|
||||
NumGlyphs = 0
|
||||
OnMouseUp = btnDriveMouseUp
|
||||
ShowCaption = False
|
||||
end
|
||||
object btnRightHome: TSpeedButton
|
||||
Left = 201
|
||||
|
|
|
|||
|
|
@ -3374,23 +3374,31 @@ begin
|
|||
end;
|
||||
|
||||
function TfrmMain.CreateFileView(sType: String; Page: TFileViewPage; AConfig: TIniFileEx; ASectionName: String; ATabIndex: Integer): TFileView;
|
||||
var
|
||||
FileViewFlags: TFileViewFlags = [];
|
||||
begin
|
||||
// This function should be changed to a separate TFileView factory.
|
||||
|
||||
if gDelayLoadingTabs then
|
||||
FileViewFlags := [fvfDelayLoadingFiles];
|
||||
if sType = 'columns' then
|
||||
Result := TColumnsFileView.Create(Page, AConfig, ASectionName, ATabIndex)
|
||||
Result := TColumnsFileView.Create(Page, AConfig, ASectionName, ATabIndex, FileViewFlags)
|
||||
else
|
||||
raise Exception.Create('Invalid file view type');
|
||||
end;
|
||||
|
||||
function TfrmMain.CreateFileView(sType: String; Page: TFileViewPage; AConfig: TXmlConfig; ANode: TXmlNode): TFileView;
|
||||
var
|
||||
FileViewFlags: TFileViewFlags = [];
|
||||
begin
|
||||
// This function should be changed to a separate TFileView factory.
|
||||
|
||||
if gDelayLoadingTabs then
|
||||
FileViewFlags := [fvfDelayLoadingFiles];
|
||||
if sType = 'columns' then
|
||||
Result := TColumnsFileView.Create(Page, AConfig, ANode)
|
||||
Result := TColumnsFileView.Create(Page, AConfig, ANode, FileViewFlags)
|
||||
else if sType = 'brief' then
|
||||
Result := TBriefFileView.Create(Page, AConfig, ANode)
|
||||
Result := TBriefFileView.Create(Page, AConfig, ANode, FileViewFlags)
|
||||
else
|
||||
raise Exception.Create('Invalid file view type');
|
||||
end;
|
||||
|
|
@ -3525,6 +3533,7 @@ var
|
|||
iActiveTab: Integer;
|
||||
Page: TFileViewPage;
|
||||
AFileView: TFileView;
|
||||
AFileViewFlags: TFileViewFlags;
|
||||
aFileSource: IFileSource;
|
||||
RootNode, TabNode, ViewNode: TXmlNode;
|
||||
begin
|
||||
|
|
@ -3602,7 +3611,11 @@ begin
|
|||
Page := ANoteBook.AddPage(EmptyStr);
|
||||
Page.UpdateCaption(GetLastDir(sPath));
|
||||
aFileSource := TFileSystemFileSource.GetFileSource;
|
||||
AFileView := TColumnsFileView.Create(Page, aFileSource, sPath);
|
||||
if gDelayLoadingTabs then
|
||||
AFileViewFlags := [fvfDelayLoadingFiles]
|
||||
else
|
||||
AFileViewFlags := [];
|
||||
AFileView := TColumnsFileView.Create(Page, aFileSource, sPath, AFileViewFlags);
|
||||
AssignEvents(AFileView);
|
||||
end
|
||||
else if Assigned(RootNode) then
|
||||
|
|
@ -4326,6 +4339,13 @@ begin
|
|||
LoadTabsXml(nbLeft);
|
||||
LoadTabsXml(nbRight);
|
||||
end;
|
||||
|
||||
if gDelayLoadingTabs then
|
||||
begin
|
||||
// Load only the current active tab of each notebook.
|
||||
FrameLeft.Flags := FrameLeft.Flags - [fvfDelayLoadingFiles];
|
||||
FrameRight.Flags := FrameRight.Flags - [fvfDelayLoadingFiles];
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.LoadWindowState;
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
||||
Height = 403
|
||||
Width = 616
|
||||
ClientHeight = 403
|
||||
ClientWidth = 616
|
||||
Height = 494
|
||||
Width = 634
|
||||
ClientHeight = 494
|
||||
ClientWidth = 634
|
||||
object gbSorting: TGroupBox[0]
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 104
|
||||
Height = 132
|
||||
Top = 6
|
||||
Width = 604
|
||||
Width = 622
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
|
|
@ -21,15 +21,15 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
ChildSizing.HorizontalSpacing = 6
|
||||
ChildSizing.VerticalSpacing = 12
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ClientHeight = 86
|
||||
ClientWidth = 600
|
||||
ClientHeight = 110
|
||||
ClientWidth = 618
|
||||
TabOrder = 0
|
||||
object lblSortMethod: TLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 12
|
||||
Height = 14
|
||||
Height = 22
|
||||
Top = 8
|
||||
Width = 92
|
||||
Width = 127
|
||||
Caption = 'Sort &method:'
|
||||
ParentColor = False
|
||||
end
|
||||
|
|
@ -40,13 +40,13 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = gbSorting
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 114
|
||||
Height = 21
|
||||
Left = 149
|
||||
Height = 29
|
||||
Top = 5
|
||||
Width = 474
|
||||
Width = 457
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 10
|
||||
ItemHeight = 13
|
||||
ItemHeight = 21
|
||||
Items.Strings = (
|
||||
'Alphabetical, considering accents'
|
||||
'Natural sorting: alphabetical and numbers'
|
||||
|
|
@ -56,9 +56,9 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
end
|
||||
object lblCaseSensitivity: TLabel
|
||||
Left = 12
|
||||
Height = 14
|
||||
Top = 34
|
||||
Width = 92
|
||||
Height = 22
|
||||
Top = 42
|
||||
Width = 127
|
||||
Caption = 'Case sensitivity:'
|
||||
ParentColor = False
|
||||
end
|
||||
|
|
@ -69,13 +69,13 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = gbSorting
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 114
|
||||
Height = 21
|
||||
Top = 31
|
||||
Width = 474
|
||||
Left = 149
|
||||
Height = 29
|
||||
Top = 39
|
||||
Width = 457
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 10
|
||||
ItemHeight = 13
|
||||
ItemHeight = 21
|
||||
Items.Strings = (
|
||||
'not case sensitive'
|
||||
'according to locale settings (aAbBcC)'
|
||||
|
|
@ -86,9 +86,9 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
end
|
||||
object lblSortFolderMode: TLabel
|
||||
Left = 12
|
||||
Height = 14
|
||||
Top = 60
|
||||
Width = 92
|
||||
Height = 22
|
||||
Top = 76
|
||||
Width = 127
|
||||
Caption = 'Sorting directories:'
|
||||
ParentColor = False
|
||||
end
|
||||
|
|
@ -99,13 +99,13 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = gbSorting
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 114
|
||||
Height = 21
|
||||
Top = 57
|
||||
Width = 474
|
||||
Left = 149
|
||||
Height = 29
|
||||
Top = 73
|
||||
Width = 457
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 10
|
||||
ItemHeight = 13
|
||||
ItemHeight = 21
|
||||
Items.Strings = (
|
||||
'sort by name and show first'
|
||||
'sort like files and show first'
|
||||
|
|
@ -122,9 +122,9 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 131
|
||||
Top = 221
|
||||
Width = 604
|
||||
Height = 216
|
||||
Top = 249
|
||||
Width = 622
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
|
|
@ -133,49 +133,57 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
ChildSizing.VerticalSpacing = 4
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 113
|
||||
ClientWidth = 600
|
||||
ClientHeight = 194
|
||||
ClientWidth = 618
|
||||
TabOrder = 1
|
||||
object cbSpaceMovesDown: TCheckBox
|
||||
Left = 6
|
||||
Height = 17
|
||||
Height = 27
|
||||
Top = 6
|
||||
Width = 424
|
||||
Width = 589
|
||||
Caption = 'When selecting files with <SPACEBAR>, move down to next file (as with <INSERT>)'
|
||||
TabOrder = 0
|
||||
end
|
||||
object cbDirBrackets: TCheckBox
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 27
|
||||
Width = 424
|
||||
Height = 27
|
||||
Top = 37
|
||||
Width = 589
|
||||
Caption = 'Show square brackets around directories'
|
||||
TabOrder = 1
|
||||
end
|
||||
object cbShowSystemFiles: TCheckBox
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 48
|
||||
Width = 424
|
||||
Height = 27
|
||||
Top = 68
|
||||
Width = 589
|
||||
Caption = 'Show system and hidden files'
|
||||
TabOrder = 2
|
||||
end
|
||||
object cbListFilesInThread: TCheckBox
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 69
|
||||
Width = 424
|
||||
Height = 27
|
||||
Top = 99
|
||||
Width = 589
|
||||
Caption = 'Load file list in separate thread'
|
||||
TabOrder = 3
|
||||
end
|
||||
object cbLoadIconsSeparately: TCheckBox
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 90
|
||||
Width = 424
|
||||
Height = 27
|
||||
Top = 130
|
||||
Width = 589
|
||||
Caption = 'Load icons after file list'
|
||||
TabOrder = 4
|
||||
end
|
||||
object cbDelayLoadingTabs: TCheckBox
|
||||
Left = 6
|
||||
Height = 27
|
||||
Top = 161
|
||||
Width = 589
|
||||
Caption = 'Don''t load file list until a tab is activated'
|
||||
TabOrder = 5
|
||||
end
|
||||
end
|
||||
object gbFormatting: TGroupBox[2]
|
||||
AnchorSideLeft.Control = Owner
|
||||
|
|
@ -185,24 +193,24 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 99
|
||||
Top = 116
|
||||
Width = 604
|
||||
Top = 144
|
||||
Width = 622
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Formatting'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ClientHeight = 81
|
||||
ClientWidth = 600
|
||||
ClientHeight = 77
|
||||
ClientWidth = 618
|
||||
TabOrder = 2
|
||||
object lblDateTimeFormat: TLabel
|
||||
AnchorSideLeft.Control = gbFormatting
|
||||
AnchorSideTop.Control = cbDateTimeFormat
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 8
|
||||
Height = 14
|
||||
Height = 22
|
||||
Top = 9
|
||||
Width = 107
|
||||
Width = 148
|
||||
BorderSpacing.Left = 8
|
||||
Caption = 'Date and time format:'
|
||||
ParentColor = False
|
||||
|
|
@ -212,9 +220,9 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = gbFormatting
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 593
|
||||
Left = 611
|
||||
Height = 1
|
||||
Top = 16
|
||||
Top = 20
|
||||
Width = 1
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
|
|
@ -228,15 +236,15 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = gbFormatting
|
||||
AnchorSideRight.Control = lblDateTimeExample
|
||||
Left = 123
|
||||
Height = 21
|
||||
Left = 164
|
||||
Height = 29
|
||||
Top = 6
|
||||
Width = 462
|
||||
Width = 439
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 8
|
||||
ItemHeight = 13
|
||||
ItemHeight = 21
|
||||
Items.Strings = (
|
||||
'yyyy.mm.dd hh:mm:ss'
|
||||
'yyyy.mm.dd hh:mm'
|
||||
|
|
@ -255,9 +263,9 @@ inherited frmOptionsFilesViews: TfrmOptionsFilesViews
|
|||
AnchorSideTop.Control = cbDateTimeFormat
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 33
|
||||
Width = 117
|
||||
Height = 27
|
||||
Top = 41
|
||||
Width = 169
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Short file size format'
|
||||
TabOrder = 1
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ TFRMOPTIONSFILESVIEWS.CBDIRBRACKETS.CAPTION=Show square brackets around director
|
|||
TFRMOPTIONSFILESVIEWS.CBSHOWSYSTEMFILES.CAPTION=Show system and hidden files
|
||||
TFRMOPTIONSFILESVIEWS.CBLISTFILESINTHREAD.CAPTION=Load file list in separate thread
|
||||
TFRMOPTIONSFILESVIEWS.CBLOADICONSSEPARATELY.CAPTION=Load icons after file list
|
||||
TFRMOPTIONSFILESVIEWS.CBDELAYLOADINGTABS.CAPTION=Don't load file list until a tab is activated
|
||||
TFRMOPTIONSFILESVIEWS.GBFORMATTING.CAPTION=Formatting
|
||||
TFRMOPTIONSFILESVIEWS.LBLDATETIMEFORMAT.CAPTION=Date and time format:
|
||||
TFRMOPTIONSFILESVIEWS.CBSHORTFILESIZEFORMAT.CAPTION=Short file size format
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ type
|
|||
cbDirBrackets: TCheckBox;
|
||||
cbListFilesInThread: TCheckBox;
|
||||
cbLoadIconsSeparately: TCheckBox;
|
||||
cbDelayLoadingTabs: TCheckBox;
|
||||
cbShortFileSizeFormat: TCheckBox;
|
||||
cbShowSystemFiles: TCheckBox;
|
||||
cbSortMethod: TComboBox;
|
||||
|
|
@ -108,6 +109,7 @@ begin
|
|||
cbShowSystemFiles.Checked:= gShowSystemFiles;
|
||||
cbListFilesInThread.Checked:= gListFilesInThread;
|
||||
cbLoadIconsSeparately.Checked:= gLoadIconsSeparately;
|
||||
cbDelayLoadingTabs.Checked:= gDelayLoadingTabs;
|
||||
end;
|
||||
|
||||
function TfrmOptionsFilesViews.Save: TOptionsEditorSaveFlags;
|
||||
|
|
@ -130,6 +132,7 @@ begin
|
|||
gShowSystemFiles:= cbShowSystemFiles.Checked;
|
||||
gListFilesInThread:= cbListFilesInThread.Checked;
|
||||
gLoadIconsSeparately:= cbLoadIconsSeparately.Checked;
|
||||
gDelayLoadingTabs := cbDelayLoadingTabs.Checked;
|
||||
|
||||
Result := [];
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ type
|
|||
function GetActiveDisplayFile: TDisplayFile; override;
|
||||
procedure Resize; override;
|
||||
public
|
||||
constructor Create(AOwner: TWinControl; AConfig: TXmlConfig; ANode: TXmlNode); override;
|
||||
constructor Create(AOwner: TWinControl; AConfig: TXmlConfig; ANode: TXmlNode; AFlags: TFileViewFlags = []); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure AddFileSource(aFileSource: IFileSource; aPath: String); override;
|
||||
|
|
@ -721,13 +721,12 @@ end;
|
|||
|
||||
procedure TBriefFileView.AfterChangePath;
|
||||
begin
|
||||
inherited AfterChangePath;
|
||||
|
||||
// FUpdatingGrid := True;
|
||||
dgPanel.Row := 0;
|
||||
// FUpdatingGrid := False;
|
||||
|
||||
MakeFileSourceFileList;
|
||||
inherited AfterChangePath;
|
||||
|
||||
pnlHeader.UpdatePathLabel;
|
||||
end;
|
||||
|
||||
|
|
@ -759,17 +758,18 @@ begin
|
|||
end;
|
||||
|
||||
constructor TBriefFileView.Create(AOwner: TWinControl; AConfig: TXmlConfig;
|
||||
ANode: TXmlNode);
|
||||
ANode: TXmlNode; AFlags: TFileViewFlags = []);
|
||||
begin
|
||||
inherited Create(AOwner, AConfig, ANode);
|
||||
inherited Create(AOwner, AConfig, ANode, AFlags);
|
||||
|
||||
LoadConfiguration(AConfig, ANode);
|
||||
|
||||
// Update view before making file source file list,
|
||||
// so that file list isn't unnecessarily displayed twice.
|
||||
UpdateView;
|
||||
|
||||
if FileSourcesCount > 0 then
|
||||
begin
|
||||
// Update view before making file source file list,
|
||||
// so that file list isn't unnecessarily displayed twice.
|
||||
UpdateView;
|
||||
MakeFileSourceFileList;
|
||||
end;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -299,10 +299,10 @@ type
|
|||
isSlave:boolean;
|
||||
//---------------------
|
||||
|
||||
constructor Create(AOwner: TWinControl; AFileSource: IFileSource; APath: String); override;
|
||||
constructor Create(AOwner: TWinControl; AFileView: TFileView); override;
|
||||
constructor Create(AOwner: TWinControl; AConfig: TIniFileEx; ASectionName: String; ATabIndex: Integer); override;
|
||||
constructor Create(AOwner: TWinControl; AConfig: TXmlConfig; ANode: TXmlNode); override;
|
||||
constructor Create(AOwner: TWinControl; AFileSource: IFileSource; APath: String; AFlags: TFileViewFlags = []); override;
|
||||
constructor Create(AOwner: TWinControl; AFileView: TFileView; AFlags: TFileViewFlags = []); override;
|
||||
constructor Create(AOwner: TWinControl; AConfig: TIniFileEx; ASectionName: String; ATabIndex: Integer; AFlags: TFileViewFlags = []); override;
|
||||
constructor Create(AOwner: TWinControl; AConfig: TXmlConfig; ANode: TXmlNode; AFlags: TFileViewFlags = []); override;
|
||||
|
||||
destructor Destroy; override;
|
||||
|
||||
|
|
@ -1156,20 +1156,18 @@ end;
|
|||
|
||||
procedure TColumnsFileView.AfterChangePath;
|
||||
begin
|
||||
inherited AfterChangePath;
|
||||
|
||||
FUpdatingGrid := True;
|
||||
dgPanel.Row := 0;
|
||||
FUpdatingGrid := False;
|
||||
|
||||
MakeFileSourceFileList;
|
||||
inherited AfterChangePath;
|
||||
|
||||
pnlHeader.UpdatePathLabel;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.ShowRenameFileEdit(aFile: TFile);
|
||||
var
|
||||
ALeft, ATop, AWidth, AHeight: Integer;
|
||||
sFileName, sExtension: String;
|
||||
begin
|
||||
if FFileNameColumn <> -1 then
|
||||
begin
|
||||
|
|
@ -2224,9 +2222,9 @@ begin
|
|||
dgPanel.Options := dgPanel.Options - [goVertLine]
|
||||
end;
|
||||
|
||||
constructor TColumnsFileView.Create(AOwner: TWinControl; AFileSource: IFileSource; APath: String);
|
||||
constructor TColumnsFileView.Create(AOwner: TWinControl; AFileSource: IFileSource; APath: String; AFlags: TFileViewFlags = []);
|
||||
begin
|
||||
inherited Create(AOwner, AFileSource, APath);
|
||||
inherited Create(AOwner, AFileSource, APath, AFlags);
|
||||
|
||||
FFiles := TDisplayFiles.Create;
|
||||
FColumnsSorting := TColumnsSortings.Create;
|
||||
|
|
@ -2238,15 +2236,15 @@ begin
|
|||
MakeFileSourceFileList;
|
||||
end;
|
||||
|
||||
constructor TColumnsFileView.Create(AOwner: TWinControl; AFileView: TFileView);
|
||||
constructor TColumnsFileView.Create(AOwner: TWinControl; AFileView: TFileView; AFlags: TFileViewFlags = []);
|
||||
begin
|
||||
inherited Create(AOwner, AFileView);
|
||||
inherited Create(AOwner, AFileView, AFlags);
|
||||
UpdateView;
|
||||
end;
|
||||
|
||||
constructor TColumnsFileView.Create(AOwner: TWinControl; AConfig: TIniFileEx; ASectionName: String; ATabIndex: Integer);
|
||||
constructor TColumnsFileView.Create(AOwner: TWinControl; AConfig: TIniFileEx; ASectionName: String; ATabIndex: Integer; AFlags: TFileViewFlags = []);
|
||||
begin
|
||||
inherited Create(AOwner, AConfig, ASectionName, ATabIndex);
|
||||
inherited Create(AOwner, AConfig, ASectionName, ATabIndex, AFlags);
|
||||
|
||||
FFiles := TDisplayFiles.Create;
|
||||
FColumnsSorting := TColumnsSortings.Create;
|
||||
|
|
@ -2254,20 +2252,21 @@ begin
|
|||
LoadConfiguration(ASectionName, ATabIndex);
|
||||
end;
|
||||
|
||||
constructor TColumnsFileView.Create(AOwner: TWinControl; AConfig: TXmlConfig; ANode: TXmlNode);
|
||||
constructor TColumnsFileView.Create(AOwner: TWinControl; AConfig: TXmlConfig; ANode: TXmlNode; AFlags: TFileViewFlags = []);
|
||||
begin
|
||||
inherited Create(AOwner, AConfig, ANode);
|
||||
inherited Create(AOwner, AConfig, ANode, AFlags);
|
||||
|
||||
FFiles := TDisplayFiles.Create;
|
||||
FColumnsSorting := TColumnsSortings.Create;
|
||||
|
||||
LoadConfiguration(AConfig, ANode);
|
||||
|
||||
// Update view before making file source file list,
|
||||
// so that file list isn't unnecessarily displayed twice.
|
||||
UpdateView;
|
||||
|
||||
if FileSourcesCount > 0 then
|
||||
begin
|
||||
// Update view before making file source file list,
|
||||
// so that file list isn't unnecessarily displayed twice.
|
||||
UpdateView;
|
||||
MakeFileSourceFileList;
|
||||
end;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ type
|
|||
|
||||
TFileViewWorkers = specialize TFPGObjectList<TFileViewWorker>;
|
||||
|
||||
TFileViewFlag = (fvfDelayLoadingFiles, fvfDontLoadFiles, fvfDontWatch);
|
||||
TFileViewFlags = set of TFileViewFlag;
|
||||
|
||||
{en
|
||||
Base class for any view of a file or files.
|
||||
There should always be at least one file displayed on the view.
|
||||
|
|
@ -64,6 +67,7 @@ type
|
|||
}
|
||||
FFilePropertiesNeeded: TFilePropertiesTypes;
|
||||
FFileViewWorkers: TFileViewWorkers;
|
||||
FFlags: TFileViewFlags;
|
||||
FHashedFiles: TBucketList; //<en Contains pointers to file source files for quick checking if a file object is still valid
|
||||
FHashedNames: TStringHashList;
|
||||
FReloadNeeded: Boolean; //<en If file list should be reloaded
|
||||
|
|
@ -97,6 +101,7 @@ type
|
|||
FOnFileListChanged : TOnFileListChanged;
|
||||
|
||||
procedure AddFile(FileName, APath: String);
|
||||
function FileListLoaded: Boolean;
|
||||
function GetCurrentAddress: String;
|
||||
function GetNotebookPage: TCustomPage;
|
||||
function GetCurrentFileSource: IFileSource;
|
||||
|
|
@ -112,6 +117,7 @@ type
|
|||
procedure RemoveFile(FileName: String);
|
||||
procedure RenameFile(NewFileName, OldFileName: String);
|
||||
procedure ResortFile(ADisplayFile: TDisplayFile);
|
||||
procedure SetFlags(AValue: TFileViewFlags);
|
||||
procedure UpdateFile(FileName: String);
|
||||
{en
|
||||
Assigns the built lists to the file view and displays new the file list.
|
||||
|
|
@ -157,6 +163,8 @@ type
|
|||
function MarkShiftPlus: Boolean; virtual;
|
||||
function MarkShiftMinus: Boolean; virtual;
|
||||
|
||||
function IsVisibleToUser: Boolean;
|
||||
|
||||
{en
|
||||
This function should set active file by reference of TFile
|
||||
or at least by all the properties of the given TFile,
|
||||
|
|
@ -235,16 +243,20 @@ type
|
|||
public
|
||||
constructor Create(AOwner: TWinControl;
|
||||
AFileSource: IFileSource;
|
||||
APath: String); virtual reintroduce;
|
||||
APath: String;
|
||||
AFlags: TFileViewFlags = []); virtual reintroduce;
|
||||
constructor Create(AOwner: TWinControl;
|
||||
AFileView: TFileView); virtual reintroduce;
|
||||
AFileView: TFileView;
|
||||
AFlags: TFileViewFlags = []); virtual reintroduce;
|
||||
constructor Create(AOwner: TWinControl;
|
||||
AConfig: TIniFileEx;
|
||||
ASectionName: String;
|
||||
ATabIndex: Integer); virtual reintroduce;
|
||||
ATabIndex: Integer;
|
||||
AFlags: TFileViewFlags = []); virtual reintroduce;
|
||||
constructor Create(AOwner: TWinControl;
|
||||
AConfig: TXmlConfig;
|
||||
ANode: TXmlNode); virtual reintroduce;
|
||||
ANode: TXmlNode;
|
||||
AFlags: TFileViewFlags = []); virtual reintroduce;
|
||||
|
||||
destructor Destroy; override;
|
||||
|
||||
|
|
@ -354,6 +366,7 @@ type
|
|||
property FileSource: IFileSource read GetCurrentFileSource;
|
||||
property FileSources[Index: Integer]: IFileSource read GetFileSource;
|
||||
property FileSourcesCount: Integer read GetFileSourcesCount;
|
||||
property Flags: TFileViewFlags read FFlags write SetFlags;
|
||||
property Path[FileSourceIndex, PathIndex: Integer]: UTF8String read GetPath;
|
||||
property PathsCount[FileSourceIndex: Integer]: Integer read GetPathsCount;
|
||||
|
||||
|
|
@ -427,29 +440,33 @@ uses
|
|||
const
|
||||
MinimumReloadInterval = 1000; // 1 second
|
||||
|
||||
constructor TFileView.Create(AOwner: TWinControl; AFileSource: IFileSource; APath: String);
|
||||
constructor TFileView.Create(AOwner: TWinControl; AFileSource: IFileSource; APath: String; AFlags: TFileViewFlags = []);
|
||||
begin
|
||||
FFlags := AFlags;
|
||||
CreateDefault(AOwner);
|
||||
|
||||
FHistory.Add(AFileSource, aPath);
|
||||
FileSource.AddReloadEventListener(@ReloadEvent);
|
||||
end;
|
||||
|
||||
constructor TFileView.Create(AOwner: TWinControl; AFileView: TFileView);
|
||||
constructor TFileView.Create(AOwner: TWinControl; AFileView: TFileView; AFlags: TFileViewFlags = []);
|
||||
begin
|
||||
FFlags := AFlags;
|
||||
CreateDefault(AOwner);
|
||||
AFileView.CloneTo(Self);
|
||||
if Assigned(FileSource) then
|
||||
FileSource.AddReloadEventListener(@ReloadEvent);
|
||||
end;
|
||||
|
||||
constructor TFileView.Create(AOwner: TWinControl; AConfig: TIniFileEx; ASectionName: String; ATabIndex: Integer);
|
||||
constructor TFileView.Create(AOwner: TWinControl; AConfig: TIniFileEx; ASectionName: String; ATabIndex: Integer; AFlags: TFileViewFlags = []);
|
||||
begin
|
||||
FFlags := AFlags;
|
||||
CreateDefault(AOwner);
|
||||
end;
|
||||
|
||||
constructor TFileView.Create(AOwner: TWinControl; AConfig: TXmlConfig; ANode: TXmlNode);
|
||||
constructor TFileView.Create(AOwner: TWinControl; AConfig: TXmlConfig; ANode: TXmlNode; AFlags: TFileViewFlags = []);
|
||||
begin
|
||||
FFlags := AFlags;
|
||||
CreateDefault(AOwner);
|
||||
end;
|
||||
|
||||
|
|
@ -536,6 +553,7 @@ begin
|
|||
if Assigned(AFileView) then
|
||||
begin
|
||||
AFileView.FLastMark := FLastMark;
|
||||
AFileView.FFlags := FFlags;
|
||||
// FFileSource should have been passed to FileView constructor already.
|
||||
// FMethods are created in FileView constructor.
|
||||
AFileView.OnBeforeChangePath := Self.OnBeforeChangePath;
|
||||
|
|
@ -559,6 +577,11 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function TFileView.FileListLoaded: Boolean;
|
||||
begin
|
||||
Result := Assigned(FAllDisplayFiles);
|
||||
end;
|
||||
|
||||
function TFileView.GetNotebookPage: TCustomPage;
|
||||
begin
|
||||
if Parent is TCustomPage then
|
||||
|
|
@ -626,7 +649,7 @@ end;
|
|||
procedure TFileView.RenameFile(NewFileName, OldFileName: String);
|
||||
var
|
||||
ADisplayFile: TDisplayFile;
|
||||
I, J: Integer;
|
||||
I: Integer;
|
||||
begin
|
||||
I := FHashedNames.Find(OldFileName);
|
||||
if I >= 0 then
|
||||
|
|
@ -728,6 +751,30 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure TFileView.SetFlags(AValue: TFileViewFlags);
|
||||
var
|
||||
AddedFlags, RemovedFlags: TFileViewFlags;
|
||||
begin
|
||||
if FFlags = AValue then Exit;
|
||||
|
||||
AddedFlags := AValue - FFlags;
|
||||
RemovedFlags := FFlags - AValue;
|
||||
FFlags := AValue;
|
||||
|
||||
if fvfDontWatch in AddedFlags then
|
||||
EnableWatcher(False);
|
||||
|
||||
if ([fvfDelayLoadingFiles, fvfDontLoadFiles] * RemovedFlags <> []) then
|
||||
begin
|
||||
if not (FileListLoaded or (GetCurrentWorkType = fvwtCreate)) then
|
||||
Reload;
|
||||
EnableWatcher(True);
|
||||
end;
|
||||
|
||||
if fvfDontWatch in RemovedFlags then
|
||||
EnableWatcher(True);
|
||||
end;
|
||||
|
||||
function TFileView.CloneActiveFile: TFile;
|
||||
var
|
||||
aFile: TDisplayFile;
|
||||
|
|
@ -917,6 +964,14 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function TFileView.IsVisibleToUser: Boolean;
|
||||
begin
|
||||
if NotebookPage is TFileViewPage then
|
||||
Result := TFileViewPage(NotebookPage).IsActive
|
||||
else
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TFileView.SetActiveFile(const aFile: TFile);
|
||||
begin
|
||||
end;
|
||||
|
|
@ -943,7 +998,8 @@ var
|
|||
DisplayFilesHashed: TStringHashList = nil;
|
||||
i: Integer;
|
||||
begin
|
||||
if csDestroying in ComponentState then
|
||||
if (csDestroying in ComponentState) or (FileSourcesCount = 0) or
|
||||
([fvfDelayLoadingFiles, fvfDontLoadFiles] * Flags <> []) then
|
||||
Exit;
|
||||
|
||||
{$IFDEF timeFileView}
|
||||
|
|
@ -986,9 +1042,10 @@ begin
|
|||
if gListFilesInThread then
|
||||
begin
|
||||
// Clear files.
|
||||
if Assigned(FFiles) then
|
||||
if Assigned(FAllDisplayFiles) then
|
||||
begin
|
||||
FFiles.Clear; // Clear references to files from the source.
|
||||
FFiles.Clear;
|
||||
FAllDisplayFiles.Clear; // Clear references to files from the source.
|
||||
end;
|
||||
|
||||
BeforeMakeFileList;
|
||||
|
|
@ -1417,6 +1474,8 @@ begin
|
|||
|
||||
if Assigned(OnAfterChangePath) then
|
||||
OnAfterChangePath(Self);
|
||||
|
||||
MakeFileSourceFileList;
|
||||
end;
|
||||
|
||||
procedure TFileView.ChangePathToParent(AllowChangingFileSource: Boolean);
|
||||
|
|
@ -1662,7 +1721,8 @@ var
|
|||
begin
|
||||
if Enable then
|
||||
begin
|
||||
if Assigned(FileSource) and
|
||||
if ([fvfDelayLoadingFiles, fvfDontWatch] * Flags = []) and
|
||||
Assigned(FileSource) and
|
||||
FileSource.IsClass(TFileSystemFileSource) and
|
||||
(FWatchPath <> CurrentPath) then
|
||||
begin
|
||||
|
|
@ -1703,13 +1763,14 @@ end;
|
|||
|
||||
procedure TFileView.ActivateEvent(Sender: TObject);
|
||||
begin
|
||||
SetFlags(Flags - [fvfDelayLoadingFiles]);
|
||||
ReloadIfNeeded;
|
||||
end;
|
||||
|
||||
function TFileView.CheckIfDelayReload: Boolean;
|
||||
begin
|
||||
Result := ((watch_only_foreground in gWatchDirs) and (not Application.Active)) or
|
||||
((NotebookPage is TFileViewPage) and not TFileViewPage(NotebookPage).IsActive);
|
||||
(not IsVisibleToUser);
|
||||
end;
|
||||
|
||||
procedure TFileView.DoReload;
|
||||
|
|
@ -1736,18 +1797,23 @@ procedure TFileView.WatcherEvent(const EventData: TFSWatcherEventData);
|
|||
begin
|
||||
if IncludeTrailingPathDelimiter(EventData.Path) = CurrentPath then
|
||||
begin
|
||||
case EventData.EventType of
|
||||
fswFileCreated:
|
||||
Self.AddFile(EventData.FileName, EventData.Path);
|
||||
fswFileChanged:
|
||||
Self.UpdateFile(EventData.FileName);
|
||||
fswFileDeleted:
|
||||
Self.RemoveFile(EventData.FileName);
|
||||
fswFileRenamed:
|
||||
Self.RenameFile(EventData.FileName, EventData.OldFileName);
|
||||
else
|
||||
Reload(EventData.Path);
|
||||
end;
|
||||
if FileListLoaded then
|
||||
begin
|
||||
case EventData.EventType of
|
||||
fswFileCreated:
|
||||
Self.AddFile(EventData.FileName, EventData.Path);
|
||||
fswFileChanged:
|
||||
Self.UpdateFile(EventData.FileName);
|
||||
fswFileDeleted:
|
||||
Self.RemoveFile(EventData.FileName);
|
||||
fswFileRenamed:
|
||||
Self.RenameFile(EventData.FileName, EventData.OldFileName);
|
||||
else
|
||||
Reload(EventData.Path);
|
||||
end;
|
||||
end
|
||||
else
|
||||
Reload(EventData.Path);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
|
@ -1841,7 +1907,7 @@ begin
|
|||
// Redisplaying file list is done in the main thread because it takes
|
||||
// relatively short time, so the user usually won't notice it and it is
|
||||
// a bit faster this way.
|
||||
if not Assigned(FFiles) then
|
||||
if Assigned(FAllDisplayFiles) and not Assigned(FFiles) then
|
||||
FFiles := TDisplayFiles.Create(False);
|
||||
TFileListBuilder.MakeDisplayFileList(
|
||||
FAllDisplayFiles, FFiles, FileFilter, FFilterOptions);
|
||||
|
|
|
|||
|
|
@ -186,6 +186,7 @@ var
|
|||
gDriveBlackList: String;
|
||||
gListFilesInThread: Boolean;
|
||||
gLoadIconsSeparately: Boolean;
|
||||
gDelayLoadingTabs: Boolean;
|
||||
gLastUsedPacker: String;
|
||||
|
||||
{ Tools page }
|
||||
|
|
@ -718,6 +719,7 @@ begin
|
|||
gShowSystemFiles := False;
|
||||
gListFilesInThread := True;
|
||||
gLoadIconsSeparately := True;
|
||||
gDelayLoadingTabs := True;
|
||||
gDriveBlackList := '';
|
||||
|
||||
{ Tools page }
|
||||
|
|
@ -1561,6 +1563,7 @@ begin
|
|||
gShowSystemFiles := GetValue(Node, 'ShowSystemFiles', gShowSystemFiles);
|
||||
gListFilesInThread := GetValue(Node, 'ListFilesInThread', gListFilesInThread);
|
||||
gLoadIconsSeparately := GetValue(Node, 'LoadIconsSeparately', gLoadIconsSeparately);
|
||||
gDelayLoadingTabs := GetValue(Node, 'DelayLoadingTabs', gDelayLoadingTabs);
|
||||
gDriveBlackList := GetValue(Node, 'DriveBlackList', gDriveBlackList);
|
||||
end;
|
||||
|
||||
|
|
@ -1909,6 +1912,7 @@ begin
|
|||
SetValue(Node, 'ShowSystemFiles', gShowSystemFiles);
|
||||
SetValue(Node, 'ListFilesInThread', gListFilesInThread);
|
||||
SetValue(Node, 'LoadIconsSeparately', gLoadIconsSeparately);
|
||||
SetValue(Node, 'DelayLoadingTabs', gDelayLoadingTabs);
|
||||
SetValue(Node, 'DriveBlackList', gDriveBlackList);
|
||||
|
||||
{ Tools page }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue