12345678910111213141516171819202122232425262728293031 |
- /////////////////////////////////////////////////////////////////////////////////
- // 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 SelectionHistoryMemento : HistoryMemento
- {
- private object savedSelectionData;
- private IDocumentWorkspace historyWorkspace;
- public SelectionHistoryMemento(string name, ImageResource image, IDocumentWorkspace historyWorkspace)
- : base(name, image)
- {
- this.historyWorkspace = historyWorkspace;
- this.savedSelectionData = this.historyWorkspace.GetSelection().Save();
- }
- protected override HistoryMemento OnUndo()
- {
- SelectionHistoryMemento sha = new SelectionHistoryMemento(Name, Image, this.historyWorkspace);
- this.historyWorkspace.GetSelection().Restore(this.savedSelectionData);
- return sha;
- }
- }
- }
|