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