{*************************************************************************}
{                                                                         }
{ AboutUnit.pas - "About program" window                                  }
{                                                                         }
{ This file is a part of the project:                                     }
{   Dizzy Quest Editor - the quest editor for Dizzy-like games            }
{                                                                         }
{ © Parfenov Alexey Andreevich, 2007                                      }
{                                                                         }
{ e-mail: AlkatrazStudio@yandex.ru                                        }
{                                                                         }
{ This program is free software; you can redistribute it and/or modify    }
{ it under the terms of the GNU General Public License as published by    }
{ the Free Software Foundation; either version 2 of the License, or       }
{ (at your option) any later version.                                     }
{                                                                         }
{ This program is distributed in the hope that it will be useful,         }
{ but WITHOUT ANY WARRANTY; without even the implied warranty of          }
{ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            }
{ GNU General Public License for more details.                            }
{                                                                         }
{ You may read GNU General Public License at:                             }
{   http://www.gnu.org/copyleft/gpl.html                                  }
{                                                                         }
{*************************************************************************}
unit AboutUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, jpeg, JvGIF, Buttons, ComCtrls,shellapi,
  alkatraz,dqe2_types;

type
  TForm_About = class(TForm)
    Label_1: TLabel;
    Panel1: TPanel;
    Label1: TLabel;
    Label3: TLabel;
    Label2: TLabel;
    Label4: TLabel;
    Label6: TLabel;
    Label5: TLabel;
    Image1: TImage;
    Image2: TImage;
    Image3: TImage;
    Image4: TImage;
    Image5: TImage;
    BitBtn1: TBitBtn;
    Image6: TImage;
    Panel2: TPanel;
    RichEdit1: TRichEdit;
    procedure FormCreate(Sender: TObject);
    procedure Image6MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Image6MouseLeave(Sender: TObject);
    function GetLabel(Sender:TObject):TLabel;
    procedure Image6MouseEnter(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure Localize;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form_About: TForm_About;

implementation

uses MainUnit;

{$R *.dfm}

var lng:array of string;

procedure TForm_About.BitBtn1Click(Sender: TObject);
begin
  Close;
end;

procedure TForm_About.FormCreate(Sender: TObject);
begin
  SetCurrentDir(AppPath+'..\Shared\data\images');
  Image1.Picture.LoadFromFile('paxscript.gif');
  Image2.Picture.LoadFromFile('bass.gif');
  Image3.Picture.LoadFromFile('synedit.gif');
  Image4.Picture.LoadFromFile('graphics32.gif');
  Image5.Picture.LoadFromFile('jedi.gif');
  Image6.Picture.LoadFromFile('asphyre.gif');
  SetCurrentDir(World.SharedDir);
  SetLength(lng,2);
  RichEdit1.Text:=
  'Project: Dizzy Quest Editor 2 - editor & player for Dizzy-like quest games'#13#10+
  'Version: '+dqe2versionStr+#13#10+
  'Programmer: Parfenov Alexey (Alkatraz Studio)'#13#10+
  'Homepage: http://dqe.sourceforge.net'#13#10+
  'SF.net page: https://sourceforge.net/projects/dqe'#13#10+
  'CVS: server - dqe.cvs.sourceforge.net, repository - /cvsroot/dqe'#13#10+
  'E-Mail: AlkatrazStudio@yandex.ru'#13#10+
  'Sources'#39' and binaries'#39' licenses: GPL'#13#10#13#10+
  '                                                                '+
  '                                                                '+
  '                     '#169' Alkatraz Studio 2007-infinity';
end;

function TForm_About.GetLabel(Sender: TObject): TLabel;
var
  g:TGraphicControl;
begin
  G:=sender as TGraphicControl;
  result:=TLabel(FindComponent('Label'+g.Name[length(g.Name)]));
end;

procedure TForm_About.Image6MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
  lab:TLabel;
begin
  lab:=GetLabel(Sender);
  ShellExecute(Handle,PAnsiChar('open'),PAnsiChar(
    TImage(FindComponent('Image'+lab.Name[length(lab.Name)])).Hint),
    nil,nil,SW_SHOWNORMAL);
end;

procedure TForm_About.Image6MouseEnter(Sender: TObject);
var
  lab:TLabel;
begin
  lab:=GetLabel(Sender);
  lab.Font.Color:=clBlue;
  lab.Font.Style:=[fsUnderline];
end;

procedure TForm_About.Image6MouseLeave(Sender: TObject);
var
  lab:TLabel;
begin
  lab:=GetLabel(Sender);
  lab.Font.Color:=clBlack;
  lab.Font.Style:=[];
end;

procedure TForm_About.Localize;
begin
  LoadStringsFromIni(MainUnit.lang_ini,Name,lng);
  Caption:=lng[0];
  Label_1.Caption:=lng[1];
end;

end.
