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