ADD: Feature [0002263] [patch] cm_GoToFirstFile skip dirs

ADD: cm_GoToFirstEntry, cm_GoToLastEntry commands instead
This commit is contained in:
Alexander Koblov 2019-03-17 09:00:10 +00:00
commit 24f01ade52
4 changed files with 62 additions and 2 deletions

View file

@ -104,6 +104,8 @@ type
published // commands
procedure cm_QuickSearch(const Params: array of string);
procedure cm_QuickFilter(const Params: array of string);
procedure cm_GoToFirstEntry(const {%H-}Params: array of string);
procedure cm_GoToLastEntry(const {%H-}Params: array of string);
procedure cm_GoToFirstFile(const Params: array of string);
procedure cm_GoToLastFile(const Params: array of string);
end;
@ -155,7 +157,7 @@ begin
end;
end;
procedure TOrderedFileView.cm_GoToFirstFile(const Params: array of string);
procedure TOrderedFileView.cm_GoToFirstEntry(const Params: array of string);
begin
if not (IsEmpty or IsLoadingFileList) then
begin
@ -164,7 +166,7 @@ begin
end;
end;
procedure TOrderedFileView.cm_GoToLastFile(const Params: array of string);
procedure TOrderedFileView.cm_GoToLastEntry(const Params: array of string);
begin
if not (IsEmpty or IsLoadingFileList) then
begin
@ -173,6 +175,38 @@ begin
end;
end;
procedure TOrderedFileView.cm_GoToFirstFile(const Params: array of string);
var
I: Integer;
begin
if not (IsEmpty or IsLoadingFileList) then
begin
SetFocus;
for I:= 0 to FFiles.Count - 1 do
if not (FFiles[I].FSFile.IsDirectory or FFiles[I].FSFile.IsLinkToDirectory) then
begin
SetActiveFile(I);
Exit;
end;
end;
end;
procedure TOrderedFileView.cm_GoToLastFile(const Params: array of string);
var
I: Integer;
begin
if not (IsEmpty or IsLoadingFileList) then
begin
SetFocus;
for I:= FFiles.Count - 1 downto 0 do
if not (FFiles[I].FSFile.IsDirectory or FFiles[I].FSFile.IsLinkToDirectory) then
begin
SetActiveFile(I);
Exit;
end;
end;
end;
procedure TOrderedFileView.cm_QuickFilter(const Params: array of string);
begin
if not IsLoadingFileList then

View file

@ -2341,6 +2341,18 @@ object frmMain: TfrmMain
Caption = 'Add path and file name to command line'
OnExecute = actExecute
end
object actGoToFirstEntry: TAction
Tag = 14
Category = 'Navigation'
Caption = 'Place cursor on first folder or file'
OnExecute = actExecute
end
object actGoToLastEntry: TAction
Tag = 14
Category = 'Navigation'
Caption = 'Place cursor on last folder or file'
OnExecute = actExecute
end
object actGoToFirstFile: TAction
Tag = 14
Category = 'Navigation'

View file

@ -85,6 +85,8 @@ type
actChangeDirToParent: TAction;
actEditPath: TAction;
actHorizontalFilePanels: TAction;
actGoToFirstEntry: TAction;
actGoToLastEntry: TAction;
actGoToFirstFile: TAction;
actGoToLastFile: TAction;
actCompareDirectories: TAction;

View file

@ -193,6 +193,8 @@ type
procedure cm_ShowButtonMenu(const Params: array of string);
procedure cm_TransferLeft(const {%H-}Params: array of string);
procedure cm_TransferRight(const {%H-}Params: array of string);
procedure cm_GoToFirstEntry(const {%H-}Params: array of string);
procedure cm_GoToLastEntry(const {%H-}Params: array of string);
procedure cm_GoToFirstFile(const {%H-}Params: array of string);
procedure cm_GoToLastFile(const {%H-}Params: array of string);
procedure cm_Minimize(const {%H-}Params: array of string);
@ -1464,6 +1466,16 @@ begin
frmMain.SelectedPanel = fpLeft);
end;
procedure TMainCommands.cm_GoToFirstEntry(const Params: array of string);
begin
frmMain.ActiveFrame.ExecuteCommand('cm_GoToFirstEntry', []);
end;
procedure TMainCommands.cm_GoToLastEntry(const Params: array of string);
begin
frmMain.ActiveFrame.ExecuteCommand('cm_GoToLastEntry', []);
end;
procedure TMainCommands.cm_GoToFirstFile(const Params: array of string);
begin
frmMain.ActiveFrame.ExecuteCommand('cm_GoToFirstFile', []);