///////////////////////////////////////////////////////////////////////////////// // Paint.NET // // Copyright (C) dotPDN LLC, Rick Brewster, Tom Jackson, and contributors. // // Portions Copyright (C) Microsoft Corporation. All Rights Reserved. // // See src/Resources/Files/License.txt for full licensing and attribution // // details. // // . // ///////////////////////////////////////////////////////////////////////////////// namespace PaintDotNet.Measurement.HistoryMementos { public class NewLayerHistoryMemento : HistoryMemento { private int layerIndex; private IDocumentWorkspace historyWorkspace; protected override HistoryMemento OnUndo() { DeleteLayerHistoryMemento ha = new DeleteLayerHistoryMemento(Name, Image, this.historyWorkspace, (Layer)this.historyWorkspace.GetDocument().Layers[layerIndex]); ha.ID = this.ID; this.historyWorkspace.GetDocument().Layers.RemoveAt(layerIndex); this.historyWorkspace.GetDocument().Invalidate(); return ha; } public NewLayerHistoryMemento(string name, ImageResource image, IDocumentWorkspace historyWorkspace, int layerIndex) : base(name, image) { this.historyWorkspace = historyWorkspace; this.layerIndex = layerIndex; } } }