unit AboutForm;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, SProgressIndicator, Vcl.StdCtrls,
  Vcl.ExtCtrls;

type
  TAboutFrm = class(TForm)
    SProgressIndicator: TSProgressIndicator;
    ClientPanel: TPanel;
    stCaption: TStaticText;
    stKernelVersion: TStaticText;
    stFrontEndVersion: TStaticText;
    stCopyright: TStaticText;
    llWebAlgosim: TLinkLabel;
    stBuildTime: TStaticText;
    llWebRejbrand: TLinkLabel;
    llSpace: TLinkLabel;
    procedure FormResize(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure llWebAlgosimLinkClick(Sender: TObject; const Link: string;
      LinkType: TSysLinkType);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  AboutFrm: TAboutFrm;

implementation

uses
  MainForm, ASKernelDefs, FrontEndProps, ShellAPI, Math, WinMgrForm, Rux;

{$R *.dfm}

procedure TAboutFrm.FormCreate(Sender: TObject);
begin
  stKernelVersion.Caption := 'Kernel version: ' + ASKernelDefs.KernelVersion.ToString;
  stFrontEndVersion.Caption := 'Front end version: ' + FrontEndProps.GetFrontEndVersion.ToString;
  stBuildTime.Caption := 'Build time: ' + DateToStr(ASKernelDefs.LinkerTimestamp);
  SProgressIndicator.StartTime := AlgosimMainForm.Kernel.StartTime;
  TUx.RegisterCallback(SProgressIndicator,
    procedure
    begin
      SProgressIndicator.AccentColor := TUx.ThemeData.ActiveCaptionColor;
    end
  );
  TWindowWatcher.Create(Self);
end;

procedure TAboutFrm.FormResize(Sender: TObject);
begin
  SProgressIndicator.Width := Min(ClientHeight, ClientWidth div 2);
end;

procedure TAboutFrm.llWebAlgosimLinkClick(Sender: TObject; const Link: string;
  LinkType: TSysLinkType);
begin
  if LinkType = sltURL then
    ShellExecute(Handle, nil, PChar(Link), nil, nil, SW_SHOWNORMAL);
end;

end.
