1 | unit FormImportPattern;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
---|
7 | Acronym, FormEx;
|
---|
8 |
|
---|
9 | type
|
---|
10 |
|
---|
11 | { TFormImportPattern }
|
---|
12 |
|
---|
13 | TFormImportPattern = class(TFormEx)
|
---|
14 | ButtonCancel: TButton;
|
---|
15 | ButtonOk: TButton;
|
---|
16 | CheckBoxRepetition: TCheckBox;
|
---|
17 | ComboBoxAction: TComboBox;
|
---|
18 | ComboBoxVariable: TComboBox;
|
---|
19 | EditBlockEnd: TEdit;
|
---|
20 | EditBlockStart: TEdit;
|
---|
21 | Label10: TLabel;
|
---|
22 | Label11: TLabel;
|
---|
23 | Label8: TLabel;
|
---|
24 | Label9: TLabel;
|
---|
25 | ScrollBox1: TScrollBox;
|
---|
26 | procedure FormCreate(Sender: TObject);
|
---|
27 | procedure FormShow(Sender: TObject);
|
---|
28 | private
|
---|
29 | procedure InitControls;
|
---|
30 | public
|
---|
31 | procedure Save(Pattern: TImportPattern);
|
---|
32 | procedure Load(Pattern: TImportPattern);
|
---|
33 | end;
|
---|
34 |
|
---|
35 |
|
---|
36 | implementation
|
---|
37 |
|
---|
38 | {$R *.lfm}
|
---|
39 |
|
---|
40 | { TFormImportPattern }
|
---|
41 |
|
---|
42 | procedure TFormImportPattern.FormShow(Sender: TObject);
|
---|
43 | begin
|
---|
44 | InitControls;
|
---|
45 | end;
|
---|
46 |
|
---|
47 | procedure TFormImportPattern.FormCreate(Sender: TObject);
|
---|
48 | begin
|
---|
49 | InitControls;
|
---|
50 | end;
|
---|
51 |
|
---|
52 | procedure TFormImportPattern.InitControls;
|
---|
53 | var
|
---|
54 | I: TImportPatternFlag;
|
---|
55 | J: TImportVariable;
|
---|
56 | Index: Integer;
|
---|
57 | begin
|
---|
58 | Index := ComboBoxAction.ItemIndex;
|
---|
59 | while ComboBoxAction.Items.Count > 0 do
|
---|
60 | ComboBoxAction.Items.Delete(ComboBoxAction.Items.Count - 1);
|
---|
61 | while ComboBoxAction.Items.Count <= Integer(High(ImportPatternFlagString)) do
|
---|
62 | ComboBoxAction.Items.Add('');
|
---|
63 | for I := Low(TImportPatternFlag) to High(TImportPatternFlag) do
|
---|
64 | ComboBoxAction.Items[Integer(I)] := ImportPatternFlagString[I];
|
---|
65 | ComboBoxAction.ItemIndex := Index;
|
---|
66 |
|
---|
67 | Index := ComboBoxVariable.ItemIndex;
|
---|
68 | ComboBoxVariable.Items.Clear;
|
---|
69 | while ComboBoxVariable.Items.Count > 0 do
|
---|
70 | ComboBoxVariable.Items.Delete(ComboBoxVariable.Items.Count - 1);
|
---|
71 | while ComboBoxVariable.Items.Count <= Integer(High(ImportVariableString)) do
|
---|
72 | ComboBoxVariable.Items.Add('');
|
---|
73 | for J := Low(TImportVariable) to High(TImportVariable) do
|
---|
74 | ComboBoxVariable.Items[Integer(J)] := ImportVariableString[J];
|
---|
75 | ComboBoxVariable.ItemIndex := Index;
|
---|
76 | end;
|
---|
77 |
|
---|
78 | procedure TFormImportPattern.Save(Pattern: TImportPattern);
|
---|
79 | begin
|
---|
80 | Pattern.StartString := EditBlockStart.Text;
|
---|
81 | Pattern.EndString := EditBlockEnd.Text;
|
---|
82 | Pattern.Variable := TImportVariable(ComboBoxVariable.ItemIndex);
|
---|
83 | Pattern.Flag := TImportPatternFlag(ComboBoxAction.ItemIndex);
|
---|
84 | Pattern.Repetition := CheckBoxRepetition.Checked;
|
---|
85 | end;
|
---|
86 |
|
---|
87 | procedure TFormImportPattern.Load(Pattern: TImportPattern);
|
---|
88 | begin
|
---|
89 | EditBlockStart.Text := Pattern.StartString;
|
---|
90 | EditBlockEnd.Text := Pattern.EndString;
|
---|
91 | ComboBoxVariable.ItemIndex := Integer(Pattern.Variable);
|
---|
92 | ComboBoxAction.ItemIndex := Integer(Pattern.Flag);
|
---|
93 | CheckBoxRepetition.Checked := Pattern.Repetition;
|
---|
94 | end;
|
---|
95 |
|
---|
96 | end.
|
---|
97 |
|
---|