From f1642f3014ae1c846d8e09cc344b05afb7ec03d7 Mon Sep 17 00:00:00 2001 From: RKrom Date: Tue, 17 Jun 2014 13:09:01 +0200 Subject: [PATCH] Changed dynamic destination handling, children are only created for the dynamic destinations and not the "parent". e.g. there is an outlook entry, which has children for all the open emails, but not for outlook itself. As this was already in the menu on the main level, there is no need to repeat this. --- .../additional_files/readme.txt.template | 2 ++ GreenshotPlugin/Core/AbstractDestination.cs | 23 +++---------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/Greenshot/releases/additional_files/readme.txt.template b/Greenshot/releases/additional_files/readme.txt.template index 469c391ea..cac8301f7 100644 --- a/Greenshot/releases/additional_files/readme.txt.template +++ b/Greenshot/releases/additional_files/readme.txt.template @@ -19,6 +19,8 @@ Bugs resolved: * Bug #1610: Image editor: 'Obfuscate' and 'Highlight' and more, now should rotate / resize correctly. * Bug #1619: Image editor: Autocrop now also considers the elements. +Changes: +* We cleaned up the dynamic destination context-menu: if an entry (e.g export to the editor) has child items (export to open editors) the parent is still selectable, we also no longer repeat the parent in the children. 1.1.9.13-g01ce82d Windows 8.1 & Box bug-fix Release diff --git a/GreenshotPlugin/Core/AbstractDestination.cs b/GreenshotPlugin/Core/AbstractDestination.cs index f15f1f00a..f518689d7 100644 --- a/GreenshotPlugin/Core/AbstractDestination.cs +++ b/GreenshotPlugin/Core/AbstractDestination.cs @@ -307,6 +307,9 @@ namespace GreenshotPlugin.Core { basisMenuItem.Tag = this; basisMenuItem.Text = Description; AddTagEvents(basisMenuItem, menu, Description); + basisMenuItem.Click -= destinationClickHandler; + basisMenuItem.Click += destinationClickHandler; + if (isDynamic && addDynamics) { basisMenuItem.DropDownOpening += delegate(object source, EventArgs eventArgs) { if (basisMenuItem.DropDownItems.Count == 0) { @@ -322,18 +325,6 @@ namespace GreenshotPlugin.Core { ToolStripMenuItem destinationMenuItem = null; - if (!useDynamicsOnly) { - destinationMenuItem = new ToolStripMenuItem(Description); - destinationMenuItem.Tag = this; - destinationMenuItem.Image = DisplayIcon; - destinationMenuItem.Click += destinationClickHandler; - AddTagEvents(destinationMenuItem, menu, Description); - - basisMenuItem.DropDownItems.Add(destinationMenuItem); - // invoke the "main" subdestination when clicking its parent - basisMenuItem.Click -= destinationClickHandler; - basisMenuItem.Click += destinationClickHandler; - } if (useDynamicsOnly && subDestinations.Count == 1) { basisMenuItem.Tag = subDestinations[0]; basisMenuItem.Text = subDestinations[0].Description; @@ -349,17 +340,9 @@ namespace GreenshotPlugin.Core { basisMenuItem.DropDownItems.Add(destinationMenuItem); } } - } else { - // Setting base "click" only if there are no sub-destinations - - // Make sure any previous handler is removed, otherwise it would be added multiple times! - basisMenuItem.Click -= destinationClickHandler; - basisMenuItem.Click += destinationClickHandler; } } }; - } else { - basisMenuItem.Click += destinationClickHandler; } return basisMenuItem;