mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 10:47:02 -07:00
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:
parent
8588fbd510
commit
f1642f3014
2 changed files with 5 additions and 20 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue