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.

This commit is contained in:
RKrom 2014-06-17 13:09:01 +02:00
commit f1642f3014
2 changed files with 5 additions and 20 deletions

View file

@ -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

View file

@ -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;