unit Myview;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls, Menus, FileCtrl, ExtCtrls, Buttons;

type
  TBrowser = class(TForm)
    P1: TPanel;
    File1: TFileListBox;
    Dir1: TDirectoryListBox;
    Filter1: TFilterComboBox;
    Drive1: TDriveComboBox;
    P2: TPanel;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    RadioButton10: TRadioButton;
    RadioButton11: TRadioButton;
    RadioButton12: TRadioButton;
    RadioButton8: TRadioButton;
    RadioButton9: TRadioButton;
    Panel1: TPanel;
    Image1: TImage;
    CB1: TCheckBox;
    procedure RadioButton7Click(Sender: TObject);
    procedure RadioButton9Click(Sender: TObject);
    procedure RadioButton8Click(Sender: TObject);
    procedure RadioButton6Click(Sender: TObject);
    procedure RadioButton5Click(Sender: TObject);
    procedure RadioButton4Click(Sender: TObject);
    procedure RadioButton3Click(Sender: TObject);
    procedure RadioButton2Click(Sender: TObject);
    procedure RadioButton1Click(Sender: TObject);
    procedure FormResize(Sender: TObject);
    procedure File1Click(Sender: TObject);
    procedure CB1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Browser: TBrowser;

implementation

{$R *.DFM}

Procedure NViewLibSetCustomLang(pProgress,pError, pLoad, pErrLoad, pWarning : PChar); far; external 'NViewL16';
function NViewLibSetLanguage(Lang: PChar): bool; far; external 'NViewL16';
function NViewLibLoad(FileName : PChar; ShowProgress: BooLean):hbitmap; far;  external 'NViewL16';
function NViewLibSaveAsJPG(Quality:Integer; FileName: PChar):bool; far;  external 'NViewL16';


procedure TBrowser.RadioButton1Click(Sender: TObject);
begin
NViewLibSetLanguage(PChar('Engilsh'));
end;

procedure TBrowser.RadioButton2Click(Sender: TObject);
begin
NViewLibSetLanguage(PChar('German'));
end;

procedure TBrowser.RadioButton3Click(Sender: TObject);
begin
NViewLibSetLanguage(PChar('Dutch'));
end;

procedure TBrowser.RadioButton4Click(Sender: TObject);
begin
NViewLibSetLanguage(PChar('portuguese'));
end;

procedure TBrowser.RadioButton5Click(Sender: TObject);
begin
NViewLibSetLanguage(PChar('Spanish'));
end;

procedure TBrowser.RadioButton6Click(Sender: TObject);
begin
NViewLibSetLanguage(PChar('Japanese'));
end;

procedure TBrowser.RadioButton7Click(Sender: TObject);
begin
NViewLibSetLanguage(PChar('custom'));
end;

procedure TBrowser.RadioButton8Click(Sender: TObject);
begin
NViewLibSetLanguage(PChar('Italian'));
end;

procedure TBrowser.RadioButton9Click(Sender: TObject);
begin
NViewLibSetLanguage(PChar('French'));
end;

procedure TBrowser.FormResize(Sender: TObject);
begin
  Filter1.Top := P1.ClientHeight - Filter1.Left - Filter1.Height;
  Drive1.Top  := Filter1.Top  - Filter1.Left - Drive1.Height;
  Dir1.Height := (Drive1.Top - 3*Drive1.Left) Div 2;
  Dir1.Top    := Drive1.Top  - Filter1.Left - Dir1.Height;
  File1.Height := Dir1.Height;
  File1.Top    := Dir1.Top  - Filter1.Left - File1.Height;
  CB1.Left     := P2.Width - CB1.Width - 4; 
end;

procedure TBrowser.File1Click(Sender: TObject);
Var P: PChar;
begin
  GetMem(P, Length(File1.Filename)+1);
  StrPCopy(P, File1.Filename);
  Image1.Picture.Bitmap.Handle:= NViewLibLoad(P,true);
  Dispose(P);
end;

procedure TBrowser.CB1Click(Sender: TObject);
begin
   Image1.Stretch := CB1.Checked;
end;

end.
