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
 CanUndo, GetUndoInfo and CanRedo, GetRedoInfo

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 - Oct 25 2018 : 11:51:11
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
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Oct 25 2018 : 21:54:52
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
w2m Posted - Oct 25 2018 : 15:26:11
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
xequte Posted - Oct 25 2018 : 15:13:46
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