cdar

view unit_Editor_ws.pas @ 1:87b91371db05

removed files from hg-test
author "Meillo r e t u r n s <meillo@marmaro.de>"
date Sun, 03 Dec 2006 21:56:21 +0100
parents
children
line source
1 unit unit_Editor_ws;
3 interface//####################################################################################
5 uses
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, StdCtrls, ExtCtrls, jpeg, ExtDlgs;
9 type
10 Tform_Editor_ws = class(TForm)
11 btn_cancel: TButton;
12 btn_Apply: TButton;
13 gbx_BilderLaden: TGroupBox;
14 btn_bp: TButton;
15 lbl_1: TLabel;
16 tbx_BackgroundPath: TEdit;
17 tbx_EnterPath: TEdit;
18 btn_ep: TButton;
19 lbl_2: TLabel;
20 gbx_EnterPos: TGroupBox;
21 hsb_EnterXPos: TScrollBar;
22 tbx_XPos: TEdit;
23 lbl_3: TLabel;
24 tbx_YPos: TEdit;
25 lbl_4: TLabel;
26 vsb_EnterYPos: TScrollBar;
27 gbx_ShowTill: TGroupBox;
28 rbtn_DoShow: TRadioButton;
29 rbtn_NotShow: TRadioButton;
30 pan_ShowTill: TPanel;
31 rbtn_TillClick: TRadioButton;
32 rbtn_TillTime: TRadioButton;
33 cobx_Delay: TComboBox;
34 lbl_5: TLabel;
35 lbl_6: TLabel;
36 OpenDialog1: TOpenPictureDialog;
37 procedure FormClose(Sender: TObject; var Action: TCloseAction);
38 procedure FormCreate(Sender: TObject);
39 procedure hsb_EnterXPosChange(Sender: TObject);
40 procedure vsb_EnterYPosChange(Sender: TObject);
41 procedure rbtn_NotShowClick(Sender: TObject);
42 procedure rbtn_DoShowClick(Sender: TObject);
43 procedure btn_bpClick(Sender: TObject);
44 procedure btn_epClick(Sender: TObject);
45 procedure FormShow(Sender: TObject);
46 procedure btn_ApplyClick(Sender: TObject);
47 procedure btn_cancelClick(Sender: TObject);
48 procedure rbtn_TillTimeClick(Sender: TObject);
49 procedure rbtn_TillClickClick(Sender: TObject);
50 procedure tbx_BackgroundPathChange(Sender: TObject);
51 procedure tbx_EnterPathChange(Sender: TObject);
52 private
53 { Private declarations }
54 public
55 { Public declarations }
56 end;
58 var
59 form_Editor_ws: Tform_Editor_ws;
61 implementation//###############################################################################
62 uses unit_Editor;
63 {$R *.dfm}//###################################################################################
65 //------------------------------------------------------------------------------ form create
66 procedure Tform_Editor_ws.FormCreate(Sender: TObject);
67 begin
68 // set language
69 if form_editor.englisch = true then
70 begin // English
71 form_Editor_ws.Caption := 'Welcome-Screen Settings';
72 btn_cancel.Caption := 'Cancel Changes';
73 btn_Apply.Caption := 'Apply Changes';
74 btn_bp.Caption := 'Browse';
75 btn_ep.Caption := 'Browse';
76 lbl_1.Caption := 'Background-Picture: (600x450 px)';
77 lbl_2.caption := 'Enter-Picture: (150x40 px recommended)';
78 lbl_5.Caption := '... of the Enter-Picture';
79 lbl_6.Caption := '(You can move by Drag n Drop too)';
80 rbtn_DoShow.Caption := 'Show Welcome-Screen ...';
81 rbtn_NotShow.Caption := 'Do not show Welcome-Screen';
82 rbtn_TillClick.Caption := '... till click';
83 rbtn_TillTime.Caption := '... seconds';
84 end
85 else
86 begin // German
87 form_Editor_ws.Caption := 'Begrüßungsbild Optionen';
88 btn_cancel.Caption := 'Abbrechen';
89 btn_Apply.Caption := 'Übernehmen';
90 btn_bp.Caption := 'Durchsuchen';
91 btn_ep.Caption := 'Durchsuchen';
92 lbl_1.Caption := 'Hintergrundbild: (600x450 px)';
93 lbl_2.caption := 'Enterbild: (150x40 px empfohlen)';
94 lbl_5.Caption := '... des Enterbilds';
95 lbl_6.Caption := '(Drag n Drop ist auch möglich)';
96 rbtn_DoShow.Caption := 'Begrüßungsbild anzeigen ...';
97 rbtn_NotShow.Caption := 'Kein Begrüßungsbild anzeigen';
98 rbtn_TillClick.Caption := '... bis Klick';
99 rbtn_TillTime.Caption := '... Sekunden';
100 end;
102 // set standard path
103 opendialog1.InitialDir := extractfilepath(paramstr(0));
104 end;//--------------------------------------------------------------------------
105 //------------------------------------------------------------------------------ form show
106 procedure Tform_Editor_ws.FormShow(Sender: TObject);
107 begin
108 // disable drag'n'drop
109 form_editor.draggingstatus := 3;
110 // disable menu
111 form_editor.mnu_Tutorial.enabled := false;
112 form_editor.mnu_WelcomeScreen.Enabled := false;
113 form_editor.mnu_Autorun.Enabled := false;
114 form_editor.mnu_CreateAR.enabled := false;
115 form_editor.mnu_Sprache.enabled := false;
117 // init
118 // set picture path
119 tbx_BackgroundPath.text := form_Editor.PfadHG_alt;
120 tbx_EnterPath.text := form_Editor.PfadEnter_alt;
121 // set 'img_button'-positon
122 tbx_XPos.text := inttostr(form_Editor.xEnter_alt);
123 tbx_YPos.text := inttostr(form_Editor.yEnter_alt);
124 // kind of welcome action
125 if form_Editor.Welcomekind_alt = 'none' then
126 begin
127 rbtn_notshow.checked := true;
129 rbtn_tillclick.Enabled := false;
130 rbtn_tilltime.Enabled := false;
131 end
132 else
133 begin
134 if form_Editor.Welcomekind_alt = 'click' then
135 begin
136 rbtn_tillClick.checked := true;
137 rbtn_doshow.Checked := true;
138 end
139 else
140 begin
141 rbtn_tilltime.Checked := true;
142 rbtn_doshow.Checked := true;
143 end;
144 end;
145 // delay
146 cobx_delay.ItemIndex := form_Editor.Delay_alt;
148 // set scrollbar values
149 hsb_enterXpos.Max := form_editor.img_Background.Width - form_editor.img_button.Width;
150 hsb_enterXpos.Position := form_editor.img_button.Left;
151 vsb_enterYpos.Max := form_editor.img_Background.height - form_editor.img_button.height;
152 vsb_enterYpos.Position := form_editor.img_button.top;
153 end;//--------------------------------------------------------------------------
154 //------------------------------------------------------------------------------ form close
155 procedure Tform_Editor_ws.FormClose(Sender: TObject;
156 var Action: TCloseAction);
157 begin
158 // reenable drag'n'drop
159 form_editor.draggingstatus := 0;
160 // reenable menu
161 form_editor.mnu_Tutorial.enabled := true;
162 form_editor.mnu_WelcomeScreen.Enabled := true;
163 form_editor.mnu_Autorun.Enabled := true;
164 form_editor.mnu_CreateAR.enabled := true;
165 form_editor.mnu_Sprache.enabled := true;
166 end;//--------------------------------------------------------------------------
168 //#############################################################################################
170 //------------------------------------------------------------------------------ change x-position
171 procedure Tform_Editor_ws.hsb_EnterXPosChange(Sender: TObject);
172 begin
173 tbx_xpos.Text := inttostr(hsb_enterXpos.Position);
174 form_editor.img_button.Left := hsb_enterXpos.position;
175 end;//--------------------------------------------------------------------------
176 //------------------------------------------------------------------------------ change y-position
177 procedure Tform_Editor_ws.vsb_EnterYPosChange(Sender: TObject);
178 begin
179 tbx_ypos.Text := inttostr(vsb_enterYpos.Position);
180 form_editor.img_button.top := vsb_enterYpos.position;
181 end;//--------------------------------------------------------------------------
183 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
185 //------------------------------------------------------------------------------ NotShow
186 procedure Tform_Editor_ws.rbtn_NotShowClick(Sender: TObject);
187 begin
188 //
189 rbtn_tillclick.Enabled := false;
190 rbtn_tilltime.Enabled := false;
191 cobx_Delay.enabled := false;
193 tbx_BackgroundPath.Enabled := false;
194 btn_bp.Enabled := false;
195 tbx_EnterPath.Enabled := false;
196 btn_ep.Enabled := false;
197 hsb_EnterXPos.Enabled := false;
198 vsb_EnterYPos.Enabled := false;
199 end;//--------------------------------------------------------------------------
200 //------------------------------------------------------------------------------ Show
201 procedure Tform_Editor_ws.rbtn_DoShowClick(Sender: TObject);
202 begin
203 //
204 rbtn_tillclick.Enabled := true;
205 rbtn_tilltime.Enabled := true;
206 if rbtn_tilltime.Checked = true then
207 begin
208 cobx_Delay.Enabled := true; // time
210 tbx_BackgroundPath.Enabled := true;
211 btn_bp.Enabled := true;
212 tbx_EnterPath.Enabled := false;
213 btn_ep.Enabled := false;
214 hsb_EnterXPos.Enabled := false;
215 vsb_EnterYPos.Enabled := false;
216 end
217 else
218 begin
219 cobx_Delay.enabled := false; // click
221 tbx_BackgroundPath.Enabled := true;
222 btn_bp.Enabled := true;
223 tbx_EnterPath.Enabled := true;
224 btn_ep.Enabled := true;
225 hsb_EnterXPos.Enabled := true;
226 vsb_EnterYPos.Enabled := true;
227 end;
228 end;//--------------------------------------------------------------------------
229 //------------------------------------------------------------------------------ TillClick
230 procedure Tform_Editor_ws.rbtn_TillClickClick(Sender: TObject);
231 begin
232 cobx_Delay.Enabled := false;
234 tbx_BackgroundPath.Enabled := true;
235 btn_bp.Enabled := true;
236 tbx_EnterPath.Enabled := true;
237 btn_ep.Enabled := true;
238 hsb_EnterXPos.Enabled := true;
239 vsb_EnterYPos.Enabled := true;
240 end;//--------------------------------------------------------------------------
241 //------------------------------------------------------------------------------ TillIime
242 procedure Tform_Editor_ws.rbtn_TillTimeClick(Sender: TObject);
243 begin
244 cobx_Delay.Enabled := true;
246 tbx_BackgroundPath.Enabled := true;
247 btn_bp.Enabled := true;
248 tbx_EnterPath.Enabled := false;
249 btn_ep.Enabled := false;
250 hsb_EnterXPos.Enabled := false;
251 vsb_EnterYPos.Enabled := false;
252 end;//--------------------------------------------------------------------------
254 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
256 //------------------------------------------------------------------------------ Back-Pic
257 procedure Tform_Editor_ws.btn_bpClick(Sender: TObject);
258 begin
259 // Browse Background-Picture
260 if opendialog1.Execute then
261 begin
262 tbx_backgroundpath.Text := opendialog1.FileName;
263 // load picture
264 form_editor.img_Background.Picture.LoadFromFile(tbx_backgroundpath.text);
265 end;
266 end;//--------------------------------------------------------------------------
267 //------------------------------------------------------------------------------ Enter-Pic
268 procedure Tform_Editor_ws.btn_epClick(Sender: TObject);
269 begin
270 // Browse Enter-Picture
271 if opendialog1.Execute then
272 begin
273 tbx_enterpath.Text := opendialog1.FileName;
274 // load picture
275 form_editor.img_button.Picture.LoadFromFile(tbx_enterpath.text);
276 // if enter-button gets to large
277 if form_editor.img_button.Width > form_editor.img_Background.Width then
278 begin
279 form_editor.img_button.Picture := nil;
280 tbx_enterpath.Text := '';
281 form_editor.img_button.Width := 0;
282 form_editor.img_button.Height := 0;
283 end;
284 if form_editor.img_button.height > form_editor.img_Background.height then
285 begin
286 form_editor.img_button.Picture := nil;
287 tbx_enterpath.Text := '';
288 form_editor.img_button.Width := 0;
289 form_editor.img_button.Height := 0;
290 end;
291 // config scrollbars
292 hsb_enterXpos.Max := form_editor.img_Background.Width - form_editor.img_button.Width;
293 hsb_enterXpos.Position := form_editor.img_button.Left;
294 vsb_enterYpos.Max := form_editor.img_Background.height - form_editor.img_button.height;
295 vsb_enterYpos.Position := form_editor.img_button.top;
296 // if enter-button is fullscreen, then dont use a background-pic
297 if form_editor.img_button.Width = form_editor.img_Background.Width then
298 begin
299 if form_editor.img_button.Height = form_editor.img_Background.Height then
300 begin
301 tbx_BackgroundPath.Enabled := false;
302 btn_bp.Enabled := false;
303 end
304 else
305 begin
306 tbx_BackgroundPath.Enabled := true;
307 btn_bp.Enabled := true;
308 end;
309 end;
310 end;
311 end;//--------------------------------------------------------------------------
313 //------------------------------------------------------------------------------ no pic
314 procedure Tform_Editor_ws.tbx_BackgroundPathChange(Sender: TObject);
315 begin
316 if tbx_BackgroundPath.Text = '' then
317 begin
318 form_editor.img_Background.Picture := nil;
319 end;
320 end;//--------------------------------------------------------------------------
321 //------------------------------------------------------------------------------ no pic
322 procedure Tform_Editor_ws.tbx_EnterPathChange(Sender: TObject);
323 begin
324 if tbx_EnterPath.Text = '' then
325 begin
326 form_editor.img_Button.Picture := nil;
327 tbx_BackgroundPath.Enabled := true;
328 btn_bp.Enabled := true;
329 end;
330 end;//--------------------------------------------------------------------------
332 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
334 //------------------------------------------------------------------------------ apply
335 procedure Tform_Editor_ws.btn_ApplyClick(Sender: TObject);
336 begin
337 // set new data to '*_neu'
338 form_Editor.pfadHG_neu := tbx_backgroundpath.text;
339 form_Editor.pfadEnter_neu := tbx_Enterpath.text;
340 form_Editor.xEnter_neu := strtoint(tbx_xpos.text);
341 form_Editor.yEnter_neu := strtoint(tbx_ypos.text);
342 form_Editor.Delay_neu := cobx_Delay.ItemIndex;
343 // kind of welcome action
344 if rbtn_notshow.checked then
345 begin
346 form_Editor.Welcomekind_neu := 'none';
347 end
348 else
349 begin
350 if rbtn_tillClick.checked then
351 begin
352 form_Editor.Welcomekind_neu := 'click';
353 end
354 else
355 begin
356 form_Editor.Welcomekind_neu := 'time';
357 end;
358 end;
360 // '*_neu' to '*_alt'
361 with form_Editor do
362 begin
363 PfadHG_alt := PfadHG_neu;
364 PfadEnter_alt := PfadEnter_neu;
365 xEnter_alt := xEnter_neu;
366 yEnter_alt := yEnter_neu;
367 WelcomeKind_alt := WelcomeKind_neu;
368 Delay_alt := Delay_neu;
369 end;
371 // delay
372 form_Editor.Delay := cobx_Delay.text;
375 // close
376 form_editor_ws.Close;
377 end;//--------------------------------------------------------------------------
378 //------------------------------------------------------------------------------ cancel
379 procedure Tform_Editor_ws.btn_cancelClick(Sender: TObject);
380 begin
381 // restore old settings
382 // background-pic
383 if form_Editor.PfadHG_alt = '' then
384 begin
385 form_Editor.img_background.Picture := nil;
386 end
387 else
388 begin
389 form_editor.img_Background.Picture.LoadFromFile(form_Editor.PfadHG_alt);
390 end;
391 // enter-pic
392 if form_Editor.PfadEnter_alt = '' then
393 begin
394 form_Editor.img_button.Picture := nil;
395 end
396 else
397 begin
398 form_editor.img_button.Picture.LoadFromFile(form_Editor.PfadEnter_alt);
399 end;
400 // button-pos
401 form_editor.img_button.Left := form_Editor.xEnter_alt;
402 form_editor.img_button.top := form_Editor.yEnter_alt;
404 // close
405 form_editor_ws.Close;
406 end;//--------------------------------------------------------------------------
408 end.//#########################################################################################