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

View file

@ -1042,11 +1042,8 @@ namespace Greenshot.Editor.Drawing
/// <summary>
/// Set the canvas to a new size using the given bounds.
/// Each parameter is the distance to expand in that direction.
/// </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)
{
var resizeEffect = new ResizeCanvasEffect(left, right, top, bottom);

View file

@ -568,8 +568,10 @@ namespace Greenshot.Editor.Forms
}
/// <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>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SurfaceExpanded(object sender, EventArgs e)
{
UpdateUndoRedoSurfaceDependencies();