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