General cleanup

This commit is contained in:
Nathan Brown 2023-03-16 09:29:41 -07:00
commit d1a840ca33
3 changed files with 18 additions and 20 deletions

View file

@ -673,7 +673,7 @@ namespace Greenshot.Editor.Drawing
menu.Items.Add(item); menu.Items.Add(item);
// Push out // Push out
ToolStripMenuItem alignSubmenu = new ToolStripMenuItem("Push Out"); var pushOutSubmenu = new ToolStripMenuItem("Push Out");
// Right // Right
item = new ToolStripMenuItem("Right") item = new ToolStripMenuItem("Right")
@ -684,7 +684,7 @@ namespace Greenshot.Editor.Drawing
{ {
PushOut(Direction.RIGHT, this[0]); PushOut(Direction.RIGHT, this[0]);
}; };
alignSubmenu.DropDownItems.Add(item); pushOutSubmenu.DropDownItems.Add(item);
// Left // Left
item = new ToolStripMenuItem("Left") item = new ToolStripMenuItem("Left")
@ -695,7 +695,7 @@ namespace Greenshot.Editor.Drawing
{ {
PushOut(Direction.LEFT, this[0]); PushOut(Direction.LEFT, this[0]);
}; };
alignSubmenu.DropDownItems.Add(item); pushOutSubmenu.DropDownItems.Add(item);
// Top // Top
item = new ToolStripMenuItem("Top") item = new ToolStripMenuItem("Top")
@ -706,7 +706,7 @@ namespace Greenshot.Editor.Drawing
{ {
PushOut(Direction.TOP, this[0]); PushOut(Direction.TOP, this[0]);
}; };
alignSubmenu.DropDownItems.Add(item); pushOutSubmenu.DropDownItems.Add(item);
// Bottom // Bottom
item = new ToolStripMenuItem("Bottom") item = new ToolStripMenuItem("Bottom")
@ -717,11 +717,11 @@ namespace Greenshot.Editor.Drawing
{ {
PushOut(Direction.BOTTOM, this[0]); PushOut(Direction.BOTTOM, this[0]);
}; };
alignSubmenu.DropDownItems.Add(item); pushOutSubmenu.DropDownItems.Add(item);
menu.Items.Add(alignSubmenu); menu.Items.Add(pushOutSubmenu);
// Fit menu // Fit menu
ToolStripMenuItem fitSubmenu = new ToolStripMenuItem("Fit"); var fitSubmenu = new ToolStripMenuItem("Fit");
// Fit width // Fit width
item = new ToolStripMenuItem("Fit to width") item = new ToolStripMenuItem("Fit to width")
@ -736,7 +736,7 @@ namespace Greenshot.Editor.Drawing
item.Width = surface.Image.Width; item.Width = surface.Image.Width;
} }
SnapAllToEdge(Direction.LEFT); SnapAllToEdge(Direction.LEFT);
surface.Invalidate(); // not sure if this belongs surface.Invalidate();
}; };
fitSubmenu.DropDownItems.Add(item); fitSubmenu.DropDownItems.Add(item);
@ -753,12 +753,12 @@ namespace Greenshot.Editor.Drawing
item.Height = surface.Image.Height; item.Height = surface.Image.Height;
} }
SnapAllToEdge(Direction.TOP); SnapAllToEdge(Direction.TOP);
surface.Invalidate(); // not sure if this belongs surface.Invalidate();
}; };
fitSubmenu.DropDownItems.Add(item); fitSubmenu.DropDownItems.Add(item);
menu.Items.Add(fitSubmenu); menu.Items.Add(fitSubmenu);
ToolStripMenuItem snapSubmenu = new ToolStripMenuItem("Snap"); var snapSubmenu = new ToolStripMenuItem("Snap");
// Snap left // Snap left
item = new ToolStripMenuItem("Snap left") item = new ToolStripMenuItem("Snap left")
@ -819,7 +819,6 @@ namespace Greenshot.Editor.Drawing
if (canReset) if (canReset)
{ {
item = new ToolStripMenuItem(Language.GetString(LangKey.editor_resetsize)); item = new ToolStripMenuItem(Language.GetString(LangKey.editor_resetsize));
//item.Image = ((System.Drawing.Image)(editorFormResources.GetObject("removeObjectToolStripMenuItem.Image")));
item.Click += delegate item.Click += delegate
{ {
MakeBoundsChangeUndoable(false); MakeBoundsChangeUndoable(false);
@ -926,7 +925,7 @@ namespace Greenshot.Editor.Drawing
{ {
SnapContainerToEdge(direction, container); SnapContainerToEdge(direction, container);
} }
this.Parent.DeselectAllElements(); Parent.DeselectAllElements();
} }
/// <summary> /// <summary>
@ -939,11 +938,11 @@ namespace Greenshot.Editor.Drawing
{ {
Expansion expansion = GetExpansionFromSize(direction, targetElement.Size); Expansion expansion = GetExpansionFromSize(direction, targetElement.Size);
this.Parent.ResizeCanvas(expansion); Parent.ResizeCanvas(expansion);
SnapContainerToEdge(direction, targetElement); SnapContainerToEdge(direction, targetElement);
this.Parent.DeselectAllElements(); Parent.DeselectAllElements();
} }
private void SnapContainerToEdge(Direction direction, IDrawableContainer targetElement) private void SnapContainerToEdge(Direction direction, IDrawableContainer targetElement)
@ -954,7 +953,7 @@ namespace Greenshot.Editor.Drawing
private Size GetParentSurfaceSize() private Size GetParentSurfaceSize()
{ {
return new Size(this.Parent.Image.Width, this.Parent.Image.Height); return new Size(Parent.Image.Width, Parent.Image.Height);
} }
/// <summary> /// <summary>

View file

@ -1042,11 +1042,8 @@ namespace Greenshot.Editor.Drawing
/// <summary> /// <summary>
/// Set the canvas to a new size using the given bounds. /// Set the canvas to a new size using the given bounds.
/// Each parameter is the distance to expand in that direction.
/// </summary> /// </summary>
/// <param name="left"></param>
/// <param name="right"></param>
/// <param name="top"></param>
/// <param name="bottom"></param>
public void ResizeCanvas(int left, int right, int top, int bottom) public void ResizeCanvas(int left, int right, int top, int bottom)
{ {
var resizeEffect = new ResizeCanvasEffect(left, right, top, bottom); var resizeEffect = new ResizeCanvasEffect(left, right, top, bottom);

View file

@ -568,8 +568,10 @@ namespace Greenshot.Editor.Forms
} }
/// <summary> /// <summary>
/// Used when expanding the surface in one direction to accomodate shifting an object to one side. /// This is called when expanding the surface in one direction, used to accomodate shifting an object to one side.
/// </summary> /// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SurfaceExpanded(object sender, EventArgs e) private void SurfaceExpanded(object sender, EventArgs e)
{ {
UpdateUndoRedoSurfaceDependencies(); UpdateUndoRedoSurfaceDependencies();