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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Undo Does Not Restore Layer

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
w2m Posted - May 13 2016 : 11:36:18
{ 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
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - May 15 2016 : 21:23:32
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