Tweaking the IE capturing to only consider IE windows and special configured windows. This should speed up the process of getting the available IE's and cause less confusion.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2049 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-09-18 07:16:39 +00:00
parent ef4b1344e5
commit 45e018d197
4 changed files with 11 additions and 7 deletions

View file

@ -653,7 +653,7 @@ namespace Greenshot {
return;
}
try {
List<KeyValuePair<WindowDetails, string>> tabs = IECaptureHelper.GetTabList();
List<KeyValuePair<WindowDetails, string>> tabs = IECaptureHelper.GetBrowserTabs();
this.contextmenu_captureiefromlist.DropDownItems.Clear();
if (tabs.Count > 0) {
this.contextmenu_captureie.Enabled = true;

View file

@ -688,8 +688,7 @@ namespace Greenshot.Helpers {
// 2) Is Windows >= Vista & DWM enabled: use DWM
// 3) Otherwise use GDI (Screen might be also okay but might lose content)
if (isAutoMode) {
// TODO: Decided if this is smart, although we do consider a part of the window...
if (conf.IECapture && IECaptureHelper.IsMostlyIEWindow(windowToCapture, 75)) {
if (conf.IECapture && IECaptureHelper.IsIEWindow(windowToCapture)) {
try {
ICapture ieCapture = IECaptureHelper.CaptureIE(captureForWindow, windowToCapture);
if (ieCapture != null) {

View file

@ -87,7 +87,10 @@ namespace Greenshot.Helpers {
if ("IEFrame".Equals(someWindow.ClassName)) {
return true;
}
return someWindow.GetChild("Internet Explorer_Server") != null;
if (configuration.WindowClassesToCheckForIE != null && configuration.WindowClassesToCheckForIE.Contains(someWindow.ClassName)) {
return someWindow.GetChild("Internet Explorer_Server") != null;
}
return false;
}
/// <summary>
@ -120,10 +123,10 @@ namespace Greenshot.Helpers {
}
/// <summary>
/// Gets a list of all IE Windows with the captions of the open tabs
/// Gets a list of all IE Windows & tabs with the captions of the instances
/// </summary>
/// <returns>List<KeyValuePair<WindowDetails, string>></returns>
public static List<KeyValuePair<WindowDetails, string>> GetTabList() {
public static List<KeyValuePair<WindowDetails, string>> GetBrowserTabs() {
List<IntPtr> ieHandleList = new List<IntPtr>();
Dictionary<WindowDetails, List<string>> browserWindows = new Dictionary<WindowDetails, List<string>>();
@ -137,7 +140,7 @@ namespace Greenshot.Helpers {
Accessible accessible = new Accessible(directUIWD.Handle);
browserWindows.Add(ieWindow, accessible.IETabCaptions);
}
} else {
} else if (configuration.WindowClassesToCheckForIE != null && configuration.WindowClassesToCheckForIE.Contains(ieWindow.ClassName)) {
List<string> singleWindowText = new List<string>();
try {
IHTMLDocument2 document2 = getHTMLDocument(ieWindow);

View file

@ -152,6 +152,8 @@ namespace GreenshotPlugin.Core {
public bool IECapture;
[IniProperty("IEFieldCapture", Description="Enable/disable IE field capture, very slow but will make it possible to annotate the fields of a capture in the editor.", DefaultValue="False")]
public bool IEFieldCapture;
[IniProperty("WindowClassesToCheckForIE", Description = "Comma separated list of Window-Classes which need to be checked for a IE instance!", DefaultValue = "AfxFrameOrView70,IMWindowClass")]
public List<string> WindowClassesToCheckForIE;
[IniProperty("AutoCropDifference", Description="Sets how to compare the colors for the autocrop detection, the higher the more is 'selected'. Possible values are from 0 to 255, where everything above ~150 doesn't make much sense!", DefaultValue="10")]
public int AutoCropDifference;