diff --git a/src/Greenshot.Base/Interfaces/Drawing/IDrawableContainer.cs b/src/Greenshot.Base/Interfaces/Drawing/IDrawableContainer.cs index 2363b7ac9..b42192916 100644 --- a/src/Greenshot.Base/Interfaces/Drawing/IDrawableContainer.cs +++ b/src/Greenshot.Base/Interfaces/Drawing/IDrawableContainer.cs @@ -93,6 +93,11 @@ namespace Greenshot.Base.Interfaces.Drawing /// IList Adorners { get; } + /// + /// Is confirm/cancel possible for this container + /// + bool IsConfirmable { get; } + /// /// Adjust UI elements to the supplied DPI settings /// diff --git a/src/Greenshot.Editor/Drawing/CropContainer.cs b/src/Greenshot.Editor/Drawing/CropContainer.cs index 936a1a2c8..f33045b61 100644 --- a/src/Greenshot.Editor/Drawing/CropContainer.cs +++ b/src/Greenshot.Editor/Drawing/CropContainer.cs @@ -264,9 +264,18 @@ namespace Greenshot.Editor.Drawing Invalidate(); return true; } - - /// + /// + /// + /// /// Make sure this container is not undoable + /// public override bool IsUndoable => false; + + /// + /// + /// + /// See dedicated confirm method + /// + public override bool IsConfirmable => true; } } diff --git a/src/Greenshot.Editor/Drawing/DrawableContainer.cs b/src/Greenshot.Editor/Drawing/DrawableContainer.cs index f8a14052b..7ae58bfe6 100644 --- a/src/Greenshot.Editor/Drawing/DrawableContainer.cs +++ b/src/Greenshot.Editor/Drawing/DrawableContainer.cs @@ -480,9 +480,12 @@ namespace Greenshot.Editor.Drawing g.DrawRectangle(pen, rect); } - /// + /// public virtual bool IsUndoable => true; + /// + public virtual bool IsConfirmable => false; + /// /// Make a following bounds change on this drawablecontainer undoable! /// diff --git a/src/Greenshot.Editor/Drawing/Surface.cs b/src/Greenshot.Editor/Drawing/Surface.cs index 8eb2a872e..ead40e74f 100644 --- a/src/Greenshot.Editor/Drawing/Surface.cs +++ b/src/Greenshot.Editor/Drawing/Surface.cs @@ -2108,7 +2108,7 @@ namespace Greenshot.Editor.Drawing { // create new collection so that we can iterate safely (selectedElements might change due with confirm/cancel) List selectedDCs = new List(selectedElements); - foreach (IDrawableContainer dc in selectedDCs) + foreach (IDrawableContainer dc in selectedDCs.Where(c => c.IsConfirmable)) { throw new NotImplementedException($"No confirm/cancel defined for Container type {dc.GetType()}"); }