Add option menu for crop modes

move auto crop to crop option
refactor CropStyle from property to enum CropMode
App menu images and translations
This commit is contained in:
Christian Schulz 2022-02-28 18:27:16 +01:00
commit 3a55822049
12 changed files with 172 additions and 88 deletions

View file

@ -33,6 +33,7 @@ namespace Greenshot.Editor.Configuration
contextmenu_capturefullscreen_right, contextmenu_capturefullscreen_right,
contextmenu_capturefullscreen_bottom, contextmenu_capturefullscreen_bottom,
contextmenu_captureie, contextmenu_captureie,
editor_autocrop_not_possible,
editor_clipboardfailed, editor_clipboardfailed,
editor_close_on_save, editor_close_on_save,
editor_close_on_save_title, editor_close_on_save_title,

View file

@ -35,10 +35,28 @@ namespace Greenshot.Editor.Drawing
/// </summary> /// </summary>
public class CropContainer : DrawableContainer public class CropContainer : DrawableContainer
{ {
//awailable Styles /// <summary>
public static readonly string DefaultCropStyle = nameof(DefaultCropStyle); /// awailable modes
public static readonly string VerticalCropOutStyle = nameof(VerticalCropOutStyle); /// </summary>
public static readonly string HorizontalCropOutStyle = nameof(HorizontalCropOutStyle); public enum CropMode
{
/// <summary>
/// crop all outside the selection rectangle
/// </summary>
Default,
/// <summary>
/// like default, but initially creates the selection rectangle
/// </summary>
AutoCrop,
/// <summary>
/// crop all inside the selection, anchors the selection to the top and bottom edges
/// </summary>
Vertical,
/// <summary>
/// crop all inside the selection, anchors the selection to the left and right edges
/// </summary>
Horizontal
}
public CropContainer(ISurface parent) : base(parent) public CropContainer(ISurface parent) : base(parent)
{ {
@ -53,14 +71,14 @@ namespace Greenshot.Editor.Drawing
private void Init() private void Init()
{ {
switch (GetFieldValueAsString(FieldType.CROPSTYLE)) switch (GetFieldValue(FieldType.CROPMODE))
{ {
case string s when s.Equals(HorizontalCropOutStyle): case CropMode.Horizontal:
{ {
InitHorizontalCropOutStyle(); InitHorizontalCropOutStyle();
break; break;
} }
case string s when s.Equals(VerticalCropOutStyle): case CropMode.Vertical:
{ {
InitVerticalCropOutStyle(); InitVerticalCropOutStyle();
break; break;
@ -73,21 +91,6 @@ namespace Greenshot.Editor.Drawing
} }
} }
/// <summary>
/// rotate through all awailable Styles
/// </summary>
/// <param name="style"></param>
/// <returns></returns>
public static string GetNextStyle(string style)
{
return style switch
{
var s when s.Equals(HorizontalCropOutStyle) => VerticalCropOutStyle,
var s when s.Equals(VerticalCropOutStyle) => DefaultCropStyle,
_ => HorizontalCropOutStyle,
};
}
private void InitCropStyle() private void InitCropStyle()
{ {
CreateDefaultAdorners(); CreateDefaultAdorners();
@ -130,7 +133,7 @@ namespace Greenshot.Editor.Drawing
protected override void InitializeFields() protected override void InitializeFields()
{ {
AddField(GetType(), FieldType.FLAGS, FieldFlag.CONFIRMABLE); AddField(GetType(), FieldType.FLAGS, FieldFlag.CONFIRMABLE);
AddField(GetType(), FieldType.CROPSTYLE, DefaultCropStyle); AddField(GetType(), FieldType.CROPMODE, CropMode.Default);
} }
public override void Invalidate() public override void Invalidate()
@ -170,10 +173,10 @@ namespace Greenshot.Editor.Drawing
DrawSelectionBorder(g, selectionRect); DrawSelectionBorder(g, selectionRect);
switch (GetFieldValueAsString(FieldType.CROPSTYLE)) switch (GetFieldValue(FieldType.CROPMODE))
{ {
case var s when s.Equals(HorizontalCropOutStyle): case CropMode.Horizontal:
case var t when t.Equals(VerticalCropOutStyle): case CropMode.Vertical:
{ {
//draw inside //draw inside
g.FillRectangle(cropBrush, cropRectangle); g.FillRectangle(cropBrush, cropRectangle);
@ -204,12 +207,12 @@ namespace Greenshot.Editor.Drawing
public override bool HandleMouseDown(int x, int y) public override bool HandleMouseDown(int x, int y)
{ {
return GetFieldValueAsString(FieldType.CROPSTYLE) switch return GetFieldValue(FieldType.CROPMODE) switch
{ {
//force horizontal crop to left edge //force horizontal crop to left edge
var s when s.Equals(HorizontalCropOutStyle) => base.HandleMouseDown(0, y), CropMode.Horizontal => base.HandleMouseDown(0, y),
//force vertical crop to top edge //force vertical crop to top edge
var s when s.Equals(VerticalCropOutStyle) => base.HandleMouseDown(x, 0), CropMode.Vertical => base.HandleMouseDown(x, 0),
_ => base.HandleMouseDown(x, y), _ => base.HandleMouseDown(x, y),
}; };
} }
@ -218,9 +221,9 @@ namespace Greenshot.Editor.Drawing
{ {
Invalidate(); Invalidate();
switch (GetFieldValueAsString(FieldType.CROPSTYLE)) switch (GetFieldValue(FieldType.CROPMODE))
{ {
case var s when s.Equals(HorizontalCropOutStyle): case CropMode.Horizontal:
{ {
//stick on left and right //stick on left and right
//allow only horizontal changes //allow only horizontal changes
@ -233,7 +236,7 @@ namespace Greenshot.Editor.Drawing
} }
break; break;
} }
case var s when s.Equals(VerticalCropOutStyle): case CropMode.Vertical:
{ {
//stick on top and bottom //stick on top and bottom
//allow only vertical changes //allow only vertical changes

View file

@ -51,13 +51,13 @@ namespace Greenshot.Editor.Drawing.Fields
public static readonly IFieldType PREPARED_FILTER_OBFUSCATE = new FieldType(nameof(PREPARED_FILTER_OBFUSCATE)); public static readonly IFieldType PREPARED_FILTER_OBFUSCATE = new FieldType(nameof(PREPARED_FILTER_OBFUSCATE));
public static readonly IFieldType PREPARED_FILTER_HIGHLIGHT = new FieldType(nameof(PREPARED_FILTER_HIGHLIGHT)); public static readonly IFieldType PREPARED_FILTER_HIGHLIGHT = new FieldType(nameof(PREPARED_FILTER_HIGHLIGHT));
public static readonly IFieldType FLAGS = new FieldType(nameof(FLAGS)); public static readonly IFieldType FLAGS = new FieldType(nameof(FLAGS));
public static readonly IFieldType CROPSTYLE = new FieldType(nameof(CROPSTYLE)); public static readonly IFieldType CROPMODE = new FieldType(nameof(CROPMODE));
public static IFieldType[] Values = public static IFieldType[] Values =
{ {
ARROWHEADS, BLUR_RADIUS, BRIGHTNESS, FILL_COLOR, FONT_BOLD, FONT_FAMILY, FONT_ITALIC, FONT_SIZE, TEXT_HORIZONTAL_ALIGNMENT, TEXT_VERTICAL_ALIGNMENT, HIGHLIGHT_COLOR, ARROWHEADS, BLUR_RADIUS, BRIGHTNESS, FILL_COLOR, FONT_BOLD, FONT_FAMILY, FONT_ITALIC, FONT_SIZE, TEXT_HORIZONTAL_ALIGNMENT, TEXT_VERTICAL_ALIGNMENT, HIGHLIGHT_COLOR,
LINE_COLOR, LINE_THICKNESS, MAGNIFICATION_FACTOR, PIXEL_SIZE, PREVIEW_QUALITY, SHADOW, PREPARED_FILTER_OBFUSCATE, PREPARED_FILTER_HIGHLIGHT, FLAGS, CROPSTYLE LINE_COLOR, LINE_THICKNESS, MAGNIFICATION_FACTOR, PIXEL_SIZE, PREVIEW_QUALITY, SHADOW, PREPARED_FILTER_OBFUSCATE, PREPARED_FILTER_HIGHLIGHT, FLAGS, CROPMODE
}; };
public string Name { get; set; } public string Name { get; set; }

View file

@ -2069,14 +2069,14 @@ namespace Greenshot.Editor.Drawing
{ {
if (dc is CropContainer e) if (dc is CropContainer e)
{ {
switch (e.GetFieldValueAsString(FieldType.CROPSTYLE)) switch (e.GetFieldValue(FieldType.CROPMODE))
{ {
case var s when s.Equals(CropContainer.HorizontalCropOutStyle): case CropContainer.CropMode.Horizontal:
{ {
ApplyHorizontalCrop(_cropContainer.Bounds); ApplyHorizontalCrop(_cropContainer.Bounds);
break; break;
} }
case var s when s.Equals(CropContainer.VerticalCropOutStyle): case CropContainer.CropMode.Vertical:
{ {
ApplyVerticalCrop(_cropContainer.Bounds); ApplyVerticalCrop(_cropContainer.Bounds);
break; break;

View file

@ -98,8 +98,6 @@ namespace Greenshot.Editor.Forms {
this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator();
this.preferencesToolStripMenuItem = new GreenshotToolStripMenuItem(); this.preferencesToolStripMenuItem = new GreenshotToolStripMenuItem();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.autoCropToolStripMenuItem = new GreenshotToolStripMenuItem();
this.toolStripSeparator17 = new System.Windows.Forms.ToolStripSeparator();
this.insert_window_toolstripmenuitem = new GreenshotToolStripMenuItem(); this.insert_window_toolstripmenuitem = new GreenshotToolStripMenuItem();
this.objectToolStripMenuItem = new GreenshotToolStripMenuItem(); this.objectToolStripMenuItem = new GreenshotToolStripMenuItem();
this.addRectangleToolStripMenuItem = new GreenshotToolStripMenuItem(); this.addRectangleToolStripMenuItem = new GreenshotToolStripMenuItem();
@ -143,10 +141,15 @@ namespace Greenshot.Editor.Forms {
this.toolStripSeparator16 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator16 = new System.Windows.Forms.ToolStripSeparator();
this.btnHelp = new GreenshotToolStripButton(); this.btnHelp = new GreenshotToolStripButton();
this.propertiesToolStrip = new ToolStripEx(); this.propertiesToolStrip = new ToolStripEx();
this.obfuscateModeButton = new BindableToolStripDropDownButton(); this.obfuscateModeButton = new BindableToolStripDropDownButton();
this.pixelizeToolStripMenuItem = new GreenshotToolStripMenuItem(); this.cropModeButton = new BindableToolStripDropDownButton();
this.pixelizeToolStripMenuItem = new GreenshotToolStripMenuItem();
this.blurToolStripMenuItem = new GreenshotToolStripMenuItem(); this.blurToolStripMenuItem = new GreenshotToolStripMenuItem();
this.highlightModeButton = new BindableToolStripDropDownButton(); this.defaultCropModeToolStripMenuItem = new GreenshotToolStripMenuItem();
this.verticalCropModeToolStripMenuItem = new GreenshotToolStripMenuItem();
this.horizontalCropModeToolStripMenuItem = new GreenshotToolStripMenuItem();
this.autoCropModeToolStripMenuItem = new GreenshotToolStripMenuItem();
this.highlightModeButton = new BindableToolStripDropDownButton();
this.textHighlightMenuItem = new GreenshotToolStripMenuItem(); this.textHighlightMenuItem = new GreenshotToolStripMenuItem();
this.areaHighlightMenuItem = new GreenshotToolStripMenuItem(); this.areaHighlightMenuItem = new GreenshotToolStripMenuItem();
this.grayscaleHighlightMenuItem = new GreenshotToolStripMenuItem(); this.grayscaleHighlightMenuItem = new GreenshotToolStripMenuItem();
@ -593,8 +596,6 @@ namespace Greenshot.Editor.Forms {
this.toolStripSeparator12, this.toolStripSeparator12,
this.preferencesToolStripMenuItem, this.preferencesToolStripMenuItem,
this.toolStripSeparator5, this.toolStripSeparator5,
this.autoCropToolStripMenuItem,
this.toolStripSeparator17,
this.insert_window_toolstripmenuitem}); this.insert_window_toolstripmenuitem});
this.editToolStripMenuItem.LanguageKey = "editor_edit"; this.editToolStripMenuItem.LanguageKey = "editor_edit";
this.editToolStripMenuItem.Name = "editToolStripMenuItem"; this.editToolStripMenuItem.Name = "editToolStripMenuItem";
@ -678,16 +679,6 @@ namespace Greenshot.Editor.Forms {
// //
this.toolStripSeparator5.Name = "toolStripSeparator5"; this.toolStripSeparator5.Name = "toolStripSeparator5";
// //
// autoCropToolStripMenuItem
//
this.autoCropToolStripMenuItem.LanguageKey = "editor_autocrop";
this.autoCropToolStripMenuItem.Name = "autoCropToolStripMenuItem";
this.autoCropToolStripMenuItem.Click += new System.EventHandler(this.AutoCropToolStripMenuItemClick);
//
// toolStripSeparator17
//
this.toolStripSeparator17.Name = "toolStripSeparator17";
//
// insert_window_toolstripmenuitem // insert_window_toolstripmenuitem
// //
this.insert_window_toolstripmenuitem.LanguageKey = "editor_insertwindow"; this.insert_window_toolstripmenuitem.LanguageKey = "editor_insertwindow";
@ -1082,6 +1073,7 @@ namespace Greenshot.Editor.Forms {
this.toolStripSeparator10, this.toolStripSeparator10,
this.btnConfirm, this.btnConfirm,
this.btnCancel, this.btnCancel,
this.cropModeButton,
this.counterLabel, this.counterLabel,
this.counterUpDown}); this.counterUpDown});
// //
@ -1111,10 +1103,60 @@ namespace Greenshot.Editor.Forms {
this.blurToolStripMenuItem.LanguageKey = "editor_obfuscate_blur"; this.blurToolStripMenuItem.LanguageKey = "editor_obfuscate_blur";
this.blurToolStripMenuItem.Name = "blurToolStripMenuItem"; this.blurToolStripMenuItem.Name = "blurToolStripMenuItem";
this.blurToolStripMenuItem.Tag = FilterContainer.PreparedFilter.BLUR; this.blurToolStripMenuItem.Tag = FilterContainer.PreparedFilter.BLUR;
//
// highlightModeButton //
// // cropModeButton
this.highlightModeButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; //
this.cropModeButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.cropModeButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.defaultCropModeToolStripMenuItem,
this.verticalCropModeToolStripMenuItem,
this.horizontalCropModeToolStripMenuItem,
this.autoCropModeToolStripMenuItem});
this.cropModeButton.Image = ((System.Drawing.Image)(resources.GetObject("btnCrop.Image")));
this.cropModeButton.ImageTransparentColor = System.Drawing.Color.Magenta;
//TODO translate
this.cropModeButton.LanguageKey = "editor_crop_mode";
this.cropModeButton.Name = "cropModeButton";
this.cropModeButton.SelectedTag = CropContainer.CropMode.Default;
this.cropModeButton.Tag = CropContainer.CropMode.Default;
//
// defaultCropStyleToolStripMenuItem
//
this.defaultCropModeToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("btnCrop.Image")));
this.defaultCropModeToolStripMenuItem.LanguageKey = "editor_cropmode_default";
this.defaultCropModeToolStripMenuItem.Name = "defaultCropModeToolStripMenuItem";
this.defaultCropModeToolStripMenuItem.Tag = CropContainer.CropMode.Default;
//
// verticalCropStyleToolStripMenuItem
//
this.verticalCropModeToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("CropVertical.Image")));
this.verticalCropModeToolStripMenuItem.LanguageKey = "editor_cropmode_vertical";
this.verticalCropModeToolStripMenuItem.Name = "verticalCropModeToolStripMenuItem";
this.verticalCropModeToolStripMenuItem.Tag = CropContainer.CropMode.Vertical;
//
// horizontalCropStyleToolStripMenuItem
//
this.horizontalCropModeToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("CropHorizontal.Image")));
this.horizontalCropModeToolStripMenuItem.LanguageKey = "editor_cropmode_horizontal";
this.horizontalCropModeToolStripMenuItem.Name = "horizontalCropModeToolStripMenuItem";
this.horizontalCropModeToolStripMenuItem.Tag = CropContainer.CropMode.Horizontal;
//
// horizontalCropStyleToolStripMenuItem
//
this.autoCropModeToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("AutoCrop.Image")));
this.autoCropModeToolStripMenuItem.LanguageKey = "editor_cropmode_auto";
this.autoCropModeToolStripMenuItem.Name = "autoCropModeToolStripMenuItem";
this.autoCropModeToolStripMenuItem.Tag = CropContainer.CropMode.AutoCrop;
//
// highlightModeButton
//
this.highlightModeButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.highlightModeButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.highlightModeButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.textHighlightMenuItem, this.textHighlightMenuItem,
this.areaHighlightMenuItem, this.areaHighlightMenuItem,
@ -1872,8 +1914,13 @@ namespace Greenshot.Editor.Forms {
private BindableToolStripButton btnCancel; private BindableToolStripButton btnCancel;
private BindableToolStripButton btnConfirm; private BindableToolStripButton btnConfirm;
private GreenshotToolStripMenuItem selectAllToolStripMenuItem; private GreenshotToolStripMenuItem selectAllToolStripMenuItem;
private BindableToolStripDropDownButton highlightModeButton; private BindableToolStripDropDownButton highlightModeButton;
private GreenshotToolStripMenuItem pixelizeToolStripMenuItem; private BindableToolStripDropDownButton cropModeButton;
private GreenshotToolStripMenuItem defaultCropModeToolStripMenuItem;
private GreenshotToolStripMenuItem verticalCropModeToolStripMenuItem;
private GreenshotToolStripMenuItem horizontalCropModeToolStripMenuItem;
private GreenshotToolStripMenuItem autoCropModeToolStripMenuItem;
private GreenshotToolStripMenuItem pixelizeToolStripMenuItem;
private GreenshotToolStripMenuItem blurToolStripMenuItem; private GreenshotToolStripMenuItem blurToolStripMenuItem;
private BindableToolStripDropDownButton obfuscateModeButton; private BindableToolStripDropDownButton obfuscateModeButton;
private GreenshotToolStripButton btnHighlight; private GreenshotToolStripButton btnHighlight;

View file

@ -284,6 +284,7 @@ namespace Greenshot.Editor.Forms
obfuscateModeButton.DropDownItemClicked += FilterPresetDropDownItemClicked; obfuscateModeButton.DropDownItemClicked += FilterPresetDropDownItemClicked;
highlightModeButton.DropDownItemClicked += FilterPresetDropDownItemClicked; highlightModeButton.DropDownItemClicked += FilterPresetDropDownItemClicked;
cropModeButton.DropDownItemClicked += CropStyleDropDownItemClicked;
_toolbarButtons = new[] _toolbarButtons = new[]
{ {
@ -727,21 +728,12 @@ namespace Greenshot.Editor.Forms
private void BtnCropClick(object sender, EventArgs e) private void BtnCropClick(object sender, EventArgs e)
{ {
if (_surface.DrawingMode == DrawingModes.Crop) if (_surface.DrawingMode != DrawingModes.Crop)
{
//intercept repeated click event
//rotate through crop styles
_surface.FieldAggregator.GetField(FieldType.CROPSTYLE).Value = CropContainer.GetNextStyle((string)_surface.FieldAggregator.GetField(FieldType.CROPSTYLE).Value);
_surface.RemoveCropContainer();
//reinitialize crop modus
_surface.DrawingMode = DrawingModes.Crop;
}
else
{ {
_surface.DrawingMode = DrawingModes.Crop; _surface.DrawingMode = DrawingModes.Crop;
InitCropMode((CropContainer.CropMode)_surface.FieldAggregator.GetField(FieldType.CROPMODE).Value);
RefreshFieldControls();
} }
RefreshFieldControls();
} }
private void BtnHighlightClick(object sender, EventArgs e) private void BtnHighlightClick(object sender, EventArgs e)
@ -1305,6 +1297,7 @@ namespace Greenshot.Editor.Forms
new BidirectionalBinding(previewQualityUpDown, "Value", _surface.FieldAggregator.GetField(FieldType.PREVIEW_QUALITY), "Value", new BidirectionalBinding(previewQualityUpDown, "Value", _surface.FieldAggregator.GetField(FieldType.PREVIEW_QUALITY), "Value",
DecimalDoublePercentageConverter.GetInstance(), NotNullValidator.GetInstance()); DecimalDoublePercentageConverter.GetInstance(), NotNullValidator.GetInstance());
new BidirectionalBinding(obfuscateModeButton, "SelectedTag", _surface.FieldAggregator.GetField(FieldType.PREPARED_FILTER_OBFUSCATE), "Value"); new BidirectionalBinding(obfuscateModeButton, "SelectedTag", _surface.FieldAggregator.GetField(FieldType.PREPARED_FILTER_OBFUSCATE), "Value");
new BidirectionalBinding(cropModeButton, "SelectedTag", _surface.FieldAggregator.GetField(FieldType.CROPMODE), "Value");
new BidirectionalBinding(highlightModeButton, "SelectedTag", _surface.FieldAggregator.GetField(FieldType.PREPARED_FILTER_HIGHLIGHT), "Value"); new BidirectionalBinding(highlightModeButton, "SelectedTag", _surface.FieldAggregator.GetField(FieldType.PREPARED_FILTER_HIGHLIGHT), "Value");
new BidirectionalBinding(counterUpDown, "Value", _surface, "CounterStart", DecimalIntConverter.GetInstance(), NotNullValidator.GetInstance()); new BidirectionalBinding(counterUpDown, "Value", _surface, "CounterStart", DecimalIntConverter.GetInstance(), NotNullValidator.GetInstance());
} }
@ -1340,6 +1333,7 @@ namespace Greenshot.Editor.Forms
&& ((FieldFlag) props.GetFieldValue(FieldType.FLAGS) & FieldFlag.CONFIRMABLE) == FieldFlag.CONFIRMABLE; && ((FieldFlag) props.GetFieldValue(FieldType.FLAGS) & FieldFlag.CONFIRMABLE) == FieldFlag.CONFIRMABLE;
obfuscateModeButton.Visible = props.HasFieldValue(FieldType.PREPARED_FILTER_OBFUSCATE); obfuscateModeButton.Visible = props.HasFieldValue(FieldType.PREPARED_FILTER_OBFUSCATE);
cropModeButton.Visible = props.HasFieldValue(FieldType.CROPMODE);
highlightModeButton.Visible = props.HasFieldValue(FieldType.PREPARED_FILTER_HIGHLIGHT); highlightModeButton.Visible = props.HasFieldValue(FieldType.PREPARED_FILTER_HIGHLIGHT);
} }
else else
@ -1392,11 +1386,6 @@ namespace Greenshot.Editor.Forms
ToolStripItemEndisabler.Enable(helpToolStripMenuItem); ToolStripItemEndisabler.Enable(helpToolStripMenuItem);
ToolStripItemEndisabler.Enable(aboutToolStripMenuItem); ToolStripItemEndisabler.Enable(aboutToolStripMenuItem);
ToolStripItemEndisabler.Enable(preferencesToolStripMenuItem); ToolStripItemEndisabler.Enable(preferencesToolStripMenuItem);
if (_surface.DrawingMode == DrawingModes.Crop)
{
//While cropping, enable the button to change crop style
btnCrop.Enabled = true;
}
_controlsDisabledDueToConfirmable = true; _controlsDisabledDueToConfirmable = true;
} }
} }
@ -1600,6 +1589,37 @@ namespace Greenshot.Editor.Forms
Invalidate(true); Invalidate(true);
} }
protected void CropStyleDropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
InitCropMode((CropContainer.CropMode)e.ClickedItem.Tag);
RefreshFieldControls();
Invalidate(true);
}
private void InitCropMode(CropContainer.CropMode mode)
{
_surface.DrawingMode = DrawingModes.None;
_surface.RemoveCropContainer();
if (mode == CropContainer.CropMode.AutoCrop)
{
if (!_surface.AutoCrop())
{
//not AutoCrop possible automatic switch to default crop mode
_surface.DrawingMode = DrawingModes.Crop;
_surface.FieldAggregator.GetField(FieldType.CROPMODE).Value = CropContainer.CropMode.Default;
this.cropModeButton.SelectedTag = CropContainer.CropMode.Default;
this.statusLabel.Text = Language.GetString(LangKey.editor_autocrop_not_possible);
}
}
else
{
_surface.DrawingMode = DrawingModes.Crop;
}
}
private void SelectAllToolStripMenuItemClick(object sender, EventArgs e) private void SelectAllToolStripMenuItemClick(object sender, EventArgs e)
{ {
_surface.SelectAllElements(); _surface.SelectAllElements();
@ -1661,14 +1681,6 @@ namespace Greenshot.Editor.Forms
} }
} }
private void AutoCropToolStripMenuItemClick(object sender, EventArgs e)
{
if (_surface.AutoCrop())
{
RefreshFieldControls();
}
}
private void AddBorderToolStripMenuItemClick(object sender, EventArgs e) private void AddBorderToolStripMenuItemClick(object sender, EventArgs e)
{ {
_surface.ApplyBitmapEffect(new BorderEffect()); _surface.ApplyBitmapEffect(new BorderEffect());

View file

@ -1107,4 +1107,13 @@
<metadata name="zoomMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="zoomMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>782, 17</value> <value>782, 17</value>
</metadata> </metadata>
<data name="AutoCrop.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AutoCrop.Image.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="CropHorizontal.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\CropHorizontal.Image.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="CropVertical.Image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\CropVertical.Image.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -76,8 +76,9 @@ schnell zu finden. Vielen Dank :)</resource>
<resource name="editor_arrowheads_end">Endpunkt</resource> <resource name="editor_arrowheads_end">Endpunkt</resource>
<resource name="editor_arrowheads_none">Keine</resource> <resource name="editor_arrowheads_none">Keine</resource>
<resource name="editor_arrowheads_start">Anfangspunkt</resource> <resource name="editor_arrowheads_start">Anfangspunkt</resource>
<resource name="editor_autocrop">Automatisch zuschneiden</resource> <resource name="editor_autocrop">Automatisch zuschneiden</resource>
<resource name="editor_backcolor">Hintergrundfarbe (0-9)</resource> <resource name="editor_autocrop_not_possible">Automatisches Zuschneiden nicht möglich</resource>
<resource name="editor_backcolor">Hintergrundfarbe (0-9)</resource>
<resource name="editor_blur_radius">Weichzeichner-Radius</resource> <resource name="editor_blur_radius">Weichzeichner-Radius</resource>
<resource name="editor_bold">Fett</resource> <resource name="editor_bold">Fett</resource>
<resource name="editor_border">Rand</resource> <resource name="editor_border">Rand</resource>
@ -91,7 +92,12 @@ schnell zu finden. Vielen Dank :)</resource>
<resource name="editor_copyimagetoclipboard">Grafik in die Zwischenablage kopieren</resource> <resource name="editor_copyimagetoclipboard">Grafik in die Zwischenablage kopieren</resource>
<resource name="editor_copypathtoclipboard">Pfad in Zwischenablage kopieren</resource> <resource name="editor_copypathtoclipboard">Pfad in Zwischenablage kopieren</resource>
<resource name="editor_copytoclipboard">Kopieren</resource> <resource name="editor_copytoclipboard">Kopieren</resource>
<resource name="editor_crop">Zuschneiden (C)</resource> <resource name="editor_crop">Zuschneiden (C)</resource>
<resource name="editor_crop_mode">Zuschneiden - Modus</resource>
<resource name="editor_cropmode_default">Zuschneiden</resource>
<resource name="editor_cropmode_vertical">Vertikal ausschneiden</resource>
<resource name="editor_cropmode_horizontal">Horizontal ausschneiden</resource>
<resource name="editor_cropmode_auto">Automatisch zuschneiden</resource>
<resource name="editor_cursortool">Auswahlwerkzeug (Esc)</resource> <resource name="editor_cursortool">Auswahlwerkzeug (Esc)</resource>
<resource name="editor_cuttoclipboard">Ausschneiden</resource> <resource name="editor_cuttoclipboard">Ausschneiden</resource>
<resource name="editor_deleteelement">Gewähltes Element löschen</resource> <resource name="editor_deleteelement">Gewähltes Element löschen</resource>

View file

@ -78,6 +78,7 @@ Also, we would highly appreciate if you checked whether a tracker item already e
<resource name="editor_arrowheads_none">None</resource> <resource name="editor_arrowheads_none">None</resource>
<resource name="editor_arrowheads_start">Start point</resource> <resource name="editor_arrowheads_start">Start point</resource>
<resource name="editor_autocrop">Auto crop</resource> <resource name="editor_autocrop">Auto crop</resource>
<resource name="editor_autocrop_not_possible">Auto crop not possible</resource>
<resource name="editor_backcolor">Fill color (0-9)</resource> <resource name="editor_backcolor">Fill color (0-9)</resource>
<resource name="editor_blur_radius">Blur radius</resource> <resource name="editor_blur_radius">Blur radius</resource>
<resource name="editor_bold">Bold</resource> <resource name="editor_bold">Bold</resource>
@ -93,6 +94,11 @@ Also, we would highly appreciate if you checked whether a tracker item already e
<resource name="editor_copypathtoclipboard">Copy path to clipboard</resource> <resource name="editor_copypathtoclipboard">Copy path to clipboard</resource>
<resource name="editor_copytoclipboard">Copy</resource> <resource name="editor_copytoclipboard">Copy</resource>
<resource name="editor_crop">Crop (C)</resource> <resource name="editor_crop">Crop (C)</resource>
<resource name="editor_crop_mode">Crop mode</resource>
<resource name="editor_cropmode_default">Crop</resource>
<resource name="editor_cropmode_vertical">Crop out vertically</resource>
<resource name="editor_cropmode_horizontal">Crop out horizontally</resource>
<resource name="editor_cropmode_auto">Auto crop</resource>
<resource name="editor_cursortool">Selection Tool (ESC)</resource> <resource name="editor_cursortool">Selection Tool (ESC)</resource>
<resource name="editor_cuttoclipboard">Cut</resource> <resource name="editor_cuttoclipboard">Cut</resource>
<resource name="editor_deleteelement">Delete</resource> <resource name="editor_deleteelement">Delete</resource>