SelectAllFunction.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using PaintDotNet.Measurement.HistoryMementos;
  2. using System.Drawing.Drawing2D;
  3. namespace PaintDotNet.Measurement.HistoryFunctions
  4. {
  5. public sealed class SelectAllFunction
  6. : HistoryFunction
  7. {
  8. public static string StaticName
  9. {
  10. get
  11. {
  12. return PdnResources.GetString("SelectAllAction.Name");
  13. }
  14. }
  15. public override HistoryMemento OnExecute(IDocumentWorkspace historyWorkspace)
  16. {
  17. SelectionHistoryMemento sha = new SelectionHistoryMemento(
  18. StaticName,
  19. PdnResources.GetImageResource("Icons.MenuEditSelectAllIcon.png"),
  20. historyWorkspace);
  21. EnterCriticalRegion();
  22. historyWorkspace.GetSelection().PerformChanging();
  23. historyWorkspace.GetSelection().Reset();
  24. historyWorkspace.GetSelection().SetContinuation(historyWorkspace.GetDocument().Bounds, CombineMode.Replace);
  25. historyWorkspace.GetSelection().CommitContinuation();
  26. historyWorkspace.GetSelection().PerformChanged();
  27. return sha;
  28. }
  29. public SelectAllFunction()
  30. : base(PaintDotNet.Measurement.Enum.ActionFlags.None)
  31. {
  32. }
  33. }
  34. }