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 _areaClickAction; + + public ThumbnailOverlay(Action areaClickAction) + { + this._areaClickAction = areaClickAction; + InitializeComponent(); + } + + private void OverlayArea_Click(object sender, MouseEventArgs e) + { + this._areaClickAction(sender, e); + } + + public void SetOverlayLabel(string label) + { + this.OverlayLabel.Text = label; + } + + protected override CreateParams CreateParams + { + get + { + var Params = base.CreateParams; + Params.ExStyle |= (int)DwmApiNativeMethods.WS_EX_TOOLWINDOW; + return Params; + } + } + } +} diff --git a/PreviewOverlay.resx b/Eve-O-Preview/Thumbnail/ThumbnailOverlay.resx similarity index 94% rename from PreviewOverlay.resx rename to Eve-O-Preview/Thumbnail/ThumbnailOverlay.resx index 29dcb1b..6a0cc5e 100644 --- a/PreviewOverlay.resx +++ b/Eve-O-Preview/Thumbnail/ThumbnailOverlay.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + False + \ No newline at end of file diff --git a/Eve-O-Preview/Thumbnail/ThumbnailWindow.Designer.cs b/Eve-O-Preview/Thumbnail/ThumbnailWindow.Designer.cs new file mode 100644 index 0000000..0134590 --- /dev/null +++ b/Eve-O-Preview/Thumbnail/ThumbnailWindow.Designer.cs @@ -0,0 +1,68 @@ +namespace EveOPreview +{ + partial class ThumbnailWindow + { + /// + /// Required designer variable. + /// + + #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() + { + this.RenderAreaPictureBox = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.RenderAreaPictureBox)).BeginInit(); + this.SuspendLayout(); + // + // RenderAreaPictureBox + // + this.RenderAreaPictureBox.BackColor = System.Drawing.Color.Transparent; + this.RenderAreaPictureBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.RenderAreaPictureBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.RenderAreaPictureBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.RenderAreaPictureBox.Location = new System.Drawing.Point(0, 0); + this.RenderAreaPictureBox.Margin = new System.Windows.Forms.Padding(0); + this.RenderAreaPictureBox.Name = "RenderAreaPictureBox"; + this.RenderAreaPictureBox.Size = new System.Drawing.Size(153, 89); + this.RenderAreaPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.RenderAreaPictureBox.TabIndex = 0; + this.RenderAreaPictureBox.TabStop = false; + this.RenderAreaPictureBox.MouseLeave += new System.EventHandler(this.Preview_MouseLeave); + this.RenderAreaPictureBox.MouseHover += new System.EventHandler(this.Preview_MouseHover); + this.RenderAreaPictureBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Preview_Click); + // + // Preview + // + this.AccessibleRole = System.Windows.Forms.AccessibleRole.None; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(153, 89); + this.ControlBox = false; + this.Controls.Add(this.RenderAreaPictureBox); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(64, 64); + this.Name = "ThumbnailWindow"; + this.Opacity = 0.1D; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.Text = "Preview"; + this.TopMost = true; + ((System.ComponentModel.ISupportInitialize)(this.RenderAreaPictureBox)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.PictureBox RenderAreaPictureBox; + + + } +} \ No newline at end of file diff --git a/Eve-O-Preview/Thumbnail/ThumbnailWindow.cs b/Eve-O-Preview/Thumbnail/ThumbnailWindow.cs new file mode 100644 index 0000000..1f24b27 --- /dev/null +++ b/Eve-O-Preview/Thumbnail/ThumbnailWindow.cs @@ -0,0 +1,437 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace EveOPreview +{ + public partial class ThumbnailWindow : Form, IThumbnail + { + #region Private fields + private readonly bool _isInitializing; + private readonly IntPtr _sourceWindow; + private readonly ThumbnailManager _manager; + private readonly ThumbnailOverlay _overlay; + private Hotkey _hotkey; // This field stores the hotkey reference + + private Size _baseSize; + private Point _basePosition; + + private bool _isThumbnailSetUp; + private DWM_THUMBNAIL_PROPERTIES _Thumbnail; + private IntPtr _ThumbnailHandle; + + private bool _ignoreMouseOverEvent; + private bool _isHoverEffectActive; + private bool _isZoomActive; + #endregion + + // This constructor should never be used directly + public ThumbnailWindow(ThumbnailManager manager, IntPtr sourceWindow, string title, Size size) + { + this._isInitializing = true; + + this.IsPreviewEnabled = true; + this.IsOverlayEnabled = true; + + this._sourceWindow = sourceWindow; + this._manager = manager; + + this._isThumbnailSetUp = false; + this._ignoreMouseOverEvent = false; + this._isHoverEffectActive = false; + this._isZoomActive = false; + + InitializeComponent(); + + this.Text = title; + + this._overlay = new ThumbnailOverlay(this.Preview_Click); + + this._isInitializing = false; + + this.SetSize(size); + } + + public bool IsZoomEnabled { get; set; } + + public bool IsPreviewEnabled { get; set; } + + public bool IsOverlayEnabled { get; set; } + + public bool IsPreviewHandle(IntPtr handle) + { + return (this.Handle == handle) || (this._overlay.Handle == handle); + } + + public void ShowThumbnail() + { + if (this.IsPreviewEnabled) + { + this.Show(); + if (this.IsOverlayEnabled) + { + this._overlay.Show(); + this.MakeOverlayTopMost(); + } + else + { + this._overlay.Hide(); + } + } + else + { + this.HideThumbnail(); + } + } + + public void HideThumbnail() + { + this.Hide(); + this._overlay.Hide(); + } + + public void CloseThumbnail() + { + this._overlay.Close(); + this.Close(); + } + + public void SetLabel(string label) + { + this.Text = label; + this._overlay.SetOverlayLabel(label); + } + + public string GetLabel() + { + return this.Text; + } + + public void SetSize(Size size) + { + this.Size = size; + this._baseSize = this.Size; + this._basePosition = this.Location; + } + + public void SetLocation(Point location) + { + if (!(this._isInitializing || this._ignoreMouseOverEvent)) + { + this.Location = location; + } + + this.RefreshPreview(); + } + + public Point GetLocation() + { + return this.Location; + } + + public void SetOpacity(double opacity) + { + if (this._isHoverEffectActive) + { + return; + } + + this.Opacity = opacity; + } + + public void RegisterShortcut(string shortcut) + { + if (String.IsNullOrEmpty(shortcut)) + { + return; + } + + KeysConverter converter = new KeysConverter(); + object keysObject = converter.ConvertFrom(shortcut); + if (keysObject == null) + { + return; + } + + Keys key = (Keys)keysObject; + + Hotkey hotkey = new Hotkey(); + + if ((key & Keys.Shift) == Keys.Shift) + { + hotkey.Shift = true; + } + + if ((key & Keys.Alt) == Keys.Alt) + { + hotkey.Alt = true; + } + + if ((key & Keys.Control) == Keys.Control) + { + hotkey.Control = true; + } + + key = key & ~Keys.Shift & ~Keys.Alt & ~Keys.Control; + hotkey.KeyCode = key; + hotkey.Pressed += Hotkey_Pressed; + hotkey.Register(this); + + this._hotkey = hotkey; + } + + public void SetTopMost(bool topmost) + { + if (!this.IsPreviewEnabled) + { + return; + } + + this.TopMost = topmost; + this.MakeOverlayTopMost(); + } + + public void SetWindowFrames(bool enable) + { + this.FormBorderStyle = enable ? FormBorderStyle.SizableToolWindow : FormBorderStyle.None; + } + + protected override CreateParams CreateParams + { + get + { + var Params = base.CreateParams; + Params.ExStyle |= (int)DwmApiNativeMethods.WS_EX_TOOLWINDOW; + return Params; + } + } + + private void Preview_MouseHover(object sender, EventArgs e) + { + if (!this._ignoreMouseOverEvent) + { + this._ignoreMouseOverEvent = true; + if (this.IsZoomEnabled) + { + this.ZoomIn(); + } + + this.SetTopMost(true); + } + + this.Opacity = 1.0f; + this._isHoverEffectActive = true; + + this.RefreshPreview(); + } + + private void Preview_MouseLeave(object sender, EventArgs e) + { + if (this._ignoreMouseOverEvent) + { + if (this.IsZoomEnabled) + { + this.ZoomOut(); + } + + this._ignoreMouseOverEvent = false; + } + + this._isHoverEffectActive = false; + this.Opacity = Properties.Settings.Default.opacity; // TODO Use local object + + this.RefreshPreview(); + } + + private void Preview_Click(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { + this.ActivateClient(); + this._manager.NotifyPreviewSwitch(); + } + + if (e.Button == MouseButtons.Right) + { + // do smth cool? + } + + if (e.Button == MouseButtons.Middle) + { + // do smth cool? + } + } + + private void Hotkey_Pressed(Object sender, EventArgs e) + { + this.ActivateClient(); + this._manager.NotifyPreviewSwitch(); + } + + protected override void OnResize(EventArgs e) + { + this.RefreshPreview(); + + base.OnResize(e); + + if (!(this._isInitializing || this._ignoreMouseOverEvent)) + { + this._manager.SyncPreviewSize(this.Size); + } + } + + protected override void OnMove(EventArgs e) + { + base.OnMove(e); + + if (!(this._isInitializing || this._ignoreMouseOverEvent)) + { + this._manager.UpdatePreviewPosition(this.Text, this.Location); + } + + this.RefreshPreview(); + } + + private void MakeOverlayTopMost() + { + this._overlay.TopMost = true; + } + + private void RefreshPreview() + { + if (this._isInitializing) + { + return; + } + + if (DwmApiNativeMethods.DwmIsCompositionEnabled()) + { + if (this._isThumbnailSetUp == false) + { + this.SetUpThumbnail(); + } + + this._Thumbnail.rcDestination = new RECT(0, 0, this.ClientRectangle.Right, this.ClientRectangle.Bottom); + DwmApiNativeMethods.DwmUpdateThumbnailProperties(this._ThumbnailHandle, this._Thumbnail); + } + else + { + this._isThumbnailSetUp = false; + } + + Size overlaySize = this.RenderAreaPictureBox.Size; + overlaySize.Width -= 2 * 5; + overlaySize.Height -= 2 * 5; + + Point overlayLocation = this.Location; + overlayLocation.X += 5 + (this.Size.Width - this.RenderAreaPictureBox.Size.Width) / 2; + overlayLocation.Y += 5 + (this.Size.Height - this.RenderAreaPictureBox.Size.Height) - (this.Size.Width - this.RenderAreaPictureBox.Size.Width) / 2; + + this._overlay.Size = overlaySize; + this._overlay.Location = overlayLocation; + } + + private void SetUpThumbnail() + { + if (this._isThumbnailSetUp || !DwmApiNativeMethods.DwmIsCompositionEnabled()) + { + return; + } + + this._ThumbnailHandle = DwmApiNativeMethods.DwmRegisterThumbnail(this.Handle, this._sourceWindow); + + this._Thumbnail = new DWM_THUMBNAIL_PROPERTIES(); + this._Thumbnail.dwFlags = DWM_TNP_CONSTANTS.DWM_TNP_VISIBLE + + DWM_TNP_CONSTANTS.DWM_TNP_OPACITY + + DWM_TNP_CONSTANTS.DWM_TNP_RECTDESTINATION + + DWM_TNP_CONSTANTS.DWM_TNP_SOURCECLIENTAREAONLY; + this._Thumbnail.opacity = 255; + this._Thumbnail.fVisible = true; + this._Thumbnail.fSourceClientAreaOnly = true; + this._Thumbnail.rcDestination = new RECT(0, 0, this.ClientRectangle.Right, this.ClientRectangle.Bottom); + + DwmApiNativeMethods.DwmUpdateThumbnailProperties(this._ThumbnailHandle, this._Thumbnail); + + this._isThumbnailSetUp = true; + } + + private void ZoomIn() + { + if (this._isZoomActive) + { + return; + } + + this._isZoomActive = true; + + // TODO Use global settings object + float zoomFactor = Properties.Settings.Default.zoom_amount; + + this._baseSize = this.Size; + this._basePosition = this.Location; + + this.Size = new Size((int)(zoomFactor * this.Size.Width), (int)(zoomFactor * this.Size.Height)); + + // TODO Use global settings object + switch ((ZoomAnchor)Properties.Settings.Default.zoom_anchor) + { + case ZoomAnchor.NW: + break; + case ZoomAnchor.N: + this.Location = new Point(this.Location.X - this.Size.Width / 2 + this._baseSize.Width / 2, this.Location.Y); + break; + case ZoomAnchor.NE: + this.Location = new Point(this.Location.X - this.Size.Width + this._baseSize.Width, this.Location.Y); + break; + + case ZoomAnchor.W: + this.Location = new Point(this.Location.X, this.Location.Y - this.Size.Height / 2 + this._baseSize.Height / 2); + break; + case ZoomAnchor.C: + this.Location = new Point(this.Location.X - this.Size.Width / 2 + this._baseSize.Width / 2, this.Location.Y - this.Size.Height / 2 + this._baseSize.Height / 2); + break; + case ZoomAnchor.E: + this.Location = new Point(this.Location.X - this.Size.Width + this._baseSize.Width, this.Location.Y - this.Size.Height / 2 + this._baseSize.Height / 2); + break; + + case ZoomAnchor.SW: + this.Location = new Point(this.Location.X, this.Location.Y - this.Size.Height + this._baseSize.Height); + break; + case ZoomAnchor.S: + this.Location = new Point(this.Location.X - this.Size.Width / 2 + this._baseSize.Width / 2, this.Location.Y - this.Size.Height + this._baseSize.Height); + break; + case ZoomAnchor.SE: + this.Location = new Point(this.Location.X - this.Size.Width + this._baseSize.Width, this.Location.Y - this.Size.Height + this._baseSize.Height); + break; + } + } + + private void ZoomOut() + { + if (!this._isZoomActive) + { + return; + } + + this.Size = this._baseSize; + this.Location = this._basePosition; + + this._isZoomActive = false; + } + + private void ActivateClient() + { + DwmApiNativeMethods.SetForegroundWindow(this._sourceWindow); + + int style = DwmApiNativeMethods.GetWindowLong(this._sourceWindow, DwmApiNativeMethods.GWL_STYLE); + if ((style & DwmApiNativeMethods.WS_MAXIMIZE) == DwmApiNativeMethods.WS_MAXIMIZE) + { + // Client is already maximized, no action is required + } + else if ((style & DwmApiNativeMethods.WS_MINIMIZE) == DwmApiNativeMethods.WS_MINIMIZE) + { + DwmApiNativeMethods.ShowWindowAsync(this._sourceWindow, DwmApiNativeMethods.SW_SHOWNORMAL); + } + } + } +} \ No newline at end of file diff --git a/Preview.resx b/Eve-O-Preview/Thumbnail/ThumbnailWindow.resx similarity index 100% rename from Preview.resx rename to Eve-O-Preview/Thumbnail/ThumbnailWindow.resx diff --git a/app.config b/Eve-O-Preview/app.config similarity index 100% rename from app.config rename to Eve-O-Preview/app.config diff --git a/icon.ico b/Eve-O-Preview/icon.ico similarity index 100% rename from icon.ico rename to Eve-O-Preview/icon.ico diff --git a/ExeFile/.gitignore b/ExeFile/.gitignore deleted file mode 100644 index a6ff838..0000000 --- a/ExeFile/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -bin/* -obj/* -*.suo diff --git a/ExeFile/.hgignore b/ExeFile/.hgignore deleted file mode 100644 index 59bc062..0000000 --- a/ExeFile/.hgignore +++ /dev/null @@ -1,3 +0,0 @@ -syntax: glob -bin/* -obj/* diff --git a/ExeFile/App.xaml.cs b/ExeFile/App.xaml.cs deleted file mode 100644 index d0cd6a4..0000000 --- a/ExeFile/App.xaml.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; -using System.Windows; - -namespace ExeFile -{ - /// - /// Interaction logic for App.xaml - /// - public partial class App : Application - { - } -} diff --git a/ExeFile/MainWindow.xaml.cs b/ExeFile/MainWindow.xaml.cs deleted file mode 100644 index aff17db..0000000 --- a/ExeFile/MainWindow.xaml.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace ExeFile -{ - /// - /// Interaction logic for MainWindow.xaml - /// - 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((byte)255, - (byte)random.Next(0, 255), - (byte)random.Next(0, 255), - (byte)random.Next(0, 255) - ) - ); - } - } -} diff --git a/ExeFile/Properties/AssemblyInfo.cs b/ExeFile/Properties/AssemblyInfo.cs deleted file mode 100644 index 9ffcdf9..0000000 --- a/ExeFile/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ExeFile")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ExeFile")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[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) -)] - - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Hotkey.cs b/Hotkey.cs deleted file mode 100644 index 96d3853..0000000 --- a/Hotkey.cs +++ /dev/null @@ -1,302 +0,0 @@ -using System; -using System.Windows.Forms; -using System.ComponentModel; -using System.Xml.Serialization; -using System.Runtime.InteropServices; - -namespace MovablePython -{ - public class Hotkey : IMessageFilter - { - #region Interop - - [DllImport("user32.dll", SetLastError = true)] - private static extern int RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, Keys vk); - - [DllImport("user32.dll", SetLastError=true)] - private static extern int UnregisterHotKey(IntPtr hWnd, int id); - - private const uint WM_HOTKEY = 0x312; - - private const uint MOD_ALT = 0x1; - private const uint MOD_CONTROL = 0x2; - private const uint MOD_SHIFT = 0x4; - private const uint MOD_WIN = 0x8; - - private const uint ERROR_HOTKEY_ALREADY_REGISTERED = 1409; - - #endregion - - private static int currentID; - private const int maximumID = 0xBFFF; - - private Keys keyCode; - private bool shift; - private bool control; - private bool alt; - private bool windows; - - [XmlIgnore] - private int id; - [XmlIgnore] - private bool registered; - [XmlIgnore] - private Control windowControl; - - public event HandledEventHandler Pressed; - - public Hotkey() : this(Keys.None, false, false, false, false) - { - // No work done here! - } - - 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.Registered) - { 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)) - { return false; } - - // Unregister and say we managed it - this.Unregister(); - return true; - } - catch (Win32Exception) - { return false; } - catch (NotSupportedException) - { return false; } - } - - public bool Register(Control windowControl) - { - // Check that we have not registered - if (this.registered) - { throw new NotSupportedException("You cannot register a hotkey that is already registered"); } - - // We can't register an empty hotkey - if (this.Empty) - { 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.maximumID; - - // Translate modifier keys into unmanaged version - uint modifiers = (this.Alt ? Hotkey.MOD_ALT : 0) | (this.Control ? Hotkey.MOD_CONTROL : 0) | - (this.Shift ? Hotkey.MOD_SHIFT : 0) | (this.Windows ? Hotkey.MOD_WIN : 0); - - // Register the hotkey - if (Hotkey.RegisterHotKey(windowControl.Handle, this.id, modifiers, keyCode) == 0) - { - // Is the error that the hotkey is registered? - if (Marshal.GetLastWin32Error() == ERROR_HOTKEY_ALREADY_REGISTERED) - { return false; } - else - { throw new Win32Exception(); } - } - - // Save the control reference and register state - this.registered = true; - this.windowControl = windowControl; - - // We successfully registered - return true; - } - - public void Unregister() - { - // Check that we have registered - if (!this.registered) - { 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 (Hotkey.UnregisterHotKey(this.windowControl.Handle, this.id) == 0) - { throw new Win32Exception(); } - } - - // Clear the control reference and register state - this.registered = false; - this.windowControl = null; - } - - private void Reregister() - { - // Only do something if the key is already registered - if (!this.registered) - { 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 != Hotkey.WM_HOTKEY) - { return false; } - - // Check that the ID is our key and we are registerd - if (this.registered && (message.WParam.ToInt32() == this.id)) - { - // Fire the event and pass on the event if our handlers didn't handle it - return this.OnPressed(); - } - else - { return false; } - } - - private bool OnPressed() - { - // Fire the event if we can - HandledEventArgs handledEventArgs = new HandledEventArgs(false); - if (this.Pressed != null) - { this.Pressed(this, handledEventArgs); } - - // Return whether we handled the event or not - return handledEventArgs.Handled; - } - - public override string ToString() - { - // We can be empty - if (this.Empty) - { 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; - default: - // Leave everything alone - 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 Empty - { - get { return this.keyCode == Keys.None; } - } - - public bool Registered - { - get { return this.registered; } - } - - 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(); - } - } - } -} diff --git a/Preview.Designer.cs b/Preview.Designer.cs deleted file mode 100644 index 96889e3..0000000 --- a/Preview.Designer.cs +++ /dev/null @@ -1,67 +0,0 @@ -namespace PreviewToy -{ - partial class Preview - { - /// - /// Required designer variable. - /// - - #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() - { - this.render_area = new System.Windows.Forms.PictureBox(); - ((System.ComponentModel.ISupportInitialize)(this.render_area)).BeginInit(); - this.SuspendLayout(); - // - // render_area - // - this.render_area.BackColor = System.Drawing.Color.Transparent; - this.render_area.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.render_area.Cursor = System.Windows.Forms.Cursors.Hand; - this.render_area.Dock = System.Windows.Forms.DockStyle.Fill; - this.render_area.Location = new System.Drawing.Point(0, 0); - this.render_area.Margin = new System.Windows.Forms.Padding(0); - this.render_area.Name = "render_area"; - this.render_area.Size = new System.Drawing.Size(153, 89); - this.render_area.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.render_area.TabIndex = 0; - this.render_area.TabStop = false; - this.render_area.MouseUp += new System.Windows.Forms.MouseEventHandler(this.render_area_Click); - // - // Preview - // - this.AccessibleRole = System.Windows.Forms.AccessibleRole.None; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(153, 89); - this.ControlBox = false; - this.Controls.Add(this.render_area); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(64, 64); - this.Name = "Preview"; - this.Opacity = 0.1D; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.Text = "Preview"; - this.TopMost = true; - this.Load += new System.EventHandler(this.Preview_Load); - ((System.ComponentModel.ISupportInitialize)(this.render_area)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.PictureBox render_area; - - - } -} \ No newline at end of file diff --git a/Preview.cs b/Preview.cs deleted file mode 100644 index ce25712..0000000 --- a/Preview.cs +++ /dev/null @@ -1,355 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using System.Runtime.InteropServices; -using System.Diagnostics; -using MovablePython; - -namespace PreviewToy -{ - public partial class Preview : Form - { - public bool show_overlay = true; - public bool hover_zoom = true; - public bool is_zoomed = false; - public bool is_hovered_over = false; - - private bool mouse_over_lock = false; - private Size old_size; - private Point old_position; - - private IntPtr m_hThumbnail; - public IntPtr sourceWindow; - private DwmApi.DWM_THUMBNAIL_PROPERTIES m_ThumbnailProperties; - private bool has_been_set_up = false; - private bool thumbnail_has_been_set_up = false; - private PreviewToyHandler spawner; - private Hotkey hotkey; - - private bool hide = false; - - public PreviewOverlay overlay; - - public void MakeHidden(bool wha) - { - hide = wha; - } - - public override string ToString() - { - return this.Text; - } - - - - public void MakeTopMost(bool topmost) - { - this.TopMost = topmost && !(this.hide); - } - - public Preview(IntPtr sourceWindow, String title, PreviewToyHandler spawner, Size size) - { - has_been_set_up = false; - - this.sourceWindow = sourceWindow; - this.spawner = spawner; - - InitializeComponent(); - - this.Text = title; - - this.overlay = new PreviewOverlay(this); - - this.render_area.MouseHover += new System.EventHandler(this.preview_MouseHover); - this.render_area.MouseLeave += new System.EventHandler(this.preview_MouseLeave); - - this.old_size = this.Size; - this.old_position = this.Location; - - has_been_set_up = true; - - - } - - public void preview_MouseHover(object sender, System.EventArgs e) - { - if (!mouse_over_lock) - { - mouse_over_lock = true; - if (hover_zoom) - doZoom(); - - TopMost = true; - overlay.TopMost = true; - } - this.Opacity = 1.0f; - this.is_hovered_over = true; - RefreshPreview(); - } - - protected override CreateParams CreateParams - { - get - { - var Params = base.CreateParams; - Params.ExStyle |= 0x80; - return Params; - } - } - - public void registerShortcut(string shortcut) - { - if (shortcut == "") - return; - var cvt = new KeysConverter(); - var key = (Keys)cvt.ConvertFrom(shortcut); - - Hotkey hotkey = new Hotkey(); - - if ((key & Keys.Shift) == Keys.Shift) - { - hotkey.Shift = true; - } - if ((key & Keys.Alt) == Keys.Alt) - { - hotkey.Alt = true; - } - if ((key & Keys.Control) == Keys.Control) - { - hotkey.Control = true; - } - - key = key & ~Keys.Shift & ~Keys.Alt & ~Keys.Control; - hotkey.KeyCode = key; - hotkey.Register(this); - hotkey.Pressed += delegate { bring_client_to_foreground(); spawner.preview_did_switch(); }; - - this.hotkey = hotkey; - } - - public void doZoom() - { - if (is_zoomed) - return; - - is_zoomed = true; - - float hover_zoom_factor = Properties.Settings.Default.zoom_amount; - - old_size = Size; - old_position = Location; - - Size = new Size((int)(hover_zoom_factor * (float)Size.Width), (int)(hover_zoom_factor * (float)Size.Height)); - - switch ((PreviewToyHandler.zoom_anchor_t)Properties.Settings.Default.zoom_anchor) - { - case (PreviewToyHandler.zoom_anchor_t.NW): - break; - case (PreviewToyHandler.zoom_anchor_t.N): - Location = new Point(Location.X - Size.Width / 2 + old_size.Width / 2, Location.Y); - break; - case (PreviewToyHandler.zoom_anchor_t.NE): - Location = new Point(Location.X - Size.Width + old_size.Width, Location.Y); - break; - - case (PreviewToyHandler.zoom_anchor_t.W): - Location = new Point(Location.X, Location.Y - Size.Height / 2 + old_size.Height / 2); - break; - case (PreviewToyHandler.zoom_anchor_t.C): - Location = new Point(Location.X - Size.Width / 2 + old_size.Width / 2, Location.Y - Size.Height / 2 + old_size.Height / 2); - break; - case (PreviewToyHandler.zoom_anchor_t.E): - Location = new Point(Location.X - Size.Width + old_size.Width, Location.Y - Size.Height / 2 + old_size.Height / 2); - break; - - case (PreviewToyHandler.zoom_anchor_t.SW): - Location = new Point(Location.X, Location.Y - Size.Height + old_size.Height); - break; - case (PreviewToyHandler.zoom_anchor_t.S): - Location = new Point(Location.X - Size.Width / 2 + old_size.Width / 2, Location.Y - Size.Height + old_size.Height); - break; - case (PreviewToyHandler.zoom_anchor_t.SE): - Location = new Point(Location.X - Size.Width + old_size.Width, Location.Y - Size.Height + old_size.Height); - break; - } - } - - public void restoreZoom() - { - if (!is_zoomed) - return; - - Size = old_size; - Location = old_position; - is_zoomed = false; - } - - public void preview_MouseLeave(object sender, System.EventArgs e) - { - if (mouse_over_lock) - { - if (hover_zoom) - { - restoreZoom(); - } - mouse_over_lock = false; - } - this.is_hovered_over = false; - this.Opacity = Properties.Settings.Default.opacity; - RefreshPreview(); - } - - protected override void OnResize(EventArgs e) - { - RefreshPreview(); - base.OnResize(e); - if (has_been_set_up && !mouse_over_lock) - this.spawner.syncronize_preview_size(this.Size); - } - - protected override void OnMove(EventArgs e) - { - base.OnMove(e); - if (has_been_set_up && !mouse_over_lock) - this.spawner.register_preview_position(this.Text, this.Location); - - RefreshPreview(); - } - - public void doMove(Point position) - { - if (has_been_set_up && !mouse_over_lock) - Location = position; - - RefreshPreview(); - } - - public void SetLabel(String label) - { - this.Text = label; - this.overlay.client_label.Text = label; - } - - public void RefreshPreview() - { - if (has_been_set_up) - { - if (DwmApi.DwmIsCompositionEnabled()) - { - if (thumbnail_has_been_set_up == false) - { - this.SetUpThumbnail(); - } - m_ThumbnailProperties.rcDestination = new DwmApi.RECT(0, 0, ClientRectangle.Right, ClientRectangle.Bottom); - DwmApi.DwmUpdateThumbnailProperties(m_hThumbnail, m_ThumbnailProperties); - } - else - { - thumbnail_has_been_set_up = false; - } - - Size overlay_size = this.render_area.Size; - overlay_size.Width -= 2 * 5; - overlay_size.Height -= 2 * 5; - - Point overlay_location = this.Location; - overlay_location.X += 5 + (this.Size.Width - this.render_area.Size.Width) / 2; - overlay_location.Y += 5 + (this.Size.Height - this.render_area.Size.Height) - (this.Size.Width - this.render_area.Size.Width) / 2; - - this.overlay.Size = overlay_size; - this.overlay.Location = overlay_location; - - } - } - - new public void Show() - { - if (!hide) - { - base.Show(); - if (show_overlay) - this.overlay.Show(); - else - this.overlay.Hide(); - } - else - { - this.Hide(); - this.overlay.Hide(); - } - } - - new public void Hide() - { - base.Hide(); - this.overlay.Hide(); - } - - private void SetUpThumbnail() - { - if (DwmApi.DwmIsCompositionEnabled() && !thumbnail_has_been_set_up) - { - m_hThumbnail = DwmApi.DwmRegisterThumbnail(this.Handle, sourceWindow); - - m_ThumbnailProperties = new DwmApi.DWM_THUMBNAIL_PROPERTIES(); - m_ThumbnailProperties.dwFlags = DwmApi.DWM_THUMBNAIL_PROPERTIES.DWM_TNP_VISIBLE - + DwmApi.DWM_THUMBNAIL_PROPERTIES.DWM_TNP_OPACITY - + DwmApi.DWM_THUMBNAIL_PROPERTIES.DWM_TNP_RECTDESTINATION - + DwmApi.DWM_THUMBNAIL_PROPERTIES.DWM_TNP_SOURCECLIENTAREAONLY; - m_ThumbnailProperties.opacity = 255; - m_ThumbnailProperties.fVisible = true; - m_ThumbnailProperties.fSourceClientAreaOnly = true; - m_ThumbnailProperties.rcDestination = new DwmApi.RECT(0, 0, ClientRectangle.Right, ClientRectangle.Bottom); - - DwmApi.DwmUpdateThumbnailProperties(m_hThumbnail, m_ThumbnailProperties); - - thumbnail_has_been_set_up = true; - } - } - - private void Preview_Load(object sender, EventArgs e) - { - - } - - public void bring_client_to_foreground() - { - DwmApi.SetForegroundWindow(sourceWindow); - int style = DwmApi.GetWindowLong(sourceWindow, DwmApi.GWL_STYLE); - if ((style & DwmApi.WS_MAXIMIZE) == DwmApi.WS_MAXIMIZE) - { - //It's maximized - } - else if ((style & DwmApi.WS_MINIMIZE) == DwmApi.WS_MINIMIZE) - { - DwmApi.ShowWindowAsync(sourceWindow, DwmApi.SW_SHOWNORMAL); - } - } - - public void render_area_Click(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Left) - { - bring_client_to_foreground(); - spawner.preview_did_switch(); - } - if (e.Button == MouseButtons.Right) - { - // do smth cool? - } - if (e.Button == MouseButtons.Middle) - { - // do smth cool? - } - } - - public void set_render_area_size(Size size) - { - this.Size = size; - } - - } -} \ No newline at end of file diff --git a/PreviewHandler.cs b/PreviewHandler.cs deleted file mode 100644 index 7c46fec..0000000 --- a/PreviewHandler.cs +++ /dev/null @@ -1,948 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Text; -using System.Windows.Forms; -using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Drawing.Text; -using System.Windows.Threading; -using System.Xml.Linq; -using System.Linq; - -using System.IO; - -namespace PreviewToy -{ - - public partial class PreviewToyHandler : Form - { - private const int WM_SIZE = 5; - private const int SIZE_RESTORED = 0; - private const int SIZE_MINIMIZED = 1; - private const int SIZE_MAXIMIZED = 2; - private const int SIZE_MAXSHOW = 3; - private const int SIZE_MAXHIDE = 4; - - public event EventHandler Minimized; - public event EventHandler Maximized; - public event EventHandler Restored; - - - private Dictionary previews; - private DispatcherTimer dispatcherTimer; - - private IntPtr active_client_handle = (IntPtr)0; - private String active_client_title = ""; - - private Dictionary> unique_layouts; - private Dictionary flat_layout; - private Dictionary flat_layout_shortcuts; - private Dictionary client_layout; - - private bool is_initialized; - - private Stopwatch ignoring_size_sync; - - Dictionary xml_bad_to_ok_chars; - - [DllImport("user32.dll")] - private 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); - - private struct Rect - { - public int Left; - public int Top; - public int Right; - public int Bottom; - } - - private struct ClientLocation - { - public int X; - public int Y; - public int Width; - public int Height; - } - - public enum zoom_anchor_t - { - NW = 0, - N, - NE, - W, - C, - E, - SW, - S, - SE - }; - - private Dictionary zoom_anchor_button_map; - - public PreviewToyHandler() - { - is_initialized = false; - - previews = new Dictionary(); - - xml_bad_to_ok_chars = new Dictionary(); - xml_bad_to_ok_chars["<"] = "---lt---"; - xml_bad_to_ok_chars["&"] = "---amp---"; - xml_bad_to_ok_chars[">"] = "---gt---"; - xml_bad_to_ok_chars["\""] = "---quot---"; - xml_bad_to_ok_chars["\'"] = "---apos---"; - xml_bad_to_ok_chars[","] = "---comma---"; - xml_bad_to_ok_chars["."] = "---dot---"; - - unique_layouts = new Dictionary>(); - flat_layout = new Dictionary(); - flat_layout_shortcuts = new Dictionary(); - client_layout = new Dictionary(); - - ignoring_size_sync = new Stopwatch(); - ignoring_size_sync.Start(); - - InitializeComponent(); - init_options(); - - // DispatcherTimer setup - dispatcherTimer = new DispatcherTimer(); - dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); - dispatcherTimer.Interval = new TimeSpan(0, 0, 1); - dispatcherTimer.Start(); - - is_initialized = true; - - previews_check_listbox.DisplayMember = "Text"; - - } - - - private void GlassForm_Load(object sender, EventArgs e) - { - refresh_thumbnails(); - } - - private void init_options() - { - this.Minimized += new EventHandler(MainForm_Minimized); - - option_zoom_on_hover.Checked = Properties.Settings.Default.zoom_on_hover; - zoom_anchor_button_map = new Dictionary(); - zoom_anchor_button_map[zoom_anchor_t.NW] = option_zoom_anchor_NW; - zoom_anchor_button_map[zoom_anchor_t.N] = option_zoom_anchor_N; - zoom_anchor_button_map[zoom_anchor_t.NE] = option_zoom_anchor_NE; - zoom_anchor_button_map[zoom_anchor_t.W] = option_zoom_anchor_W; - zoom_anchor_button_map[zoom_anchor_t.C] = option_zoom_anchor_C; - zoom_anchor_button_map[zoom_anchor_t.E] = option_zoom_anchor_E; - zoom_anchor_button_map[zoom_anchor_t.SW] = option_zoom_anchor_SW; - zoom_anchor_button_map[zoom_anchor_t.S] = option_zoom_anchor_S; - zoom_anchor_button_map[zoom_anchor_t.SE] = option_zoom_anchor_SE; - zoom_anchor_button_map[(zoom_anchor_t)Properties.Settings.Default.zoom_anchor].Checked = true; - option_zoom_factor.Text = Properties.Settings.Default.zoom_amount.ToString(); - - 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 zoom_anchor_button_map) - { - kv.Value.Enabled = Properties.Settings.Default.zoom_on_hover; - } - - opacity_bar.Value = Math.Min(100, (int)(100.0 * Properties.Settings.Default.opacity)); - - load_layout(); - } - - - private void spawn_and_kill_previews() - { - if (!is_initialized) { return; } - - Process[] processes = Process.GetProcessesByName("ExeFile"); - List processHandles = 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] = new Preview(process.MainWindowHandle, "...", this, sync_size); - previews[process.MainWindowHandle].set_render_area_size(sync_size); - - // apply more thumbnail specific options - previews[process.MainWindowHandle].MakeTopMost(Properties.Settings.Default.always_on_top); - set_thumbnail_frame_style(previews[process.MainWindowHandle], Properties.Settings.Default.show_thumb_frames); - - // add a preview also - previews_check_listbox.BeginUpdate(); - previews_check_listbox.Items.Add(previews[process.MainWindowHandle]); - previews_check_listbox.EndUpdate(); - - refresh_client_window_locations(process); - } - - else if (previews.ContainsKey(process.MainWindowHandle) && process.MainWindowTitle != previews[process.MainWindowHandle].Text) //or update the preview titles - { - previews[process.MainWindowHandle].SetLabel(process.MainWindowTitle); - string key = previews[process.MainWindowHandle].Text; - string value; - if (flat_layout_shortcuts.TryGetValue(key, out value)) - { - previews[process.MainWindowHandle].registerShortcut(value); - } - refresh_client_window_locations(process); - } - - if (process.MainWindowHandle == DwmApi.GetForegroundWindow()) - { - active_client_handle = process.MainWindowHandle; - active_client_title = process.MainWindowTitle; - } - - } - - // 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) - { - previews_check_listbox.BeginUpdate(); - previews_check_listbox.Items.Remove(previews[processHandle]); - previews_check_listbox.EndUpdate(); - - previews[processHandle].overlay.Close(); - previews[processHandle].Close(); - previews.Remove(processHandle); - } - - previews_check_listbox.Update(); - - } - - private void refresh_client_window_locations(Process process) - { - if (Properties.Settings.Default.track_client_windows && client_layout.ContainsKey(process.MainWindowTitle)) - { - MoveWindow( - process.MainWindowHandle, - client_layout[process.MainWindowTitle].X, - client_layout[process.MainWindowTitle].Y, - client_layout[process.MainWindowTitle].Width, - client_layout[process.MainWindowTitle].Height, - true); - } - } - - - private string remove_nonconform_xml_characters(string entry) - { - foreach (var kv in xml_bad_to_ok_chars) - { - entry = entry.Replace(kv.Key, kv.Value); - } - return entry; - } - - private string restore_nonconform_xml_characters(string entry) - { - foreach (var kv in xml_bad_to_ok_chars) - { - 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)); - } - unique_layouts[ParseXElement(el)] = inner; - } - } - - if (File.Exists("flat_layout.xml")) - { - XElement rootElement = XElement.Load("flat_layout.xml"); - foreach (var el in rootElement.Elements()) - { - flat_layout[ParseXElement(el)] = new Point(Convert.ToInt32(el.Element("x").Value), Convert.ToInt32(el.Element("y").Value)); - flat_layout_shortcuts[ParseXElement(el)] = ""; - - if (el.Element("shortcut") != null) - { - flat_layout_shortcuts[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); - - client_layout[ParseXElement(el)] = clientLocation; - } - } - } - - private void store_layout() - { - XElement el = new XElement("layouts"); - foreach (var client in unique_layouts.Keys) - { - if (client == "") - { - continue; - } - XElement layout = MakeXElement(client); - foreach (var thumbnail_ in unique_layouts[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 flat_layout) - { - 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 (flat_layout_shortcuts.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 client_layout) - { - 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(Preview preview, String last_known_active_window) - { - Dictionary layout; - if (unique_layouts.TryGetValue(last_known_active_window, out layout)) - { - Point new_loc; - if (Properties.Settings.Default.unique_layout && layout.TryGetValue(preview.Text, out new_loc)) - { - preview.doMove(new_loc); - } - else - { - // create inner dict - layout[preview.Text] = preview.Location; - } - } - else if (last_known_active_window != "") - { - // create outer dict - unique_layouts[last_known_active_window] = new Dictionary(); - unique_layouts[last_known_active_window][preview.Text] = preview.Location; - } - } - - - private void update_client_locations() - { - Process[] processes = Process.GetProcessesByName("ExeFile"); - List processHandles = new List(); - - foreach (Process process in processes) - { - Rect rect = new Rect(); - 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; - - - client_layout[process.MainWindowTitle] = clientLocation; - } - } - - - public void preview_did_switch() - { - update_client_locations(); - store_layout(); //todo: check if it actually changed ... - foreach (KeyValuePair entry in previews) - { - entry.Value.MakeTopMost(Properties.Settings.Default.always_on_top); - //makes the PreviewOverlay topmost - entry.Value.overlay.makeTopMost(); - } - } - - - private void handle_flat_layout(Preview preview) - { - Point layout; - if (flat_layout.TryGetValue(preview.Text, out layout)) - { - preview.doMove(layout); - } - else if (preview.Text != "") - { - flat_layout[preview.Text] = preview.Location; - } - } - - 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.Handle == window || this.Handle == window || entry.Value.overlay.Handle == window) - { - active_window_is_right_type = true; - } - } - return active_window_is_right_type; - } - - - private void refresh_thumbnails() - { - - IntPtr active_window = DwmApi.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.Hide(); - } - else if (entry.Key == active_client_handle && Properties.Settings.Default.hide_active) - { - entry.Value.Hide(); - } - else - { - entry.Value.Show(); - if (Properties.Settings.Default.unique_layout) - { - handle_unique_layout(entry.Value, active_client_title); - } - else - { - handle_flat_layout(entry.Value); - } - } - entry.Value.hover_zoom = Properties.Settings.Default.zoom_on_hover; - entry.Value.show_overlay = Properties.Settings.Default.show_overlay; - //makes the PreviewOverlay TopMost - entry.Value.overlay.makeTopMost(); - if (!entry.Value.is_hovered_over) - { - entry.Value.Opacity = Properties.Settings.Default.opacity; - } - } - - DwmApi.DwmIsCompositionEnabled(); - } - - - public void syncronize_preview_size(Size sync_size) - { - if (!is_initialized) { return; } - - if (Properties.Settings.Default.sync_resize && - Properties.Settings.Default.show_thumb_frames && - ignoring_size_sync.ElapsedMilliseconds > 500) - { - ignoring_size_sync.Stop(); - - option_sync_size_x.Text = sync_size.Width.ToString(); - option_sync_size_y.Text = sync_size.Height.ToString(); - - foreach (KeyValuePair entry in previews) - { - if (entry.Value.Handle != DwmApi.GetForegroundWindow()) - { - entry.Value.set_render_area_size(sync_size); - } - } - - } - - } - - - public void register_preview_position(String preview_title, Point position) - { - - if (Properties.Settings.Default.unique_layout) - { - Dictionary layout; - if (unique_layouts.TryGetValue(active_client_title, out layout)) - { - layout[preview_title] = position; - } - else if (active_client_title == "") - { - unique_layouts[active_client_title] = new Dictionary(); - unique_layouts[active_client_title][preview_title] = position; - } - } - else - { - flat_layout[preview_title] = position; - } - - } - - - private void dispatcherTimer_Tick(object sender, EventArgs e) - { - spawn_and_kill_previews(); - refresh_thumbnails(); - if (ignoring_size_sync.ElapsedMilliseconds > 500) { ignoring_size_sync.Stop(); }; - - if (DwmApi.DwmIsCompositionEnabled()) - { - 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 option_hide_all_if_noneve_CheckedChanged(object sender, EventArgs e) - { - Properties.Settings.Default.hide_all = option_hide_all_if_not_right_type.Checked; - Properties.Settings.Default.Save(); - refresh_thumbnails(); - } - - - private void option_unique_layout_CheckedChanged(object sender, EventArgs e) - { - Properties.Settings.Default.unique_layout = option_unique_layout.Checked; - Properties.Settings.Default.Save(); - refresh_thumbnails(); - } - - - private void option_hide_active_CheckedChanged(object sender, EventArgs e) - { - Properties.Settings.Default.hide_active = option_hide_active.Checked; - Properties.Settings.Default.Save(); - refresh_thumbnails(); - } - - - private void option_sync_size_CheckedChanged(object sender, EventArgs e) - { - Properties.Settings.Default.sync_resize = option_sync_size.Checked; - Properties.Settings.Default.Save(); - 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 - syncronize_preview_size(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) - { - parse_size_entry(); - } - - - private void option_sync_size_y_TextChanged(object sender, EventArgs e) - { - parse_size_entry(); - } - - - private void option_always_on_top_CheckedChanged(object sender, EventArgs e) - { - Properties.Settings.Default.always_on_top = option_always_on_top.Checked; - Properties.Settings.Default.Save(); - refresh_thumbnails(); - } - - - void set_thumbnail_frame_style(Preview preview, bool show_frames) - { - if (show_frames) - { - preview.FormBorderStyle = FormBorderStyle.SizableToolWindow; - } - else - { - preview.FormBorderStyle = FormBorderStyle.None; - } - } - - private void option_show_thumbnail_frames_CheckedChanged(object sender, EventArgs e) - { - Properties.Settings.Default.show_thumb_frames = option_show_thumbnail_frames.Checked; - Properties.Settings.Default.Save(); - - if (Properties.Settings.Default.show_thumb_frames) - { - ignoring_size_sync.Stop(); - ignoring_size_sync.Reset(); - ignoring_size_sync.Start(); - } - - foreach (var thumbnail in previews) - { - set_thumbnail_frame_style(thumbnail.Value, Properties.Settings.Default.show_thumb_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) - { - Properties.Settings.Default.zoom_on_hover = option_zoom_on_hover.Checked; - Properties.Settings.Default.Save(); - refresh_thumbnails(); - option_zoom_factor.Enabled = Properties.Settings.Default.zoom_on_hover; - if (is_initialized) - { - foreach (var kv in zoom_anchor_button_map) - { - 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(); - refresh_thumbnails(); - } - - - private void handle_zoom_anchor_setting() - { - foreach (var kv in zoom_anchor_button_map) - { - 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) - { - refresh_thumbnails(); - } - - private void checkedListBox1_SelectedIndexChanged2(object sender, EventArgs e) - { - System.Windows.Forms.ItemCheckEventArgs arg = (System.Windows.Forms.ItemCheckEventArgs)e; - ((Preview)this.previews_check_listbox.Items[arg.Index]).MakeHidden(arg.NewValue == System.Windows.Forms.CheckState.Checked); - refresh_thumbnails(); - } - - private void flowLayoutPanel1_Paint(object sender, PaintEventArgs e) - { - - } - - private void checkBox1_CheckedChanged(object sender, EventArgs e) - { - Properties.Settings.Default.track_client_windows = option_track_client_windows.Checked; - Properties.Settings.Default.Save(); - refresh_thumbnails(); - } - - - private void opacity_bar_Scroll(object sender, ScrollEventArgs e) - { - // fire off opacity change - Properties.Settings.Default.opacity = Math.Min((float)e.NewValue / 100.0f, 1.0f); - Properties.Settings.Default.Save(); - 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) - { - if (Restored != null) - { - Restored(this, e); - } - } - - protected override void WndProc(ref Message m) - { - switch (m.Msg) - { - case WM_SIZE: - switch (m.WParam.ToInt32()) - { - case SIZE_RESTORED: - OnRestored(EventArgs.Empty); - break; - case SIZE_MINIMIZED: - OnMinimized(EventArgs.Empty); - break; - case SIZE_MAXIMIZED: - OnMaximized(EventArgs.Empty); - break; - } - break; - default: - 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/PreviewOverlay.Designer.cs b/PreviewOverlay.Designer.cs deleted file mode 100644 index 038e7c2..0000000 --- a/PreviewOverlay.Designer.cs +++ /dev/null @@ -1,93 +0,0 @@ -namespace PreviewToy -{ - partial class PreviewOverlay - { - /// - /// 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() - { - this.overlay_area = new System.Windows.Forms.PictureBox(); - this.client_label = new System.Windows.Forms.Label(); - ((System.ComponentModel.ISupportInitialize)(this.overlay_area)).BeginInit(); - this.SuspendLayout(); - // - // overlay_area - // - this.overlay_area.BackColor = System.Drawing.Color.Transparent; - this.overlay_area.Cursor = System.Windows.Forms.Cursors.Hand; - this.overlay_area.Dock = System.Windows.Forms.DockStyle.Fill; - this.overlay_area.Location = new System.Drawing.Point(0, 0); - this.overlay_area.Name = "overlay_area"; - this.overlay_area.Size = new System.Drawing.Size(284, 262); - this.overlay_area.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.overlay_area.TabIndex = 0; - this.overlay_area.TabStop = false; - this.overlay_area.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_Click); - // - // client_label - // - this.client_label.AutoSize = true; - this.client_label.Dock = System.Windows.Forms.DockStyle.Top; - this.client_label.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.client_label.ForeColor = System.Drawing.Color.DarkGray; - this.client_label.Location = new System.Drawing.Point(0, 0); - this.client_label.Name = "client_label"; - this.client_label.Size = new System.Drawing.Size(25, 13); - this.client_label.TabIndex = 1; - this.client_label.Text = "..."; - this.client_label.Click += new System.EventHandler(this.client_label_Click); - // - // 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.client_label); - this.Controls.Add(this.overlay_area); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "PreviewOverlay"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; - this.Text = "PreviewOverlay"; - this.TransparencyKey = System.Drawing.Color.Black; - this.Load += new System.EventHandler(this.PreviewOverlay_Load); - ((System.ComponentModel.ISupportInitialize)(this.overlay_area)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - public System.Windows.Forms.PictureBox overlay_area; - public System.Windows.Forms.Label client_label; - - } -} \ No newline at end of file diff --git a/PreviewOverlay.cs b/PreviewOverlay.cs deleted file mode 100644 index b2cd701..0000000 --- a/PreviewOverlay.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace PreviewToy -{ - public partial class PreviewOverlay : Form - { - private Preview parent; - private Color original_color; - public PreviewOverlay(Preview parent) - { - this.parent = parent; - InitializeComponent(); - original_color = overlay_area.BackColor; - } - - private void PreviewOverlay_Load(object sender, EventArgs e) - { - - } - - private void pictureBox1_Click(object sender, MouseEventArgs e) - { - this.parent.render_area_Click(sender, e); - } - - public void makeTopMost() - { - this.TopMost = true; - } - - private void client_label_Click(object sender, EventArgs e) - { - - } - - protected override CreateParams CreateParams - { - get - { - var Params = base.CreateParams; - Params.ExStyle |= 0x80; - return Params; - } - } - - } -} diff --git a/Program.cs b/Program.cs deleted file mode 100644 index 6604c0b..0000000 --- a/Program.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Windows.Forms; - -namespace PreviewToy -{ - static class Program - { - /// The main entry point for the application. - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(true); - Application.Run(new PreviewToyHandler()); - } - } -} \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs deleted file mode 100644 index d272cb5..0000000 --- a/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("PreviewToy")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("?")] -[assembly: AssemblyProduct("PreviewToy")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Properties/DataSources/PreviewToyMain.datasource b/Properties/DataSources/PreviewToyMain.datasource deleted file mode 100644 index 8e957e6..0000000 --- a/Properties/DataSources/PreviewToyMain.datasource +++ /dev/null @@ -1,10 +0,0 @@ - - - - PreviewToy.PreviewToyMain, eve-o preview test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - \ No newline at end of file diff --git a/preview toy.csproj.user b/preview toy.csproj.user deleted file mode 100644 index 9c62ad0..0000000 --- a/preview toy.csproj.user +++ /dev/null @@ -1,16 +0,0 @@ - - - - publish\ - - - - - - en-US - false - - - false - - \ No newline at end of file diff --git a/preview toy.suo b/preview toy.suo deleted file mode 100644 index 477401b..0000000 Binary files a/preview toy.suo and /dev/null differ diff --git a/preview toy.v11.suo b/preview toy.v11.suo deleted file mode 100644 index 3278dbc..0000000 Binary files a/preview toy.v11.suo and /dev/null differ diff --git a/preview toy_TemporaryKey.pfx b/preview toy_TemporaryKey.pfx deleted file mode 100644 index 007e110..0000000 Binary files a/preview toy_TemporaryKey.pfx and /dev/null differ