-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFastFilter.fmlua
242 lines (185 loc) · 4.62 KB
/
FastFilter.fmlua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
;;
;; FastFilter - áûñòðàÿ ôèëüòðàöèÿ â ïàíåëÿõ
;; (c) Max Rusov
;;
;;RAlt+ÁóêâûÈëèÖèôðû — Ôèëüòðàöèÿ, äîáàâèòü ñèìâîë ê ôèëüòðó
;;RAlt+BS — Óäàëèòü ñèìâîë èç ôèëüòðà
;;RAlt+/ — Ðåäàêòèðîâàòü ôèëüòð â äèàëîãå
;;RAlt+- — Âêëþ÷èòü/âûêëþ÷èòü ðåæèì èñêëþ÷àþùåãî ôèëüòðà
;;RAlt+\ — Âêëþ÷èòü/âûêëþ÷èòü ðåæèì ôèëüòðàöèè êàòàëîãîâ
;;RAlt — Óäàëèòü âåñü ôèëüòð
;;
;;!!!
;;!!!
;;
const FarHints = 'CDF48DA0-0334-4169-8453-69048DD3B51C'
macro
Name="FastFilterClear"
Descr="Fast filter: Clear Filter"
Bind="RAlt:Release"
Area="Shell"
{{
#include_macro_once "FilterFunc"
_G.FastFilter = nil _G.FastFilterExc = false _G.FastFilterSet("", false, false)}}
macro
Descr="Fast filter: Add symbol"
Bind="/RAlt\w/ RAlt, RAlt."
Area="Shell"
{{
#include_macro_once "FilterFunc"
s = mf.akey(2):sub(-1) if not _G.FastFilter then _G.FastFilter = s; _G.FastFilterExc = nil; -- Íå çàïîìèíàåì if _G.FastFilterDir == nil then _G.FastFilterDir = mf.mload("FastFilter", "FilterDir") end Plugin.Call(#%FarHints, "Info", "") else _G.FastFilter = _G.FastFilter .. s; end; _G.FastFilterSet(_G.FastFilter, _G.FastFilterExc, _G.FastFilterDir)}}
macro
Descr="Fast filter: Delete symbol"
Bind="RAltBS"
Area="Shell"
{{
#include_macro_once "FilterFunc"
if _G.FastFilter then-- _G.FastFilter = mf.substr(_G.FastFilter, 0, -1); _G.FastFilter = _G.FastFilter:sub(1, -2) _G.FastFilterSet(_G.FastFilter, _G.FastFilterExc, _G.FastFilterDir) end}}
macro
Name="FastFilterPrompt"
Descr="Fast filter: Input filter"
Bind="RAlt/"
Area="Shell"
{{
#include_macro_once "FilterFunc"
_G.FastFilter = prompt("Fast filter", "Input Filter:", 8, _G.FastFilter, "FastFilter.Text"); if not _G.FastFilter then return end _G.FastFilterSet(_G.FastFilter, _G.FastFilterExc, _G.FastFilterDir)}}
macro
Name="FastFilterInclusive"
Descr="Fast filter: Inclusive/Exclisive filter"
Bind="RAlt-"
Area="Shell"
{{
#include_macro_once "FilterFunc"
_G.FastFilterExc = not _G.FastFilterExc _G.FastFilterExclusive(_G.FastFilterExc)}}
macro
Name="FastFilterToggleFolder"
Descr="Fast filter: Toggle folder filter"
Bind="RAltBackSlash"
Area="Shell"
{{
#include_macro_once "FilterFunc"
_G.FastFilterDir = not _G.FastFilterDir; mf.msave("FastFilter", "FilterDir", _G.FastFilterDir)
_G.FastFilterDirectory(_G.FastFilterDir)}}
//-----------------------------------------------------------------------------
// Ãëîáàëüíûå ôóíêöèè
macro Name="FilterFunc"
{{
FilterName = "$FastFilter"
function ShowHint()
if _G.FastFilter then
-- Plugin.Call(#%FarHints, "Info", "") Plugin.Call(#%FarHints, "FontSize", 14) Plugin.Call(#%FarHints, "Info", (_G.FastFilterExc and "-" or "") .. _G.FastFilter, -1, -4, 3000) else Plugin.Call(#%FarHints, "Info", "") end end
function _G.FastFilterSet(AFilter, AExclusive, AFilterDir)
local s1, s2
Keys("CtrlI") if Menu.Select(FilterName, 1) == 0 then if AFilter == "" then Keys("Esc") ShowHint() return end Keys("Ins") print(FilterName) Keys("Tab Tab") s1 = "*" .. AFilter .. "*"; s2 = mf.xlat(s1); if s1 ~= s2 then s1 = s1 .. "," .. s2; end print(s1) if AFilterDir then -- Ôèëüòðóåì êàòàëîãè òîæå Keys("AltD Multiply") end Keys("Enter") if AExclusive then Keys("Subtract") else Keys("Add") end else if AFilter == "" then Keys("DEL Enter") else Keys("F4") Keys("Tab Tab") s1 = "*" .. AFilter .. "*"; s2 = mf.xlat(s1); if s1 ~= s2 then s1 = s1 .. "," .. s2; end print(s1) Keys("Enter") end end Keys("Enter") ShowHint() end
function _G.FastFilterExclusive(AOn)
Keys("CtrlI") if Menu.Select(FilterName, 1) > 0 then Keys("BS") Menu.Select(FilterName, 1) if AOn then Keys("Subtract") else Keys("Add") end Keys("Enter") ShowHint() else Keys("Esc") end end
function _G.FastFilterDirectory(AOn)
Keys("CtrlI") if Menu.Select(FilterName, 1) > 0 then Keys("F4") Keys("AltD") if AOn then Keys("Multiply") else Keys("Subtract") end Keys("Enter") Keys("Enter") ShowHint() else Keys("Esc") end end
}}