157 lines
3.9 KiB
Plaintext
157 lines
3.9 KiB
Plaintext
unit uMain;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, StdCtrls, ExtCtrls, FileCtrl, ieview, imageenview, hyieutils,
|
|
iexBitmaps, hyiedefs, iesettings, iexLayers, iexRulers;
|
|
|
|
type
|
|
TForm1 = class(TForm)
|
|
pnlTop: TPanel;
|
|
pnlBottom: TPanel;
|
|
lblInfo1: TLabel;
|
|
lblLink2: TLabel;
|
|
lblInfo2: TLabel;
|
|
lblLink1: TLabel;
|
|
edtStatus: TEdit;
|
|
lblStatus: TLabel;
|
|
lblFormats: TLabel;
|
|
edtFormats: TEdit;
|
|
pnlMain: TPanel;
|
|
pnlNavigatation: TPanel;
|
|
ImageEnView1: TImageEnView;
|
|
DriveComboBox1: TDriveComboBox;
|
|
DirectoryListBox1: TDirectoryListBox;
|
|
FileListBox1: TFileListBox;
|
|
Splitter1: TSplitter;
|
|
btnCheck: TButton;
|
|
FilterComboBox1: TFilterComboBox;
|
|
Label1: TLabel;
|
|
procedure FormShow(Sender: TObject);
|
|
procedure btnCheckClick(Sender: TObject);
|
|
procedure FileListBox1Change(Sender: TObject);
|
|
procedure ImageEnView1Click(Sender: TObject);
|
|
procedure lblLink1Click(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
procedure BuildFilter(bInclMagick : Boolean);
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
Form1: TForm1;
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
uses
|
|
iemiscplugins, imageenio, iexWindowsFunctions;
|
|
|
|
|
|
procedure TForm1.btnCheckClick(Sender: TObject);
|
|
begin
|
|
if TIEMiscPluginsImageMagick.IsAvailable then
|
|
begin
|
|
TIEMiscPluginsImageMagick.RegisterPlugin;
|
|
{$ifdef WIN64}
|
|
edtStatus.Text := '64bit Plug-In registered';
|
|
{$else}
|
|
edtStatus.Text := '32bit Plug-In registered';
|
|
{$endif}
|
|
|
|
edtFormats.Text := GetFileExtensionsOfType(ioMiscDLLPlugIns);
|
|
BuildFilter(True);
|
|
btnCheck.Enabled := False
|
|
end
|
|
else
|
|
begin
|
|
{$ifdef WIN64}
|
|
edtStatus.Text := '64bit Plug-In NOT FOUND';
|
|
{$else}
|
|
edtStatus.Text := '32bit Plug-In NOT FOUND';
|
|
{$endif}
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure TForm1.FileListBox1Change(Sender: TObject);
|
|
const
|
|
DEMO_CAPTION = 'ImageMagick PlugIn Demo';
|
|
begin
|
|
if FileListBox1.FileName = '' then
|
|
begin
|
|
ImageEnView1.Blank;
|
|
Caption := DEMO_CAPTION + '- www.ImageEn.com';
|
|
end
|
|
else
|
|
begin
|
|
// Some formats such as PCD include multiple images
|
|
// ImageEnView1.IO.Params.ImageIndex := 3;
|
|
|
|
ImageEnView1.IO.LoadFromFile( FileListBox1.FileName );
|
|
Caption := format( '%s - %s (%dx%d)', [ DEMO_CAPTION, ExtractFilename( ImageEnView1.IO.Params.FileName ),
|
|
ImageEnView1.IO.Params.Width, ImageEnView1.IO.Params.Height ]);
|
|
end;
|
|
ImageEnView1.AutoShrink := True;
|
|
end;
|
|
|
|
procedure TForm1.FormShow(Sender: TObject);
|
|
begin
|
|
BuildFilter(False);
|
|
btnCheckClick(nil);
|
|
ImageEnView1.Blank;
|
|
end;
|
|
|
|
procedure TForm1.ImageEnView1Click(Sender: TObject);
|
|
begin
|
|
ImageEnView1.AutoShrink := False;
|
|
end;
|
|
|
|
procedure TForm1.BuildFilter(bInclMagick : Boolean);
|
|
var
|
|
sMagickFormats: string;
|
|
sFilter: string;
|
|
i: Integer;
|
|
sCurrExts: string;
|
|
begin
|
|
sMagickFormats := '';
|
|
sFilter := '';
|
|
|
|
if bInclMagick then
|
|
begin
|
|
for i := Min_ImageMagick_Type to Max_ImageMagick_Type do
|
|
begin
|
|
sCurrExts := GetFileExtensionsOfType( i );
|
|
sFilter := sFilter + IEFileFormatGetInfo( i ).FullName + '|' + sCurrExts + '|';
|
|
sMagickFormats := sMagickFormats + sCurrExts + ';';
|
|
end;
|
|
|
|
edtFormats.Text := sMagickFormats;
|
|
|
|
FilterComboBox1.Filter := 'All ImageMagick Formats|' + sMagickFormats + '|' +
|
|
sFilter +
|
|
'All Images|' + GetAllSupportedFileExtensions(True, False, False) + '|' +
|
|
'All Files|*.*';
|
|
end
|
|
else
|
|
begin
|
|
FilterComboBox1.Filter := 'All ImageMagick Formats|' + sMagickFormats + '|' +
|
|
sFilter +
|
|
'All Images|' + GetAllSupportedFileExtensions(True, False, False) + '|' +
|
|
'All Files|*.*';
|
|
end;
|
|
end;
|
|
|
|
procedure TForm1.lblLink1Click(Sender: TObject);
|
|
begin
|
|
With Sender as TLabel do
|
|
WindowsLaunchFile( Handle, Caption );
|
|
end;
|
|
|
|
|
|
end.
|