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
 Undo for multipage file
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

graph_man

326 Posts

Posted - Jun 13 2022 :  05:07:05  Show Profile  Reply
In ImageEnMView, the user selects the desired pages and presses the rotate button (for example).
For each page, I load the content into an ImageEnView and do the rotation.
Is it possible to undo this action for all these pages when the UNDO button is clicked?

xequte

38180 Posts

Posted - Jun 13 2022 :  20:10:01  Show Profile  Reply
I'm afraid there is no undo functionality for TImageEnMView. You would need to save a backup of the TImageEnView frame that can be restored if the user clicks undo.



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

graph_man

326 Posts

Posted - Jun 14 2022 :  01:23:12  Show Profile  Reply
Please write in more detail how to do it.
Go to Top of Page

graph_man

326 Posts

Posted - Jun 14 2022 :  01:25:25  Show Profile  Reply
Is it possible to record additional information in the undo, for example, the page number for which this action was performed?
Go to Top of Page

xequte

38180 Posts

Posted - Jun 14 2022 :  16:21:26  Show Profile  Reply
How about something like this?

procedure TForm1.RotateFrame(Index: Integer; Angle: double);
var
  fn: string;
begin
  fn := GetBackupFolder() + ImageEnMView1.MIO.Params[Index].Filename + '_' + IntToStr( Index ) + '.png';
  ImageEnMView1.GetImageToFile( Index, fn );
  ImageEnMView1.IEMBitmap.Rotate( Index, Angle, ierBicubic );
end;

function TForm1.CanUndo(Index: Integer): Boolean;
var
  fn: string;
begin
  fn := GetBackupFolder() + ImageEnMView1.MIO.Params[Index].Filename + '_' + IntToStr( Index ) + '.png';
  Result := FileExists( fn );
end;

procedure TForm1.UndoFrame(Index: Integer);
var
  fn: string;
begin
  fn := GetBackupFolder() + ImageEnMView1.MIO.Params[Index].Filename + '_' + IntToStr( Index ) + '.png';
  ImageEnMView1.SetImageFromFile( Index, fn );
  DeleteFile( fn );
end;


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

graph_man

326 Posts

Posted - Jun 15 2022 :  04:22:08  Show Profile  Reply
Thank you.
But what is GetBackupFolder() ?
I cannot find this function.
Go to Top of Page

xequte

38180 Posts

Posted - Jun 16 2022 :  01:07:44  Show Profile  Reply
That's your own method specifying where the images should be saved to (with trailing backslash).

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: