{
********************************************************************************

SPackGui
Copyright (C) 1997-1999, 2009-2012 Geoffray Levasseur <geoffray.levasseurbrandin@numericable.fr>.
Copyright (C) <date> <add your name and mail address here>

http://0.tuxfamilly.org/
http://www.geoffray-levasseur.org/

This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software.  You can  use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".

As a counterpart to the access to the source code and  rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty  and the software's author,  the holder of the
economic rights,  and the successive licensors  have only  limited
liability.

In this respect, the user's attention is drawn to the risks associated
with loading,  using,  modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean  that it is complicated to manipulate,  and  that  also
therefore means  that it is reserved for developers  and  experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and,  more generally, to use and operate it in the
same conditions as regards security.

The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.

********************************************************************************

Description:
  About dialog unit

********************************************************************************
}
unit frmAbout;

{$include ../common/defines.inc}

interface

uses
  SysUtils, Classes, Graphics, Forms, Controls, StdCtrls, Buttons, ExtCtrls,
  Menus, LResources, ComCtrls;

type

  { TfAbout }

  TfAbout = class(TForm)
    btnClose: TBitBtn;
    lbWidgetSetUsed: TLabel;
    lbThanks1Address: TLabel;
    lbThanks1Comments: TLabel;
    lbThanks1Name: TLabel;
    lbCopyright: TLabel;
    lbCompiler: TLabel;
    lbReadLicense: TLabel;
    lbProductName: TLabel;
    lbMaintMail: TLabel;
    lbLicense: TLabel;
    lbAuth1Name: TLabel;
    lbAuth1Address: TLabel;
    lbAuth1URL: TLabel;
    lbAuth1Comments: TLabel;
    lbMaintURL: TLabel;
    lbBuild: TLabel;
    lbFullVersion: TLabel;
    mmLicence: TMemo;
    PageControl1: TPageControl;
    lbProductDesc: TLabel;
    ProgramIcon: TImage;
    tsThanks: TTabSheet;
    tsAbout: TTabSheet;
    tsAuthors: TTabSheet;
    tsLicense: TTabSheet;
    procedure btnCloseClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure lbReadLicenseClick(Sender: TObject);
    procedure lbMaintURLClick(Sender: TObject);
    procedure lbMaintURLMouseEnter(Sender: TObject);
    procedure lbMaintURLMouseLeave(Sender: TObject);
  private
    { Private declarations }
    HLCol: TColor;
    OverCol: TColor;
  public
    { Public declarations }
  end;

var
  fAbout: TfAbout;

{$R *.lfm}

implementation

uses
  {$IFDEF LCLQT}
  qt4,
  {$ENDIF}
  {$IFDEF LCLQT5}
  qt5,
  {$ENDIF}
  {$IFDEF LCLGTK2}
  gtk2,
  {$ENDIF}
  {$IFDEF LCLGTK3} //not yet ready in LCL, just here for experimentations
  gtk3,
  {$ENDIF}
  uStrings, uUtils, uVersion, uIconManager;

procedure TfAbout.btnCloseClick(Sender: TObject);
begin
  Close;
end;

procedure TfAbout.FormCreate(Sender: TObject);
begin
  btnClose.Tag := icClose;
  InitBtnGlyphs(Self);
  PageControl1.ActivePage := tsAbout;
  lbFullVersion.Caption := Format(lbFullVersion.Caption, [GetVersionString(vrVersion),
    GetBuildOS, GetBuildCPU]);
  lbCompiler.Caption := Format(lbCompiler.Caption, [GetFPCVersion, GetLazarusVersion,
    GetLazarusRevision]);
  lbBuild.Caption := Format(lbBuild.Caption, [GetBuildDate, BuildSys]);
  HLCol := clBlue;
  OverCol := clRed;
  lbMaintMail.Font.Color := HLCol;
  lbMaintURL.Font.Color := HLCol;
  lbAuth1Address.Font.Color := HLCol;
  lbAuth1URL.Font.Color := HLCol;
  lbThanks1Address.Font.Color := HLCol;
  lbReadLicense.Font.Color := HLCol;
  {$IFDEF LCLQT or IFDEF LCLQT5}
  lbWidgetSetUsed.Caption := Format(rsQtVersion, [PChar(QtVersion)]);
  {$ENDIF}
  {$IFDEF LCLGTK2 OR LCLGTK3}
  lbWidgetSetUsed.Caption := Format(rsGtkVersion, [gtk_major_version,
    gtk_minor_version, gtk_micro_version]);
  {$ENDIF}
end;

procedure TfAbout.lbReadLicenseClick(Sender: TObject);
begin
  OpenURL(sCecillAddress);
end;

procedure TfAbout.lbMaintURLClick(Sender: TObject);
begin
  OpenURL(TLabel(Sender).Caption);
end;

procedure TfAbout.lbMaintURLMouseEnter(Sender: TObject);
begin
  TLabel(Sender).Font.Color := OverCol;
  TLabel(Sender).Font.Style := [fsUnderline];
  TLabel(Sender).Cursor := crHandPoint;
end;

procedure TfAbout.lbMaintURLMouseLeave(Sender: TObject);
begin
  TLabel(Sender).Font.Color := HLCol;
  TLabel(Sender).Font.Style := [];
end;

end.
