unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls, ExtCtrls, CM2GenPlugTypes, CM2VisPlugTypes,
  CM2CMLxPlugTypes, CM2MMRB, CM2PlugInTypes;

type
  TForm2 = class(TForm)
    Image1: TImage;
    Bevel1: TBevel;
    Bevel2: TBevel;
    Button1: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    ListView1: TListView;
    Label5: TLabel;
  private
    { Private declarations }
  public
    Procedure Execute(GP: TGenPlugIn; Icon: TIcon); overload;
    Procedure Execute(VP: TVisPlugIn; Icon: TIcon); overload;
    Procedure Execute(CP: TCMLxPlugIn; Icon: TIcon); Overload;
    Procedure BuildInfo(InfoList: TInfoList);
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

{ TForm2 }

procedure TForm2.BuildInfo(InfoList: TInfoList);
Var
 I: Integer;
 Handled: Boolean;
 LI: TListItem;
 S: String;
begin
 Listview1.Items.clear;
 For I := 0 to InfoList.Count - 1 do begin
  handled := false;
  if uppercase(InfoList[I].VarName) = 'PROGRAMMED BY' then begin
   Handled := true;
   Label4.caption := 'Programmed By ' + InfoList[I].Variable;
  end;
  If uppercase(InfoList[I].VarName) = 'COPYRIGHT' then begin
   Handled := true;
   If uppercase(Copy(InfoList[I].Variable, 1, 9)) = 'COPYRIGHT' then S := Copy(InfoList[I].Variable, 10, length(InfoList[I].Variable))
    else S := InfoList[I].Variable;
   Label5.Caption := 'Copyright ' + S;
  end;
  If not handled then begin
   LI := Listview1.Items.add;
   LI.Caption := InfoList[I].VarName;
   LI.SubItems.Add(InfoList[I].Variable);
  end;
 end;
end;

procedure TForm2.Execute(GP: TGenPlugIn; Icon: TIcon);
begin
 Image1.Picture.Icon := Icon;
 Label5.Caption := '';
 Label4.Caption := '';
 Label1.Caption := GP.Name;
 Label2.Caption := 'Version: '+CM2MMRB.WordToStr(GP.Version);
 Label3.Caption := 'Required Core Version: ' + CM2MMRB.WordToStr(GP.RequiredCoreVersion);
 BuildInfo(GP.InfoList);
 ShowModal;
end;

procedure TForm2.Execute(VP: TVisPlugIn; Icon: TIcon);
begin
 Image1.Picture.Icon := Icon;
 Label5.Caption := '';
 Label4.Caption := '';
 Label1.Caption := VP.Name;
 Label2.Caption := 'Version: '+CM2MMRB.WordToStr(VP.Version);
 Label3.Caption := 'Required Core Version: ' + CM2MMRB.WordToStr(VP.RequiredCoreVersion);
 BuildInfo(VP.InfoList);
 ShowModal;
end;

procedure TForm2.Execute(CP: TCMLxPlugIn; Icon: TIcon);
begin
 Image1.Picture.Icon := Icon;
 Label5.Caption := '';
 Label4.Caption := '';
 Label1.Caption := CP.Name;
 Label2.Caption := 'Version: '+CM2MMRB.WordToStr(CP.Version);
 Label3.Caption := 'Required Core Version: ' + CM2MMRB.WordToStr(CP.RequiredCoreVersion);
 BuildInfo(CP.InfoList);
 ShowModal;
end;

end.
