UPD: Optimization

This commit is contained in:
Alexander Koblov 2018-03-25 09:47:33 +00:00
commit a0eb20f9f4
2 changed files with 24 additions and 21 deletions

View file

@ -180,6 +180,7 @@ type
constructor Create(AOwner: TWinControl; AFileSource: IFileSource; APath: String; AFlags: TFileViewFlags = []); override;
constructor Create(AOwner: TWinControl; AFileView: TFileView; AFlags: TFileViewFlags = []); override;
constructor Create(AOwner: TWinControl; AFileView: TFileView; AColumnSet: String; AFlags: TFileViewFlags = []); virtual;
constructor Create(AOwner: TWinControl; AConfig: TXmlConfig; ANode: TXmlNode; AFlags: TFileViewFlags = []); override;
destructor Destroy; override;
@ -767,6 +768,14 @@ begin
inherited Create(AOwner, AFileView, AFlags);
end;
constructor TColumnsFileView.Create(AOwner: TWinControl; AFileView: TFileView;
AColumnSet: String; AFlags: TFileViewFlags);
begin
if ColSet.Items.IndexOf(AColumnSet) >= 0 then
ActiveColm := AColumnSet;
inherited Create(AOwner, AFileView, AFlags);
end;
constructor TColumnsFileView.Create(AOwner: TWinControl; AConfig: TXmlConfig; ANode: TXmlNode; AFlags: TFileViewFlags = []);
begin
inherited Create(AOwner, AConfig, ANode, AFlags);

View file

@ -1880,16 +1880,14 @@ var
begin
with frmMain do
begin
if not (ActiveFrame is TColumnsFileView) then
begin
aFileView:= TColumnsFileView.Create(ActiveNotebook.ActivePage, ActiveFrame);
GetParamValue(Params, 'columnset', AParam);
if (ActiveFrame is TColumnsFileView) then
TColumnsFileView(ActiveFrame).SetColumnSet(AParam)
else begin
aFileView:= TColumnsFileView.Create(ActiveNotebook.ActivePage, ActiveFrame, AParam);
ActiveNotebook.ActivePage.FileView:= aFileView;
ActiveFrame.SetFocus;
end;
if GetParamValue(Params, 'columnset', AParam) then
begin
TColumnsFileView(ActiveFrame).SetColumnSet(AParam);
end;
end;
end;
@ -1900,15 +1898,13 @@ var
begin
with frmMain do
begin
if not (FrameLeft is TColumnsFileView) then
begin
aFileView:= TColumnsFileView.Create(LeftTabs.ActivePage, FrameLeft);
GetParamValue(Params, 'columnset', AParam);
if (FrameLeft is TColumnsFileView) then
TColumnsFileView(FrameLeft).SetColumnSet(AParam)
else begin
aFileView:= TColumnsFileView.Create(LeftTabs.ActivePage, FrameLeft, AParam);
LeftTabs.ActivePage.FileView:= aFileView;
end;
if GetParamValue(Params, 'columnset', AParam) then
begin
TColumnsFileView(FrameLeft).SetColumnSet(AParam);
end;
end;
end;
@ -1919,15 +1915,13 @@ var
begin
with frmMain do
begin
if not (FrameRight is TColumnsFileView) then
begin
aFileView:= TColumnsFileView.Create(RightTabs.ActivePage, FrameRight);
GetParamValue(Params, 'columnset', AParam);
if (FrameRight is TColumnsFileView) then
TColumnsFileView(FrameRight).SetColumnSet(AParam)
else begin
aFileView:= TColumnsFileView.Create(RightTabs.ActivePage, FrameRight, AParam);
RightTabs.ActivePage.FileView:= aFileView;
end;
if GetParamValue(Params, 'columnset', AParam) then
begin
TColumnsFileView(FrameRight).SetColumnSet(AParam);
end;
end;
end;