ImageEn, unit imageenview

TImageEnView.OnUndoRedo

TImageEnView.OnUndoRedo

Declaration

property OnUndoRedo: TIEOnUndoRedoEvent;

Description

Occurs before Undo or Redo is called by user action or your code to allow the undo/redo processing to be customized.
Source is the same parameter used when calling SaveUndo.
iIndex is only used with TImageEnMView and specifies the index of the image being undone/redone.
UndoObj contains the object that will be applied. The type depends on the Source:
Source Description
ieuImage Obj is a TIEBitmap
ieuSelection Obj is a memory stream of the selection
ieuLayer, ieuFullLayer Obj is a memory stream of the object
ieuObject, ieuObjectsAndLayers Obj is a memory stream of the object

Set Handled if you perform the undo/redo operation yourself (to prevent ImageEn from applying any change).

Example

// Supply our own image on "Undo"
procedure TfrmMain.ImageEnView1UndoRedo(Sender: TObject; bIsUndo: Boolean; Source:
    TIEUndoSource; UndoObj: TObject; iIndex: Integer; var Handled: Boolean);
begin
  If bIsUndo and ( Source = ieuImage ) then
  begin
    TIEBitmap( UndoObj ).IEBitmap.LoadFromFile( 'C:\Undo.bmp' );
    Handled := False; // Because we still want this undo object to be processed
  end;
end;

// Which is the same as...
procedure TfrmMain.ImageEnView1UndoRedo(Sender: TObject; bIsUndo: Boolean; Source:
    TIEUndoSource; UndoObj: TObject; iIndex: Integer; var Handled: Boolean);
begin
  If bIsUndo and ( Source = ieuImage ) then
  begin
    ImageEnView1.LoadFromFile( 'C:\Undo.jpg' );
    Handled := True; // Because we have handled it ourselves
  end;
end;