Fixed Context-Menu issues with the sub-menu arriving on the second screen, this is only a work-around (cutting the string to max 25 characters). Also added an icon for the "capture IE from list", as this might have different applications available.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2430 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2013-01-15 15:56:16 +00:00
commit f7c73932f2
2 changed files with 27 additions and 10 deletions

View file

@ -677,13 +677,21 @@ namespace Greenshot {
Dictionary<WindowDetails, int> counter = new Dictionary<WindowDetails, int>();
foreach(KeyValuePair<WindowDetails, string> tabData in tabs) {
ToolStripMenuItem captureIETabItem = new ToolStripMenuItem(tabData.Value);
string title = tabData.Value;
if (title == null) {
continue;
}
if (title.Length > conf.MaxMenuItemLength) {
title = title.Substring(0, Math.Min(title.Length, conf.MaxMenuItemLength));
}
ToolStripItem captureIETabItem = contextmenu_captureiefromlist.DropDownItems.Add(title);
int index;
if (counter.ContainsKey(tabData.Key)) {
index = counter[tabData.Key];
} else {
index = 0;
}
captureIETabItem.Image = tabData.Key.DisplayIcon;
captureIETabItem.Tag = new KeyValuePair<WindowDetails, int>(tabData.Key, index++);
captureIETabItem.Click += new System.EventHandler(Contextmenu_captureiefromlist_Click);
this.contextmenu_captureiefromlist.DropDownItems.Add(captureIETabItem);
@ -809,7 +817,13 @@ namespace Greenshot {
List<WindowDetails> windows = WindowDetails.GetTopLevelWindows();
foreach(WindowDetails window in windows) {
ToolStripMenuItem captureWindowItem = new ToolStripMenuItem(window.Text);
string title = window.Text;
if (title != null) {
if (title.Length > conf.MaxMenuItemLength) {
title = title.Substring(0, Math.Min(title.Length, conf.MaxMenuItemLength));
}
ToolStripItem captureWindowItem = menuItem.DropDownItems.Add(title);
captureWindowItem.Tag = window;
captureWindowItem.Image = window.DisplayIcon;
captureWindowItem.Click += new System.EventHandler(eventHandler);
@ -818,7 +832,7 @@ namespace Greenshot {
captureWindowItem.MouseEnter += new System.EventHandler(ShowThumbnailOnEnter);
captureWindowItem.MouseLeave += new System.EventHandler(HideThumbnailOnLeave);
}
menuItem.DropDownItems.Add(captureWindowItem);
}
}
}

View file

@ -219,6 +219,9 @@ namespace GreenshotPlugin.Core {
[IniProperty("ZoomerEnabled", Description = "Sets if the zoomer is enabled", DefaultValue = "True")]
public bool ZoomerEnabled;
[IniProperty("MaxMenuItemLength", Description = "Maximum length of submenu items in the context menu, making this longer might cause context menu issues on dual screen systems.", DefaultValue = "25")]
public int MaxMenuItemLength;
// Specifies what THIS build is
public BuildStates BuildState = BuildStates.UNSTABLE;