diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/AbstractBindingConverter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/AbstractBindingConverter.cs index 4425a9fd1..8e14bb652 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/AbstractBindingConverter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/AbstractBindingConverter.cs @@ -40,7 +40,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding { return Convert((T2) o); } - throw new ArgumentException("Cannot handle argument of type " + o.GetType()); + throw new ArgumentException($"{GetType()} cannot handle argument of type {o.GetType()}"); } protected abstract T2 Convert(T1 o); diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/BidirectionalBinding.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/BidirectionalBinding.cs index b98979873..a075c90ed 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/BidirectionalBinding.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/BidirectionalBinding.cs @@ -153,7 +153,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding { throw new MemberAccessException( "Could not set property '" + targetProperty + "' to '" + bValue + "' [" + (bValue?.GetType().Name ?? "") + "] on " + targetObject + - ". Probably other type than expected, IBindingCoverter to the rescue.", e); + ". Probably other type than expected, IBindingConverter to the rescue.", e); } } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs index 5ac788ae9..ea9cf0473 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs @@ -30,7 +30,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields { public static readonly IFieldType ARROWHEADS = new FieldType("ARROWHEADS"); public static readonly IFieldType BLUR_RADIUS = new FieldType("BLUR_RADIUS"); - public static readonly IFieldType BRIGHTNESS = new FieldType("BRIGHTNESS"); + public static readonly IFieldType BRIGHTNESS = new FieldType("BRIGHTNESS"); public static readonly IFieldType FILL_COLOR = new FieldType("FILL_COLOR"); public static readonly IFieldType FONT_BOLD = new FieldType("FONT_BOLD"); public static readonly IFieldType FONT_FAMILY = new FieldType("FONT_FAMILY"); @@ -43,7 +43,6 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields public static readonly IFieldType LINE_THICKNESS = new FieldType("LINE_THICKNESS"); public static readonly IFieldType MAGNIFICATION_FACTOR = new FieldType("MAGNIFICATION_FACTOR"); public static readonly IFieldType PIXEL_SIZE = new FieldType("PIXEL_SIZE"); - public static readonly IFieldType PREVIEW_QUALITY = new FieldType("PREVIEW_QUALITY"); public static readonly IFieldType SHADOW = new FieldType("SHADOW"); public static readonly IFieldType PREPARED_FILTER_OBFUSCATE = new FieldType("PREPARED_FILTER_OBFUSCATE"); public static readonly IFieldType PREPARED_FILTER_HIGHLIGHT = new FieldType("PREPARED_FILTER_HIGHLIGHT"); @@ -51,7 +50,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields 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, LINE_COLOR, LINE_THICKNESS, MAGNIFICATION_FACTOR, PIXEL_SIZE, PREVIEW_QUALITY, SHADOW, PREPARED_FILTER_OBFUSCATE, PREPARED_FILTER_HIGHLIGHT, FLAGS + 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, SHADOW, PREPARED_FILTER_OBFUSCATE, PREPARED_FILTER_HIGHLIGHT, FLAGS }; } } \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/BlurFilter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/BlurFilter.cs index ac1e666e1..1848baf99 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/BlurFilter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/BlurFilter.cs @@ -35,7 +35,6 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Filters public BlurFilter(DrawableContainer parent, IEditorConfiguration editorConfiguration) : base(parent, editorConfiguration) { AddField(GetType(), FieldTypes.BLUR_RADIUS, 3); - AddField(GetType(), FieldTypes.PREVIEW_QUALITY, 1.0d); } public double PreviewQuality diff --git a/src/Greenshot.Addon.LegacyEditor/EditorConfigurationExtensions.cs b/src/Greenshot.Addon.LegacyEditor/EditorConfigurationExtensions.cs index f83d074d0..6a2465b04 100644 --- a/src/Greenshot.Addon.LegacyEditor/EditorConfigurationExtensions.cs +++ b/src/Greenshot.Addon.LegacyEditor/EditorConfigurationExtensions.cs @@ -20,6 +20,7 @@ using System; using System.Collections.Generic; using System.Drawing; +using System.Globalization; using Dapplo.Windows.Common.Structs; using Dapplo.Windows.User32.Enums; using Dapplo.Windows.User32.Structs; @@ -79,7 +80,7 @@ namespace Greenshot.Addon.LegacyEditor fieldValue = Color.FromArgb(Convert.ToInt32(preferredValue)); } break; - case var allignType when fieldType.ValueType == typeof(StringAlignment): + case var alignType when fieldType.ValueType == typeof(StringAlignment): fieldValue = Enum.Parse(typeof(StringAlignment), preferredStringValue, true); break; case var fieldFlagType when fieldType.ValueType == typeof(FieldFlag): @@ -91,6 +92,12 @@ namespace Greenshot.Addon.LegacyEditor case var arrowHeadCombinationType when fieldType.ValueType == typeof(ArrowContainer.ArrowHeadCombination): fieldValue = Enum.Parse(typeof(ArrowContainer.ArrowHeadCombination), preferredStringValue, true); break; + case var floatType when fieldType.ValueType == typeof(float): + fieldValue = Convert.ToSingle(preferredValue, CultureInfo.InvariantCulture); + break; + case var doubleType when fieldType.ValueType == typeof(double): + fieldValue = Convert.ToDouble(preferredValue, CultureInfo.InvariantCulture); + break; default: fieldValue = preferredStringValue; break; diff --git a/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.Designer.cs b/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.Designer.cs index 7fa977f5e..e65fa54eb 100644 --- a/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.Designer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.Designer.cs @@ -172,8 +172,6 @@ namespace Greenshot.Addon.LegacyEditor.Forms { this.blurRadiusUpDown = new ToolStripNumericUpDown(); this.brightnessLabel = new GreenshotToolStripLabel(); this.brightnessUpDown = new ToolStripNumericUpDown(); - this.previewQualityLabel = new GreenshotToolStripLabel(); - this.previewQualityUpDown = new ToolStripNumericUpDown(); this.magnificationFactorLabel = new GreenshotToolStripLabel(); this.magnificationFactorUpDown = new ToolStripNumericUpDown(); this.pixelSizeLabel = new GreenshotToolStripLabel(); @@ -1001,8 +999,6 @@ namespace Greenshot.Addon.LegacyEditor.Forms { this.blurRadiusUpDown, this.brightnessLabel, this.brightnessUpDown, - this.previewQualityLabel, - this.previewQualityUpDown, this.magnificationFactorLabel, this.magnificationFactorUpDown, this.pixelSizeLabel, @@ -1312,40 +1308,6 @@ namespace Greenshot.Addon.LegacyEditor.Forms { this.brightnessUpDown.GotFocus += new System.EventHandler(this.ToolBarFocusableElementGotFocus); this.brightnessUpDown.LostFocus += new System.EventHandler(this.ToolBarFocusableElementLostFocus); // - // previewQualityLabel - // - this.previewQualityLabel.LanguageKey = "editor.editor_preview_quality"; - this.previewQualityLabel.Name = "previewQualityLabel"; - this.previewQualityLabel.Text = "Preview quality"; - // - // previewQualityUpDown - // - this.previewQualityUpDown.DecimalPlaces = 0; - this.previewQualityUpDown.Increment = new decimal(new int[] { - 10, - 0, - 0, - 0}); - this.previewQualityUpDown.Maximum = new decimal(new int[] { - 100, - 0, - 0, - 0}); - this.previewQualityUpDown.Minimum = new decimal(new int[] { - 10, - 0, - 0, - 0}); - this.previewQualityUpDown.Name = "previewQualityUpDown"; - this.previewQualityUpDown.Text = "50"; - this.previewQualityUpDown.Value = new decimal(new int[] { - 50, - 0, - 0, - 0}); - this.previewQualityUpDown.GotFocus += new System.EventHandler(this.ToolBarFocusableElementGotFocus); - this.previewQualityUpDown.LostFocus += new System.EventHandler(this.ToolBarFocusableElementLostFocus); - // // magnificationFactorLabel // this.magnificationFactorLabel.LanguageKey = "editor.editor_magnification_factor"; @@ -1638,8 +1600,6 @@ namespace Greenshot.Addon.LegacyEditor.Forms { private GreenshotToolStripLabel pixelSizeLabel; private ToolStripNumericUpDown magnificationFactorUpDown; private GreenshotToolStripLabel magnificationFactorLabel; - private ToolStripNumericUpDown previewQualityUpDown; - private GreenshotToolStripLabel previewQualityLabel; private ToolStripNumericUpDown blurRadiusUpDown; private GreenshotToolStripLabel blurRadiusLabel; private ToolStripEx propertiesToolStrip; diff --git a/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs b/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs index db8c5794f..984fcae5f 100644 --- a/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs +++ b/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs @@ -676,7 +676,6 @@ namespace Greenshot.Addon.LegacyEditor.Forms new BidirectionalBinding(textHorizontalAlignmentButton, "SelectedTag", _surface.FieldAggregator.GetField(FieldTypes.TEXT_HORIZONTAL_ALIGNMENT), "Value",NotNullValidator.GetInstance()), new BidirectionalBinding(textVerticalAlignmentButton, "SelectedTag", _surface.FieldAggregator.GetField(FieldTypes.TEXT_VERTICAL_ALIGNMENT), "Value",NotNullValidator.GetInstance()), new BidirectionalBinding(shadowButton, "Checked", _surface.FieldAggregator.GetField(FieldTypes.SHADOW), "Value", NotNullValidator.GetInstance()), - new BidirectionalBinding(previewQualityUpDown, "Value", _surface.FieldAggregator.GetField(FieldTypes.PREVIEW_QUALITY), "Value",DecimalDoublePercentageConverter.GetInstance(), NotNullValidator.GetInstance()), new BidirectionalBinding(obfuscateModeButton, "SelectedTag", _surface.FieldAggregator.GetField(FieldTypes.PREPARED_FILTER_OBFUSCATE), "Value"), new BidirectionalBinding(highlightModeButton, "SelectedTag", _surface.FieldAggregator.GetField(FieldTypes.PREPARED_FILTER_HIGHLIGHT), "Value"), new BidirectionalBinding(counterUpDown, "Value", _surface, "CounterStart", DecimalIntConverter.GetInstance(), NotNullValidator.GetInstance()) @@ -696,7 +695,6 @@ namespace Greenshot.Addon.LegacyEditor.Forms btnLineColor.Visible = props.HasFieldValue(FieldTypes.LINE_COLOR); lineThicknessLabel.Visible = lineThicknessUpDown.Visible = props.HasFieldValue(FieldTypes.LINE_THICKNESS); blurRadiusLabel.Visible = blurRadiusUpDown.Visible = props.HasFieldValue(FieldTypes.BLUR_RADIUS); - previewQualityLabel.Visible = previewQualityUpDown.Visible = props.HasFieldValue(FieldTypes.PREVIEW_QUALITY); magnificationFactorLabel.Visible = magnificationFactorUpDown.Visible = props.HasFieldValue(FieldTypes.MAGNIFICATION_FACTOR); pixelSizeLabel.Visible = pixelSizeUpDown.Visible = props.HasFieldValue(FieldTypes.PIXEL_SIZE); brightnessLabel.Visible = brightnessUpDown.Visible = props.HasFieldValue(FieldTypes.BRIGHTNESS);