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
 CanUndo, GetUndoInfo and CanRedo, GetRedoInfo
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

w2m

USA
1990 Posts

Posted - Oct 25 2018 :  11:51:11  Show Profile  Reply
Nigel,

In my testing the new GetUndoInfo code shown below works quite well but CanUndo and CanRedo should account for the Layerindex as well.

ImageEnView.Proc.GetUndoInfo(0, iUndoSource, iUndoOperation, iUndoCaption, iUndoIndex);
Undo1.Enabled := (cxPageControl1.PageCount > 0) and (ImageEnView.LayersCurrent = iUndoIndex);
Undo2.Enabled := (cxPageControl1.PageCount > 0) and (ImageEnView.LayersCurrent = iUndoIndex);

As best as I can determine CanUndo does not utilize GetUndoInfo to determine if undo can be applied to the LayersCurrent. Also should there be a GetRedoInfo procedure as well? If not how can you disable a redo button if the incorrect layer is the current layer?

In my judgement CanUndo and CanRedo should account for the Layerindex which would greatly simplify undo/redo operations.

Should UndoLayersCount and RedoLayersCount procedures be added.

function TImageEnProc.GetCanUndo: Boolean;
begin
result := fUndoList.Count > 0; // add and iUndoIndex = LayersCurrent
end;

function TImageEnProc.GetCanRedo: Boolean;
begin
result := fRedoList.Count > 0; // add and iRedoIndex = LayersCurrent
end;

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

xequte

38209 Posts

Posted - Oct 25 2018 :  15:13:46  Show Profile  Reply
Hi Bill

Undo/Redo is supposed to immune to the layer selection, but there is a bug that prevents that from happening in some scenarios. If you pull the source from Git (or email me for it) there is a fix that ensures that the correct layer is undone/redone.

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

w2m

USA
1990 Posts

Posted - Oct 25 2018 :  15:26:11  Show Profile  Reply
Yes, I got it from Git, but you missed my point and that is CanUndo and CanRedo should be false if the correct layer is not selected. Also, but not as important, the UndoCount should be for the selected layer.

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

xequte

38209 Posts

Posted - Oct 25 2018 :  21:54:52  Show Profile  Reply
Hi Bill

I'm not sure about making undo layer specific. If a user makes a change to a layer (e.g. moves it, rotates it or performs an image editing features) they probably want to be able to undo it, even if the layer is not selected. Also if they have a list of undo items (e.g. layer 3 added, layer 2 deleted, layer 1 negative effect) they would need to select the last edited layer in order to traverse the undo list (i.e. select layer 1, in order to undo layer 2 delete in our example).

I think the way it is currently implemented best matches how most image applications perform.

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