ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 edit - undo
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

kowal

Poland
46 Posts

Posted - Feb 18 2025 :  08:57:48  Show Profile  Reply
hello,
Is it possible do execute undo/redo functions concerning all layers except for background layer or for example only for some kind of layers?


regards
Stan

xequte

39245 Posts

Posted - Feb 18 2025 :  16:24:55  Show Profile  Reply
Hi Stan

You should be able to use the OnSaveUndo event to remove any undo items that you don't want:


http://www.imageen.com/help/TImageEnView.OnSaveUndo.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

kowal

Poland
46 Posts

Posted - Nov 09 2025 :  13:53:14  Show Profile  Reply
Hello!
today I try to learn something about undoRedo trying UndoReDo demo but can not find example how to use
the events:
SaveUndo(Sender: TObject; Source: TIEUndoSource);

ImageEnView1UndoRedo(Sender: TObject; bIsUndo: Boolean;
Source: TIEUndoSource; UndoObj: TObject; iIndex: Integer;
var Handled: Boolean);

And I can not find more details about these functions in help files.
regards,
S.Kowalski
Go to Top of Page

xequte

39245 Posts

Posted - Nov 09 2025 :  19:31:22  Show Profile  Reply
Hi

Documentation is at:

https://www.imageen.com/help/TImageEnView.OnUndoRedo.html

But it is lacking detail and an example. I will update it for the next release.

TImageEnProc.OnUndoRedo

Declaration

property OnUndoRedo: TIEOnUndoRedoEvent;

Description
Occurs before TImageEnProc.Undo or TImageEnProc.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 TImageEnProc.SaveUndo.
*iIndex* is only used with <A 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*:
- 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).

Note: You can check for iecsUndo in the TImageEnView.OnImageChangeE> event to detect changes due to undo/redo

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 ).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.IEBitmap.LoadFromFile( 'C:\Undo.jpg' );
    Handled := True; // Because we have handled it ourselves
  end;
end;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

kowal

Poland
46 Posts

Posted - Nov 10 2025 :  16:15:05  Show Profile  Reply
Thank you very much!
I'll try do do something using your help.
S. Kowalski
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: