mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 14:24:43 -07:00
Add functionality for expand left and right
This commit is contained in:
parent
24d4e926ad
commit
8f7a7de496
1 changed files with 56 additions and 0 deletions
|
@ -598,6 +598,62 @@ namespace Greenshot.Editor.Drawing
|
||||||
};
|
};
|
||||||
menu.Items.Add(item);
|
menu.Items.Add(item);
|
||||||
|
|
||||||
|
// Stich? Append? Attach? Expand? Push?
|
||||||
|
item = new ToolStripMenuItem("Expand to Right")
|
||||||
|
{
|
||||||
|
Image = (Image)EditorFormResources.GetObject("removeObjectToolStripMenuItem.Image")
|
||||||
|
};
|
||||||
|
// Action to perform on click.
|
||||||
|
item.Click += delegate
|
||||||
|
{
|
||||||
|
// Calculate height and width of new frame.
|
||||||
|
int width = this[0].Width + surface.Image.Width;
|
||||||
|
int height = Math.Max(surface.Image.Height, this[0].Height);
|
||||||
|
int oldWidth = surface.Image.Width;
|
||||||
|
// Create image for use as new frame.
|
||||||
|
Bitmap newImage = new Bitmap(width, height);
|
||||||
|
// Save old image.
|
||||||
|
Bitmap oldImage = (Bitmap)ImageHelper.Clone(surface.Image);
|
||||||
|
// Set background to new, larger frame.
|
||||||
|
surface.Image = newImage;
|
||||||
|
// Move object to open space
|
||||||
|
this[0].MoveBy(oldWidth - this[0].Location.X, -this[0].Location.Y);
|
||||||
|
// Push original image to bottom.
|
||||||
|
var oldImageContainer = surface.AddImageContainer(oldImage, 0, 0);
|
||||||
|
IDrawableContainerList oldImageContainerList = this.Clone();
|
||||||
|
oldImageContainerList[0] = oldImageContainer;
|
||||||
|
surface.Elements.PushElementsToBottom(oldImageContainerList);
|
||||||
|
};
|
||||||
|
menu.Items.Add(item);
|
||||||
|
|
||||||
|
// Left
|
||||||
|
item = new ToolStripMenuItem("Expand to Left")
|
||||||
|
{
|
||||||
|
Image = (Image)EditorFormResources.GetObject("removeObjectToolStripMenuItem.Image")
|
||||||
|
};
|
||||||
|
// Action to perform on click.
|
||||||
|
item.Click += delegate
|
||||||
|
{
|
||||||
|
// Calculate height and width of new frame.
|
||||||
|
int width = this[0].Width + surface.Image.Width;
|
||||||
|
int height = Math.Max(surface.Image.Height, this[0].Height);
|
||||||
|
int oldWidth = surface.Image.Width;
|
||||||
|
// Create image for use as new frame.
|
||||||
|
Bitmap newImage = new Bitmap(width, height);
|
||||||
|
// Save old image.
|
||||||
|
Bitmap oldImage = (Bitmap)ImageHelper.Clone(surface.Image);
|
||||||
|
// Set background to new, larger frame.
|
||||||
|
surface.Image = newImage;
|
||||||
|
// Move object to open space
|
||||||
|
this[0].MoveBy(-this[0].Location.X, -this[0].Location.Y);
|
||||||
|
// Re-add original image and push to bottom.
|
||||||
|
var oldImageContainer = surface.AddImageContainer(oldImage, this[0].Width, 0);
|
||||||
|
IDrawableContainerList oldImageContainerList = this.Clone();
|
||||||
|
oldImageContainerList[0] = oldImageContainer;
|
||||||
|
surface.Elements.PushElementsToBottom(oldImageContainerList);
|
||||||
|
};
|
||||||
|
menu.Items.Add(item);
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
item = new ToolStripMenuItem(Language.GetString(LangKey.editor_deleteelement))
|
item = new ToolStripMenuItem(Language.GetString(LangKey.editor_deleteelement))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue