mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Quick filter files in the panel, cm_QuickFilter command with Ctrl+F as default hotkey.
This commit is contained in:
parent
7025adf332
commit
4edfbcd01a
10 changed files with 7578 additions and 7212 deletions
|
|
@ -1683,6 +1683,11 @@ object frmMain: TfrmMain
|
|||
Caption = 'Move/Rename files without asking for confirmation'
|
||||
OnExecute = actExecute
|
||||
end
|
||||
object actQuickFilter: TAction
|
||||
Category = 'Commands'
|
||||
Caption = 'Quick filter'
|
||||
OnExecute = actExecute
|
||||
end
|
||||
end
|
||||
object pmHotList: TPopupMenu
|
||||
left = 152
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ TFRMMAIN.ACTSORTBYCOLUMN.CAPTION=Sort by column
|
|||
TFRMMAIN.ACTDRIVECONTEXTMENU.CAPTION=Drive context menu
|
||||
TFRMMAIN.ACTCOPYNOASK.CAPTION=Copy files without asking for confirmation
|
||||
TFRMMAIN.ACTRENAMENOASK.CAPTION=Move/Rename files without asking for confirmation
|
||||
TFRMMAIN.ACTQUICKFILTER.CAPTION=Quick filter
|
||||
TFRMMAIN.TBEDIT.CAPTION=Edit
|
||||
TFRMMAIN.TBDELETE.CAPTION=Delete
|
||||
TFRMMAIN.MENUITEM2.CAPTION=-
|
||||
|
|
|
|||
7006
src/fmain.pas
7006
src/fmain.pas
File diff suppressed because it is too large
Load diff
7412
src/foptions.lfm
7412
src/foptions.lfm
File diff suppressed because it is too large
Load diff
|
|
@ -141,14 +141,16 @@ TFRMOPTIONS.CBCMDLINEHISTORY.CAPTION=Command line history
|
|||
TFRMOPTIONS.CBFILEMASKHISTORY.CAPTION=File mask history
|
||||
TFRMOPTIONS.BTNCONFIGEDIT.CAPTION=Edit
|
||||
TFRMOPTIONS.BTNCONFIGAPPLY.CAPTION=Apply
|
||||
TFRMOPTIONS.GBQUICKSEARCH.CAPTION=Quick search (current dir)
|
||||
TFRMOPTIONS.RBCTRLALTLETTERQS.CAPTION=&Ctrl+Alt+Letters
|
||||
TFRMOPTIONS.RBALTLETTERQS.CAPTION=Al&t+Letters
|
||||
TFRMOPTIONS.RBLETTERQS.CAPTION=L&etter only
|
||||
TFRMOPTIONS.RBNONEQS.CAPTION=Di&sabled
|
||||
TFRMOPTIONS.GBEXACTNAMEMATCH.CAPTION=Exact &name match:
|
||||
TFRMOPTIONS.GBEXACTNAMEMATCH.CAPTION=Exact name match:
|
||||
TFRMOPTIONS.CBEXACTBEGINNING.CAPTION=&Beginning (name must start with first typed character)
|
||||
TFRMOPTIONS.CBEXACTENDING.CAPTION=En&ding (last character before a typed dot . must match)
|
||||
TFRMOPTIONS.GRPQUICKSEARCHFILTERKEYS.CAPTION=Keys settings
|
||||
TFRMOPTIONS.LBLQUICKSEARCH.CAPTION=Quick &search:
|
||||
TFRMOPTIONS.RBCTRLALTLETTERQS.CAPTION=Ctrl+Alt+Letters
|
||||
TFRMOPTIONS.RBALTLETTERQS.CAPTION=Alt+Letters
|
||||
TFRMOPTIONS.RBLETTERQS.CAPTION=Letter only
|
||||
TFRMOPTIONS.RBNONEQS.CAPTION=Disabled
|
||||
TFRMOPTIONS.LBLQUICKFILTER.CAPTION=Quick &filter:
|
||||
TFRMOPTIONS.LBLCONFIGCOLUMNS.CAPTION=Configure columns for file system:
|
||||
TFRMOPTIONS.CBBFILESYSTEM.TEXT=General
|
||||
TFRMOPTIONS.BTNNEWCOLUMNSSET.CAPTION=&New
|
||||
|
|
|
|||
|
|
@ -182,6 +182,15 @@ type
|
|||
gbExtended: TGroupBox;
|
||||
gbAutoRefresh: TGroupBox;
|
||||
gbShowIconsMode: TGroupBox;
|
||||
grpQuickSearchFilterKeys: TGroupBox;
|
||||
lblQuickSearch: TLabel;
|
||||
lblQuickFilter: TLabel;
|
||||
pnlQuickSearch: TPanel;
|
||||
pnlQuickFilter: TPanel;
|
||||
rbAltLetterQF: TRadioButton;
|
||||
rbCtrlAltLetterQF: TRadioButton;
|
||||
rbLetterQF: TRadioButton;
|
||||
rbNoneQF: TRadioButton;
|
||||
rbIconsShowAllAndExe: TRadioButton;
|
||||
rbIconsShowAll: TRadioButton;
|
||||
rbIconsShowNone: TRadioButton;
|
||||
|
|
@ -276,7 +285,6 @@ type
|
|||
pgHotKey: TPage;
|
||||
pgLng: TPage;
|
||||
pgTools: TPage;
|
||||
gbQuickSearch: TGroupBox;
|
||||
rbProgramDir: TRadioButton;
|
||||
rbUserHomeDir: TRadioButton;
|
||||
rbUseMmapInSearch: TRadioButton;
|
||||
|
|
@ -372,6 +380,7 @@ type
|
|||
procedure pcPluginsTypesChange(Sender: TObject);
|
||||
procedure pgBehavResize(Sender: TObject);
|
||||
procedure rbIconsShowNoneChange(Sender: TObject);
|
||||
procedure rbQuickSearchFilterKeyChange(Sender: TObject);
|
||||
procedure stgCommandsResize(Sender: TObject);
|
||||
procedure stgCommandsSelectCell(Sender: TObject; aCol, aRow: Integer;
|
||||
var CanSelect: Boolean);
|
||||
|
|
@ -471,6 +480,12 @@ begin
|
|||
end;
|
||||
tvTreeView.Items.Item[0].Selected:= True;
|
||||
|
||||
// Set QuickFilter radio buttons captions same as QuickSearch.
|
||||
rbCtrlAltLetterQF.Caption := rbCtrlAltLetterQS.Caption;
|
||||
rbAltLetterQF.Caption := rbAltLetterQS.Caption;
|
||||
rbLetterQF.Caption := rbLetterQS.Caption;
|
||||
rbNoneQF.Caption := rbNoneQS.Caption;
|
||||
|
||||
// create plugins lists
|
||||
tmpDSXPlugins:= TDSXModuleList.Create;
|
||||
tmpWCXPlugins:= TWCXModuleList.Create;
|
||||
|
|
@ -964,6 +979,16 @@ begin
|
|||
cbIconsSize.Enabled := not rbIconsShowNone.Checked;
|
||||
end;
|
||||
|
||||
procedure TfrmOptions.rbQuickSearchFilterKeyChange(Sender: TObject);
|
||||
begin
|
||||
rbCtrlAltLetterQF.Enabled := not rbCtrlAltLetterQS.Checked;
|
||||
rbAltLetterQF.Enabled := not rbAltLetterQS.Checked;
|
||||
rbLetterQF.Enabled := not rbLetterQS.Checked;
|
||||
rbCtrlAltLetterQS.Enabled := not rbCtrlAltLetterQF.Checked;
|
||||
rbAltLetterQS.Enabled := not rbAltLetterQF.Checked;
|
||||
rbLetterQS.Enabled := not rbLetterQF.Checked;
|
||||
end;
|
||||
|
||||
procedure TfrmOptions.stgCommandsResize(Sender: TObject);
|
||||
begin
|
||||
stgCommands.ColWidths[stgCmdHotkeysIndex] := stgCommands.Width
|
||||
|
|
@ -2144,6 +2169,18 @@ begin
|
|||
else
|
||||
rbNoneQS.Checked := True;
|
||||
|
||||
if gQuickFilter then
|
||||
begin
|
||||
if (gQuickFilterMode = [ssCtrl, ssAlt]) then
|
||||
rbCtrlAltLetterQF.Checked := True
|
||||
else if (gQuickFilterMode = [ssAlt]) then
|
||||
rbAltLetterQF.Checked := True
|
||||
else if gQuickFilterMode = [] then
|
||||
rbLetterQF.Checked := True;
|
||||
end
|
||||
else
|
||||
rbNoneQF.Checked := True;
|
||||
|
||||
cbExactBeginning.Checked := gQuickSearchMatchBeginning;
|
||||
cbExactEnding.Checked := gQuickSearchMatchEnding;
|
||||
{ Misc page }
|
||||
|
|
@ -2332,6 +2369,15 @@ begin
|
|||
if rbLetterQS.Checked then
|
||||
gQuickSearchMode := [];
|
||||
|
||||
gQuickFilter := not rbNoneQF.Checked;
|
||||
|
||||
if rbCtrlAltLetterQF.Checked then
|
||||
gQuickFilterMode := [ssCtrl, ssAlt];
|
||||
if rbAltLetterQF.Checked then
|
||||
gQuickFilterMode := [ssAlt];
|
||||
if rbLetterQF.Checked then
|
||||
gQuickFilterMode := [];
|
||||
|
||||
gQuickSearchMatchBeginning := cbExactBeginning.Checked;
|
||||
gQuickSearchMatchEnding := cbExactEnding.Checked;
|
||||
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ type
|
|||
fSearchDirect,
|
||||
fNext,
|
||||
fPrevious : Boolean;
|
||||
FFileFilter: String;
|
||||
|
||||
fUpdateFileCount,
|
||||
fUpdateDiskFreeSpace: Boolean;
|
||||
|
|
@ -175,7 +176,10 @@ type
|
|||
pnlHeader: TPanel;
|
||||
pmColumnsMenu: TPopupMenu;
|
||||
pnAltSearch: TPanel;
|
||||
pnlFilter: TPanel;
|
||||
edtSearch: TEdit;
|
||||
edtFilter: TEdit;
|
||||
btnCloseFilter: TButton;
|
||||
edtPath: TEdit;
|
||||
edtRename: TEdit;
|
||||
lblPath: TPathLabel;
|
||||
|
|
@ -215,8 +219,10 @@ type
|
|||
|
||||
procedure ShowRenameFileEdit(const sFileName:String);
|
||||
procedure ShowPathEdit;
|
||||
procedure ShowAltPanel(Char : TUTF8Char = #0);
|
||||
procedure CloseAltPanel;
|
||||
procedure ShowSearchPanel(Char : TUTF8Char = #0);
|
||||
procedure CloseSearchPanel;
|
||||
procedure ShowFilterPanel(Char : TUTF8Char = #0);
|
||||
procedure CloseFilterPanel;
|
||||
|
||||
function GetActiveItem: TColumnsViewFile;
|
||||
|
||||
|
|
@ -230,18 +236,23 @@ type
|
|||
}
|
||||
procedure SetActive(Active: Boolean);
|
||||
|
||||
procedure SetFileFilter(NewFilter: String);
|
||||
|
||||
// -- Events --------------------------------------------------------------
|
||||
|
||||
procedure edtPathExit(Sender: TObject);
|
||||
procedure edtSearchExit(Sender: TObject);
|
||||
procedure edtRenameExit(Sender: TObject);
|
||||
procedure edtFilterExit(Sender: TObject);
|
||||
|
||||
procedure edtSearchChange(Sender: TObject);
|
||||
procedure edtSearchKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure edtPathKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure edtRenameKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure edtPathKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure edtRenameKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure edtFilterChange(Sender: TObject);
|
||||
procedure edtFilterKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
|
||||
procedure btnCloseFilterClick(Sender: TObject);
|
||||
|
||||
procedure dgPanelEnter(Sender: TObject);
|
||||
procedure dgPanelExit(Sender: TObject);
|
||||
|
|
@ -272,6 +283,9 @@ type
|
|||
|
||||
procedure UTF8KeyPressEvent(Sender: TObject; var UTF8Key: TUTF8Char);
|
||||
|
||||
|
||||
property FileFilter: String read FFileFilter write SetFileFilter;
|
||||
|
||||
protected
|
||||
procedure SetCurrentPath(NewPath: String); override;
|
||||
function GetActiveFile: TFile; override;
|
||||
|
|
@ -378,6 +392,7 @@ type
|
|||
procedure cm_MarkCurrentExtension(param: string='');
|
||||
procedure cm_UnmarkCurrentExtension(param: string='');
|
||||
procedure cm_QuickSearch(param: string='');
|
||||
procedure cm_QuickFilter(param: string='');
|
||||
procedure cm_Open(param: string='');
|
||||
procedure cm_SortByColumn(param: string='');
|
||||
procedure cm_CountDirContent(param: string='');
|
||||
|
|
@ -641,7 +656,7 @@ var
|
|||
LastSelection: String;
|
||||
begin
|
||||
if pnAltSearch.Visible then
|
||||
CloseAltPanel;
|
||||
CloseSearchPanel;
|
||||
|
||||
if Assigned(GetActiveItem) then
|
||||
LastSelection := GetActiveItem.TheFile.Name
|
||||
|
|
@ -1090,7 +1105,7 @@ begin
|
|||
|
||||
VK_TAB:
|
||||
begin
|
||||
CloseAltPanel;
|
||||
CloseSearchPanel;
|
||||
SetFocus;
|
||||
Key := 0;
|
||||
end;
|
||||
|
|
@ -1098,7 +1113,7 @@ begin
|
|||
VK_ESCAPE:
|
||||
begin
|
||||
Key := 0;
|
||||
CloseAltPanel;
|
||||
CloseSearchPanel;
|
||||
SetFocus;
|
||||
end;
|
||||
|
||||
|
|
@ -1106,7 +1121,7 @@ begin
|
|||
VK_SELECT:
|
||||
begin
|
||||
Key := 0;
|
||||
CloseAltPanel;
|
||||
CloseSearchPanel;
|
||||
SetFocus;
|
||||
|
||||
{LaBero begin}
|
||||
|
|
@ -1438,6 +1453,12 @@ begin
|
|||
lblPath.SetActive(Active);
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.SetFileFilter(NewFilter: String);
|
||||
begin
|
||||
FFileFilter := NewFilter;
|
||||
MakeDisplayFileList;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.edtPathExit(Sender: TObject);
|
||||
begin
|
||||
edtPath.Visible := False;
|
||||
|
|
@ -1446,7 +1467,7 @@ end;
|
|||
procedure TColumnsFileView.edtSearchExit(Sender: TObject);
|
||||
begin
|
||||
// sometimes must be search panel closed this way
|
||||
CloseAltPanel;
|
||||
CloseSearchPanel;
|
||||
RedrawGrid;
|
||||
end;
|
||||
|
||||
|
|
@ -1456,6 +1477,12 @@ begin
|
|||
UnMarkAll;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.edtFilterExit(Sender: TObject);
|
||||
begin
|
||||
if edtFilter.Text = '' then
|
||||
CloseFilterPanel;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.edtSearchChange(Sender: TObject);
|
||||
var
|
||||
I, iPos, iEnd : Integer;
|
||||
|
|
@ -1464,7 +1491,7 @@ var
|
|||
sSearchNameNoExt,
|
||||
sSearchExt : String;
|
||||
begin
|
||||
if edtSearch.Text='' then Exit;
|
||||
if (edtSearch.Text='') or IsEmpty then Exit;
|
||||
//DebugLn('edtSearchChange: '+ edtSearch.Text);
|
||||
|
||||
sSearchName := AnsiLowerCase(edtSearch.Text);
|
||||
|
|
@ -1540,14 +1567,21 @@ begin
|
|||
fPrevious := False;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.CloseAltPanel;
|
||||
procedure TColumnsFileView.CloseSearchPanel;
|
||||
begin
|
||||
pnAltSearch.Visible:=False;
|
||||
edtSearch.Text:='';
|
||||
FActive:= False;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.ShowAltPanel(Char : TUTF8Char);
|
||||
procedure TColumnsFileView.CloseFilterPanel;
|
||||
begin
|
||||
edtFilter.Text := ''; // Automatically triggers edtFilterChange.
|
||||
pnlFilter.Visible := False;
|
||||
SetFocus;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.ShowSearchPanel(Char : TUTF8Char);
|
||||
begin
|
||||
frmMain.EnableHotkeys(False);
|
||||
|
||||
|
|
@ -1572,6 +1606,26 @@ begin
|
|||
FActive:= True;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.ShowFilterPanel(Char : TUTF8Char = #0);
|
||||
begin
|
||||
frmMain.EnableHotkeys(False);
|
||||
|
||||
pnlFilter.Visible := True;
|
||||
edtFilter.Width := pnlFilter.Width div 2;
|
||||
edtFilter.SetFocus;
|
||||
|
||||
if Char <> #0 then
|
||||
begin
|
||||
edtFilter.Text := Char;
|
||||
edtFilter.SelStart := UTF8Length(edtFilter.Text) + 1;
|
||||
edtFilter.SelLength := 0;
|
||||
end
|
||||
else
|
||||
begin
|
||||
edtFilter.SelectAll;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.UpDatelblInfo;
|
||||
var
|
||||
i: Integer;
|
||||
|
|
@ -1786,6 +1840,33 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.edtFilterChange(Sender: TObject);
|
||||
begin
|
||||
FileFilter := edtFilter.Text;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.edtFilterKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
case Key of
|
||||
VK_TAB, VK_RETURN, VK_SELECT:
|
||||
begin
|
||||
SetFocus;
|
||||
Key := 0;
|
||||
end;
|
||||
|
||||
VK_ESCAPE: // Close panel and remove filter with Escape.
|
||||
begin
|
||||
CloseFilterPanel;
|
||||
Key := 0;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.btnCloseFilterClick(Sender: TObject);
|
||||
begin
|
||||
CloseFilterPanel;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.MakeVisible(iRow:Integer);
|
||||
begin
|
||||
with dgPanel do
|
||||
|
|
@ -1906,37 +1987,55 @@ end;
|
|||
|
||||
procedure TColumnsFileView.dgPanelKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
var
|
||||
ScreenPoint: TPoint;
|
||||
ModifierKeys: TShiftState;
|
||||
UTF8Char: TUTF8Char;
|
||||
begin
|
||||
// used for quick search by Ctrl+Alt+Letter and Alt+Letter
|
||||
if gQuickSearch then
|
||||
begin
|
||||
ModifierKeys := GetKeyShiftStateEx;
|
||||
|
||||
if ((gQuickSearchMode <> []) and
|
||||
// Check only Ctrl and Alt as quicksearch keys.
|
||||
(ModifierKeys * [ssCtrl, ssAlt] = gQuickSearchMode))
|
||||
{$IFDEF MSWINDOWS}
|
||||
// Entering international characters with Ctrl+Alt on Windows.
|
||||
or ((gQuickSearchMode = []) and
|
||||
(ModifierKeys * [ssCtrl, ssAlt] = [ssCtrl, ssAlt]) and
|
||||
(ModifierKeys - [ssCtrl, ssAlt, ssShift, ssCaps] = []))
|
||||
{$ENDIF}
|
||||
then
|
||||
function CheckSearchOrFilter(ModifierKeys: TShiftState;
|
||||
SearchOrFilterEnabled: Boolean;
|
||||
SearchOrFilterMode: TShiftState;
|
||||
out UTF8Char: TUTF8Char): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
// used for quick search/filter by Ctrl+Alt+Letter and Alt+Letter
|
||||
if SearchOrFilterEnabled then
|
||||
begin
|
||||
UTF8Char := VirtualKeyToUTF8Char(Key, ModifierKeys - gQuickSearchMode);
|
||||
if UTF8Char <> '' then
|
||||
if ((SearchOrFilterMode <> []) and
|
||||
// Check only Ctrl and Alt.
|
||||
(ModifierKeys * [ssCtrl, ssAlt] = SearchOrFilterMode))
|
||||
{$IFDEF MSWINDOWS}
|
||||
// Entering international characters with Ctrl+Alt on Windows.
|
||||
or ((SearchOrFilterMode = []) and
|
||||
(ModifierKeys * [ssCtrl, ssAlt] = [ssCtrl, ssAlt]) and
|
||||
(ModifierKeys - [ssCtrl, ssAlt, ssShift, ssCaps] = []))
|
||||
{$ENDIF}
|
||||
then
|
||||
begin
|
||||
ShowAltPanel(UTF8Char);
|
||||
Key := 0;
|
||||
Exit;
|
||||
UTF8Char := VirtualKeyToUTF8Char(Key, ModifierKeys - SearchOrFilterMode);
|
||||
Result := UTF8Char <> '';
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
ModifierKeys: TShiftState;
|
||||
ScreenPoint: TPoint;
|
||||
UTF8Char: TUTF8Char;
|
||||
begin
|
||||
ModifierKeys := GetKeyShiftStateEx;
|
||||
|
||||
if CheckSearchOrFilter(ModifierKeys, gQuickSearch, gQuickSearchMode, UTF8Char) then
|
||||
begin
|
||||
ShowSearchPanel(UTF8Char);
|
||||
Key := 0;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if CheckSearchOrFilter(ModifierKeys, gQuickFilter, gQuickFilterMode, UTF8Char) then
|
||||
begin
|
||||
ShowFilterPanel(UTF8Char);
|
||||
Key := 0;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
case Key of
|
||||
VK_APPS:
|
||||
begin
|
||||
|
|
@ -2347,6 +2446,29 @@ begin
|
|||
edtSearch.Left:=64;
|
||||
edtSearch.Top:=1;
|
||||
|
||||
// Create filter panel.
|
||||
pnlFilter := TPanel.Create(Self);
|
||||
pnlFilter.Parent := Self;
|
||||
pnlFilter.Visible := False;
|
||||
pnlFilter.Align := alBottom;
|
||||
pnlFilter.AutoSize := True;
|
||||
pnlFilter.Caption := rsQuickFilterPanel;
|
||||
pnlFilter.Alignment := taLeftJustify;
|
||||
pnlFilter.BevelWidth := 1;
|
||||
pnlFilter.BevelInner := bvSpace;
|
||||
|
||||
edtFilter := TEdit.Create(pnlFilter);
|
||||
edtFilter.Parent := pnlFilter;
|
||||
edtFilter.TabStop := False;
|
||||
edtfilter.BorderSpacing.Left := 64;
|
||||
edtFilter.Align := alLeft;
|
||||
|
||||
btnCloseFilter := TButton.Create(pnlFilter);
|
||||
btnCloseFilter.Parent := pnlFilter;
|
||||
btnCloseFilter.Align := alRight;
|
||||
btnCloseFilter.Caption := 'x';
|
||||
btnCloseFilter.AutoSize := True;
|
||||
|
||||
// ---
|
||||
dgPanel.OnUTF8KeyPress := @UTF8KeyPressEvent;
|
||||
dgPanel.OnMouseDown := @dgPanelMouseDown;
|
||||
|
|
@ -2369,12 +2491,18 @@ begin
|
|||
edtSearch.OnKeyDown := @edtSearchKeyDown;
|
||||
edtSearch.OnExit := @edtSearchExit;
|
||||
|
||||
edtFilter.OnChange := @edtFilterChange;
|
||||
edtFilter.OnKeyDown := @edtFilterKeyDown;
|
||||
edtFilter.OnExit := @edtFilterExit;
|
||||
|
||||
edtPath.OnKeyDown := @edtPathKeyDown;
|
||||
edtPath.OnExit := @edtPathExit;
|
||||
|
||||
edtRename.OnKeyDown := @edtRenameKeyDown;
|
||||
edtRename.OnExit := @edtRenameExit;
|
||||
|
||||
btnCloseFilter.OnClick := @btnCloseFilterClick;
|
||||
|
||||
pnlHeader.OnResize := @pnlHeaderResize;
|
||||
|
||||
lblPath.OnClick := @lblPathClick;
|
||||
|
|
@ -2528,6 +2656,8 @@ procedure TColumnsFileView.MakeDisplayFileList;
|
|||
var
|
||||
AFile: TColumnsViewFile;
|
||||
i: Integer;
|
||||
invalidFilter: Boolean = False;
|
||||
localFilter: String;
|
||||
begin
|
||||
FFiles.Clear;
|
||||
|
||||
|
|
@ -2535,6 +2665,16 @@ begin
|
|||
begin
|
||||
Sort;
|
||||
|
||||
// Prepare filter string based on options.
|
||||
if FileFilter <> EmptyStr then
|
||||
begin
|
||||
localFilter := FileFilter;
|
||||
if not gQuickSearchMatchBeginning then
|
||||
localFilter := '*' + localFilter;
|
||||
if not gQuickSearchMatchEnding then
|
||||
localFilter := localFilter + '*';
|
||||
end;
|
||||
|
||||
for i := 0 to FFileSourceFiles.Count - 1 do
|
||||
begin
|
||||
if gShowSystemFiles = False then
|
||||
|
|
@ -2542,6 +2682,28 @@ begin
|
|||
if FFileSourceFiles[i].IsSysFile then Continue;
|
||||
end;
|
||||
|
||||
// Filter files.
|
||||
if (FileFilter <> EmptyStr) and (invalidFilter = False) then
|
||||
begin
|
||||
try
|
||||
if (FFileSourceFiles[i].Name <> '..') and
|
||||
(FFileSourceFiles[i].Name <> '.') and
|
||||
|
||||
// Don't filter directories.
|
||||
not (FFileSourceFiles[i].IsDirectory or
|
||||
FFileSourceFiles[i].IsLinkToDirectory) and
|
||||
|
||||
not MatchesMask(UTF8LowerCase(FFileSourceFiles[i].Name),
|
||||
UTF8LowerCase(localFilter))
|
||||
then
|
||||
Continue;
|
||||
|
||||
except
|
||||
on EConvertError do
|
||||
invalidFilter := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
AFile := TColumnsViewFile.Create(FFileSourceFiles[i]);
|
||||
if (gShowIcons <> sim_none) then
|
||||
AFile.IconID := PixMapManager.GetIconByFile(AFile.TheFile,
|
||||
|
|
@ -2670,6 +2832,28 @@ begin
|
|||
end;
|
||||
|
||||
procedure TColumnsFileView.UTF8KeyPressEvent(Sender: TObject; var UTF8Key: TUTF8Char);
|
||||
|
||||
|
||||
function CheckSearchOrFilter(ModifierKeys: TShiftState;
|
||||
SearchOrFilterEnabled: Boolean;
|
||||
SearchOrFilterMode: TShiftState): Boolean;
|
||||
begin
|
||||
if SearchOrFilterEnabled and (SearchOrFilterMode = []) and
|
||||
// Check only ssCtrl and ssAlt.
|
||||
(ModifierKeys * [ssCtrl, ssAlt] = SearchOrFilterMode) then
|
||||
begin
|
||||
// Make upper case if either caps-lock is toggled or shift pressed.
|
||||
if (ssCaps in ModifierKeys) xor (ssShift in ModifierKeys) then
|
||||
UTF8Key := UTF8UpperCase(UTF8Key)
|
||||
else
|
||||
UTF8Key := UTF8LowerCase(UTF8Key);
|
||||
|
||||
Result := True;
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
var
|
||||
ModifierKeys: TShiftState;
|
||||
begin
|
||||
|
|
@ -2681,19 +2865,16 @@ begin
|
|||
|
||||
ModifierKeys := GetKeyShiftStateEx;
|
||||
|
||||
if gQuickSearch and (gQuickSearchMode = []) and
|
||||
// Check only ssCtrl and ssAlt.
|
||||
(ModifierKeys * [ssCtrl, ssAlt] = gQuickSearchMode) then
|
||||
begin
|
||||
// Make upper case if either caps-lock is toggled or shift pressed.
|
||||
if (ssCaps in ModifierKeys) xor (ssShift in ModifierKeys) then
|
||||
UTF8Key := UTF8UpperCase(UTF8Key)
|
||||
else
|
||||
UTF8Key := UTF8LowerCase(UTF8Key);
|
||||
|
||||
ShowAltPanel(UTF8Key);
|
||||
UTF8Key:= '';
|
||||
end;
|
||||
if CheckSearchOrFilter(ModifierKeys, gQuickSearch, gQuickSearchMode) then
|
||||
begin
|
||||
ShowSearchPanel(UTF8Key);
|
||||
UTF8Key := '';
|
||||
end
|
||||
else if CheckSearchOrFilter(ModifierKeys, gQuickFilter, gQuickFilterMode) then
|
||||
begin
|
||||
ShowFilterPanel(UTF8Key);
|
||||
UTF8Key := '';
|
||||
end
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.DoDragDropOperation(Operation: TDragDropOperation;
|
||||
|
|
@ -2780,7 +2961,12 @@ end;
|
|||
|
||||
procedure TColumnsFileView.cm_QuickSearch(param: string='');
|
||||
begin
|
||||
ShowAltPanel;
|
||||
ShowSearchPanel;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.cm_QuickFilter(param: string='');
|
||||
begin
|
||||
ShowFilterPanel;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.cm_Open(param: string='');
|
||||
|
|
|
|||
|
|
@ -157,6 +157,7 @@ const cf_Null=0;
|
|||
procedure cm_PackFiles(param: string='');
|
||||
procedure cm_ExtractFiles(param: string='');
|
||||
procedure cm_QuickSearch(param: string='');
|
||||
procedure cm_QuickFilter(param: string='');
|
||||
procedure cm_RightOpenDrives(param: string='');
|
||||
procedure cm_ShowButtonMenu(param: string='');
|
||||
procedure cm_TransferLeft(param: string='');
|
||||
|
|
@ -983,6 +984,11 @@ begin
|
|||
FrmMain.ActiveFrame.ExecuteCommand('cm_QuickSearch', param);
|
||||
end;
|
||||
|
||||
procedure TActs.cm_QuickFilter(param: string='');
|
||||
begin
|
||||
FrmMain.ActiveFrame.ExecuteCommand('cm_QuickFilter', param);
|
||||
end;
|
||||
|
||||
procedure TActs.cm_RightOpenDrives(param:string);
|
||||
var
|
||||
p : TPoint;
|
||||
|
|
|
|||
|
|
@ -207,6 +207,8 @@ var
|
|||
gQuickSearchMode : TShiftState = [ssCtrl, ssAlt];
|
||||
gQuickSearchMatchBeginning,
|
||||
gQuickSearchMatchEnding : Boolean;
|
||||
gQuickFilter : Boolean = False;
|
||||
gQuickFilterMode : TShiftState = [];
|
||||
|
||||
{ Misc page }
|
||||
gGridVertLine,
|
||||
|
|
@ -299,6 +301,7 @@ begin
|
|||
AddHotKey('Ctrl+Right','cm_TransferRight','','FrmMain','FrmMain');
|
||||
AddHotKey('Ctrl+PgDn','cm_OpenArchive','','FrmMain','FrmMain');
|
||||
AddHotKey('Ctrl+S','cm_QuickSearch','','FrmMain','FrmMain');
|
||||
AddHotKey('Ctrl+F','cm_QuickFilter','','FrmMain','FrmMain');
|
||||
AddHotKey('Ctrl+Alt+X','cm_CopyNamesToClip','','FrmMain','FrmMain');
|
||||
AddHotKey('Ctrl+Alt+C','cm_CopyFullNamesToClip','','FrmMain','FrmMain');
|
||||
AddHotKey('Alt+Z','cm_TargetEqualSource','','FrmMain','FrmMain');
|
||||
|
|
@ -589,6 +592,8 @@ begin
|
|||
gQuickSearchMode := TShiftState(gIni.ReadInteger('Configuration', 'QuickSearchMode', Integer(gQuickSearchMode)));
|
||||
gQuickSearchMatchBeginning := gIni.ReadBool('Configuration', 'QuickSearchMatchBeginning', True);
|
||||
gQuickSearchMatchEnding := gIni.ReadBool('Configuration', 'QuickSearchMatchEnding', True);
|
||||
gQuickFilter := gIni.ReadBool('Configuration', 'QuickFilter', gQuickFilter);
|
||||
gQuickFilterMode := TShiftState(gIni.ReadInteger('Configuration', 'QuickFilterMode', Integer(gQuickFilterMode)));
|
||||
{ Misc page }
|
||||
gGridVertLine:= gIni.ReadBool('Configuration', 'GridVertLine', False);
|
||||
gGridHorzLine:= gIni.ReadBool('Configuration', 'GridHorzLine', False);
|
||||
|
|
@ -817,6 +822,8 @@ begin
|
|||
gIni.WriteInteger('Configuration', 'QuickSearchMode', Integer(gQuickSearchMode));
|
||||
gIni.WriteBool('Configuration', 'QuickSearchMatchBeginning', gQuickSearchMatchBeginning);
|
||||
gIni.WriteBool('Configuration', 'QuickSearchMatchEnding', gQuickSearchMatchEnding);
|
||||
gIni.WriteBool('Configuration', 'QuickFilter', gQuickFilter);
|
||||
gIni.WriteInteger('Configuration', 'QuickFilterMode', Integer(gQuickFilterMode));
|
||||
{ Misc page }
|
||||
gIni.WriteBool('Configuration', 'GridVertLine', gGridVertLine);
|
||||
gIni.WriteBool('Configuration', 'GridHorzLine', gGridHorzLine);
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ resourcestring
|
|||
rsMsgLogExtract = 'Extract file %s';
|
||||
|
||||
rsQuickSearchPanel = 'Find:';
|
||||
rsQuickFilterPanel = 'Filter:';
|
||||
rsSavePosition = '&Save position';
|
||||
rsPositionSaved = 'Position saved.';
|
||||
// File operations dialog
|
||||
|
|
@ -226,7 +227,7 @@ resourcestring
|
|||
rsOptFolderTabs = 'Folder tabs';
|
||||
rsOptLog = 'Log';
|
||||
rsOptConfig = 'Configuration';
|
||||
rsOptQuickSearch = 'Quick search';
|
||||
rsOptQuickSearch = 'Quick search/filter';
|
||||
rsOptColumns = 'Columns';
|
||||
rsOptMiscellaneous = 'Miscellaneous';
|
||||
rsOptAutoRefresh = 'Auto refresh';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue