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; return;
} }
try { try {
List<KeyValuePair<WindowDetails, string>> tabs = IECaptureHelper.GetTabList(); List<KeyValuePair<WindowDetails, string>> tabs = IECaptureHelper.GetBrowserTabs();
this.contextmenu_captureiefromlist.DropDownItems.Clear(); this.contextmenu_captureiefromlist.DropDownItems.Clear();
if (tabs.Count > 0) { if (tabs.Count > 0) {
this.contextmenu_captureie.Enabled = true; this.contextmenu_captureie.Enabled = true;

View file

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

View file

@ -87,8 +87,11 @@ namespace Greenshot.Helpers {
if ("IEFrame".Equals(someWindow.ClassName)) { if ("IEFrame".Equals(someWindow.ClassName)) {
return true; return true;
} }
if (configuration.WindowClassesToCheckForIE != null && configuration.WindowClassesToCheckForIE.Contains(someWindow.ClassName)) {
return someWindow.GetChild("Internet Explorer_Server") != null; return someWindow.GetChild("Internet Explorer_Server") != null;
} }
return false;
}
/// <summary> /// <summary>
/// Get Windows displaying an IE /// Get Windows displaying an IE
@ -120,10 +123,10 @@ namespace Greenshot.Helpers {
} }
/// <summary> /// <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> /// </summary>
/// <returns>List<KeyValuePair<WindowDetails, string>></returns> /// <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>(); List<IntPtr> ieHandleList = new List<IntPtr>();
Dictionary<WindowDetails, List<string>> browserWindows = new Dictionary<WindowDetails, List<string>>(); Dictionary<WindowDetails, List<string>> browserWindows = new Dictionary<WindowDetails, List<string>>();
@ -137,7 +140,7 @@ namespace Greenshot.Helpers {
Accessible accessible = new Accessible(directUIWD.Handle); Accessible accessible = new Accessible(directUIWD.Handle);
browserWindows.Add(ieWindow, accessible.IETabCaptions); browserWindows.Add(ieWindow, accessible.IETabCaptions);
} }
} else { } else if (configuration.WindowClassesToCheckForIE != null && configuration.WindowClassesToCheckForIE.Contains(ieWindow.ClassName)) {
List<string> singleWindowText = new List<string>(); List<string> singleWindowText = new List<string>();
try { try {
IHTMLDocument2 document2 = getHTMLDocument(ieWindow); IHTMLDocument2 document2 = getHTMLDocument(ieWindow);

View file

@ -152,6 +152,8 @@ namespace GreenshotPlugin.Core {
public bool IECapture; 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")] [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; 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")] [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; public int AutoCropDifference;