unit umain; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ImageEnView, ComCtrls, ieSettings, ieview, hyieutils, iexBitmaps, hyiedefs, iexLayers, iexRulers; type TForm1 = class(TForm) ImageEnView1: TImageEnView; Panel1: TPanel; btnNextTransition: TButton; btnFullScreen: TButton; Label1: TLabel; Label2: TLabel; lblTransName: TLabel; spnTransition: TUpDown; btnShowTransition: TButton; lblTrans: TLabel; grpWordTransition: TGroupBox; lblWord: TLabel; cmbFont: TComboBox; edtWord: TEdit; chkBold: TCheckBox; grOptions: TGroupBox; chkDrawAlternative: TCheckBox; lblDuration: TLabel; spnDuration: TUpDown; lblDrawAlternative: TLabel; procedure FormCreate(Sender: TObject); procedure btnNextTransitionClick(Sender: TObject); procedure btnFullScreenClick(Sender: TObject); procedure ImageEnView1KeyPress(Sender: TObject; var Key: Char); procedure spnTransitionClick(Sender: TObject; Button: TUDBtnType); procedure btnShowTransitionClick(Sender: TObject); procedure chkDrawAlternativeClick(Sender: TObject); procedure cmbFontChange(Sender: TObject); procedure spnDurationClick(Sender: TObject; Button: TUDBtnType); private { Private declarations } FCurrentImage : Integer; FCurrentTransition : Integer; Fleft, Ftop, Fwidth, Fheight: integer; procedure ShowNextTransition(bNext: boolean); procedure ShowCurrentTransition; public { Public declarations } end; var Form1: TForm1; implementation uses iexTransitions; {$R *.DFM} {$R WindowsTheme.res} procedure TForm1.ShowNextTransition(bNext: boolean); begin if bNext then begin Inc(FCurrentTransition); if FCurrentTransition in [2, 3] then FCurrentTransition := 4; { Ignore transition # 2 and 3 } end else begin Dec(FCurrentTransition); if FCurrentTransition in [2, 3] then FCurrentTransition := 1; { Ignore transition # 2 and 3 } end; if FCurrentTransition < 1 then FCurrentTransition := MAX_TRANSITIONS // wrap around else if FCurrentTransition > MAX_TRANSITIONS then FCurrentTransition := 1; ShowCurrentTransition; end; procedure TForm1.ShowCurrentTransition; var bWordTransition: Boolean; begin // Display lblTransName.caption := IETransitionList[FCurrentTransition].name; Caption := 'Transition: ' + IETransitionList[FCurrentTransition].name; lblTrans.Caption := 'Transition #: ' + IntToStr(FCurrentTransition); chkDrawAlternative.Enabled := TIETransitionType(FCurrentTransition) in Transitions_Supporting_TransitionsDrawAlternative; lblDrawAlternative.Enabled := chkDrawAlternative.Enabled; // Word transition controls bWordTransition := TIETransitionType(FCurrentTransition) in Transitions_Supporting_Word; grpWordTransition .Enabled := bWordTransition; cmbFont .Enabled := bWordTransition; edtWord .Enabled := bWordTransition; chkBold .Enabled := bWordTransition; lblWord .Enabled := bWordTransition; // Get next image index inc(FCurrentImage); if FCurrentImage > 3 then FCurrentImage := 0; // Set properties for Word transitions IEGlobalSettings().WordTransitionParams.Word := edtWord.Text; IEGlobalSettings().WordTransitionParams.FontName := cmbFont.Text; if chkBold.checked then IEGlobalSettings().WordTransitionParams.Style := [fsBold] else IEGlobalSettings().WordTransitionParams.Style := []; // Set general options IEGlobalSettings().TransitionsDrawAlternative := chkDrawAlternative.checked; // Prepare ImageEnView1 for a transition (e.g. so loading the image will not immediately update the display ImageEnView1.PrepareTransition; // Load the next image ImageEnView1.io.LoadFromFile(extractfilepath(ParamStr(0)) + inttostr(FCurrentImage) + '.jpg'); // Run the transition ImageEnView1.RunTransition( TIETransitionType(FCurrentTransition) , spnDuration.Position); end; procedure TForm1.FormCreate(Sender: TObject); begin FCurrentImage := -1; FCurrentTransition := 1; ShowCurrentTransition; end; procedure TForm1.btnNextTransitionClick(Sender: TObject); begin ShowNextTransition(True); end; procedure TForm1.btnFullScreenClick(Sender: TObject); begin Fleft := Left; Ftop := Top; Fwidth := Width; Fheight := Height; Panel1.Hide; ImageEnView1.BorderStyle := bsNone; WindowState := wsMaximized; BorderStyle := bsNone; ImageEnView1.SetFocus; end; procedure TForm1.ImageEnView1KeyPress(Sender: TObject; var Key: Char); const VK_ESC = #27; begin if Key = VK_ESC then begin BorderStyle := bsSizeable; WindowState := wsNormal; ImageEnView1.BorderStyle := bsSingle; Panel1.Show; SetBounds(Fleft, Ftop, Fwidth, Fheight); end; end; procedure TForm1.spnTransitionClick(Sender: TObject; Button: TUDBtnType); begin case Button of btNext : ShowNextTransition(True); btPrev : ShowNextTransition(false); end; end; procedure TForm1.btnShowTransitionClick(Sender: TObject); begin ShowCurrentTransition; end; procedure TForm1.chkDrawAlternativeClick(Sender: TObject); begin ShowCurrentTransition; end; procedure TForm1.cmbFontChange(Sender: TObject); begin edtWord.Font.Name := cmbFont.Text; end; procedure TForm1.spnDurationClick(Sender: TObject; Button: TUDBtnType); begin lblDuration.Caption := 'Duration: ' + IntToStr(spnDuration.Position) + ' msec'; end; end.