diff --git a/Eve-O-Preview/Configuration/Interface/ClientLayout.cs b/Eve-O-Preview/Configuration/Interface/ClientLayout.cs index 02266c4..c158401 100644 --- a/Eve-O-Preview/Configuration/Interface/ClientLayout.cs +++ b/Eve-O-Preview/Configuration/Interface/ClientLayout.cs @@ -6,18 +6,23 @@ namespace EveOPreview.Configuration { } - public ClientLayout(int x, int y, int width, int height) + public ClientLayout(int x, int y, int width, int height, bool maximized) { this.X = x; this.Y = y; this.Width = width; this.Height = height; + this.IsMaximized = maximized; } public int X { get; set; } + public int Y { get; set; } public int Width { get; set; } + public int Height { get; set; } + + public bool IsMaximized { get; set; } } } \ No newline at end of file diff --git a/Eve-O-Preview/Eve-O-Preview.csproj b/Eve-O-Preview/Eve-O-Preview.csproj index 5e9d4aa..375b7a6 100644 --- a/Eve-O-Preview/Eve-O-Preview.csproj +++ b/Eve-O-Preview/Eve-O-Preview.csproj @@ -10,7 +10,7 @@ WinExe Properties EveOPreview - Eve-O Preview + EVE-O Preview v4.7 diff --git a/Eve-O-Preview/Program.cs b/Eve-O-Preview/Program.cs index 9ab309b..dd29e98 100644 --- a/Eve-O-Preview/Program.cs +++ b/Eve-O-Preview/Program.cs @@ -19,14 +19,6 @@ namespace EveOPreview [STAThread] static void Main() { -#if DEBUG - var expirationDate = new DateTime(2019, 5, 15); - if (DateTime.Today >= expirationDate) - { - MessageBox.Show(@"This Beta version is expired. Please download a new build at https://github.com/Phrynohyas/eve-o-preview/releases", @"EVE-O Preview", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - } -#endif - // The very usual Mutex-based single-instance screening // 'token' variable is used to store reference to the instance Mutex // during the app lifetime diff --git a/Eve-O-Preview/Properties/AssemblyInfo.cs b/Eve-O-Preview/Properties/AssemblyInfo.cs index 9b2adf4..2908b70 100644 --- a/Eve-O-Preview/Properties/AssemblyInfo.cs +++ b/Eve-O-Preview/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")] -[assembly: AssemblyVersion("4.1.0.1")] -[assembly: AssemblyFileVersion("4.1.0.1")] +[assembly: AssemblyVersion("4.1.0.6")] +[assembly: AssemblyFileVersion("4.1.0.6")] [assembly: CLSCompliant(false)] \ No newline at end of file diff --git a/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs b/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs index 9f55ac2..ea0904f 100644 --- a/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs +++ b/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs @@ -590,7 +590,14 @@ namespace EveOPreview.Services return; } - this._windowManager.MoveWindow(clientHandle, clientLayout.X, clientLayout.Y, clientLayout.Width, clientLayout.Height); + if (clientLayout.IsMaximized) + { + this._windowManager.MaximizeWindow(clientHandle); + } + else + { + this._windowManager.MoveWindow(clientHandle, clientLayout.X, clientLayout.Y, clientLayout.Width, clientLayout.Height); + } } private void UpdateClientLayouts() @@ -604,16 +611,17 @@ namespace EveOPreview.Services { IThumbnailView view = entry.Value; (int Left, int Top, int Right, int Bottom) position = this._windowManager.GetWindowPosition(view.Id); - int width = Math.Abs(position.Right - position.Left); int height = Math.Abs(position.Bottom - position.Top); - if (!this.IsValidWindowPosition(position.Left, position.Top, width, height)) + var isMaximized = this._windowManager.IsWindowMaximized(view.Id); + + if (!(isMaximized || this.IsValidWindowPosition(position.Left, position.Top, width, height))) { continue; } - this._configuration.SetClientLayout(view.Title, new ClientLayout(position.Left, position.Top, width, height)); + this._configuration.SetClientLayout(view.Title, new ClientLayout(position.Left, position.Top, width, height, isMaximized)); } } diff --git a/Eve-O-Preview/Services/Implementation/WindowManager.cs b/Eve-O-Preview/Services/Implementation/WindowManager.cs index b7e7135..c1b8d88 100644 --- a/Eve-O-Preview/Services/Implementation/WindowManager.cs +++ b/Eve-O-Preview/Services/Implementation/WindowManager.cs @@ -31,7 +31,7 @@ namespace EveOPreview.Services.Implementation if ((style & InteropConstants.WS_MINIMIZE) == InteropConstants.WS_MINIMIZE) { - User32NativeMethods.ShowWindowAsync(handle, InteropConstants.SW_SHOWNORMAL); + User32NativeMethods.ShowWindowAsync(handle, InteropConstants.SW_RESTORE); } } @@ -56,6 +56,11 @@ namespace EveOPreview.Services.Implementation User32NativeMethods.MoveWindow(handle, left, top, width, height, true); } + public void MaximizeWindow(IntPtr handle) + { + User32NativeMethods.ShowWindowAsync(handle, InteropConstants.SW_SHOWMAXIMIZED); + } + public (int Left, int Top, int Right, int Bottom) GetWindowPosition(IntPtr handle) { User32NativeMethods.GetWindowRect(handle, out RECT windowRectangle); @@ -63,6 +68,11 @@ namespace EveOPreview.Services.Implementation return (windowRectangle.Left, windowRectangle.Top, windowRectangle.Right, windowRectangle.Bottom); } + public bool IsWindowMaximized(IntPtr handle) + { + return User32NativeMethods.IsZoomed(handle); + } + public bool IsWindowMinimized(IntPtr handle) { return User32NativeMethods.IsIconic(handle); diff --git a/Eve-O-Preview/Services/Interface/IWindowManager.cs b/Eve-O-Preview/Services/Interface/IWindowManager.cs index 50a01b6..c1ce08d 100644 --- a/Eve-O-Preview/Services/Interface/IWindowManager.cs +++ b/Eve-O-Preview/Services/Interface/IWindowManager.cs @@ -8,14 +8,13 @@ namespace EveOPreview.Services bool IsCompositionEnabled { get; } IntPtr GetForegroundWindowHandle(); - void ActivateWindow(IntPtr handle); void MinimizeWindow(IntPtr handle, bool enableAnimation); - void MoveWindow(IntPtr handle, int left, int top, int width, int height); + void MaximizeWindow(IntPtr handle); (int Left, int Top, int Right, int Bottom) GetWindowPosition(IntPtr handle); + bool IsWindowMaximized(IntPtr handle); bool IsWindowMinimized(IntPtr handle); - IDwmThumbnail GetLiveThumbnail(IntPtr destination, IntPtr source); Image GetStaticThumbnail(IntPtr source); } diff --git a/Eve-O-Preview/Services/Interface/InteropConstants.cs b/Eve-O-Preview/Services/Interface/InteropConstants.cs index e6df312..5fdd320 100644 --- a/Eve-O-Preview/Services/Interface/InteropConstants.cs +++ b/Eve-O-Preview/Services/Interface/InteropConstants.cs @@ -56,7 +56,7 @@ namespace EveOPreview.Services public const UInt32 WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE); public const UInt32 WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST); public const UInt32 WS_EX_LAYERED = 0x00080000; - public const UInt32 WS_EX_NOINHERITLAYOUT = 0x00100000; // Disable inheritence of mirroring by children + public const UInt32 WS_EX_NOINHERITLAYOUT = 0x00100000; // Disable inheritance of mirroring by children public const UInt32 WS_EX_LAYOUTRTL = 0x00400000; // Right to left mirroring public const UInt32 WS_EX_COMPOSITED = 0x02000000; public const UInt32 WS_EX_NOACTIVATE = 0x08000000; @@ -78,5 +78,6 @@ namespace EveOPreview.Services public const int SW_SHOWNORMAL = 1; public const int SW_SHOWMINIMIZED = 2; public const int SW_SHOWMAXIMIZED = 3; + public const int SW_RESTORE = 9; } } \ No newline at end of file