diff --git a/.gitignore b/.gitignore
index fbad72c..7b25809 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
-bin/*
-obj/*
-*.suo
+bin/
+obj/
+*.suo
+*.user
diff --git a/.hgignore b/.hgignore
deleted file mode 100644
index aa6e832..0000000
--- a/.hgignore
+++ /dev/null
@@ -1,3 +0,0 @@
-syntax: glob
-bin/*
-obj/*
diff --git a/preview toy.sln b/EVE-O-Preview.sln
similarity index 69%
rename from preview toy.sln
rename to EVE-O-Preview.sln
index 007fa50..c5d80f3 100644
--- a/preview toy.sln
+++ b/EVE-O-Preview.sln
@@ -1,11 +1,9 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.31101.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "preview toy", "preview toy.csproj", "{6CA62DF3-8589-484C-8BC8-F763CA66BBB1}"
+Microsoft Visual Studio Solution File, Format Version 14.00
+# Visual Studio 2015
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Eve-O-Preview", "Eve-O-Preview\Eve-O-Preview.csproj", "{6CA62DF3-8589-484C-8BC8-F763CA66BBB1}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExeFile", "ExeFile\ExeFile.csproj", "{BE2C3A13-CC19-4525-895F-381DD71C5833}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Eve-O-Mock", "Eve-O-Mock\Eve-O-Mock.csproj", "{BE2C3A13-CC19-4525-895F-381DD71C5833}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/ExeFile/App.config b/Eve-O-Mock/App.config
similarity index 100%
rename from ExeFile/App.config
rename to Eve-O-Mock/App.config
diff --git a/ExeFile/App.xaml b/Eve-O-Mock/App.xaml
similarity index 85%
rename from ExeFile/App.xaml
rename to Eve-O-Mock/App.xaml
index d27e1f5..c963d94 100644
--- a/ExeFile/App.xaml
+++ b/Eve-O-Mock/App.xaml
@@ -1,8 +1,8 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/Eve-O-Mock/App.xaml.cs b/Eve-O-Mock/App.xaml.cs
new file mode 100644
index 0000000..b19c434
--- /dev/null
+++ b/Eve-O-Mock/App.xaml.cs
@@ -0,0 +1,8 @@
+using System.Windows;
+
+namespace EveOMock
+{
+ public partial class App : Application
+ {
+ }
+}
diff --git a/ExeFile/ExeFile.csproj b/Eve-O-Mock/Eve-O-Mock.csproj
similarity index 95%
rename from ExeFile/ExeFile.csproj
rename to Eve-O-Mock/Eve-O-Mock.csproj
index 241071d..6c0f85f 100644
--- a/ExeFile/ExeFile.csproj
+++ b/Eve-O-Mock/Eve-O-Mock.csproj
@@ -1,104 +1,105 @@
-
-
-
-
- Debug
- AnyCPU
- {BE2C3A13-CC19-4525-895F-381DD71C5833}
- WinExe
- Properties
- ExeFile
- ExeFile
- v4.5
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
- 4.0
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
- MainWindow.xaml
- Code
-
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
-
-
-
+
+
+
+
+ Debug
+ AnyCPU
+ {BE2C3A13-CC19-4525-895F-381DD71C5833}
+ WinExe
+ Properties
+ EveOMock
+ ExeFile
+ v4.5
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ App.xaml
+ Code
+
+
+ MainWindow.xaml
+ Code
+
+
+
+
+ Code
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+
+
+ -->
\ No newline at end of file
diff --git a/ExeFile/MainWindow.xaml b/Eve-O-Mock/MainWindow.xaml
similarity index 87%
rename from ExeFile/MainWindow.xaml
rename to Eve-O-Mock/MainWindow.xaml
index 10a1f9b..252faa9 100644
--- a/ExeFile/MainWindow.xaml
+++ b/Eve-O-Mock/MainWindow.xaml
@@ -1,10 +1,10 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/Eve-O-Mock/MainWindow.xaml.cs b/Eve-O-Mock/MainWindow.xaml.cs
new file mode 100644
index 0000000..1b9018c
--- /dev/null
+++ b/Eve-O-Mock/MainWindow.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Windows;
+using System.Windows.Media;
+
+namespace EveOMock
+{
+ public partial class MainWindow : Window
+ {
+ public MainWindow()
+ {
+ InitializeComponent();
+ Random random = new Random();
+ this.Title += random.Next().ToString("X");
+ this.grid.Background = new SolidColorBrush(Color.FromArgb(255, (byte)random.Next(0, 255), (byte)random.Next(0, 255), (byte)random.Next(0, 255)));
+ }
+ }
+}
diff --git a/Eve-O-Mock/Properties/AssemblyInfo.cs b/Eve-O-Mock/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..8f04a3c
--- /dev/null
+++ b/Eve-O-Mock/Properties/AssemblyInfo.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+[assembly: AssemblyTitle("EVE Online mock executable for the EVE-O Preview project")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("EVE-O Mock")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
+
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
+
+[assembly: CLSCompliant(true)]
\ No newline at end of file
diff --git a/ExeFile/Properties/Resources.Designer.cs b/Eve-O-Mock/Properties/Resources.Designer.cs
similarity index 81%
rename from ExeFile/Properties/Resources.Designer.cs
rename to Eve-O-Mock/Properties/Resources.Designer.cs
index 7453b44..154cb18 100644
--- a/ExeFile/Properties/Resources.Designer.cs
+++ b/Eve-O-Mock/Properties/Resources.Designer.cs
@@ -1,71 +1,63 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.18444
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace ExeFile.Properties
-{
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ExeFile.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
- }
-}
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace EveOMock.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EveOMock.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/ExeFile/Properties/Resources.resx b/Eve-O-Mock/Properties/Resources.resx
similarity index 100%
rename from ExeFile/Properties/Resources.resx
rename to Eve-O-Mock/Properties/Resources.resx
diff --git a/ExeFile/Properties/Settings.Designer.cs b/Eve-O-Mock/Properties/Settings.Designer.cs
similarity index 77%
rename from ExeFile/Properties/Settings.Designer.cs
rename to Eve-O-Mock/Properties/Settings.Designer.cs
index fbbc5ec..74657f2 100644
--- a/ExeFile/Properties/Settings.Designer.cs
+++ b/Eve-O-Mock/Properties/Settings.Designer.cs
@@ -1,30 +1,26 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.18444
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace ExeFile.Properties
-{
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
- return defaultInstance;
- }
- }
- }
-}
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace EveOMock.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/ExeFile/Properties/Settings.settings b/Eve-O-Mock/Properties/Settings.settings
similarity index 100%
rename from ExeFile/Properties/Settings.settings
rename to Eve-O-Mock/Properties/Settings.settings
diff --git a/AboutBox.Designer.cs b/Eve-O-Preview/AboutBox.Designer.cs
similarity index 100%
rename from AboutBox.Designer.cs
rename to Eve-O-Preview/AboutBox.Designer.cs
diff --git a/AboutBox.cs b/Eve-O-Preview/AboutBox.cs
similarity index 100%
rename from AboutBox.cs
rename to Eve-O-Preview/AboutBox.cs
diff --git a/AboutBox.resx b/Eve-O-Preview/AboutBox.resx
similarity index 100%
rename from AboutBox.resx
rename to Eve-O-Preview/AboutBox.resx
diff --git a/Eve-O-Preview/Configuration/Configuration.cs b/Eve-O-Preview/Configuration/Configuration.cs
new file mode 100644
index 0000000..62d40ec
--- /dev/null
+++ b/Eve-O-Preview/Configuration/Configuration.cs
@@ -0,0 +1,7 @@
+namespace EveOPreview
+{
+ public class Configuration
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/Configuration/ConfigurationStorage.cs b/Eve-O-Preview/Configuration/ConfigurationStorage.cs
new file mode 100644
index 0000000..974930e
--- /dev/null
+++ b/Eve-O-Preview/Configuration/ConfigurationStorage.cs
@@ -0,0 +1,7 @@
+namespace EveOPreview.Managers
+{
+ public class ConfigurationStorage
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/DwmAPI/DWM_BLURBEHIND.cs b/Eve-O-Preview/DwmAPI/DWM_BLURBEHIND.cs
new file mode 100644
index 0000000..14ebd8e
--- /dev/null
+++ b/Eve-O-Preview/DwmAPI/DWM_BLURBEHIND.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace EveOPreview
+{
+ [StructLayout(LayoutKind.Sequential)]
+ class DWM_BLURBEHIND
+ {
+ public uint dwFlags;
+ [MarshalAs(UnmanagedType.Bool)]
+ public bool fEnable;
+ public IntPtr hRegionBlur;
+ [MarshalAs(UnmanagedType.Bool)]
+ public bool fTransitionOnMaximized;
+
+ public const uint DWM_BB_ENABLE = 0x00000001;
+ public const uint DWM_BB_BLURREGION = 0x00000002;
+ public const uint DWM_BB_TRANSITIONONMAXIMIZED = 0x00000004;
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/DwmAPI/DWM_THUMBNAIL_PROPERTIES.cs b/Eve-O-Preview/DwmAPI/DWM_THUMBNAIL_PROPERTIES.cs
new file mode 100644
index 0000000..5c12e31
--- /dev/null
+++ b/Eve-O-Preview/DwmAPI/DWM_THUMBNAIL_PROPERTIES.cs
@@ -0,0 +1,17 @@
+using System.Runtime.InteropServices;
+
+namespace EveOPreview
+{
+ [StructLayout(LayoutKind.Sequential)]
+ class DWM_THUMBNAIL_PROPERTIES
+ {
+ public uint dwFlags;
+ public RECT rcDestination;
+ public RECT rcSource;
+ public byte opacity;
+ [MarshalAs(UnmanagedType.Bool)]
+ public bool fVisible;
+ [MarshalAs(UnmanagedType.Bool)]
+ public bool fSourceClientAreaOnly;
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/DwmAPI/DWM_TNP_CONSTANTS.cs b/Eve-O-Preview/DwmAPI/DWM_TNP_CONSTANTS.cs
new file mode 100644
index 0000000..7042770
--- /dev/null
+++ b/Eve-O-Preview/DwmAPI/DWM_TNP_CONSTANTS.cs
@@ -0,0 +1,11 @@
+namespace EveOPreview
+{
+ static class DWM_TNP_CONSTANTS
+ {
+ public const uint DWM_TNP_RECTDESTINATION = 0x00000001;
+ public const uint DWM_TNP_RECTSOURCE = 0x00000002;
+ public const uint DWM_TNP_OPACITY = 0x00000004;
+ public const uint DWM_TNP_VISIBLE = 0x00000008;
+ public const uint DWM_TNP_SOURCECLIENTAREAONLY = 0x00000010;
+ }
+}
\ No newline at end of file
diff --git a/Win32api.cs b/Eve-O-Preview/DwmAPI/DwmApiNativeMethods.cs
similarity index 70%
rename from Win32api.cs
rename to Eve-O-Preview/DwmAPI/DwmApiNativeMethods.cs
index 4dd3ab8..e3c663f 100644
--- a/Win32api.cs
+++ b/Eve-O-Preview/DwmAPI/DwmApiNativeMethods.cs
@@ -1,14 +1,12 @@
using System;
using System.Runtime.InteropServices;
using System.Drawing;
-using System.Text;
-namespace PreviewToy
+namespace EveOPreview
{
// Desktop Windows Manager APIs
- internal class DwmApi
+ static class DwmApiNativeMethods
{
-
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();
@@ -43,65 +41,8 @@ namespace PreviewToy
[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmQueryThumbnailSourceSize(IntPtr hThumbnail, out Size size);
-
- [StructLayout(LayoutKind.Sequential)]
- public class DWM_THUMBNAIL_PROPERTIES
- {
- public uint dwFlags;
- public RECT rcDestination;
- public RECT rcSource;
- public byte opacity;
- [MarshalAs(UnmanagedType.Bool)]
- public bool fVisible;
- [MarshalAs(UnmanagedType.Bool)]
- public bool fSourceClientAreaOnly;
- public const uint DWM_TNP_RECTDESTINATION = 0x00000001;
- public const uint DWM_TNP_RECTSOURCE = 0x00000002;
- public const uint DWM_TNP_OPACITY = 0x00000004;
- public const uint DWM_TNP_VISIBLE = 0x00000008;
- public const uint DWM_TNP_SOURCECLIENTAREAONLY = 0x00000010;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public class MARGINS
- {
- public int cxLeftWidth, cxRightWidth, cyTopHeight, cyBottomHeight;
-
- public MARGINS(int left, int top, int right, int bottom)
- {
- cxLeftWidth = left; cyTopHeight = top;
- cxRightWidth = right; cyBottomHeight = bottom;
- }
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public class DWM_BLURBEHIND
- {
- public uint dwFlags;
- [MarshalAs(UnmanagedType.Bool)]
- public bool fEnable;
- public IntPtr hRegionBlur;
- [MarshalAs(UnmanagedType.Bool)]
- public bool fTransitionOnMaximized;
-
- public const uint DWM_BB_ENABLE = 0x00000001;
- public const uint DWM_BB_BLURREGION = 0x00000002;
- public const uint DWM_BB_TRANSITIONONMAXIMIZED = 0x00000004;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public struct RECT
- {
- public int left, top, right, bottom;
-
- public RECT(int left, int top, int right, int bottom)
- {
- this.left = left; this.top = top; this.right = right; this.bottom = bottom;
- }
- }
-
- public const int SW_SHOWNORMAL = 1;
+ public const int SW_SHOWNORMAL = 1;
public const int SW_SHOWMINIMIZED = 2;
public const int SW_SHOWMAXIMIZED = 3;
@@ -110,8 +51,10 @@ namespace PreviewToy
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HTCAPTION = 0x2;
+
[DllImport("User32.dll")]
public static extern bool ReleaseCapture();
+
[DllImport("User32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
@@ -175,5 +118,17 @@ namespace PreviewToy
public const UInt32 WS_EX_COMPOSITED = 0x02000000;
public const UInt32 WS_EX_NOACTIVATE = 0x08000000;
- }
+ public const int WM_SIZE = 5;
+ public const int SIZE_RESTORED = 0;
+ public const int SIZE_MINIMIZED = 1;
+ public const int SIZE_MAXIMIZED = 2;
+ public const int SIZE_MAXSHOW = 3;
+ public const int SIZE_MAXHIDE = 4;
+
+ [DllImport("user32.dll")]
+ public static extern int GetWindowRect(IntPtr hwnd, out RECT rect);
+
+ [DllImport("user32.dll")]
+ public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
+ }
}
\ No newline at end of file
diff --git a/Eve-O-Preview/DwmAPI/MARGINS.cs b/Eve-O-Preview/DwmAPI/MARGINS.cs
new file mode 100644
index 0000000..58ad6fc
--- /dev/null
+++ b/Eve-O-Preview/DwmAPI/MARGINS.cs
@@ -0,0 +1,21 @@
+using System.Runtime.InteropServices;
+
+namespace EveOPreview
+{
+ [StructLayout(LayoutKind.Sequential)]
+ class MARGINS
+ {
+ public int cxLeftWidth;
+ public int cxRightWidth;
+ public int cyTopHeight;
+ public int cyBottomHeight;
+
+ public MARGINS(int left, int top, int right, int bottom)
+ {
+ cxLeftWidth = left;
+ cyTopHeight = top;
+ cxRightWidth = right;
+ cyBottomHeight = bottom;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/DwmAPI/RECT.cs b/Eve-O-Preview/DwmAPI/RECT.cs
new file mode 100644
index 0000000..bc9f5ec
--- /dev/null
+++ b/Eve-O-Preview/DwmAPI/RECT.cs
@@ -0,0 +1,21 @@
+using System.Runtime.InteropServices;
+
+namespace EveOPreview
+{
+ [StructLayout(LayoutKind.Sequential)]
+ struct RECT
+ {
+ public int Left;
+ public int Top;
+ public int Right;
+ public int Bottom;
+
+ public RECT(int left, int top, int right, int bottom)
+ {
+ this.Left = left;
+ this.Top = top;
+ this.Right = right;
+ this.Bottom = bottom;
+ }
+ }
+}
\ No newline at end of file
diff --git a/preview toy.csproj b/Eve-O-Preview/Eve-O-Preview.csproj
similarity index 74%
rename from preview toy.csproj
rename to Eve-O-Preview/Eve-O-Preview.csproj
index c03ed96..99848fb 100644
--- a/preview toy.csproj
+++ b/Eve-O-Preview/Eve-O-Preview.csproj
@@ -8,8 +8,8 @@
{6CA62DF3-8589-484C-8BC8-F763CA66BBB1}
WinExe
Properties
- PreviewToy
- eve-o preview
+ EveOPreview
+ Eve-O Preview
v4.5
@@ -42,6 +42,7 @@
prompt
4
false
+ false
pdbonly
@@ -57,7 +58,7 @@
icon.ico
- PreviewToy.Program
+ EveOPreview.Program
4B29FD125BFAD24FF900FC81CCE0B0AD37464FDB
@@ -81,6 +82,13 @@
true
+
+ false
+
+
+
+
+
@@ -95,36 +103,49 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
Form
-
- PreviewHandler.cs
+
+ MainForm.cs
-
+
+
+
+
+
Form
-
- PreviewOverlay.cs
+
+ ThumbnailOverlay.cs
-
+
Designer
- PreviewHandler.cs
+ MainForm.cs
-
- PreviewOverlay.cs
+
+ ThumbnailOverlay.cs
ResXFileCodeGenerator
Resources.Designer.cs
Designer
-
+
Designer
- Preview.cs
+ ThumbnailWindow.cs
True
@@ -134,8 +155,6 @@
Designer
-
-
SettingsSingleFileGenerator
Settings.Designer.cs
@@ -145,13 +164,13 @@
Settings.settings
True
-
+
Form
-
- Preview.cs
+
+ ThumbnailWindow.cs
-
+
diff --git a/Eve-O-Preview/GUI/ClientLocation.cs b/Eve-O-Preview/GUI/ClientLocation.cs
new file mode 100644
index 0000000..6f66438
--- /dev/null
+++ b/Eve-O-Preview/GUI/ClientLocation.cs
@@ -0,0 +1,10 @@
+namespace EveOPreview
+{
+ public struct ClientLocation
+ {
+ public int X;
+ public int Y;
+ public int Width;
+ public int Height;
+ }
+}
\ No newline at end of file
diff --git a/PreviewHandler.Designer.cs b/Eve-O-Preview/GUI/MainForm.Designer.cs
similarity index 97%
rename from PreviewHandler.Designer.cs
rename to Eve-O-Preview/GUI/MainForm.Designer.cs
index 88dd593..802defc 100644
--- a/PreviewHandler.Designer.cs
+++ b/Eve-O-Preview/GUI/MainForm.Designer.cs
@@ -6,9 +6,9 @@ using System;
using System.Windows.Forms;
using System.Diagnostics;
-namespace PreviewToy
+namespace EveOPreview
{
- partial class PreviewToyHandler
+ partial class MainForm
{
///
/// Required designer variable.
@@ -37,7 +37,7 @@ namespace PreviewToy
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PreviewToyHandler));
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.option_hide_active = new System.Windows.Forms.CheckBox();
this.option_hide_all_if_not_right_type = new System.Windows.Forms.CheckBox();
this.option_unique_layout = new System.Windows.Forms.CheckBox();
@@ -566,7 +566,7 @@ namespace PreviewToy
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(0);
this.MaximizeBox = false;
- this.Name = "PreviewToyHandler";
+ this.Name = "MainForm";
this.Text = "EVE Online previewer";
this.TopMost = true;
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
diff --git a/Eve-O-Preview/GUI/MainForm.cs b/Eve-O-Preview/GUI/MainForm.cs
new file mode 100644
index 0000000..902c16a
--- /dev/null
+++ b/Eve-O-Preview/GUI/MainForm.cs
@@ -0,0 +1,482 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Windows.Forms;
+using System.Diagnostics;
+using System.Globalization;
+using System.Windows.Threading;
+using System.Xml.Linq;
+using System.IO;
+
+namespace EveOPreview
+{
+ public partial class MainForm : Form
+ {
+ public event EventHandler Minimized;
+ public event EventHandler Maximized;
+ public event EventHandler Restored;
+
+ private readonly bool _isInitialized;
+ private readonly ThumbnailManager _manager;
+
+
+ private Dictionary _zoomAnchorButtonMap;
+
+ public MainForm()
+ {
+ _isInitialized = false;
+
+ InitializeComponent();
+ init_options();
+
+ // TODO Fix this
+ previews_check_listbox.DisplayMember = "Text";
+
+ this._manager = new ThumbnailManager(add_thumbnail,remove_thumbnail, set_aero_status, set_size);
+
+ _isInitialized = true;
+
+ this._manager.Activate();
+ }
+
+ private void add_thumbnail(IList thumbnails)
+ {
+ this.previews_check_listbox.BeginUpdate();
+ foreach (string th in thumbnails)
+ {
+ previews_check_listbox.Items.Add(th);
+ }
+ this.previews_check_listbox.EndUpdate();
+ }
+
+ private void remove_thumbnail(IList thumbnails)
+ {
+ this.previews_check_listbox.BeginUpdate();
+ foreach (string th in thumbnails)
+ {
+ previews_check_listbox.Items.Remove(th);
+ }
+ this.previews_check_listbox.EndUpdate();
+ }
+
+ private void set_aero_status(bool value)
+ {
+
+ if (value)
+ {
+ aero_status_label.Text = "AERO is ON";
+ aero_status_label.ForeColor = Color.Black;
+ }
+ else
+ {
+ aero_status_label.Text = "AERO is OFF";
+ aero_status_label.ForeColor = Color.Red;
+ }
+ }
+
+ private void set_size(int x, int y)
+ {
+ option_sync_size_x.Text = x.ToString();
+ option_sync_size_y.Text = y.ToString();
+ }
+
+ private void GlassForm_Load(object sender, EventArgs e)
+ {
+ this._manager.refresh_thumbnails();
+ }
+
+ private void init_options()
+ {
+ this.Minimized += MainForm_Minimized;
+
+ option_zoom_on_hover.Checked = Properties.Settings.Default.zoom_on_hover;
+ _zoomAnchorButtonMap = new Dictionary();
+ _zoomAnchorButtonMap[ZoomAnchor.NW] = option_zoom_anchor_NW;
+ _zoomAnchorButtonMap[ZoomAnchor.N] = option_zoom_anchor_N;
+ _zoomAnchorButtonMap[ZoomAnchor.NE] = option_zoom_anchor_NE;
+ _zoomAnchorButtonMap[ZoomAnchor.W] = option_zoom_anchor_W;
+ _zoomAnchorButtonMap[ZoomAnchor.C] = option_zoom_anchor_C;
+ _zoomAnchorButtonMap[ZoomAnchor.E] = option_zoom_anchor_E;
+ _zoomAnchorButtonMap[ZoomAnchor.SW] = option_zoom_anchor_SW;
+ _zoomAnchorButtonMap[ZoomAnchor.S] = option_zoom_anchor_S;
+ _zoomAnchorButtonMap[ZoomAnchor.SE] = option_zoom_anchor_SE;
+ _zoomAnchorButtonMap[(ZoomAnchor)Properties.Settings.Default.zoom_anchor].Checked = true;
+ option_zoom_factor.Text = Properties.Settings.Default.zoom_amount.ToString(CultureInfo.InvariantCulture);
+
+ option_always_on_top.Checked = Properties.Settings.Default.always_on_top;
+ option_hide_active.Checked = Properties.Settings.Default.hide_active;
+ option_hide_all_if_not_right_type.Checked = Properties.Settings.Default.hide_all;
+
+ option_unique_layout.Checked = Properties.Settings.Default.unique_layout;
+
+ option_sync_size.Checked = Properties.Settings.Default.sync_resize;
+ option_sync_size_x.Text = Properties.Settings.Default.sync_resize_x.ToString();
+ option_sync_size_y.Text = Properties.Settings.Default.sync_resize_y.ToString();
+
+ option_show_thumbnail_frames.Checked = Properties.Settings.Default.show_thumb_frames;
+
+ option_show_overlay.Checked = Properties.Settings.Default.show_overlay;
+
+ option_track_client_windows.Checked = Properties.Settings.Default.track_client_windows;
+
+ option_minToTray.Checked = Properties.Settings.Default.minimizeToTray;
+
+ // disable/enable zoom suboptions
+ option_zoom_factor.Enabled = Properties.Settings.Default.zoom_on_hover;
+ foreach (var kv in _zoomAnchorButtonMap)
+ {
+ kv.Value.Enabled = Properties.Settings.Default.zoom_on_hover;
+ }
+
+ opacity_bar.Value = Math.Min(100, (int)(100.0 * Properties.Settings.Default.opacity));
+ }
+
+
+
+
+ private void option_hide_all_if_noneve_CheckedChanged(object sender, EventArgs e)
+ {
+ if (!_isInitialized)
+ {
+ return;
+ }
+
+ Properties.Settings.Default.hide_all = option_hide_all_if_not_right_type.Checked;
+ Properties.Settings.Default.Save();
+ this._manager.refresh_thumbnails();
+ }
+
+
+ private void option_unique_layout_CheckedChanged(object sender, EventArgs e)
+ {
+ if (!_isInitialized)
+ {
+ return;
+ }
+
+ Properties.Settings.Default.unique_layout = option_unique_layout.Checked;
+ Properties.Settings.Default.Save();
+ this._manager.refresh_thumbnails();
+ }
+
+
+ private void option_hide_active_CheckedChanged(object sender, EventArgs e)
+ {
+ if (!_isInitialized)
+ {
+ return;
+ }
+
+ Properties.Settings.Default.hide_active = option_hide_active.Checked;
+ Properties.Settings.Default.Save();
+ this._manager.refresh_thumbnails();
+ }
+
+
+ private void option_sync_size_CheckedChanged(object sender, EventArgs e)
+ {
+ if (!_isInitialized)
+ {
+ return;
+ }
+
+ Properties.Settings.Default.sync_resize = option_sync_size.Checked;
+ Properties.Settings.Default.Save();
+ this._manager.refresh_thumbnails();
+ }
+
+
+ private void parse_size_entry()
+ {
+ UInt32 x = 0, y = 0;
+
+ try
+ {
+ y = Convert.ToUInt32(option_sync_size_y.Text);
+ x = Convert.ToUInt32(option_sync_size_x.Text);
+ }
+ catch (System.FormatException)
+ {
+ return;
+ }
+
+ if (x < 64 || y < 64)
+ {
+ return;
+ }
+
+ Properties.Settings.Default.sync_resize_y = y;
+ Properties.Settings.Default.sync_resize_x = x;
+ Properties.Settings.Default.Save();
+
+ // resize
+ this._manager.SyncPreviewSize(new Size((int)Properties.Settings.Default.sync_resize_x,
+ (int)Properties.Settings.Default.sync_resize_y));
+ }
+
+
+ private void option_sync_size_x_TextChanged(object sender, EventArgs e)
+ {
+ if (!_isInitialized)
+ {
+ return;
+ }
+
+ parse_size_entry();
+ }
+
+
+ private void option_sync_size_y_TextChanged(object sender, EventArgs e)
+ {
+ if (!_isInitialized)
+ {
+ return;
+ }
+
+ parse_size_entry();
+ }
+
+
+ private void option_always_on_top_CheckedChanged(object sender, EventArgs e)
+ {
+ if (!_isInitialized)
+ {
+ return;
+ }
+
+ Properties.Settings.Default.always_on_top = option_always_on_top.Checked;
+ Properties.Settings.Default.Save();
+ this._manager.refresh_thumbnails();
+ }
+
+
+ private void option_show_thumbnail_frames_CheckedChanged(object sender, EventArgs e)
+ {
+ if (!_isInitialized)
+ {
+ return;
+ }
+
+ Properties.Settings.Default.show_thumb_frames = option_show_thumbnail_frames.Checked;
+ Properties.Settings.Default.Save();
+
+ this._manager.set_frames();
+ }
+
+ private void list_running_clients_SelectedIndexChanged(object sender, EventArgs e) { }
+
+
+ private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
+ {
+ string url = "https://bitbucket.org/ulph/eve-o-preview-git";
+ ProcessStartInfo sInfo = new ProcessStartInfo(new Uri(url).AbsoluteUri);
+ Process.Start(sInfo);
+ }
+
+
+ private void previewToyMainBindingSource_CurrentChanged(object sender, EventArgs e)
+ {
+
+ }
+
+ private void option_zoom_on_hover_CheckedChanged(object sender, EventArgs e)
+ {
+ if (!_isInitialized) return;
+
+ Properties.Settings.Default.zoom_on_hover = option_zoom_on_hover.Checked;
+ Properties.Settings.Default.Save();
+ this._manager.refresh_thumbnails();
+ option_zoom_factor.Enabled = Properties.Settings.Default.zoom_on_hover;
+
+ foreach (var kv in _zoomAnchorButtonMap)
+ {
+ kv.Value.Enabled = Properties.Settings.Default.zoom_on_hover;
+ }
+
+ }
+
+ private void option_show_overlay_CheckedChanged(object sender, EventArgs e)
+ {
+ Properties.Settings.Default.show_overlay = option_show_overlay.Checked;
+ Properties.Settings.Default.Save();
+ this._manager.refresh_thumbnails();
+ }
+
+
+ private void handle_zoom_anchor_setting()
+ {
+ foreach (var kv in _zoomAnchorButtonMap)
+ {
+ if (kv.Value.Checked == true)
+ Properties.Settings.Default.zoom_anchor = (byte)kv.Key;
+ }
+ }
+
+ private void option_zoom_anchor_X_CheckedChanged(object sender, EventArgs e)
+ {
+ handle_zoom_anchor_setting();
+ Properties.Settings.Default.Save();
+ }
+
+ private void option_zoom_factor_TextChanged(object sender, EventArgs e)
+ {
+ try
+ {
+ float tmp = (float)Convert.ToDouble(option_zoom_factor.Text);
+ if (tmp < 1)
+ {
+ tmp = 1;
+ }
+ else if (tmp > 10)
+ {
+ tmp = 10;
+ }
+ Properties.Settings.Default.zoom_amount = tmp;
+ option_zoom_factor.Text = tmp.ToString();
+ Properties.Settings.Default.Save();
+ }
+ catch
+ {
+ // do naught
+ }
+ }
+
+ private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ this._manager.refresh_thumbnails();
+ }
+
+ private void checkedListBox1_SelectedIndexChanged2(object sender, EventArgs e)
+ {
+ System.Windows.Forms.ItemCheckEventArgs arg = (System.Windows.Forms.ItemCheckEventArgs)e;
+ ((ThumbnailWindow)this.previews_check_listbox.Items[arg.Index]).IsPreviewEnabled = (arg.NewValue != System.Windows.Forms.CheckState.Checked);
+ this._manager.refresh_thumbnails();
+ }
+
+ private void flowLayoutPanel1_Paint(object sender, PaintEventArgs e)
+ {
+
+ }
+
+ private void checkBox1_CheckedChanged(object sender, EventArgs e)
+ {
+ if (!_isInitialized)
+ {
+ return;
+ }
+ Properties.Settings.Default.track_client_windows = option_track_client_windows.Checked;
+ Properties.Settings.Default.Save();
+ this._manager.refresh_thumbnails();
+ }
+
+
+ private void opacity_bar_Scroll(object sender, ScrollEventArgs e)
+ {
+ if (!_isInitialized)
+ {
+ return;
+ }
+ // fire off opacity change
+ Properties.Settings.Default.opacity = Math.Min((float)e.NewValue / 100.0f, 1.0f);
+ Properties.Settings.Default.Save();
+ this._manager.refresh_thumbnails();
+ }
+
+
+ private void OnMinimized(EventArgs e)
+ {
+ if (Minimized != null && Properties.Settings.Default.minimizeToTray)
+ {
+ this.Hide();
+ }
+ else if (Minimized != null && !Properties.Settings.Default.minimizeToTray)
+ {
+ Minimized(this, e);
+ }
+ }
+
+ private void OnMaximized(EventArgs e)
+ {
+ if (Maximized != null)
+ {
+ Maximized(this, e);
+ }
+ }
+
+ private void OnRestored(EventArgs e)
+ {
+ Restored?.Invoke(this, e);
+ }
+
+ protected override void WndProc(ref Message m)
+ {
+ switch (m.Msg)
+ {
+ case DwmApiNativeMethods.WM_SIZE:
+ switch (m.WParam.ToInt32())
+ {
+ case DwmApiNativeMethods.SIZE_RESTORED:
+ OnRestored(EventArgs.Empty);
+ break;
+ case DwmApiNativeMethods.SIZE_MINIMIZED:
+ OnMinimized(EventArgs.Empty);
+ break;
+ case DwmApiNativeMethods.SIZE_MAXIMIZED:
+ OnMaximized(EventArgs.Empty);
+ break;
+ }
+ break;
+ }
+
+ base.WndProc(ref m);
+ }
+
+ void MainForm_Minimized(object sender, EventArgs e)
+ {
+ // TODO: do something here
+ }
+
+ private void option_minToTray_CheckedChanged(object sender, EventArgs e)
+ {
+ Properties.Settings.Default.minimizeToTray = option_minToTray.Checked;
+ Properties.Settings.Default.Save();
+ }
+
+ private void exitToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ Application.Exit();
+ }
+
+ private void restoreToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (!this.Visible)
+ {
+ this.Show();
+ }
+ else if (Restored != null)
+ {
+ Restored(this, e);
+ }
+ else
+ {
+ this.BringToFront();
+ }
+ }
+
+ private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
+ {
+ if (!this.Visible)
+ {
+ this.Show();
+ }
+ else if (Restored != null)
+ {
+ Restored(this, e);
+ }
+ else
+ {
+ this.BringToFront();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/PreviewHandler.resx b/Eve-O-Preview/GUI/MainForm.resx
similarity index 100%
rename from PreviewHandler.resx
rename to Eve-O-Preview/GUI/MainForm.resx
diff --git a/Eve-O-Preview/GUI/ZoomAnchor.cs b/Eve-O-Preview/GUI/ZoomAnchor.cs
new file mode 100644
index 0000000..ebfcb97
--- /dev/null
+++ b/Eve-O-Preview/GUI/ZoomAnchor.cs
@@ -0,0 +1,15 @@
+namespace EveOPreview
+{
+ public enum ZoomAnchor
+ {
+ NW = 0,
+ N,
+ NE,
+ W,
+ C,
+ E,
+ SW,
+ S,
+ SE
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/Hotkeys/Hotkey.cs b/Eve-O-Preview/Hotkeys/Hotkey.cs
new file mode 100644
index 0000000..5fc8132
--- /dev/null
+++ b/Eve-O-Preview/Hotkeys/Hotkey.cs
@@ -0,0 +1,332 @@
+using System;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Xml.Serialization;
+using System.Runtime.InteropServices;
+
+namespace EveOPreview
+{
+ public class Hotkey : IMessageFilter
+ {
+ private static int _currentId;
+ private const int MaxId = 0xBFFF;
+
+ [XmlElement("keyCode")]
+ private Keys _keyCode;
+ [XmlElement("shift")]
+ private bool _shift;
+ [XmlElement("control")]
+ private bool _control;
+ [XmlElement("alt")]
+ private bool _alt;
+ [XmlElement("windows")]
+ private bool _windows;
+
+ [XmlIgnore]
+ private int _id;
+ [XmlIgnore]
+ private bool _isRegistered;
+ [XmlIgnore]
+ private Control _windowControl;
+
+ public event HandledEventHandler Pressed;
+
+ public Hotkey()
+ : this(Keys.None, false, false, false, false)
+ {
+ }
+
+ public Hotkey(Keys keyCode, bool shift, bool control, bool alt, bool windows)
+ {
+ // Assign properties
+ this.KeyCode = keyCode;
+ this.Shift = shift;
+ this.Control = control;
+ this.Alt = alt;
+ this.Windows = windows;
+
+ // Register us as a message filter
+ Application.AddMessageFilter(this);
+ }
+
+ ~Hotkey()
+ {
+ // Unregister the hotkey if necessary
+ if (this.IsRegistered)
+ {
+ this.Unregister();
+ }
+ }
+
+ public Hotkey Clone()
+ {
+ // Clone the whole object
+ return new Hotkey(this._keyCode, this._shift, this._control, this._alt, this._windows);
+ }
+
+ public bool GetCanRegister(Control windowControl)
+ {
+ // Handle any exceptions: they mean "no, you can't register" :)
+ try
+ {
+ // Attempt to register
+ if (this.Register(windowControl))
+ {
+ // Unregister and say we managed it
+ this.Unregister();
+ return true;
+ }
+ }
+ catch (Win32Exception)
+ {
+ }
+ catch (NotSupportedException)
+ {
+ }
+
+ return false;
+ }
+
+ public bool Register(Control windowControl)
+ {
+ // Check that we have not registered
+ if (this._isRegistered)
+ {
+ throw new NotSupportedException("You cannot register a hotkey that is already registered");
+ }
+
+ // We can't register an empty hotkey
+ if (this.IsEmpty)
+ {
+ throw new NotSupportedException("You cannot register an empty hotkey");
+ }
+
+ // Get an ID for the hotkey and increase current ID
+ this._id = Hotkey._currentId;
+ Hotkey._currentId = Hotkey._currentId + 1 % Hotkey.MaxId;
+
+ // Translate modifier keys into unmanaged version
+ uint modifiers = (this.Alt ? HotkeyNativeMethods.MOD_ALT : 0) | (this.Control ? HotkeyNativeMethods.MOD_CONTROL : 0) |
+ (this.Shift ? HotkeyNativeMethods.MOD_SHIFT : 0) | (this.Windows ? HotkeyNativeMethods.MOD_WIN : 0);
+
+ // Register the hotkey
+ if (HotkeyNativeMethods.RegisterHotKey(windowControl.Handle, this._id, modifiers, _keyCode) == 0)
+ {
+ // Is the error that the hotkey is registered?
+ if (Marshal.GetLastWin32Error() != HotkeyNativeMethods.ERROR_HOTKEY_ALREADY_REGISTERED)
+ {
+ throw new Win32Exception();
+ }
+
+ return false;
+ }
+
+ // Save the control reference and register state
+ this._isRegistered = true;
+ this._windowControl = windowControl;
+
+ // We successfully registered
+ return true;
+ }
+
+ public void Unregister()
+ {
+ // Check that we have registered
+ if (!this._isRegistered)
+ {
+ throw new NotSupportedException("You cannot unregister a hotkey that is not registered");
+ }
+
+ // It's possible that the control itself has died: in that case, no need to unregister!
+ if (!this._windowControl.IsDisposed)
+ {
+ // Clean up after ourselves
+ if (HotkeyNativeMethods.UnregisterHotKey(this._windowControl.Handle, this._id) == 0)
+ {
+ throw new Win32Exception();
+ }
+ }
+
+ // Clear the control reference and register state
+ this._isRegistered = false;
+ this._windowControl = null;
+ }
+
+ private void Reregister()
+ {
+ // Only do something if the key is already registered
+ if (!this._isRegistered)
+ {
+ return;
+ }
+
+ // Save control reference
+ Control windowControl = this._windowControl;
+
+ // Unregister and then reregister again
+ this.Unregister();
+ this.Register(windowControl);
+ }
+
+ public bool PreFilterMessage(ref Message message)
+ {
+ // Only process WM_HOTKEY messages
+ if (message.Msg != HotkeyNativeMethods.WM_HOTKEY)
+ {
+ return false;
+ }
+
+ // Check that the ID is our key and we are registerd
+ return this._isRegistered && (message.WParam.ToInt32() == this._id) && this.OnPressed();
+ }
+
+ private bool OnPressed()
+ {
+ // Fire the event if we can
+ HandledEventArgs handledEventArgs = new HandledEventArgs(false);
+ this.Pressed?.Invoke(this, handledEventArgs);
+
+ // Return whether we handled the event or not
+ return handledEventArgs.Handled;
+ }
+
+ public override string ToString()
+ {
+ // We can be empty
+ if (this.IsEmpty)
+ {
+ return "(none)";
+ }
+
+ // Build key name
+ string keyName = Enum.GetName(typeof(Keys), this._keyCode) ?? " ";
+ switch (this._keyCode)
+ {
+ case Keys.D0:
+ case Keys.D1:
+ case Keys.D2:
+ case Keys.D3:
+ case Keys.D4:
+ case Keys.D5:
+ case Keys.D6:
+ case Keys.D7:
+ case Keys.D8:
+ case Keys.D9:
+ // Strip the first character
+ keyName = keyName.Substring(1);
+ break;
+ }
+
+ // Build modifiers
+ string modifiers = "";
+ if (this._shift)
+ {
+ modifiers += "Shift+";
+ }
+
+ if (this._control)
+ {
+ modifiers += "Control+";
+ }
+
+ if (this._alt)
+ {
+ modifiers += "Alt+";
+ }
+
+ if (this._windows)
+ {
+ modifiers += "Windows+";
+ }
+
+ // Return result
+ return modifiers + keyName;
+ }
+
+ public bool IsEmpty
+ {
+ get
+ {
+ return this._keyCode == Keys.None;
+ }
+ }
+
+ public bool IsRegistered
+ {
+ get
+ {
+ return this._isRegistered;
+ }
+ }
+
+ public Keys KeyCode
+ {
+ get
+ {
+ return this._keyCode;
+ }
+ set
+ {
+ // Save and reregister
+ this._keyCode = value;
+ this.Reregister();
+ }
+ }
+
+ public bool Shift
+ {
+ get
+ {
+ return this._shift;
+ }
+ set
+ {
+ // Save and reregister
+ this._shift = value;
+ this.Reregister();
+ }
+ }
+
+ public bool Control
+ {
+ get
+ {
+ return this._control;
+ }
+ set
+ {
+ // Save and reregister
+ this._control = value;
+ this.Reregister();
+ }
+ }
+
+ public bool Alt
+ {
+ get
+ {
+ return this._alt;
+ }
+ set
+ {
+ // Save and reregister
+ this._alt = value;
+ this.Reregister();
+ }
+ }
+
+ public bool Windows
+ {
+ get
+ {
+ return this._windows;
+ }
+ set
+ {
+ // Save and reregister
+ this._windows = value;
+ this.Reregister();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/Hotkeys/HotkeyNativeMethods.cs b/Eve-O-Preview/Hotkeys/HotkeyNativeMethods.cs
new file mode 100644
index 0000000..8823fee
--- /dev/null
+++ b/Eve-O-Preview/Hotkeys/HotkeyNativeMethods.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Windows.Forms;
+
+namespace EveOPreview
+{
+ static class HotkeyNativeMethods
+ {
+ [DllImport("user32.dll", SetLastError = true)]
+ public static extern int RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, Keys vk);
+
+ [DllImport("user32.dll", SetLastError = true)]
+ public static extern int UnregisterHotKey(IntPtr hWnd, int id);
+
+ public const uint WM_HOTKEY = 0x312;
+
+ public const uint MOD_ALT = 0x1;
+ public const uint MOD_CONTROL = 0x2;
+ public const uint MOD_SHIFT = 0x4;
+ public const uint MOD_WIN = 0x8;
+
+ public const uint ERROR_HOTKEY_ALREADY_REGISTERED = 1409;
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/Program.cs b/Eve-O-Preview/Program.cs
new file mode 100644
index 0000000..4373bcc
--- /dev/null
+++ b/Eve-O-Preview/Program.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Windows.Forms;
+
+namespace EveOPreview
+{
+ static class Program
+ {
+ /// The main entry point for the application.
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(true);
+ Application.Run(new MainForm());
+ }
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/Properties/AssemblyInfo.cs b/Eve-O-Preview/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..75c665f
--- /dev/null
+++ b/Eve-O-Preview/Properties/AssemblyInfo.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("EVE-O Preview")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("EVE-O Preview")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: ComVisible(false)]
+[assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")]
+[assembly: AssemblyVersion("1.18.0.0")]
+[assembly: AssemblyFileVersion("1.18.0.0")]
+
+// Provide your own key name to build the app locally
+[assembly: AssemblyKeyName("Phrynohyas")]
+
+[assembly: CLSCompliant(true)]
diff --git a/Properties/Resources.Designer.cs b/Eve-O-Preview/Properties/Resources.Designer.cs
similarity index 91%
rename from Properties/Resources.Designer.cs
rename to Eve-O-Preview/Properties/Resources.Designer.cs
index bc8c639..2490aeb 100644
--- a/Properties/Resources.Designer.cs
+++ b/Eve-O-Preview/Properties/Resources.Designer.cs
@@ -1,14 +1,14 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.34014
+// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
-namespace PreviewToy.Properties {
+namespace EveOPreview.Properties {
using System;
@@ -39,7 +39,7 @@ namespace PreviewToy.Properties {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PreviewToy.Properties.Resources", typeof(Resources).Assembly);
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EveOPreview.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
diff --git a/Properties/Resources.resx b/Eve-O-Preview/Properties/Resources.resx
similarity index 100%
rename from Properties/Resources.resx
rename to Eve-O-Preview/Properties/Resources.resx
diff --git a/Properties/Settings.Designer.cs b/Eve-O-Preview/Properties/Settings.Designer.cs
similarity index 96%
rename from Properties/Settings.Designer.cs
rename to Eve-O-Preview/Properties/Settings.Designer.cs
index ad54533..7effa90 100644
--- a/Properties/Settings.Designer.cs
+++ b/Eve-O-Preview/Properties/Settings.Designer.cs
@@ -1,18 +1,18 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.34014
+// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
-namespace PreviewToy.Properties {
+namespace EveOPreview.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
diff --git a/Properties/Settings.settings b/Eve-O-Preview/Properties/Settings.settings
similarity index 100%
rename from Properties/Settings.settings
rename to Eve-O-Preview/Properties/Settings.settings
diff --git a/Resources/icon.ico b/Eve-O-Preview/Resources/icon.ico
similarity index 100%
rename from Resources/icon.ico
rename to Eve-O-Preview/Resources/icon.ico
diff --git a/Resources/icon.png b/Eve-O-Preview/Resources/icon.png
similarity index 100%
rename from Resources/icon.png
rename to Eve-O-Preview/Resources/icon.png
diff --git a/Eve-O-Preview/Thumbnail/IThumbnail.cs b/Eve-O-Preview/Thumbnail/IThumbnail.cs
new file mode 100644
index 0000000..1b396c4
--- /dev/null
+++ b/Eve-O-Preview/Thumbnail/IThumbnail.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Drawing;
+
+namespace EveOPreview
+{
+ public interface IThumbnail
+ {
+ bool IsZoomEnabled { get; set; }
+ bool IsPreviewEnabled { get; set; }
+ bool IsOverlayEnabled { get; set; }
+
+ bool IsPreviewHandle(IntPtr handle);
+
+ void ShowThumbnail();
+ void HideThumbnail();
+ void CloseThumbnail();
+
+ void RegisterShortcut(string shortcut);
+
+ void SetLabel(string label);
+ string GetLabel();
+
+ void SetLocation(Point location);
+ Point GetLocation();
+
+ void SetOpacity(double opacity);
+ void SetTopMost(bool topmost);
+ void SetWindowFrames(bool enable);
+ void SetSize(Size size);
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/Thumbnail/ThumbnailFactory.cs b/Eve-O-Preview/Thumbnail/ThumbnailFactory.cs
new file mode 100644
index 0000000..f56fbf5
--- /dev/null
+++ b/Eve-O-Preview/Thumbnail/ThumbnailFactory.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Drawing;
+
+namespace EveOPreview
+{
+ public class ThumbnailFactory
+ {
+ public IThumbnail Create(ThumbnailManager manager, IntPtr sourceWindow, string title, Size size)
+ {
+ return new ThumbnailWindow(manager, sourceWindow, title, size);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/Thumbnail/ThumbnailManager.cs b/Eve-O-Preview/Thumbnail/ThumbnailManager.cs
new file mode 100644
index 0000000..3a52deb
--- /dev/null
+++ b/Eve-O-Preview/Thumbnail/ThumbnailManager.cs
@@ -0,0 +1,507 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Drawing;
+using System.IO;
+using System.Windows.Threading;
+using System.Xml.Linq;
+
+namespace EveOPreview
+{
+ public class ThumbnailManager
+ {
+ private readonly Stopwatch _ignoringSizeSync;
+ private DispatcherTimer _dispatcherTimer;
+ private readonly ThumbnailFactory _thumbnailFactory;
+ private readonly Dictionary _previews;
+
+ private IntPtr _activeClientHandle;
+ private string _activeClientTitle;
+
+ private readonly Dictionary> _uniqueLayouts;
+ private readonly Dictionary _flatLayout;
+ private readonly Dictionary _flatLayoutShortcuts;
+ private readonly Dictionary _clientLayout;
+
+ private readonly Dictionary _xmlBadToOkChars;
+
+ private readonly Action> _addThumbnail;
+ private readonly Action> _removeThumbnail;
+ private readonly Action _setAeroStatus;
+ private readonly Action _sizeChange;
+
+ public ThumbnailManager(Action> addThumbnail, Action> removeThumbnail, Action setAeroStatus, Action sizeChange)
+ {
+ _addThumbnail = addThumbnail;
+ _removeThumbnail = removeThumbnail;
+ _setAeroStatus = setAeroStatus;
+ _sizeChange = sizeChange;
+
+ _ignoringSizeSync = new Stopwatch();
+ _ignoringSizeSync.Start();
+
+ this._activeClientHandle = (IntPtr)0;
+ this._activeClientTitle = "";
+
+ _xmlBadToOkChars = new Dictionary();
+ _xmlBadToOkChars["<"] = "---lt---";
+ _xmlBadToOkChars["&"] = "---amp---";
+ _xmlBadToOkChars[">"] = "---gt---";
+ _xmlBadToOkChars["\""] = "---quot---";
+ _xmlBadToOkChars["\'"] = "---apos---";
+ _xmlBadToOkChars[","] = "---comma---";
+ _xmlBadToOkChars["."] = "---dot---";
+
+ _uniqueLayouts = new Dictionary>();
+ _flatLayout = new Dictionary();
+ _flatLayoutShortcuts = new Dictionary();
+ _clientLayout = new Dictionary();
+
+ this._previews = new Dictionary();
+
+ // DispatcherTimer setup
+ _dispatcherTimer = new DispatcherTimer();
+ _dispatcherTimer.Tick += dispatcherTimer_Tick;
+ _dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
+
+ this._thumbnailFactory = new ThumbnailFactory();
+ }
+
+ public void Activate()
+ {
+ this.load_layout();
+ this._dispatcherTimer.Start();
+ }
+
+ public void Deactivate()
+ {
+ this._dispatcherTimer.Stop();
+ }
+
+ private void spawn_and_kill_previews()
+ {
+ // TODO Extract this!
+ Process[] processes = Process.GetProcessesByName("ExeFile");
+ List processHandles = new List();
+ List addedList=new List();
+ List removedList = new List();
+ // pop new previews
+
+ foreach (Process process in processes)
+ {
+ processHandles.Add(process.MainWindowHandle);
+
+ Size sync_size = new Size();
+ sync_size.Width = (int)Properties.Settings.Default.sync_resize_x;
+ sync_size.Height = (int)Properties.Settings.Default.sync_resize_y;
+
+ if (!_previews.ContainsKey(process.MainWindowHandle) && process.MainWindowTitle != "")
+ {
+ _previews[process.MainWindowHandle] = this._thumbnailFactory.Create(this, process.MainWindowHandle, "...", sync_size);
+
+ // apply more thumbnail specific options
+ _previews[process.MainWindowHandle].SetTopMost(Properties.Settings.Default.always_on_top);
+ _previews[process.MainWindowHandle].SetWindowFrames(Properties.Settings.Default.show_thumb_frames);
+
+ // add a preview also
+ addedList.Add(_previews[process.MainWindowHandle].GetLabel());
+
+ refresh_client_window_locations(process);
+ }
+
+ else if (_previews.ContainsKey(process.MainWindowHandle) && process.MainWindowTitle != _previews[process.MainWindowHandle].GetLabel()) //or update the preview titles
+ {
+ _previews[process.MainWindowHandle].SetLabel(process.MainWindowTitle);
+ string key = _previews[process.MainWindowHandle].GetLabel();
+ string value;
+ if (_flatLayoutShortcuts.TryGetValue(key, out value))
+ {
+ _previews[process.MainWindowHandle].RegisterShortcut(value);
+ }
+ refresh_client_window_locations(process);
+ }
+
+ if (process.MainWindowHandle == DwmApiNativeMethods.GetForegroundWindow())
+ {
+ _activeClientHandle = process.MainWindowHandle;
+ _activeClientTitle = process.MainWindowTitle;
+ }
+
+ }
+
+ // TODO Check for empty list
+ _addThumbnail(addedList);
+
+ // clean up old previews
+ List to_be_pruned = new List();
+ foreach (IntPtr processHandle in _previews.Keys)
+ {
+ if (!(processHandles.Contains(processHandle)))
+ {
+ to_be_pruned.Add(processHandle);
+ }
+ }
+
+ foreach (IntPtr processHandle in to_be_pruned)
+ {
+ removedList.Add(_previews[processHandle].GetLabel());
+
+ _previews[processHandle].CloseThumbnail();
+ _previews.Remove(processHandle);
+ }
+
+ _removeThumbnail(removedList);
+ }
+
+ private void refresh_client_window_locations(Process process)
+ {
+ if (Properties.Settings.Default.track_client_windows && _clientLayout.ContainsKey(process.MainWindowTitle))
+ {
+ DwmApiNativeMethods.MoveWindow(process.MainWindowHandle, _clientLayout[process.MainWindowTitle].X,
+ _clientLayout[process.MainWindowTitle].Y, _clientLayout[process.MainWindowTitle].Width,
+ _clientLayout[process.MainWindowTitle].Height, true);
+ }
+ }
+
+ private void dispatcherTimer_Tick(object sender, EventArgs e)
+ {
+ spawn_and_kill_previews();
+ refresh_thumbnails();
+ if (_ignoringSizeSync.ElapsedMilliseconds > 500) { _ignoringSizeSync.Stop(); };
+
+ // TODO Do this once in 10 seconds
+ _setAeroStatus(DwmApiNativeMethods.DwmIsCompositionEnabled());
+ }
+
+ public void NotifyPreviewSwitch()
+ {
+ update_client_locations();
+ store_layout(); //todo: check if it actually changed ...
+ foreach (KeyValuePair entry in _previews)
+ {
+ entry.Value.SetTopMost(Properties.Settings.Default.always_on_top);
+ }
+ }
+
+
+ public void SyncPreviewSize(Size sync_size)
+ {
+ if (Properties.Settings.Default.sync_resize &&
+ Properties.Settings.Default.show_thumb_frames &&
+ _ignoringSizeSync.ElapsedMilliseconds > 500)
+ {
+ _ignoringSizeSync.Stop();
+
+ _sizeChange(sync_size.Width, sync_size.Height);
+
+ foreach (KeyValuePair entry in _previews)
+ {
+ if (entry.Value.IsPreviewHandle(DwmApiNativeMethods.GetForegroundWindow()))
+ {
+ entry.Value.SetSize(sync_size);
+ }
+ }
+
+ }
+
+ }
+
+
+ public void UpdatePreviewPosition(string preview_title, Point position)
+ {
+
+ if (Properties.Settings.Default.unique_layout)
+ {
+ Dictionary layout;
+ if (_uniqueLayouts.TryGetValue(_activeClientTitle, out layout))
+ {
+ layout[preview_title] = position;
+ }
+ else if (_activeClientTitle == "")
+ {
+ _uniqueLayouts[_activeClientTitle] = new Dictionary();
+ _uniqueLayouts[_activeClientTitle][preview_title] = position;
+ }
+ }
+ else
+ {
+ _flatLayout[preview_title] = position;
+ }
+
+ }
+
+ private string remove_nonconform_xml_characters(string entry)
+ {
+ foreach (var kv in _xmlBadToOkChars)
+ {
+ entry = entry.Replace(kv.Key, kv.Value);
+ }
+ return entry;
+ }
+
+ private string restore_nonconform_xml_characters(string entry)
+ {
+ foreach (var kv in _xmlBadToOkChars)
+ {
+ entry = entry.Replace(kv.Value, kv.Key);
+ }
+ return entry;
+ }
+
+ private XElement MakeXElement(string input)
+ {
+ string clean = remove_nonconform_xml_characters(input).Replace(" ", "_");
+ return new XElement(clean);
+ }
+
+ private string ParseXElement(XElement input)
+ {
+ return restore_nonconform_xml_characters(input.Name.ToString()).Replace("_", " ");
+ }
+
+ private void load_layout()
+ {
+ if (File.Exists("layout.xml"))
+ {
+ XElement rootElement = XElement.Load("layout.xml");
+ foreach (var el in rootElement.Elements())
+ {
+ Dictionary inner = new Dictionary();
+ foreach (var inner_el in el.Elements())
+ {
+ inner[ParseXElement(inner_el)] = new Point(Convert.ToInt32(inner_el.Element("x")?.Value), Convert.ToInt32(inner_el.Element("y")?.Value));
+ }
+ _uniqueLayouts[ParseXElement(el)] = inner;
+ }
+ }
+
+ if (File.Exists("flat_layout.xml"))
+ {
+ XElement rootElement = XElement.Load("flat_layout.xml");
+ foreach (var el in rootElement.Elements())
+ {
+ _flatLayout[ParseXElement(el)] = new Point(Convert.ToInt32(el.Element("x").Value), Convert.ToInt32(el.Element("y").Value));
+ _flatLayoutShortcuts[ParseXElement(el)] = "";
+
+ if (el.Element("shortcut") != null)
+ {
+ _flatLayoutShortcuts[ParseXElement(el)] = el.Element("shortcut").Value;
+ }
+ }
+ }
+
+ if (File.Exists("client_layout.xml"))
+ {
+ XElement rootElement = XElement.Load("client_layout.xml");
+ foreach (var el in rootElement.Elements())
+ {
+ ClientLocation clientLocation = new ClientLocation();
+ clientLocation.X = Convert.ToInt32(el.Element("x").Value);
+ clientLocation.Y = Convert.ToInt32(el.Element("y").Value);
+ clientLocation.Width = Convert.ToInt32(el.Element("width").Value);
+ clientLocation.Height = Convert.ToInt32(el.Element("height").Value);
+
+ _clientLayout[ParseXElement(el)] = clientLocation;
+ }
+ }
+ }
+
+ private void store_layout()
+ {
+ XElement el = new XElement("layouts");
+ foreach (var client in _uniqueLayouts.Keys)
+ {
+ if (client == "")
+ {
+ continue;
+ }
+ XElement layout = MakeXElement(client);
+ foreach (var thumbnail_ in _uniqueLayouts[client])
+ {
+ string thumbnail = thumbnail_.Key;
+ if (thumbnail == "" || thumbnail == "...")
+ {
+ continue;
+ }
+ XElement position = MakeXElement(thumbnail);
+ position.Add(new XElement("x", thumbnail_.Value.X));
+ position.Add(new XElement("y", thumbnail_.Value.Y));
+ layout.Add(position);
+ }
+ el.Add(layout);
+ }
+
+ el.Save("layout.xml");
+
+ XElement el2 = new XElement("flat_layout");
+ foreach (var clientKV in _flatLayout)
+ {
+ if (clientKV.Key == "" || clientKV.Key == "...")
+ {
+ continue;
+ }
+ XElement layout = MakeXElement(clientKV.Key);
+ layout.Add(new XElement("x", clientKV.Value.X));
+ layout.Add(new XElement("y", clientKV.Value.Y));
+
+ string shortcut;
+ if (_flatLayoutShortcuts.TryGetValue(clientKV.Key, out shortcut))
+ {
+ layout.Add(new XElement("shortcut", shortcut));
+ }
+ el2.Add(layout);
+ }
+
+ el2.Save("flat_layout.xml");
+
+ XElement el3 = new XElement("client_layout");
+ foreach (var clientKV in _clientLayout)
+ {
+ if (clientKV.Key == "" || clientKV.Key == "...")
+ {
+ continue;
+ }
+ XElement layout = MakeXElement(clientKV.Key);
+ layout.Add(new XElement("x", clientKV.Value.X));
+ layout.Add(new XElement("y", clientKV.Value.Y));
+ layout.Add(new XElement("width", clientKV.Value.Width));
+ layout.Add(new XElement("height", clientKV.Value.Height));
+ el3.Add(layout);
+ }
+
+ el3.Save("client_layout.xml");
+ }
+
+ private void handle_unique_layout(IThumbnail thumbnailWindow, string last_known_active_window)
+ {
+ Dictionary layout;
+ if (_uniqueLayouts.TryGetValue(last_known_active_window, out layout))
+ {
+ Point new_loc;
+ if (Properties.Settings.Default.unique_layout && layout.TryGetValue(thumbnailWindow.GetLabel(), out new_loc))
+ {
+ thumbnailWindow.SetLocation(new_loc);
+ }
+ else
+ {
+ // create inner dict
+ layout[thumbnailWindow.GetLabel()] = thumbnailWindow.GetLocation();
+ }
+ }
+ else if (last_known_active_window != "")
+ {
+ // create outer dict
+ _uniqueLayouts[last_known_active_window] = new Dictionary();
+ _uniqueLayouts[last_known_active_window][thumbnailWindow.GetLabel()] = thumbnailWindow.GetLocation();
+ }
+ }
+
+ private void update_client_locations()
+ {
+ Process[] processes = Process.GetProcessesByName("ExeFile");
+ List processHandles = new List();
+
+ foreach (Process process in processes)
+ {
+ RECT rect = new RECT();
+ DwmApiNativeMethods.GetWindowRect(process.MainWindowHandle, out rect);
+
+ int left = Math.Abs(rect.Left);
+ int right = Math.Abs(rect.Right);
+ int client_width = Math.Abs(left - right);
+
+ int top = Math.Abs(rect.Top);
+ int bottom = Math.Abs(rect.Bottom);
+ int client_height = Math.Abs(top - bottom);
+
+ ClientLocation clientLocation = new ClientLocation();
+ clientLocation.X = rect.Left;
+ clientLocation.Y = rect.Top;
+ clientLocation.Width = client_width;
+ clientLocation.Height = client_height;
+
+
+ _clientLayout[process.MainWindowTitle] = clientLocation;
+ }
+ }
+
+ private void handle_flat_layout(IThumbnail thumbnailWindow)
+ {
+ Point layout;
+ if (_flatLayout.TryGetValue(thumbnailWindow.GetLabel(), out layout))
+ {
+ thumbnailWindow.SetLocation(layout);
+ }
+ else if (thumbnailWindow.GetLabel() != "")
+ {
+ _flatLayout[thumbnailWindow.GetLabel()] = thumbnailWindow.GetLocation();
+ }
+ }
+
+ private bool window_is_preview_or_client(IntPtr window)
+ {
+ bool active_window_is_right_type = false;
+ foreach (KeyValuePair entry in _previews)
+ {
+ if (entry.Key == window || entry.Value.IsPreviewHandle(window))
+ {
+ active_window_is_right_type = true;
+ }
+ }
+ return active_window_is_right_type;
+ }
+
+ public void refresh_thumbnails()
+ {
+
+ IntPtr active_window = DwmApiNativeMethods.GetForegroundWindow();
+
+ // hide, show, resize and move
+ foreach (KeyValuePair entry in _previews)
+ {
+ if (!window_is_preview_or_client(active_window) && Properties.Settings.Default.hide_all)
+ {
+ entry.Value.HideThumbnail();
+ }
+ else if (entry.Key == _activeClientHandle && Properties.Settings.Default.hide_active)
+ {
+ entry.Value.HideThumbnail();
+ }
+ else
+ {
+ entry.Value.ShowThumbnail();
+ if (Properties.Settings.Default.unique_layout)
+ {
+ handle_unique_layout(entry.Value, _activeClientTitle);
+ }
+ else
+ {
+ handle_flat_layout(entry.Value);
+ }
+ }
+ entry.Value.IsZoomEnabled = Properties.Settings.Default.zoom_on_hover;
+ entry.Value.IsOverlayEnabled = Properties.Settings.Default.show_overlay;
+ entry.Value.SetOpacity(Properties.Settings.Default.opacity);
+ }
+
+ DwmApiNativeMethods.DwmIsCompositionEnabled();
+ }
+
+ public void set_frames()
+ {
+ if (Properties.Settings.Default.show_thumb_frames)
+ {
+ _ignoringSizeSync.Stop();
+ _ignoringSizeSync.Reset();
+ _ignoringSizeSync.Start();
+ }
+
+ foreach (var thumbnail in _previews)
+ {
+ thumbnail.Value.SetWindowFrames(Properties.Settings.Default.show_thumb_frames);
+ }
+
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/Thumbnail/ThumbnailOverlay.Designer.cs b/Eve-O-Preview/Thumbnail/ThumbnailOverlay.Designer.cs
new file mode 100644
index 0000000..fee5bc5
--- /dev/null
+++ b/Eve-O-Preview/Thumbnail/ThumbnailOverlay.Designer.cs
@@ -0,0 +1,90 @@
+namespace EveOPreview
+{
+ partial class ThumbnailOverlay
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ System.Windows.Forms.PictureBox OverlayAreaPictureBox;
+ this.OverlayLabel = new System.Windows.Forms.Label();
+ OverlayAreaPictureBox = new System.Windows.Forms.PictureBox();
+ ((System.ComponentModel.ISupportInitialize)(OverlayAreaPictureBox)).BeginInit();
+ this.SuspendLayout();
+ //
+ // OverlayAreaPictureBox
+ //
+ OverlayAreaPictureBox.BackColor = System.Drawing.Color.Transparent;
+ OverlayAreaPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
+ OverlayAreaPictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
+ OverlayAreaPictureBox.Location = new System.Drawing.Point(0, 0);
+ OverlayAreaPictureBox.Name = "OverlayAreaPictureBox";
+ OverlayAreaPictureBox.Size = new System.Drawing.Size(284, 262);
+ OverlayAreaPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
+ OverlayAreaPictureBox.TabIndex = 0;
+ OverlayAreaPictureBox.TabStop = false;
+ OverlayAreaPictureBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OverlayArea_Click);
+ //
+ // OverlayLabel
+ //
+ this.OverlayLabel.AutoSize = true;
+ this.OverlayLabel.Dock = System.Windows.Forms.DockStyle.Top;
+ this.OverlayLabel.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.OverlayLabel.ForeColor = System.Drawing.Color.DarkGray;
+ this.OverlayLabel.Location = new System.Drawing.Point(0, 0);
+ this.OverlayLabel.Name = "OverlayLabel";
+ this.OverlayLabel.Size = new System.Drawing.Size(25, 13);
+ this.OverlayLabel.TabIndex = 1;
+ this.OverlayLabel.Text = "...";
+ //
+ // PreviewOverlay
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.Color.Black;
+ this.ClientSize = new System.Drawing.Size(284, 262);
+ this.ControlBox = false;
+ this.Controls.Add(this.OverlayLabel);
+ this.Controls.Add(OverlayAreaPictureBox);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "ThumbnailOverlay";
+ this.ShowIcon = false;
+ this.ShowInTaskbar = false;
+ this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
+ this.Text = "PreviewOverlay";
+ this.TransparencyKey = System.Drawing.Color.Black;
+ ((System.ComponentModel.ISupportInitialize)(OverlayAreaPictureBox)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label OverlayLabel;
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/Thumbnail/ThumbnailOverlay.cs b/Eve-O-Preview/Thumbnail/ThumbnailOverlay.cs
new file mode 100644
index 0000000..434b648
--- /dev/null
+++ b/Eve-O-Preview/Thumbnail/ThumbnailOverlay.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Windows.Forms;
+
+namespace EveOPreview
+{
+ public partial class ThumbnailOverlay : Form
+ {
+ private readonly Action