Refactor layout and code of about dialog.

This commit is contained in:
Ansgar Becker
2010-01-10 16:22:53 +00:00
parent 43b010d227
commit 1a4db545c5
7 changed files with 483 additions and 1610 deletions

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

BIN
res/aboutbox_image.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,71 +1,44 @@
unit About;
// -------------------------------------
// About-box
// -------------------------------------
interface
uses
Windows, Classes, Graphics, Forms, Controls, StdCtrls, ExtCtrls, SysUtils, ComCtrls, GIFImg;
Windows, Classes, Graphics, Forms, Controls, StdCtrls, ExtCtrls, SysUtils, ComCtrls, pngimage;
type
TAboutBox = class(TForm)
PanelLogos: TPanel;
ImageMysql: TImage;
ButtonClose: TButton;
PanelMain: TPanel;
ProductName: TLabel;
LabelVersion: TLabel;
LabelCompiled: TLabel;
LabelWebpage: TLabel;
PageControlTexts: TPageControl;
tabAuthors: TTabSheet;
ButtonBoard: TButton;
ImageHeidisql: TImage;
MemoThanks: TMemo;
tabThanks: TTabSheet;
btnClose: TButton;
btnForum: TButton;
MemoAuthors: TMemo;
ImageDonate: TImage;
lblAppName: TLabel;
lblAppVersion: TLabel;
lblAppCompiled: TLabel;
lblAppWebpage: TLabel;
btnUpdateCheck: TButton;
ImageHeidisql: TImage;
btnDonate: TButton;
lblAppDescription: TLabel;
procedure OpenURL(Sender: TObject);
procedure MouseOver(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
procedure AboutWindow( AOwner: TComponent );
// -----------------------------------------------------------------------------
implementation
uses
main, helpers;
{$R *.DFM}
procedure AboutWindow( AOwner: TComponent );
var
f : TAboutBox;
begin
f := TAboutBox.Create( AOwner );
f.ShowModal(); // don't care about result
FreeAndNil(f);
end;
procedure TAboutBox.OpenURL(Sender: TObject);
begin
ShellExec( TControl(Sender).Hint );
@@ -75,7 +48,7 @@ end;
procedure TAboutBox.MouseOver(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
LabelWebpage.Font.Color := clBlue;
lblAppWebpage.Font.Color := clBlue;
if (Sender is TLabel) then
begin
TLabel(Sender).Font.Color := clRed;
@@ -85,28 +58,28 @@ end;
procedure TAboutBox.FormShow(Sender: TObject);
var
// CompiledInt : Integer;
Compiled : TDateTime;
begin
// Define the current cursor like a clock
Screen.Cursor := crHourGlass;
InheritFont(Font);
InheritFont(ProductName.Font);
ProductName.Font.Size := 14;
InheritFont(LabelWebpage.Font);
InheritFont(lblAppName.Font);
lblAppName.Font.Size := 14;
InheritFont(lblAppWebpage.Font);
// Assign text
Caption := 'About '+AppName;
lblAppName.Caption := AppName;
lblAppDescription.Caption := AppDescription;
lblAppVersion.Caption := 'Version '+AppVersion;
FileAge(ParamStr(0), Compiled);
lblAppCompiled.Caption := 'Compiled on: ' + DateTimeToStr(Compiled);
lblAppWebpage.Caption := AppDomain;
lblAppWebpage.Hint := AppDomain;
// Avoid scroll by removing blank line outside visible area in Authors text box
MemoAuthors.Text := TrimRight(MemoAuthors.Text);
MemoAuthors.WordWrap := True;
// App-Version
LabelVersion.Caption := 'Version '+AppVersion;
// Compile-date
FileAge(ParamStr(0), Compiled);
LabelCompiled.Caption := 'Compiled on: ' + DateTimeToStr( Compiled );
// Define the current cursor like a pointer (default)
Screen.Cursor := crDefault;
end;

View File

@@ -865,7 +865,7 @@ end;
var
MainForm : TMainForm;
AppVerMajor, AppVerMinor, AppVerRelease, AppVerRevision: Integer;
AppVersion : String;
AppVersion, AppDescription: String;
DirnameCommonAppData,
DirnameUserAppData,
DirnameSnippets,
@@ -1146,7 +1146,7 @@ var
dwVerSize, // Size of Version Info Data
dwWnd: DWORD; // Handle for the size call.
FI: PVSFixedFileInfo; // Delphi structure; see WINDOWS.PAS
ptrVerBuf: Pointer; // pointer to a version buffer
ptrVerBuf, Translation, Info: Pointer;
begin
caption := APPNAME;
setLocales;
@@ -1169,8 +1169,16 @@ begin
AppVerMinor := LoWord(FI.dwFileVersionMS);
AppVerRelease := HiWord(FI.dwFileVersionLS);
AppVerRevision := LoWord(FI.dwFileVersionLS);
FreeMem(ptrVerBuf);
AppVersion := Format('%d.%d.%d.%d', [AppVerMajor, AppVerMinor, AppVerRelease, AppVerRevision]);
// Fetch language code and file description
VerQueryValue(ptrVerBuf,'\\VarFileInfo\\Translation', Translation, dwInfoSize);
VerQueryValue(ptrVerBuf,
PChar(Format('\\StringFileInfo\\%.4x%.4x\\%s',
[LoWord(Longint(translation^)), HiWord(Longint(Translation^)), 'FileDescription'])),
Info,
dwInfoSize);
SetString(AppDescription, PChar(Info), dwInfoSize-1);
FreeMem(ptrVerBuf);
// "All users" folder for HeidiSQL's data (All Users\Application Data)
DirnameCommonAppData := GetShellFolder(CSIDL_COMMON_APPDATA) + '\' + APPNAME + '\';
@@ -1759,9 +1767,13 @@ begin
end;
procedure TMainForm.actAboutBoxExecute(Sender: TObject);
var
Box: TAboutBox;
begin
// Info-Box
AboutWindow (Self);
Box := TAboutBox.Create(Self);
Box.ShowModal;
Box.Free;
end;
procedure TMainForm.actClearEditorExecute(Sender: TObject);