-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
123 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,118 @@ | ||
unit About; | ||
|
||
{$MODE Delphi} | ||
|
||
{ | ||
Disk Image Manager - About window | ||
Copyright (c) Damien Guard. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
} | ||
|
||
interface | ||
|
||
uses | ||
LCLIntf, Forms, ExtCtrls, StdCtrls, Graphics; | ||
|
||
type | ||
TfrmAbout = class(TForm) | ||
btnOK: TButton; | ||
imgAppIcon: TImage; | ||
lblTitle: TLabel; | ||
bvLine: TBevel; | ||
lblVersion: TLabel; | ||
timFade: TTimer; | ||
lblWeb: TLabel; | ||
procedure FormCreate(Sender: TObject); | ||
procedure FormShow(Sender: TObject); | ||
procedure btnOKClick(Sender: TObject); | ||
procedure lblWebClick(Sender: TObject); | ||
procedure timFadeTimer(Sender: TObject); | ||
end; | ||
|
||
var | ||
frmAbout: TfrmAbout; | ||
|
||
implementation | ||
|
||
uses | ||
Main; | ||
|
||
{$R *.lfm} | ||
|
||
procedure TfrmAbout.FormCreate(Sender: TObject); | ||
begin | ||
Caption := 'About ' + Application.Title; | ||
lblTitle.Caption := Application.Title; | ||
lblVersion.Caption := 'Compiled: ' + {$I %DATE%} + ' ' + {$I %TIME%}; | ||
end; | ||
|
||
procedure TfrmAbout.timFadeTimer(Sender: TObject); | ||
begin | ||
if (timFade.Tag > 0) then | ||
if (frmAbout.AlphaBlendValue < 250) then | ||
frmAbout.AlphaBlendValue := frmAbout.AlphaBlendValue + timFade.Tag | ||
else | ||
begin | ||
timFade.Enabled := False; | ||
frmAbout.AlphaBlendValue := 255; | ||
end | ||
else | ||
if (frmAbout.AlphaBlendValue > 5) then | ||
frmAbout.AlphaBlendValue := frmAbout.AlphaBlendValue + timFade.Tag | ||
else | ||
begin | ||
timFade.Enabled := False; | ||
frmAbout.AlphaBlendValue := 0; | ||
Close; | ||
end; | ||
end; | ||
|
||
procedure TfrmAbout.FormShow(Sender: TObject); | ||
begin | ||
frmAbout.Font := frmMain.Font; | ||
frmAbout.AlphaBlendValue := 0; | ||
lblVersion.Font.Color := clBtnShadow; | ||
timFade.Tag := 4; | ||
timFade.Enabled := True; | ||
end; | ||
|
||
procedure TfrmAbout.lblWebClick(Sender: TObject); | ||
begin | ||
OpenDocument(PChar(TLabel(Sender).Caption)); | ||
end; | ||
|
||
procedure TfrmAbout.btnOKClick(Sender: TObject); | ||
begin | ||
timFade.Tag := -4; | ||
timFade.Enabled := True; | ||
end; | ||
|
||
end. | ||
unit About; | ||
|
||
{$MODE Delphi} | ||
|
||
{ | ||
Disk Image Manager - About window | ||
Copyright (c) Damien Guard. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
} | ||
|
||
interface | ||
|
||
uses | ||
LCLIntf, Forms, ExtCtrls, StdCtrls, Graphics, SysUtils, ShellApi, Windows; | ||
|
||
type | ||
TfrmAbout = class(TForm) | ||
btnOK: TButton; | ||
imgAppIcon: TImage; | ||
lblTitle: TLabel; | ||
bvLine: TBevel; | ||
lblVersion: TLabel; | ||
timFade: TTimer; | ||
lblWeb: TLabel; | ||
function GetAppVersion: String; | ||
procedure FormCreate(Sender: TObject); | ||
procedure FormShow(Sender: TObject); | ||
procedure btnOKClick(Sender: TObject); | ||
procedure lblWebClick(Sender: TObject); | ||
procedure timFadeTimer(Sender: TObject); | ||
end; | ||
|
||
var | ||
frmAbout: TfrmAbout; | ||
|
||
|
||
implementation | ||
|
||
uses | ||
Main; | ||
|
||
{$R *.lfm} | ||
|
||
function TfrmAbout.GetAppVersion: String; | ||
var | ||
Size, Size2: DWord; | ||
Pt, Pt2: Pointer; | ||
begin | ||
Size := GetFileVersionInfoSize(PChar(ParamStr(0)),Size2); | ||
if (Size > 0) then | ||
begin | ||
GetMem(Pt,Size); | ||
try | ||
GetFileVersionInfo(PChar(ParamStr(0)),0,Size,Pt); | ||
VerQueryValue(Pt,'\',Pt2,Size2); | ||
with TVSFixedFileInfo(Pt2^) do | ||
begin | ||
Result := Format('%d.%d.%d.%d', [HiWord(dwFileVersionMS),LoWord(dwFileVersionMS), | ||
HiWord(dwFileVersionLS),LoWord(dwFileVersionLS)]); | ||
end; | ||
finally | ||
FreeMem(Pt); | ||
end; | ||
end; | ||
end; | ||
|
||
procedure TfrmAbout.FormCreate(Sender: TObject); | ||
begin | ||
Caption := 'About ' + Application.Title; | ||
lblTitle.Caption := Application.Title; | ||
lblVersion.Caption := Format('%s build: %s compiled %s %s', [{$I %FPCTARGETOS%}, GetAppVersion, {$I %DATE%}, {$I %TIME%}]); | ||
end; | ||
|
||
procedure TfrmAbout.timFadeTimer(Sender: TObject); | ||
begin | ||
if (timFade.Tag > 0) then | ||
if (frmAbout.AlphaBlendValue < 250) then | ||
frmAbout.AlphaBlendValue := frmAbout.AlphaBlendValue + timFade.Tag | ||
else | ||
begin | ||
timFade.Enabled := False; | ||
frmAbout.AlphaBlendValue := 255; | ||
end | ||
else | ||
if (frmAbout.AlphaBlendValue > 5) then | ||
frmAbout.AlphaBlendValue := frmAbout.AlphaBlendValue + timFade.Tag | ||
else | ||
begin | ||
timFade.Enabled := False; | ||
frmAbout.AlphaBlendValue := 0; | ||
Close; | ||
end; | ||
end; | ||
|
||
procedure TfrmAbout.FormShow(Sender: TObject); | ||
begin | ||
frmAbout.Font := frmMain.Font; | ||
frmAbout.AlphaBlendValue := 0; | ||
lblVersion.Font.Color := clBtnShadow; | ||
timFade.Tag := 4; | ||
timFade.Enabled := True; | ||
end; | ||
|
||
procedure TfrmAbout.lblWebClick(Sender: TObject); | ||
begin | ||
OpenDocument(PChar(TLabel(Sender).Caption)); | ||
end; | ||
|
||
procedure TfrmAbout.btnOKClick(Sender: TObject); | ||
begin | ||
timFade.Tag := -4; | ||
timFade.Enabled := True; | ||
end; | ||
|
||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.