rev |
line source |
meillo@0
|
1 unit unit_Editor_as;
|
meillo@0
|
2
|
meillo@0
|
3 interface//####################################################################################
|
meillo@0
|
4
|
meillo@0
|
5 uses
|
meillo@0
|
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
meillo@0
|
7 Dialogs, ExtCtrls, StdCtrls, ExtDlgs;
|
meillo@0
|
8
|
meillo@0
|
9 type
|
meillo@0
|
10 Tform_Editor_as = class(TForm)
|
meillo@0
|
11 gbx_AutorunIcon: TGroupBox;
|
meillo@0
|
12 btn_BrowseIcon: TButton;
|
meillo@0
|
13 tbx_IconPath: TEdit;
|
meillo@0
|
14 img_Icon: TImage;
|
meillo@0
|
15 gbx_ZielDir: TGroupBox;
|
meillo@0
|
16 tbx_CDRootPath: TEdit;
|
meillo@0
|
17 btn_BrowseCDRoot: TButton;
|
meillo@0
|
18 lbl_1: TLabel;
|
meillo@0
|
19 lbl_2: TLabel;
|
meillo@0
|
20 lbl_3: TLabel;
|
meillo@0
|
21 btn_cancel: TButton;
|
meillo@0
|
22 btn_apply: TButton;
|
meillo@0
|
23 btn_restore: TButton;
|
meillo@0
|
24 img_IconCDAR: TImage;
|
meillo@0
|
25 GroupBox1: TGroupBox;
|
meillo@0
|
26 lbl_4: TLabel;
|
meillo@0
|
27 lbl_5: TLabel;
|
meillo@0
|
28 tbx_StartsFD: TEdit;
|
meillo@0
|
29 tbx_Warnings: TMemo;
|
meillo@0
|
30 OpenDialog1: TOpenPictureDialog;
|
meillo@0
|
31 procedure FormCreate(Sender: TObject);
|
meillo@0
|
32 procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
meillo@0
|
33 procedure FormShow(Sender: TObject);
|
meillo@0
|
34 procedure btn_BrowseIconClick(Sender: TObject);
|
meillo@0
|
35 procedure btn_BrowseCDRootClick(Sender: TObject);
|
meillo@0
|
36 procedure btn_restoreClick(Sender: TObject);
|
meillo@0
|
37 procedure btn_applyClick(Sender: TObject);
|
meillo@0
|
38 procedure btn_cancelClick(Sender: TObject);
|
meillo@0
|
39 procedure tbx_StartsFDChange(Sender: TObject);
|
meillo@0
|
40 procedure tbx_CDRootPathChange(Sender: TObject);
|
meillo@0
|
41 private
|
meillo@0
|
42
|
meillo@0
|
43 public
|
meillo@0
|
44 { Public declarations }
|
meillo@0
|
45 end;
|
meillo@0
|
46
|
meillo@0
|
47 var
|
meillo@0
|
48 form_Editor_as: Tform_Editor_as;
|
meillo@0
|
49
|
meillo@0
|
50 implementation//###############################################################################
|
meillo@0
|
51 uses unit_Editor, unit_Editor_as_BrowseDir;
|
meillo@0
|
52 {$R *.dfm}//###################################################################################
|
meillo@0
|
53
|
meillo@0
|
54 // forwardings
|
meillo@0
|
55 procedure Warnings();forward;
|
meillo@0
|
56
|
meillo@0
|
57 //------------------------------------------------------------------------------ form create
|
meillo@0
|
58 procedure Tform_Editor_as.FormCreate(Sender: TObject);
|
meillo@0
|
59 begin
|
meillo@0
|
60 // set language
|
meillo@0
|
61 if form_editor.englisch = true then
|
meillo@0
|
62 begin // English
|
meillo@0
|
63 form_editor_as.Caption := 'Autorun Settings';
|
meillo@0
|
64 btn_BrowseIcon.Caption := 'Browse';
|
meillo@0
|
65 btn_BrowseCDRoot.Caption := 'Browse';
|
meillo@0
|
66 lbl_1.Caption := 'Autorun-Icon of the CD';
|
meillo@0
|
67 lbl_2.Caption := 'Directory where the Files will be copied to';
|
meillo@0
|
68 lbl_3.Caption := '(This Directory represents the Root-Dir of the CD)';
|
meillo@0
|
69 btn_cancel.Caption := 'Cancel Changes';
|
meillo@0
|
70 btn_apply.Caption := 'Apply Changes';
|
meillo@0
|
71 btn_restore.Caption := 'CDAR-Icon';
|
meillo@0
|
72 lbl_4.Caption := 'Choose the File which will be started by CDAR';
|
meillo@0
|
73 lbl_5.Caption := '(Insert a Path relative to the CD-Root-Dir!)';
|
meillo@0
|
74 end
|
meillo@0
|
75 else
|
meillo@0
|
76 begin // German
|
meillo@0
|
77 form_editor_as.Caption := 'Autorun Optionen';
|
meillo@0
|
78 btn_BrowseIcon.Caption := 'Durchsuchen';
|
meillo@0
|
79 btn_BrowseCDRoot.Caption := 'Durchsuchen';
|
meillo@0
|
80 lbl_1.Caption := 'Autorun-Icon der CD';
|
meillo@0
|
81 lbl_2.Caption := 'Ordner in den die Dateien kopiert werden';
|
meillo@0
|
82 lbl_3.Caption := '(Entspricht dem CD-Grund-Verzeichnis)';
|
meillo@0
|
83 btn_cancel.Caption := 'Abbrechen';
|
meillo@0
|
84 btn_apply.Caption := 'Übernehmen';
|
meillo@0
|
85 btn_restore.Caption := 'CDAR-Icon';
|
meillo@0
|
86 lbl_4.Caption := 'Datei, die von CDAR gestartet werden soll';
|
meillo@0
|
87 lbl_5.Caption := '(Pfad relativ zum CD-Grund-Verzeichnis)';
|
meillo@0
|
88 end;
|
meillo@0
|
89
|
meillo@0
|
90 // set standard path in OpenDialog
|
meillo@0
|
91 opendialog1.InitialDir := extractfilepath(paramstr(0));
|
meillo@0
|
92 end;//--------------------------------------------------------------------------
|
meillo@0
|
93 //------------------------------------------------------------------------------ form show
|
meillo@0
|
94 procedure Tform_Editor_as.FormShow(Sender: TObject);
|
meillo@0
|
95 begin
|
meillo@0
|
96 // disable drag'n'drop
|
meillo@0
|
97 form_editor.draggingstatus := 3;
|
meillo@0
|
98 // disable menu
|
meillo@0
|
99 form_editor.mnu_Tutorial.enabled := false;
|
meillo@0
|
100 form_editor.mnu_WelcomeScreen.Enabled := false;
|
meillo@0
|
101 form_editor.mnu_Autorun.Enabled := false;
|
meillo@0
|
102 form_editor.mnu_CreateAR.enabled := false;
|
meillo@0
|
103 form_editor.mnu_Sprache.enabled := false;
|
meillo@0
|
104
|
meillo@0
|
105 // init
|
meillo@0
|
106 tbx_IconPath.text := form_Editor.PfadIcon_alt;
|
meillo@0
|
107 if form_Editor.PfadIcon_alt = '' then
|
meillo@0
|
108 begin
|
meillo@0
|
109 img_IconCDAR.show;
|
meillo@0
|
110 img_icon.Hide;
|
meillo@0
|
111 end
|
meillo@0
|
112 else
|
meillo@0
|
113 begin
|
meillo@0
|
114 img_IconCDAR.hide;
|
meillo@0
|
115 img_Icon.Show;
|
meillo@0
|
116 img_icon.Picture.LoadFromFile(form_Editor.PfadIcon_alt);
|
meillo@0
|
117 end;
|
meillo@0
|
118 tbx_CDRootPath.text := form_Editor.CDRoot_alt;
|
meillo@0
|
119 tbx_StartsFD.Text := form_Editor.StartsFD_alt;
|
meillo@0
|
120 end;//--------------------------------------------------------------------------
|
meillo@0
|
121 //------------------------------------------------------------------------------ form close
|
meillo@0
|
122 procedure Tform_Editor_as.FormClose(Sender: TObject;
|
meillo@0
|
123 var Action: TCloseAction);
|
meillo@0
|
124 begin
|
meillo@0
|
125 // enable drag'n'drop
|
meillo@0
|
126 form_editor.draggingstatus := 0;
|
meillo@0
|
127 // enable menu
|
meillo@0
|
128 form_editor.mnu_Tutorial.enabled := true;
|
meillo@0
|
129 form_editor.mnu_WelcomeScreen.Enabled := true;
|
meillo@0
|
130 form_editor.mnu_Autorun.Enabled := true;
|
meillo@0
|
131 form_editor.mnu_CreateAR.enabled := true;
|
meillo@0
|
132 form_editor.mnu_Sprache.enabled := true;
|
meillo@0
|
133 end;//--------------------------------------------------------------------------
|
meillo@0
|
134
|
meillo@0
|
135 //#############################################################################################
|
meillo@0
|
136
|
meillo@0
|
137 //------------------------------------------------------------------------------ browse icon
|
meillo@0
|
138 procedure Tform_Editor_as.btn_BrowseIconClick(Sender: TObject);
|
meillo@0
|
139 begin
|
meillo@0
|
140 if opendialog1.Execute then
|
meillo@0
|
141 begin
|
meillo@0
|
142 tbx_IconPath.Text := opendialog1.FileName;
|
meillo@0
|
143 // load picture
|
meillo@0
|
144 img_Icon.Picture.LoadFromFile(tbx_IconPath.text);
|
meillo@0
|
145 // show picture
|
meillo@0
|
146 img_IconCDAR.hide;
|
meillo@0
|
147 img_Icon.Show;
|
meillo@0
|
148 end;
|
meillo@0
|
149 end;//--------------------------------------------------------------------------
|
meillo@0
|
150 //------------------------------------------------------------------------------ restore icon
|
meillo@0
|
151 procedure Tform_Editor_as.btn_restoreClick(Sender: TObject);
|
meillo@0
|
152 begin
|
meillo@0
|
153 img_IconCDAR.show;
|
meillo@0
|
154 img_icon.Hide;
|
meillo@0
|
155 tbx_IconPath.Text := '';
|
meillo@0
|
156 end;//--------------------------------------------------------------------------
|
meillo@0
|
157
|
meillo@0
|
158 //------------------------------------------------------------------------------ browse CD-root
|
meillo@0
|
159 procedure Tform_Editor_as.btn_BrowseCDRootClick(Sender: TObject);
|
meillo@0
|
160 begin
|
meillo@0
|
161 application.CreateForm(tform_editor_as_browsedir, form_editor_as_browsedir);
|
meillo@0
|
162 form_editor_as_browsedir.show;
|
meillo@0
|
163 end;//--------------------------------------------------------------------------
|
meillo@0
|
164
|
meillo@0
|
165 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
meillo@0
|
166
|
meillo@0
|
167 //------------------------------------------------------------------------------ change CD-root
|
meillo@0
|
168 procedure Tform_Editor_as.tbx_CDRootPathChange(Sender: TObject);
|
meillo@0
|
169 begin
|
meillo@0
|
170 // format check
|
meillo@0
|
171 Warnings;
|
meillo@0
|
172 end;//--------------------------------------------------------------------------
|
meillo@0
|
173 //------------------------------------------------------------------------------ change startsFD
|
meillo@0
|
174 procedure Tform_Editor_as.tbx_StartsFDChange(Sender: TObject);
|
meillo@0
|
175 begin
|
meillo@0
|
176 // format check
|
meillo@0
|
177 Warnings;
|
meillo@0
|
178 end;//--------------------------------------------------------------------------
|
meillo@0
|
179
|
meillo@0
|
180 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
meillo@0
|
181
|
meillo@0
|
182 //------------------------------------------------------------------------------ apply
|
meillo@0
|
183 procedure Tform_Editor_as.btn_applyClick(Sender: TObject);
|
meillo@0
|
184 begin
|
meillo@0
|
185 form_Editor.PfadIcon_alt := tbx_IconPath.text;
|
meillo@0
|
186
|
meillo@0
|
187 if copy(tbx_CDRootPath.text, length(tbx_CDRootpath.text), 1) <> '\' then
|
meillo@0
|
188 begin
|
meillo@0
|
189 form_Editor.CDRoot_alt := tbx_CDRootPath.Text + '\';
|
meillo@0
|
190 end
|
meillo@0
|
191 else
|
meillo@0
|
192 begin
|
meillo@0
|
193 form_Editor.CDRoot_alt := tbx_CDRootPath.Text;
|
meillo@0
|
194 end;
|
meillo@0
|
195
|
meillo@0
|
196 form_Editor.StartsFD_alt := tbx_startsFD.text;
|
meillo@0
|
197
|
meillo@0
|
198 // close
|
meillo@0
|
199 form_editor_as.Close;
|
meillo@0
|
200 end;//--------------------------------------------------------------------------
|
meillo@0
|
201 //------------------------------------------------------------------------------ cancel
|
meillo@0
|
202 procedure Tform_Editor_as.btn_cancelClick(Sender: TObject);
|
meillo@0
|
203 begin
|
meillo@0
|
204 // close
|
meillo@0
|
205 form_editor_as.Close;
|
meillo@0
|
206 end;//--------------------------------------------------------------------------
|
meillo@0
|
207
|
meillo@0
|
208 //#############################################################################################
|
meillo@0
|
209
|
meillo@0
|
210 //------------------------------------------------------------------------------ warnings
|
meillo@0
|
211 procedure Warnings();
|
meillo@0
|
212 begin
|
meillo@0
|
213 with form_Editor_as do
|
meillo@0
|
214 begin
|
meillo@0
|
215 tbx_Warnings.lines.clear;
|
meillo@0
|
216
|
meillo@0
|
217 if copy(tbx_CDRootPath.text, 2, 2) <> ':\' then
|
meillo@0
|
218 begin
|
meillo@0
|
219 btn_apply.Enabled := false;
|
meillo@0
|
220 tbx_Warnings.Show;
|
meillo@0
|
221 tbx_Warnings.Lines.Add('2nd Path must be ABSOLUTE');
|
meillo@0
|
222 if pos(':', tbx_StartsFD.text) <> 0 then
|
meillo@0
|
223 begin
|
meillo@0
|
224 tbx_Warnings.Lines.Add('3rd Path must be RELATIVE');
|
meillo@0
|
225 end;
|
meillo@0
|
226 end
|
meillo@0
|
227 else
|
meillo@0
|
228 begin
|
meillo@0
|
229 if pos(':', tbx_StartsFD.text) <> 0 then
|
meillo@0
|
230 begin
|
meillo@0
|
231 btn_apply.Enabled := false;
|
meillo@0
|
232 tbx_Warnings.Show;
|
meillo@0
|
233 tbx_Warnings.Lines.Add('3rd Path must be RELATIVE');
|
meillo@0
|
234 end
|
meillo@0
|
235 else
|
meillo@0
|
236 begin
|
meillo@0
|
237 btn_apply.Enabled := true;
|
meillo@0
|
238 tbx_Warnings.hide;
|
meillo@0
|
239 end;
|
meillo@0
|
240 end;
|
meillo@0
|
241 tbx_Warnings.Text := copy(tbx_Warnings.text, 1, length(tbx_Warnings.text)-2);
|
meillo@0
|
242 end;
|
meillo@0
|
243 end;//--------------------------------------------------------------------------
|
meillo@0
|
244
|
meillo@0
|
245 end.//#########################################################################################
|