mirror of https://gitlab.com/basile.b/dexed.git
added a file filter
This commit is contained in:
parent
74826a6fbb
commit
1e63f7d6e9
|
@ -1,28 +1,35 @@
|
|||
inherited CEMiniExplorerWidget: TCEMiniExplorerWidget
|
||||
Left = 1493
|
||||
Left = 1093
|
||||
Height = 651
|
||||
Top = 45
|
||||
Top = 185
|
||||
Width = 329
|
||||
Caption = 'Mini explorer'
|
||||
ClientHeight = 651
|
||||
ClientWidth = 329
|
||||
inherited Back: TPanel
|
||||
Height = 651
|
||||
Width = 329
|
||||
ClientHeight = 651
|
||||
ClientWidth = 329
|
||||
inherited Content: TPanel
|
||||
Height = 651
|
||||
Width = 329
|
||||
ClientHeight = 651
|
||||
ClientWidth = 329
|
||||
object lstFiles: TListView[0]
|
||||
Left = 4
|
||||
Height = 277
|
||||
Top = 370
|
||||
Width = 324
|
||||
Width = 321
|
||||
Align = alClient
|
||||
AutoSort = False
|
||||
AutoWidthLastColumn = True
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Bottom = 4
|
||||
Columns = <
|
||||
item
|
||||
Width = 320
|
||||
Width = 317
|
||||
end>
|
||||
ReadOnly = True
|
||||
ShowColumnHeaders = False
|
||||
|
@ -35,7 +42,7 @@ inherited CEMiniExplorerWidget: TCEMiniExplorerWidget
|
|||
Left = 4
|
||||
Height = 195
|
||||
Top = 169
|
||||
Width = 324
|
||||
Width = 321
|
||||
Align = alTop
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Top = 4
|
||||
|
@ -51,7 +58,7 @@ inherited CEMiniExplorerWidget: TCEMiniExplorerWidget
|
|||
Left = 4
|
||||
Height = 131
|
||||
Top = 4
|
||||
Width = 324
|
||||
Width = 321
|
||||
Align = alTop
|
||||
AutoWidthLastColumn = True
|
||||
BorderSpacing.Left = 4
|
||||
|
@ -59,7 +66,7 @@ inherited CEMiniExplorerWidget: TCEMiniExplorerWidget
|
|||
BorderSpacing.Right = 4
|
||||
Columns = <
|
||||
item
|
||||
Width = 320
|
||||
Width = 317
|
||||
end>
|
||||
ReadOnly = True
|
||||
ShowColumnHeaders = False
|
||||
|
@ -71,13 +78,13 @@ inherited CEMiniExplorerWidget: TCEMiniExplorerWidget
|
|||
Left = 4
|
||||
Height = 24
|
||||
Top = 141
|
||||
Width = 324
|
||||
Width = 321
|
||||
Align = alTop
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Right = 4
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 24
|
||||
ClientWidth = 324
|
||||
ClientWidth = 321
|
||||
TabOrder = 3
|
||||
object btnAddFav: TBitBtn
|
||||
Left = 0
|
||||
|
@ -126,12 +133,12 @@ inherited CEMiniExplorerWidget: TCEMiniExplorerWidget
|
|||
TabOrder = 0
|
||||
end
|
||||
object btnEdit: TBitBtn
|
||||
Left = 296
|
||||
Left = 84
|
||||
Height = 24
|
||||
Hint = 'open selected file in a Coedit-or'
|
||||
Top = 0
|
||||
Width = 28
|
||||
Align = alRight
|
||||
Align = alLeft
|
||||
Glyph.Data = {
|
||||
36040000424D3604000000000000360000002800000010000000100000000100
|
||||
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
|
||||
|
@ -172,12 +179,12 @@ inherited CEMiniExplorerWidget: TCEMiniExplorerWidget
|
|||
TabOrder = 1
|
||||
end
|
||||
object btnShellOpen: TBitBtn
|
||||
Left = 268
|
||||
Left = 56
|
||||
Height = 24
|
||||
Hint = 'open the selected file with the shell'
|
||||
Top = 0
|
||||
Width = 28
|
||||
Align = alRight
|
||||
Align = alLeft
|
||||
Glyph.Data = {
|
||||
36040000424D3604000000000000360000002800000010000000100000000100
|
||||
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
|
||||
|
@ -263,21 +270,17 @@ inherited CEMiniExplorerWidget: TCEMiniExplorerWidget
|
|||
OnClick = btnRemFavClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object Bevel1: TBevel
|
||||
Left = 204
|
||||
Height = 24
|
||||
object lstFilter: TListFilterEdit
|
||||
Left = 112
|
||||
Height = 23
|
||||
Top = 0
|
||||
Width = 64
|
||||
Align = alRight
|
||||
Shape = bsTopLine
|
||||
end
|
||||
object Bevel2: TBevel
|
||||
Left = 56
|
||||
Height = 24
|
||||
Top = 0
|
||||
Width = 72
|
||||
Align = alLeft
|
||||
Shape = bsBottomLine
|
||||
Width = 184
|
||||
ButtonWidth = 23
|
||||
NumGlyphs = 1
|
||||
Align = alCustom
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
MaxLength = 0
|
||||
TabOrder = 4
|
||||
end
|
||||
end
|
||||
object Splitter1: TSplitter[4]
|
||||
|
@ -285,7 +288,7 @@ inherited CEMiniExplorerWidget: TCEMiniExplorerWidget
|
|||
Left = 0
|
||||
Height = 6
|
||||
Top = 135
|
||||
Width = 332
|
||||
Width = 329
|
||||
Align = alTop
|
||||
ResizeAnchor = akTop
|
||||
end
|
||||
|
@ -294,7 +297,7 @@ inherited CEMiniExplorerWidget: TCEMiniExplorerWidget
|
|||
Left = 0
|
||||
Height = 6
|
||||
Top = 364
|
||||
Width = 332
|
||||
Width = 329
|
||||
Align = alTop
|
||||
ResizeAnchor = akTop
|
||||
end
|
||||
|
|
|
@ -5,18 +5,21 @@ unit ce_miniexplorer;
|
|||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, ExtCtrls, Menus, ComCtrls,
|
||||
Buttons, lcltype, strutils, ce_widget, ce_common, ce_interfaces, ce_observer;
|
||||
Classes, SysUtils, FileUtil, ListFilterEdit, Forms, Controls, Graphics,
|
||||
ExtCtrls, Menus, ComCtrls, Buttons, lcltype, StdCtrls, strutils, ce_widget,
|
||||
ce_common, ce_interfaces, ce_observer;
|
||||
|
||||
type
|
||||
|
||||
{ TCEMiniExplorerWidget }
|
||||
|
||||
TCEMiniExplorerWidget = class(TCEWidget)
|
||||
Bevel1: TBevel;
|
||||
Bevel2: TBevel;
|
||||
btnAddFav: TBitBtn;
|
||||
btnEdit: TBitBtn;
|
||||
btnShellOpen: TBitBtn;
|
||||
btnRemFav: TBitBtn;
|
||||
imgList: TImageList;
|
||||
lstFilter: TListFilterEdit;
|
||||
lstFiles: TListView;
|
||||
lstFav: TListView;
|
||||
Panel1: TPanel;
|
||||
|
@ -51,6 +54,7 @@ type
|
|||
procedure lstDeletion(Sender: TObject; Item: TListItem);
|
||||
procedure lstFavSelect(Sender: TObject; Item: TListItem; Selected: Boolean);
|
||||
procedure shellOpenSelected;
|
||||
procedure lstFilterChange(sender: TObject);
|
||||
public
|
||||
constructor create(aIwner: TComponent); override;
|
||||
destructor destroy; override;
|
||||
|
@ -83,6 +87,11 @@ begin
|
|||
Tree.OnDeletion := @treeDeletion;
|
||||
Tree.OnSelectionChanged := @treeSelectionChanged;
|
||||
Tree.OnExpanding := @treeExpanding;
|
||||
|
||||
// the filter is just use a GUI element and reveals:
|
||||
// http://bugs.freepascal.org/view.php?id=27137
|
||||
lstFilter.FilteredListbox := nil;
|
||||
lstFilter.onChange := @lstFilterChange;
|
||||
//
|
||||
treeSetRoots;
|
||||
end;
|
||||
|
@ -213,18 +222,26 @@ end;
|
|||
procedure TCEMiniExplorerWidget.fillLstFiles(const aList: TStrings);
|
||||
var
|
||||
itm: TListItem;
|
||||
fname: string;
|
||||
fname, itemText: string;
|
||||
dat: PString;
|
||||
noFilter: boolean;
|
||||
begin
|
||||
noFilter := lstFilter.Filter = '';
|
||||
lstFiles.Clear;
|
||||
lstFiles.BeginUpdate;
|
||||
for fname in aList do
|
||||
begin
|
||||
itm := lstFiles.Items.Add;
|
||||
itm.Caption := extractFileName(fname);
|
||||
dat := NewStr(fname);
|
||||
itm.Data := dat;
|
||||
itm.ImageIndex := 0;
|
||||
itemText := extractFileName(fname);
|
||||
if noFilter or AnsiContainsText(itemText,lstFilter.Filter) then
|
||||
begin
|
||||
itm := lstFiles.Items.Add;
|
||||
itm.Caption := itemText;
|
||||
dat := NewStr(fname);
|
||||
itm.Data := dat;
|
||||
itm.ImageIndex := 0;
|
||||
end;
|
||||
end;
|
||||
lstFiles.EndUpdate;
|
||||
end;
|
||||
|
||||
procedure TCEMiniExplorerWidget.btnShellOpenClick(Sender: TObject);
|
||||
|
@ -261,6 +278,10 @@ begin
|
|||
nil, amcMisc, amkErr);
|
||||
end;
|
||||
|
||||
procedure TCEMiniExplorerWidget.lstFilterChange(sender: TObject);
|
||||
begin
|
||||
lstFilesFromTree;
|
||||
end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION Tree ------------------------------------------------------------------}
|
||||
|
|
Loading…
Reference in New Issue