From 14d90fc804f47fb8998933e5c10e72615582bb37 Mon Sep 17 00:00:00 2001 From: Christian Schulz Date: Thu, 17 Mar 2022 20:23:17 +0100 Subject: [PATCH] Bugfix: Moving event subscriptions to Initialize() --- .../Forms/ImageEditorForm.Designer.cs | 8 +++++--- src/Greenshot.Editor/Forms/ImageEditorForm.cs | 12 +++--------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Greenshot.Editor/Forms/ImageEditorForm.Designer.cs b/src/Greenshot.Editor/Forms/ImageEditorForm.Designer.cs index 8d8162fd9..90f62493e 100644 --- a/src/Greenshot.Editor/Forms/ImageEditorForm.Designer.cs +++ b/src/Greenshot.Editor/Forms/ImageEditorForm.Designer.cs @@ -1090,6 +1090,7 @@ namespace Greenshot.Editor.Forms { this.obfuscateModeButton.SelectedTag = FilterContainer.PreparedFilter.BLUR; this.obfuscateModeButton.Tag = FilterContainer.PreparedFilter.BLUR; // + this.obfuscateModeButton.DropDownItemClicked += FilterPresetDropDownItemClicked; // pixelizeToolStripMenuItem // this.pixelizeToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("pixelizeToolStripMenuItem.Image"))); @@ -1115,12 +1116,11 @@ namespace Greenshot.Editor.Forms { 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.CropModes.Default; this.cropModeButton.Tag = CropContainer.CropModes.Default; - + this.cropModeButton.DropDownItemClicked += CropStyleDropDownItemClicked; // // defaultCropStyleToolStripMenuItem // @@ -1146,7 +1146,7 @@ namespace Greenshot.Editor.Forms { this.horizontalCropModeToolStripMenuItem.Tag = CropContainer.CropModes.Horizontal; // - // horizontalCropStyleToolStripMenuItem + // autoCropModeToolStripMenuItem // this.autoCropModeToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("AutoCrop.Image"))); this.autoCropModeToolStripMenuItem.LanguageKey = "editor_cropmode_auto"; @@ -1168,6 +1168,7 @@ namespace Greenshot.Editor.Forms { this.highlightModeButton.Name = "highlightModeButton"; this.highlightModeButton.SelectedTag = FilterContainer.PreparedFilter.TEXT_HIGHTLIGHT; this.highlightModeButton.Tag = FilterContainer.PreparedFilter.TEXT_HIGHTLIGHT; + this.highlightModeButton.DropDownItemClicked += FilterPresetDropDownItemClicked; // // textHighlightMenuItem // @@ -1275,6 +1276,7 @@ namespace Greenshot.Editor.Forms { this.fontFamilyComboBox.Padding = new System.Windows.Forms.Padding(2,0,0,2); this.fontFamilyComboBox.GotFocus += new System.EventHandler(this.ToolBarFocusableElementGotFocus); this.fontFamilyComboBox.LostFocus += new System.EventHandler(this.ToolBarFocusableElementLostFocus); + this.fontFamilyComboBox.PropertyChanged += FontPropertyChanged; // // fontSizeLabel // diff --git a/src/Greenshot.Editor/Forms/ImageEditorForm.cs b/src/Greenshot.Editor/Forms/ImageEditorForm.cs index c99d8bd43..98a12a204 100644 --- a/src/Greenshot.Editor/Forms/ImageEditorForm.cs +++ b/src/Greenshot.Editor/Forms/ImageEditorForm.cs @@ -182,6 +182,9 @@ namespace Greenshot.Editor.Forms UpdateUi(); + // Workaround: for the MouseWheel event which doesn't get to the panel + MouseWheel += PanelMouseWheel; + // Use best fit, for those capture modes where we can get huge images bool useBestFit = _surface.CaptureDetails.CaptureMode switch { @@ -281,12 +284,6 @@ namespace Greenshot.Editor.Forms // a smaller size than the initial panel size (as set by the forms designer) panel1.Height = 10; - fontFamilyComboBox.PropertyChanged += FontPropertyChanged; - - obfuscateModeButton.DropDownItemClicked += FilterPresetDropDownItemClicked; - highlightModeButton.DropDownItemClicked += FilterPresetDropDownItemClicked; - cropModeButton.DropDownItemClicked += CropStyleDropDownItemClicked; - _toolbarButtons = new[] { btnCursor, btnRect, btnEllipse, btnText, btnLine, btnArrow, btnFreehand, btnHighlight, btnObfuscate, btnCrop, btnStepLabel, btnSpeechBubble @@ -295,9 +292,6 @@ namespace Greenshot.Editor.Forms pluginToolStripMenuItem.Visible = pluginToolStripMenuItem.DropDownItems.Count > 0; - // Workaround: for the MouseWheel event which doesn't get to the panel - MouseWheel += PanelMouseWheel; - // Make sure the value is set correctly when starting if (Surface != null) {