Bugfix: Moving event subscriptions to Initialize()

This commit is contained in:
Christian Schulz 2022-03-17 20:23:17 +01:00
commit 14d90fc804
2 changed files with 8 additions and 12 deletions

View file

@ -1090,6 +1090,7 @@ namespace Greenshot.Editor.Forms {
this.obfuscateModeButton.SelectedTag = FilterContainer.PreparedFilter.BLUR; this.obfuscateModeButton.SelectedTag = FilterContainer.PreparedFilter.BLUR;
this.obfuscateModeButton.Tag = FilterContainer.PreparedFilter.BLUR; this.obfuscateModeButton.Tag = FilterContainer.PreparedFilter.BLUR;
// //
this.obfuscateModeButton.DropDownItemClicked += FilterPresetDropDownItemClicked;
// pixelizeToolStripMenuItem // pixelizeToolStripMenuItem
// //
this.pixelizeToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("pixelizeToolStripMenuItem.Image"))); this.pixelizeToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("pixelizeToolStripMenuItem.Image")));
@ -1115,12 +1116,11 @@ namespace Greenshot.Editor.Forms {
this.autoCropModeToolStripMenuItem}); this.autoCropModeToolStripMenuItem});
this.cropModeButton.Image = ((System.Drawing.Image)(resources.GetObject("btnCrop.Image"))); this.cropModeButton.Image = ((System.Drawing.Image)(resources.GetObject("btnCrop.Image")));
this.cropModeButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.cropModeButton.ImageTransparentColor = System.Drawing.Color.Magenta;
//TODO translate
this.cropModeButton.LanguageKey = "editor_crop_mode"; this.cropModeButton.LanguageKey = "editor_crop_mode";
this.cropModeButton.Name = "cropModeButton"; this.cropModeButton.Name = "cropModeButton";
this.cropModeButton.SelectedTag = CropContainer.CropModes.Default; this.cropModeButton.SelectedTag = CropContainer.CropModes.Default;
this.cropModeButton.Tag = CropContainer.CropModes.Default; this.cropModeButton.Tag = CropContainer.CropModes.Default;
this.cropModeButton.DropDownItemClicked += CropStyleDropDownItemClicked;
// //
// defaultCropStyleToolStripMenuItem // defaultCropStyleToolStripMenuItem
// //
@ -1146,7 +1146,7 @@ namespace Greenshot.Editor.Forms {
this.horizontalCropModeToolStripMenuItem.Tag = CropContainer.CropModes.Horizontal; this.horizontalCropModeToolStripMenuItem.Tag = CropContainer.CropModes.Horizontal;
// //
// horizontalCropStyleToolStripMenuItem // autoCropModeToolStripMenuItem
// //
this.autoCropModeToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("AutoCrop.Image"))); this.autoCropModeToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("AutoCrop.Image")));
this.autoCropModeToolStripMenuItem.LanguageKey = "editor_cropmode_auto"; this.autoCropModeToolStripMenuItem.LanguageKey = "editor_cropmode_auto";
@ -1168,6 +1168,7 @@ namespace Greenshot.Editor.Forms {
this.highlightModeButton.Name = "highlightModeButton"; this.highlightModeButton.Name = "highlightModeButton";
this.highlightModeButton.SelectedTag = FilterContainer.PreparedFilter.TEXT_HIGHTLIGHT; this.highlightModeButton.SelectedTag = FilterContainer.PreparedFilter.TEXT_HIGHTLIGHT;
this.highlightModeButton.Tag = FilterContainer.PreparedFilter.TEXT_HIGHTLIGHT; this.highlightModeButton.Tag = FilterContainer.PreparedFilter.TEXT_HIGHTLIGHT;
this.highlightModeButton.DropDownItemClicked += FilterPresetDropDownItemClicked;
// //
// textHighlightMenuItem // textHighlightMenuItem
// //
@ -1275,6 +1276,7 @@ namespace Greenshot.Editor.Forms {
this.fontFamilyComboBox.Padding = new System.Windows.Forms.Padding(2,0,0,2); this.fontFamilyComboBox.Padding = new System.Windows.Forms.Padding(2,0,0,2);
this.fontFamilyComboBox.GotFocus += new System.EventHandler(this.ToolBarFocusableElementGotFocus); this.fontFamilyComboBox.GotFocus += new System.EventHandler(this.ToolBarFocusableElementGotFocus);
this.fontFamilyComboBox.LostFocus += new System.EventHandler(this.ToolBarFocusableElementLostFocus); this.fontFamilyComboBox.LostFocus += new System.EventHandler(this.ToolBarFocusableElementLostFocus);
this.fontFamilyComboBox.PropertyChanged += FontPropertyChanged;
// //
// fontSizeLabel // fontSizeLabel
// //

View file

@ -182,6 +182,9 @@ namespace Greenshot.Editor.Forms
UpdateUi(); 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 // Use best fit, for those capture modes where we can get huge images
bool useBestFit = _surface.CaptureDetails.CaptureMode switch 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) // a smaller size than the initial panel size (as set by the forms designer)
panel1.Height = 10; panel1.Height = 10;
fontFamilyComboBox.PropertyChanged += FontPropertyChanged;
obfuscateModeButton.DropDownItemClicked += FilterPresetDropDownItemClicked;
highlightModeButton.DropDownItemClicked += FilterPresetDropDownItemClicked;
cropModeButton.DropDownItemClicked += CropStyleDropDownItemClicked;
_toolbarButtons = new[] _toolbarButtons = new[]
{ {
btnCursor, btnRect, btnEllipse, btnText, btnLine, btnArrow, btnFreehand, btnHighlight, btnObfuscate, btnCrop, btnStepLabel, btnSpeechBubble 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; 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 // Make sure the value is set correctly when starting
if (Surface != null) if (Surface != null)
{ {