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