Login | ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/decoder/trunk/Quelltext/About.pas
Revision: 2
Committed: Thu Nov 8 11:09:30 2018 UTC (22 months, 2 weeks ago) by daniel-marschall
Content type: text/x-pascal
File size: 5072 byte(s)
Log Message:
Published revision 01 March 2007 to SVN.
Added disclaimer.
Changed the license to Apache2.

File Contents

# Content
1 unit About;
2
3 interface
4
5 uses
6 Windows, Messages, SysUtils, Forms, StdCtrls, ExtCtrls, Inifiles, shellapi,
7 DCConst, Controls, Classes;
8
9 type
10 TAboutForm = class(TForm)
11 lbl_name: TLabel;
12 img_schloss: TImage;
13 lbl_version: TLabel;
14 lbl_leader: TLabel;
15 lbl_copyright: TLabel;
16 spe_leftshape: TShape;
17 gbx_lang: TGroupBox;
18 lbl_lang_value: TLabel;
19 lbl_translator_value: TLabel;
20 lbl_revision_value: TLabel;
21 btn_close: TButton;
22 lbl_url: TLabel;
23 lbl_lang_name: TLabel;
24 lbl_translator_name: TLabel;
25 lbl_revision_name: TLabel;
26 procedure form_create(Sender: TObject);
27 procedure btn_closeClick(Sender: TObject);
28 procedure lbl_urlClick(Sender: TObject);
29 private
30 LangArray, LangArraySig: array of TLanguageEntry;
31 function GetLangEntry(name: string): string;
32 function GetLangSig(name: string): string;
33 end;
34
35 var
36 AboutForm: TAboutForm;
37
38 implementation
39
40 {$R *.dfm}
41
42 function TAboutForm.GetLangEntry(name: string): string;
43 var
44 i: integer;
45 begin
46 for i := 0 to high(LangArray) do
47 begin
48 if LangArray[i].name = name then
49 begin
50 result := LangArray[i].text;
51 break;
52 end;
53 end;
54 end;
55
56 function TAboutForm.GetLangSig(name: string): string;
57 var
58 i: integer;
59 begin
60 for i := 0 to high(LangArraySig) do
61 begin
62 if LangArraySig[i].name = name then
63 begin
64 result := LangArraySig[i].text;
65 break;
66 end;
67 end;
68 end;
69
70 procedure TAboutForm.lbl_urlClick(Sender: TObject);
71 begin
72 shellexecute(application.Handle, 'open', 'http://www.viathinksoft.de/', '', '', sw_normal);
73 end;
74
75 procedure TAboutForm.btn_closeClick(Sender: TObject);
76 begin
77 close;
78 end;
79
80 procedure TAboutForm.form_create(Sender: TObject);
81 var
82 ini: TIniFile;
83 str: TStringList;
84 i: integer;
85 Y, M, D: Word;
86 begin
87 // Sprachdatei & Signatur auslesen
88
89 ini := TIniFile.Create(ExtractFilePath(Application.ExeName)+'Language.ini');
90 str := TStringList.Create();
91 try
92 ini.ReadSection(Name, str);
93 for i := 0 to str.count-1 do
94 begin
95 setlength(LangArray, length(LangArray)+1);
96 LangArray[length(LangArray)-1].name := str.strings[i];
97 LangArray[length(LangArray)-1].text := ini.ReadString(Name, str.strings[i], '?');
98 LangArray[length(LangArray)-1].text := StringReplace(LangArray[length(LangArray)-1].text, '###', #13#10, [rfReplaceAll]);
99 end;
100
101 ini.ReadSection('Signature', str);
102 for i := 0 to str.count-1 do
103 begin
104 setlength(LangArraySig, length(LangArraySig)+1);
105 LangArraySig[length(LangArraySig)-1].name := str.strings[i];
106 LangArraySig[length(LangArraySig)-1].text := ini.ReadString('Signature', str.strings[i], '?');
107 LangArraySig[length(LangArraySig)-1].text := StringReplace(LangArraySig[length(LangArraySig)-1].text, '###', #13#10, [rfReplaceAll]);
108 end;
109 finally
110 ini.free;
111 str.Free;
112 end;
113
114 // Bilder
115
116 icon.LoadFromResourceID(hInstance, 104);
117 img_schloss.Picture.Bitmap.LoadFromResourceName(hInstance, 'SCHLOSS');
118
119 // Texte
120
121 Caption := GetLangEntry('about');
122 lbl_translator_value.Caption := GetLangSig('Translator');
123 lbl_lang_value.Caption := GetLangSig('Language');
124 lbl_revision_value.Caption := GetLangSig('Revision');
125 gbx_lang.Caption := GetLangEntry('installedlang');
126 lbl_leader.Caption := Format(GetLangEntry('leader'), ['Daniel Marschall']);
127 lbl_version.Caption := Format(GetLangEntry('version'), [DC4Ver]);
128 lbl_name.Caption := '(De)Coder';
129 lbl_url.Caption := 'www.viathinksoft.de';
130 DecodeDate(Now(), Y, M, D);
131 lbl_copyright.Caption := Format(GetLangEntry('copyright'), [2001, Y, 'ViaThinkSoft']);
132 lbl_lang_name.Caption := GetLangEntry('lang');
133 lbl_translator_name.Caption := GetLangEntry('translator');
134 lbl_revision_name.Caption := GetLangEntry('revision');
135 btn_close.Caption := GetLangEntry('ok');
136
137 // Horizontal
138
139 spe_leftshape.Width := img_schloss.Width + 16;
140 lbl_name.Left := spe_leftshape.Left + spe_leftshape.Width + 8;
141 lbl_url.left := lbl_name.left;
142 lbl_version.left := lbl_url.left;
143 lbl_leader.left := lbl_version.left;
144 lbl_copyright.left := lbl_leader.left;
145 gbx_lang.Left := lbl_copyright.left;
146 gbx_lang.Width := max_4(lbl_name.width, lbl_version.width, lbl_leader.width, lbl_copyright.width);
147 btn_close.Left := gbx_lang.left + gbx_lang.width - btn_close.width;
148 lbl_lang_value.Left := lbl_lang_name.left + max_3(lbl_lang_name.Width, lbl_translator_name.Width, lbl_revision_name.Width) + 8;
149 lbl_translator_value.left := lbl_translator_name.left + max_3(lbl_lang_name.Width, lbl_translator_name.Width, lbl_revision_name.Width) + 8;
150 lbl_revision_value.left := lbl_revision_name.left + max_3(lbl_lang_name.Width, lbl_translator_name.Width, lbl_revision_name.Width) + 8;
151
152 // Vertikal
153
154 spe_leftshape.Height := btn_close.Top + btn_close.Height + 8;
155 clientheight := spe_leftshape.top + spe_leftshape.Height;
156 clientwidth := btn_close.Left + btn_close.Width + 8;
157 end;
158
159 end.