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 Does Not Restore Layer
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

w2m

USA
1990 Posts

Posted - May 13 2016 :  11:36:18  Show Profile  Reply
{ Increase the default undo limit }
ImageEnView1.Proc.UndoLimit := 99;
{ Do not automatically call TImageEnProc.SaveUndo }
ImageEnView1.Proc.AutoUndo := False;

procedure TForm1.ImageEnView1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if (Key = VK_DELETE) and (ImageEnView1.LayersCurrent <> 0) then
  begin
    ImageEnView1.Proc.SaveUndo('Delete layer', ieuLayer, True);
    ImageEnView1.LayersRemove(ImageEnView1.LayersCurrent);
    UpdateUndoMenu;
    UpdateGUI;
    UpdateStatusBar;
  end;
end;

procedure TForm1.Undo1Click(Sender: TObject);
 { Undo the last change }
begin
  if Assigned(ImageEnView1.IEBitmap) then
  begin
    with ImageEnView1 do
    begin
      with Proc do
      begin
        Undo;
        ClearUndo;
      end;
      IO.Params.Width := ImageEnView1.IEBitmap.Width;
      IO.Params.Height := ImageEnView1.IEBitmap.Height;
      Update;
      IEBitmap.Modified := Proc.CanUndo;
    end;
    UpdateUndoMenu;
    UpdateStatusBar;
  end;
end;


When Undo is executed, the deleted layer is not restored. Why?

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development

xequte

39053 Posts

Posted - May 15 2016 :  21:23:32  Show Profile  Reply
Hi Bill

The documentation is very poor for this method, as the correct undo source is ieuObjectsAndLayers. I'll improve the documentation for the next update

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