This change should make the UI Icon Size setting dynamic, clearing all cached icons when the size changes (in the settings UI) so if they have a dynamic size the best is selected.

This commit is contained in:
RKrom 2014-11-11 13:23:59 +01:00
parent c50e5fa5ab
commit 61c2921b2a
16 changed files with 140 additions and 123 deletions

View file

@ -170,7 +170,6 @@ namespace GreenshotPlugin.Core {
private static Dictionary<string, List<string>> classnameTree = new Dictionary<string, List<string>>();
private static CoreConfiguration conf = IniConfig.GetIniSection<CoreConfiguration>();
private static List<IntPtr> ignoreHandles = new List<IntPtr>();
private static Dictionary<string, Image> iconCache = new Dictionary<string, Image>();
private static List<string> excludeProcessesFromFreeze = new List<string>();
private static IAppVisibility appVisibility = null;
@ -204,7 +203,6 @@ namespace GreenshotPlugin.Core {
}
}
public bool isGutter {
get {
return METRO_GUTTER_CLASS.Equals(ClassName);
@ -307,17 +305,7 @@ namespace GreenshotPlugin.Core {
return null;
}
try {
string filename = ProcessPath;
if (!iconCache.ContainsKey(filename)) {
Image icon = null;
using (Icon appIcon = Shell32.ExtractAssociatedIcon(filename)) {
if (appIcon != null) {
icon = appIcon.ToBitmap();
}
}
iconCache.Add(filename, icon);
}
return iconCache[filename];
return PluginUtils.GetCachedExeIcon(ProcessPath, 0);
} catch (Exception ex) {
LOG.WarnFormat("Couldn't get icon for window {0} due to: {1}", Text, ex.Message);
LOG.Warn(ex);