unit frmAbout;

{$mode ObjFPC}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, orca_scene2d, LCLIntf;

type

  { TFormAbout }

  TFormAbout = class(TForm)
    D2Resources1: TD2Resources;
    Image1: TD2Image;
    Label1: TD2Label;
    Label2: TD2Label;
    Label3: TD2Label;
    lblGitlab: TD2Label;
    Label5: TD2Label;
    Line1: TD2Line;
    Root: TD2Background;
    Scene: TD2Scene;
    procedure FormCreate(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: char);
    procedure lblGitlabClick(Sender: TObject);
    procedure lblGitlabMouseEnter(Sender: TObject);
    procedure lblGitlabMouseLeave(Sender: TObject);
    procedure RootClick(Sender: TObject);
  private

  public

  end;

var
  FormAbout: TFormAbout;

implementation

uses
  untConfig;

{$R *.lfm}

{ TFormAbout }

procedure TFormAbout.lblGitlabMouseEnter(Sender: TObject);
begin
  lblGitlab.Font.Style:= d2FontUnderline;
end;

procedure TFormAbout.FormKeyPress(Sender: TObject; var Key: char);
begin
  if (Key = #27) then Close;
end;

procedure TFormAbout.FormCreate(Sender: TObject);
var
  AScale: Double;
begin
  AScale:= TConfigReader.GetScale();
  self.Width:= Trunc(520 * AScale);
  self.Height:= Trunc(270 * AScale);
  Root.Scale.X:= AScale;
  Root.Scale.Y:= AScale;
end;

procedure TFormAbout.lblGitlabClick(Sender: TObject);
begin
  LCLIntf.OpenURL('https://code.moenext.com/rarnu/puzzle-editor');
end;

procedure TFormAbout.lblGitlabMouseLeave(Sender: TObject);
begin
  lblGitlab.Font.Style:= d2FontRegular;
end;

procedure TFormAbout.RootClick(Sender: TObject);
begin
  Close;
end;

end.

