forked from doublecmd/doublecmd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ffindview.pas
129 lines (105 loc) · 2.7 KB
/
ffindview.pas
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
{
Seksi Commander
----------------------------
Find dialog for Viewer
Licence : GNU GPL v 2.0
Author : [email protected]
contributors:
}
unit fFindView;
{$mode objfpc}{$H+}
interface
uses
SysUtils, Classes, Controls, Forms, StdCtrls, Buttons, uOSForms;
type
{ TfrmFindView }
TfrmFindView = class(TModalForm)
cbDataToFind: TComboBox;
btnFind: TBitBtn;
btnClose: TBitBtn;
cbCaseSens: TCheckBox;
cbBackwards: TCheckBox;
chkHex: TCheckBox;
cbRegExp: TCheckBox;
procedure cbBackwardsChange(Sender: TObject);
procedure cbRegExpChange(Sender: TObject);
procedure chkHexChange(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure btnFindClick(Sender: TObject);
procedure cbDataToFindKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
function GetTextSearchOptions: UIntPtr;
public
{ Public declarations }
end;
implementation
{$R *.lfm}
uses
LCLProc, LCLType, uFindFiles, uDCUtils;
procedure TfrmFindView.FormShow(Sender: TObject);
begin
if cbDataToFind.Text = EmptyStr then
begin
if cbDataToFind.Items.Count > 0 then
cbDataToFind.Text:= cbDataToFind.Items[0];
end;
cbDataToFind.SelectAll;
end;
procedure TfrmFindView.chkHexChange(Sender: TObject);
begin
if not chkHex.Checked then
cbCaseSens.Checked:= Boolean(cbCaseSens.Tag)
else begin
cbCaseSens.Tag:= Integer(cbCaseSens.Checked);
cbCaseSens.Checked:= True;
end;
cbCaseSens.Enabled:= not chkHex.Checked;
end;
procedure TfrmFindView.FormActivate(Sender: TObject);
begin
cbDataToFind.SetFocus;
end;
procedure TfrmFindView.cbBackwardsChange(Sender: TObject);
begin
if cbBackwards.Checked then cbRegExp.Checked:= False
end;
procedure TfrmFindView.cbRegExpChange(Sender: TObject);
begin
if cbRegExp.Checked then cbBackwards.Checked:= False;
end;
procedure TfrmFindView.btnFindClick(Sender: TObject);
begin
InsertFirstItem(cbDataToFind.Text, cbDataToFind, GetTextSearchOptions);
ModalResult:= mrOk;
end;
procedure TfrmFindView.cbDataToFindKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key = VK_Down) and (cbDataToFind.Items.Count > 0) then
cbDataToFind.DroppedDown:= True;
if Key = 13 then
begin
Key:= 0;
btnFind.Click;
end;
if Key = 27 then
begin
Key:= 0;
ModalResult:= mrCancel;
end;
end;
function TfrmFindView.GetTextSearchOptions: UIntPtr;
var
Options: TTextSearchOptions absolute Result;
begin
Result:= 0;
if cbCaseSens.Checked then
Include(Options, tsoMatchCase);
if cbRegExp.Checked then
Include(Options, tsoRegExpr);
if chkHex.Checked then
Include(Options, tsoHex);
end;
end.