Add regions and update docs

This commit is contained in:
Nathan Brown 2023-03-16 14:54:16 -07:00
commit 4a22c613cd

View file

@ -673,6 +673,7 @@ namespace Greenshot.Editor.Drawing
menu.Items.Add(item); menu.Items.Add(item);
// Push out // Push out
#region Push Out
var pushOutSubmenu = new ToolStripMenuItem("Push Out"); var pushOutSubmenu = new ToolStripMenuItem("Push Out");
// Right // Right
@ -719,8 +720,10 @@ namespace Greenshot.Editor.Drawing
}; };
pushOutSubmenu.DropDownItems.Add(item); pushOutSubmenu.DropDownItems.Add(item);
menu.Items.Add(pushOutSubmenu); menu.Items.Add(pushOutSubmenu);
#endregion Push Out
// Fit menu // Fit menu
#region Fit
var fitSubmenu = new ToolStripMenuItem("Fit"); var fitSubmenu = new ToolStripMenuItem("Fit");
// Fit width // Fit width
@ -730,7 +733,7 @@ namespace Greenshot.Editor.Drawing
}; };
item.Click += delegate item.Click += delegate
{ {
foreach (var item in this) foreach (IDrawableContainer item in this)
{ {
MakeBoundsChangeUndoable(false); MakeBoundsChangeUndoable(false);
item.Width = surface.Image.Width; item.Width = surface.Image.Width;
@ -747,7 +750,7 @@ namespace Greenshot.Editor.Drawing
}; };
item.Click += delegate item.Click += delegate
{ {
foreach (var item in this) foreach (IDrawableContainer item in this)
{ {
MakeBoundsChangeUndoable(false); MakeBoundsChangeUndoable(false);
item.Height = surface.Image.Height; item.Height = surface.Image.Height;
@ -757,7 +760,9 @@ namespace Greenshot.Editor.Drawing
}; };
fitSubmenu.DropDownItems.Add(item); fitSubmenu.DropDownItems.Add(item);
menu.Items.Add(fitSubmenu); menu.Items.Add(fitSubmenu);
#endregion Fit
#region Snap
var snapSubmenu = new ToolStripMenuItem("Snap"); var snapSubmenu = new ToolStripMenuItem("Snap");
// Snap left // Snap left
@ -804,6 +809,7 @@ namespace Greenshot.Editor.Drawing
}; };
snapSubmenu.DropDownItems.Add(item); snapSubmenu.DropDownItems.Add(item);
menu.Items.Add(snapSubmenu); menu.Items.Add(snapSubmenu);
#endregion Snap
// Delete // Delete
item = new ToolStripMenuItem(Language.GetString(LangKey.editor_deleteelement)) item = new ToolStripMenuItem(Language.GetString(LangKey.editor_deleteelement))
@ -916,9 +922,7 @@ namespace Greenshot.Editor.Drawing
/// <summary> /// <summary>
/// Moves all selected elements to one edge of the surface. /// Moves all selected elements to one edge of the surface.
/// </summary> /// </summary>
/// <param name="direction"></param> /// <param name="direction">The direction in which to move the container.</param>
///
///
public void SnapAllToEdge(Direction direction) public void SnapAllToEdge(Direction direction)
{ {
foreach (IDrawableContainer container in this) foreach (IDrawableContainer container in this)
@ -932,8 +936,7 @@ namespace Greenshot.Editor.Drawing
/// Push an element entirely outside the current bounds of the surface, expanding the surface to accomodate it. /// Push an element entirely outside the current bounds of the surface, expanding the surface to accomodate it.
/// </summary> /// </summary>
/// <param name="direction">Direction in which to move element.</param> /// <param name="direction">Direction in which to move element.</param>
/// <param name="targetElement"></param> /// <param name="targetElement">The element to move.</param>
///
public void PushOut(Direction direction, IDrawableContainer targetElement) public void PushOut(Direction direction, IDrawableContainer targetElement)
{ {
Expansion expansion = GetExpansionFromSize(direction, targetElement.Size); Expansion expansion = GetExpansionFromSize(direction, targetElement.Size);
@ -961,7 +964,7 @@ namespace Greenshot.Editor.Drawing
/// </summary> /// </summary>
/// <param name="direction">The direction in which to expand.</param> /// <param name="direction">The direction in which to expand.</param>
/// <param name="elementSize">The size of the element to accommodate.</param> /// <param name="elementSize">The size of the element to accommodate.</param>
/// <returns></returns> /// <returns>The new expansion object, or null if an invalid Direction was given.</returns>
private static Expansion GetExpansionFromSize(Direction direction, Size elementSize) private static Expansion GetExpansionFromSize(Direction direction, Size elementSize)
{ {
var expansion = new Expansion(); var expansion = new Expansion();