This fixes a bug where the AutoCrop can't be undone, there is still a bug where a redo of a crop (auto or normal) doesn't update the bindings.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2310 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-11-24 10:29:39 +00:00
commit 3d62f9c279

View file

@ -734,15 +734,19 @@ namespace Greenshot.Drawing {
public bool AutoCrop() {
Rectangle cropRectangle = ImageHelper.FindAutoCropRectangle(Image, conf.AutoCropDifference);
if (isCropPossible(ref cropRectangle)) {
DrawingMode = DrawingModes.Crop;
cropContainer = new CropContainer(this);
cropContainer.Left = cropRectangle.X;
cropContainer.Top = cropRectangle.Y;
cropContainer.Width = cropRectangle.Width;
cropContainer.Height = cropRectangle.Height;
DeselectAllElements();
AddElement(cropContainer);
SelectElement(cropContainer);
// Maybe a bit obscure, but the following line creates a drop container
// It's available as "undrawnElement"
DrawingMode = DrawingModes.Crop;
undrawnElement.Left = cropRectangle.X;
undrawnElement.Top = cropRectangle.Y;
undrawnElement.Width = cropRectangle.Width;
undrawnElement.Height = cropRectangle.Height;
undrawnElement.Status = EditStatus.UNDRAWN;
AddElement(undrawnElement);
SelectElement(undrawnElement);
drawingElement = null;
undrawnElement = null;
return true;
}
return false;
@ -970,7 +974,7 @@ namespace Greenshot.Drawing {
if (drawingElement == null && DrawingMode != DrawingModes.None) {
if (undrawnElement == null) {
DeselectAllElements();
if(undrawnElement == null) {
if (undrawnElement == null) {
CreateUndrawnElement();
}
}