cdar

view unit_Start.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
line source
1 unit unit_Start;
3 interface//####################################################################################
5 uses
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, jpeg, ExtCtrls, StdCtrls, shellapi, ComCtrls, Buttons;
9 type
10 Tform_Start = class(TForm)
11 img_Logo: TImage;
12 img_Copyright: TImage;
13 img_ThanksJuFo: TImage;
14 btn_close: TBitBtn;
15 btn_Editor: TBitBtn;
16 img_Easteregg: TImage;
17 License: TMemo;
18 procedure FormCreate(Sender: TObject);
19 procedure btn_CloseClick(Sender: TObject);
20 procedure btn_EditorClick(Sender: TObject);
21 procedure img_EastereggClick(Sender: TObject);
22 private
24 public
26 end;
28 var
29 form_Start: Tform_Start;
31 const ini = 'cdar.ini';
32 welcome = 'welcome.jpg';
33 enter = 'enter.jpg';
35 procedure shellexec(const Zielpfad :string);
37 implementation//###############################################################################
38 uses unit_Welcome, unit_Editor, modul_allgemein, unit_Easteregg;
39 {$R *.dfm}//###################################################################################
41 //------------------------------------------------------------------------------ Form Create
42 procedure Tform_Start.FormCreate(Sender: TObject);
43 begin
44 // init
45 form_start.Color := rgb(192,192,192);
47 // command line parameters
48 if lowercase(paramstr(1)) = 'editor' then // start editor
49 begin
50 application.CreateForm(tform_editor, form_editor);
51 form_editor.Show;
52 end
53 else if lowercase(paramstr(1)) = 'welcome' then // show welcome screen
54 begin
55 application.CreateForm(tform_welcome, form_welcome);
56 form_welcome.Show;
57 end
58 else if lowercase(paramstr(1)) = 'marmaro' then // easteregg ... bit boring in open source ;-)
59 begin
60 application.CreateForm(tform_easteregg, form_easteregg);
61 form_easteregg.show;
62 form_Start.hide;
63 end
64 else if lowercase(paramstr(1)) = '' then // about window
65 begin
66 // do nothing special
67 end
68 else // direct call
69 begin
70 shellexec(paramstr(1));
71 application.Terminate;
72 end;
73 end;//--------------------------------------------------------------------------
75 //#############################################################################################
77 //------------------------------------------------------------------------------ kill
78 procedure Tform_Start.btn_CloseClick(Sender: TObject);
79 begin
80 application.Terminate;
81 end;//--------------------------------------------------------------------------
82 //------------------------------------------------------------------------------ editor
83 procedure Tform_Start.btn_EditorClick(Sender: TObject);
84 begin
85 application.CreateForm(tform_editor, form_editor);
86 form_Editor.show;
87 form_Start.hide;
88 end;//--------------------------------------------------------------------------
90 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
92 //------------------------------------------------------------------------------ easteregg
93 procedure Tform_Start.img_EastereggClick(Sender: TObject);
94 begin
95 application.CreateForm(tform_easteregg, form_easteregg);
96 form_Easteregg.show;
97 form_Start.hide;
98 end;//--------------------------------------------------------------------------
100 //#############################################################################################
102 //------------------------------------------------------------------------------ shellexec
103 procedure shellexec(const Zielpfad :string);
104 begin
105 if zielpfad <> '..\-' then // '..\-' means 'no action'
106 begin
107 try
108 ShellExecute(application.Handle, 'open', pchar(zielpfad), nil, nil, sw_shownormal);
109 except
110 showmessage('could not execute file or open dir');
111 end;
112 end;
113 application.Terminate;
114 end;//--------------------------------------------------------------------------
116 end.//#########################################################################################