-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathTMAbout.pas
143 lines (119 loc) · 3.75 KB
/
TMAbout.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
unit TMAbout;
{
Aestan Tray Menu
Made by Onno Broekmans; visit http://www.xs4all.nl/~broekroo/aetraymenu
for more information.
This work is hereby released into the Public Domain. To view a copy of the
public domain dedication, visit:
http://creativecommons.org/licenses/publicdomain/
or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford,
California 94305, USA.
This is the about dialog for AeTrayMenu.
}
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, JvGradient, StdCtrls, ExtCtrls, JvExStdCtrls, JvRichEdit, ComCtrls,
JvStringHolder, JvExControls;
type
TAboutDiag = class(TForm)
VersionLabel: TLabel;
CloseBtn: TButton;
AboutText: TJvRichEdit;
AboutHeader: TLabel;
BottomLine: TBevel;
OtherAboutLabel: TLabel;
AboutAeTrayMenu: TJvStrHolder;
JvGradient2: TJvGradient;
procedure AboutTextsURLClick(Sender: TObject; const URLText: String;
Button: TMouseButton);
procedure OtherAboutLabelClick(Sender: TObject);
procedure FormShow(Sender: TObject);
private
FCustomAboutVersion: String;
FCustomAboutHeader: String;
FCustomAboutText: TStrings;
InternalVersionText: String;
FShowingCustom: Boolean;
procedure SetCustomAboutText(const Value: TStrings);
procedure SetShowingCustom(const Value: Boolean);
public
property CustomAboutHeader: String read FCustomAboutHeader write FCustomAboutHeader;
property CustomAboutVersion: String read FCustomAboutVersion write FCustomAboutVersion;
property CustomAboutText: TStrings read FCustomAboutText write SetCustomAboutText;
property ShowingCustom: Boolean read FShowingCustom write SetShowingCustom;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure SwitchAboutBox(Custom: Boolean);
end;
var
AboutDiag: TAboutDiag;
implementation
uses ShellApi, JclFileUtils;
{$R *.dfm}
{$I AeTrayMenu.lc}
procedure TAboutDiag.AboutTextsURLClick(Sender: TObject;
const URLText: String; Button: TMouseButton);
begin
ShellExecute(0, nil, PChar(URLText), nil, nil, SW_SHOW);
end;
constructor TAboutDiag.Create(AOwner: TComponent);
var
VersionInfo: TJclFileVersionInfo;
begin
inherited;
FCustomAboutText := TStringList.Create;
try
VersionInfo := TJclFileVersionInfo.Create(ParamStr(0));
try
InternalVersionText := 'Version ' + VersionInfo.FileVersion + #13#10 +
'Built on ' + __COMPILE_DATETIME_AS_STRING__;
finally
FreeAndNil(VersionInfo);
end; //try..finally
except
//Ignore exceptions
end;
end;
destructor TAboutDiag.Destroy;
begin
FreeAndNil(FCustomAboutText);
inherited;
end;
procedure TAboutDiag.OtherAboutLabelClick(Sender: TObject);
begin
ShowingCustom := not ShowingCustom;
end;
procedure TAboutDiag.SetCustomAboutText(const Value: TStrings);
begin
FCustomAboutText.Assign(Value);
end;
procedure TAboutDiag.SwitchAboutBox(Custom: Boolean);
begin
if Custom then
begin
AboutHeader.Caption := ' ' + CustomAboutHeader;
VersionLabel.Caption := CustomAboutVersion;
AboutText.Lines.Assign(CustomAboutText);
OtherAboutLabel.Caption := 'About Aestan Tray Menu';
end
else //custom
begin
AboutHeader.Caption := ' Aestan Tray Menu';
VersionLabel.Caption := InternalVersionText;
AboutText.Lines.Assign(AboutAeTrayMenu.Strings);
OtherAboutLabel.Caption := 'About ' + CustomAboutHeader;
end; //else custom
end;
procedure TAboutDiag.FormShow(Sender: TObject);
begin
ShowingCustom := (CustomAboutHeader <> '');
SwitchAboutBox(ShowingCustom);
OtherAboutLabel.Visible := ShowingCustom;
end;
procedure TAboutDiag.SetShowingCustom(const Value: Boolean);
begin
FShowingCustom := Value;
SwitchAboutBox(Value);
end;
end.