From 418ae9352dbad5d959fbeb9b68f45f449a3bb60e Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Fri, 29 Aug 2025 22:19:21 +0200 Subject: [PATCH] Make region selector shower instead of whole screen ) --- .clang-format | 3 + src/Eve-O-Mock/App.xaml.cs | 7 +- src/Eve-O-Mock/Eve-O-Mock.csproj | 2 +- src/Eve-O-Mock/MainWindow.xaml.cs | 22 +- src/Eve-O-Mock/Properties/AssemblyInfo.cs | 37 +- .../Properties/Resources.Designer.cs | 38 +- .../Properties/Settings.Designer.cs | 16 +- src/Eve-O-Preview/AboutBox.Designer.cs | 93 +- src/Eve-O-Preview/AboutBox.cs | 96 +- .../ApplicationBase/ApplicationController.cs | 104 +- .../ApplicationBase/ExceptionHandler.cs | 78 +- .../ApplicationBase/IApplicationController.cs | 38 +- .../ApplicationBase/IIocContainer.cs | 28 +- .../ApplicationBase/IPresenter.cs | 10 +- .../ApplicationBase/IPresenterGeneric.cs | 10 +- src/Eve-O-Preview/ApplicationBase/IView.cs | 20 +- .../ApplicationBase/LightInjectContainer.cs | 136 +- .../ApplicationBase/Presenter.cs | 34 +- .../ApplicationBase/PresenterGeneric.cs | 29 +- .../Configuration/Implementation/AppConfig.cs | 19 +- .../Implementation/ConfigurationStorage.cs | 83 +- .../Implementation/ThumbnailConfiguration.cs | 756 ++--- .../Configuration/Interface/AnimationStyle.cs | 9 +- .../Configuration/Interface/ClientLayout.cs | 37 +- .../Configuration/Interface/IAppConfig.cs | 16 +- .../Interface/IConfigurationStorage.cs | 12 +- .../Interface/IThumbnailConfiguration.cs | 157 +- .../Configuration/Interface/ZoomAnchor.cs | 16 +- src/Eve-O-Preview/Eve-O-Preview.csproj | 2 +- src/Eve-O-Preview/Hotkeys/HotkeyHandler.cs | 183 +- .../Hotkeys/HotkeyHandlerNativeMethods.cs | 28 +- .../Configuration/SaveConfigurationHandler.cs | 26 +- .../Services/StartStopServiceHandler.cs | 35 +- .../ThumbnailActiveSizeUpdatedHandler.cs | 26 +- .../ThumbnailConfiguredSizeUpdatedHandler.cs | 26 +- .../ThumbnailFrameSettingsUpdatedHandler.cs | 26 +- .../Thumbnails/ThumbnailListUpdatedHandler.cs | 44 +- .../ThumbnailLocationUpdatedHandler.cs | 31 +- .../ThumbnailRegionSettingsUpdatedHandler.cs | 20 + .../Messages/Base/NotificationBase.cs | 17 +- .../Configuration/SaveConfiguration.cs | 7 +- .../Messages/Services/StartService.cs | 7 +- .../Mediator/Messages/Services/StopService.cs | 7 +- .../Thumbnails/ThumbnailActiveSizeUpdated.cs | 13 +- .../ThumbnailConfiguredSizeUpdated.cs | 7 +- .../ThumbnailFrameSettingsUpdated.cs | 7 +- .../Thumbnails/ThumbnailListUpdated.cs | 21 +- .../Thumbnails/ThumbnailLocationUpdated.cs | 25 +- .../ThumbnailRegionSettingsUpdated.cs | 5 + .../Implementation/MainFormPresenter.cs | 414 ++- .../ViewAnimationStyleConverter.cs | 26 +- .../Implementation/ViewZoomAnchorConverter.cs | 26 +- .../Interface/IMainFormPresenter.cs | 14 +- .../Presenters/Interface/ViewCloseRequest.cs | 17 +- src/Eve-O-Preview/Program.cs | 158 +- .../Properties/Resources.Designer.cs | 38 +- .../Services/Implementation/DwmThumbnail.cs | 162 +- .../Services/Implementation/ProcessInfo.cs | 21 +- .../Services/Implementation/ProcessMonitor.cs | 260 +- .../Implementation/ThumbnailManager.cs | 1877 ++++++------ .../Services/Implementation/WindowManager.cs | 483 ++- .../Services/Interface/IDwmThumbnail.cs | 18 +- .../Services/Interface/IProcessInfo.cs | 12 +- .../Services/Interface/IProcessMonitor.cs | 20 +- .../Services/Interface/IThumbnailManager.cs | 23 +- .../Services/Interface/IWindowManager.cs | 32 +- .../Services/Interface/InteropConstants.cs | 144 +- .../Services/Interop/ANIMATIONINFO.cs | 6 +- .../Services/Interop/DWM_BLURBEHIND.cs | 28 +- .../Interop/DWM_THUMBNAIL_PROPERTIES.cs | 26 +- .../Services/Interop/DWM_TNP_CONSTANTS.cs | 18 +- .../Services/Interop/DwmNativeMethods.cs | 47 +- .../Services/Interop/Gdi32NativeMethods.cs | 35 +- src/Eve-O-Preview/Services/Interop/MARGINS.cs | 31 +- src/Eve-O-Preview/Services/Interop/RECT.cs | 31 +- .../Services/Interop/User32NativeMethods.cs | 93 +- .../Services/Interop/WINDOWPLACEMENT.cs | 50 +- .../View/Implementation/InputDialog.cs | 71 + .../View/Implementation/LiveThumbnailView.cs | 113 +- .../View/Implementation/MainForm.Designer.cs | 2728 +++++++++-------- .../View/Implementation/MainForm.cs | 1094 ++++--- .../RegionPickerDialog.Designer.cs | 40 + .../View/Implementation/RegionPickerDialog.cs | 136 + .../Implementation/StaticThumbnailImage.cs | 30 +- .../Implementation/StaticThumbnailView.cs | 141 +- .../Implementation/ThumbnailDescription.cs | 21 +- .../ThumbnailOverlay.Designer.cs | 163 +- .../View/Implementation/ThumbnailOverlay.cs | 91 +- .../Implementation/ThumbnailView.Designer.cs | 74 +- .../View/Implementation/ThumbnailView.cs | 1124 ++++--- .../Implementation/ThumbnailViewFactory.cs | 40 +- .../View/Interface/IMainFormView.cs | 98 +- .../View/Interface/IThumbnailDescription.cs | 12 +- .../View/Interface/IThumbnailView.cs | 66 +- .../View/Interface/IThumbnailViewFactory.cs | 10 +- .../View/Interface/ViewAnimationStyle.cs | 9 +- .../View/Interface/ViewZoomAnchor.cs | 16 +- 97 files changed, 6329 insertions(+), 6327 deletions(-) create mode 100644 .clang-format create mode 100644 src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailRegionSettingsUpdatedHandler.cs create mode 100644 src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailRegionSettingsUpdated.cs create mode 100644 src/Eve-O-Preview/View/Implementation/InputDialog.cs create mode 100644 src/Eve-O-Preview/View/Implementation/RegionPickerDialog.Designer.cs create mode 100644 src/Eve-O-Preview/View/Implementation/RegionPickerDialog.cs diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..d53bf86 --- /dev/null +++ b/.clang-format @@ -0,0 +1,3 @@ +BasedOnStyle: Google +IndentWidth: 4 +ColumnLimit: 120 \ No newline at end of file diff --git a/src/Eve-O-Mock/App.xaml.cs b/src/Eve-O-Mock/App.xaml.cs index b19c434..7e58594 100644 --- a/src/Eve-O-Mock/App.xaml.cs +++ b/src/Eve-O-Mock/App.xaml.cs @@ -1,8 +1,5 @@ using System.Windows; -namespace EveOMock -{ - public partial class App : Application - { - } +namespace EveOMock { + public partial class App : Application {} } diff --git a/src/Eve-O-Mock/Eve-O-Mock.csproj b/src/Eve-O-Mock/Eve-O-Mock.csproj index 603e9da..b811999 100644 --- a/src/Eve-O-Mock/Eve-O-Mock.csproj +++ b/src/Eve-O-Mock/Eve-O-Mock.csproj @@ -1,6 +1,6 @@  - net8.0-windows + net6.0-windows WinExe EveOMock ExeFile diff --git a/src/Eve-O-Mock/MainWindow.xaml.cs b/src/Eve-O-Mock/MainWindow.xaml.cs index 1b9018c..875d9d0 100644 --- a/src/Eve-O-Mock/MainWindow.xaml.cs +++ b/src/Eve-O-Mock/MainWindow.xaml.cs @@ -2,16 +2,14 @@ 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))); - } - } +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/src/Eve-O-Mock/Properties/AssemblyInfo.cs b/src/Eve-O-Mock/Properties/AssemblyInfo.cs index f69f53c..28d267c 100644 --- a/src/Eve-O-Mock/Properties/AssemblyInfo.cs +++ b/src/Eve-O-Mock/Properties/AssemblyInfo.cs @@ -3,26 +3,25 @@ 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: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: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: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:AssemblyVersion("1.0.0.0")] +[assembly:AssemblyFileVersion("1.0.0.0")] -[assembly: CLSCompliant(true)] \ No newline at end of file +[assembly:CLSCompliant(true)] \ No newline at end of file diff --git a/src/Eve-O-Mock/Properties/Resources.Designer.cs b/src/Eve-O-Mock/Properties/Resources.Designer.cs index ae39ba2..e64d5c4 100644 --- a/src/Eve-O-Mock/Properties/Resources.Designer.cs +++ b/src/Eve-O-Mock/Properties/Resources.Designer.cs @@ -10,8 +10,7 @@ namespace EveOMock.Properties { using System; - - + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,45 +18,44 @@ namespace EveOMock.Properties { // 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", "17.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", + "17.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() { - } - + + [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)] + [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); + 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)] + [global::System.ComponentModel.EditorBrowsableAttribute( + global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } + get { return resourceCulture; } + set { resourceCulture = value; } } } } diff --git a/src/Eve-O-Mock/Properties/Settings.Designer.cs b/src/Eve-O-Mock/Properties/Settings.Designer.cs index a2df83f..9d33e9a 100644 --- a/src/Eve-O-Mock/Properties/Settings.Designer.cs +++ b/src/Eve-O-Mock/Properties/Settings.Designer.cs @@ -9,18 +9,16 @@ //------------------------------------------------------------------------------ namespace EveOMock.Properties { - - + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute( + "Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - + private static Settings defaultInstance = + ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + public static Settings Default { - get { - return defaultInstance; - } + get { return defaultInstance; } } } } diff --git a/src/Eve-O-Preview/AboutBox.Designer.cs b/src/Eve-O-Preview/AboutBox.Designer.cs index 82dd819..5ad0583 100644 --- a/src/Eve-O-Preview/AboutBox.Designer.cs +++ b/src/Eve-O-Preview/AboutBox.Designer.cs @@ -1,7 +1,5 @@ -namespace PreviewToy -{ - partial class AboutBox - { +namespace PreviewToy { + partial class AboutBox { /// /// Required designer variable. /// @@ -10,23 +8,20 @@ /// /// Clean up any resources being used. /// - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } - #region Windows Form Designer generated code +#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() - { + private void InitializeComponent() { this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); this.logoPictureBox = new System.Windows.Forms.PictureBox(); this.labelProductName = new System.Windows.Forms.Label(); @@ -38,12 +33,14 @@ this.tableLayoutPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit(); this.SuspendLayout(); - // + // // tableLayoutPanel - // + // this.tableLayoutPanel.ColumnCount = 2; - this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F)); - this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67F)); + this.tableLayoutPanel.ColumnStyles.Add( + new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F)); + this.tableLayoutPanel.ColumnStyles.Add( + new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67F)); this.tableLayoutPanel.Controls.Add(this.logoPictureBox, 0, 0); this.tableLayoutPanel.Controls.Add(this.labelProductName, 1, 0); this.tableLayoutPanel.Controls.Add(this.labelVersion, 1, 1); @@ -55,17 +52,23 @@ this.tableLayoutPanel.Location = new System.Drawing.Point(9, 9); this.tableLayoutPanel.Name = "tableLayoutPanel"; this.tableLayoutPanel.RowCount = 6; - this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); - this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add( + new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add( + new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add( + new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add( + new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); + this.tableLayoutPanel.RowStyles.Add( + new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel.RowStyles.Add( + new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F)); this.tableLayoutPanel.Size = new System.Drawing.Size(534, 490); this.tableLayoutPanel.TabIndex = 0; - // + // // logoPictureBox - // + // this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill; this.logoPictureBox.Image = global::PreviewToy.Properties.Resources.Eve_online; this.logoPictureBox.Location = new System.Drawing.Point(3, 3); @@ -75,9 +78,9 @@ this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.logoPictureBox.TabIndex = 12; this.logoPictureBox.TabStop = false; - // + // // labelProductName - // + // this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill; this.labelProductName.Location = new System.Drawing.Point(182, 0); this.labelProductName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); @@ -87,9 +90,9 @@ this.labelProductName.TabIndex = 19; this.labelProductName.Text = "Product Name"; this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // labelVersion - // + // this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill; this.labelVersion.Location = new System.Drawing.Point(182, 49); this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); @@ -99,9 +102,9 @@ this.labelVersion.TabIndex = 0; this.labelVersion.Text = "Version"; this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // labelCopyright - // + // this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill; this.labelCopyright.Location = new System.Drawing.Point(182, 98); this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); @@ -112,10 +115,11 @@ this.labelCopyright.TabStop = true; this.labelCopyright.Text = "Copyright"; this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.labelCopyright.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.labelCopyright_LinkClicked); - // + this.labelCopyright.LinkClicked += + new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.labelCopyright_LinkClicked); + // // labelCompanyName - // + // this.labelCompanyName.Dock = System.Windows.Forms.DockStyle.Fill; this.labelCompanyName.Location = new System.Drawing.Point(182, 147); this.labelCompanyName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); @@ -126,32 +130,36 @@ this.labelCompanyName.TabStop = true; this.labelCompanyName.Text = "Company Name"; this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.labelCompanyName.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.labelCompanyName_LinkClicked); - // + this.labelCompanyName.LinkClicked += + new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.labelCompanyName_LinkClicked); + // // okButton - // - this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + // + this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)( + (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.okButton.Location = new System.Drawing.Point(456, 464); this.okButton.Name = "okButton"; this.okButton.Size = new System.Drawing.Size(75, 23); this.okButton.TabIndex = 24; this.okButton.Text = "&OK"; - // + // // richTextBoxDescription - // + // this.richTextBoxDescription.BackColor = System.Drawing.SystemColors.Control; this.richTextBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill; - this.richTextBoxDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.richTextBoxDescription.Font = + new System.Drawing.Font("Microsoft Sans Serif", 6F, System.Drawing.FontStyle.Regular, + System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.richTextBoxDescription.Location = new System.Drawing.Point(179, 199); this.richTextBoxDescription.Name = "richTextBoxDescription"; this.richTextBoxDescription.ReadOnly = true; this.richTextBoxDescription.Size = new System.Drawing.Size(352, 239); this.richTextBoxDescription.TabIndex = 25; this.richTextBoxDescription.Text = "Description"; - // + // // AboutBox - // + // this.AcceptButton = this.okButton; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; @@ -169,10 +177,9 @@ this.tableLayoutPanel.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit(); this.ResumeLayout(false); - } - #endregion +#endregion private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; private System.Windows.Forms.PictureBox logoPictureBox; diff --git a/src/Eve-O-Preview/AboutBox.cs b/src/Eve-O-Preview/AboutBox.cs index de2b446..9375b73 100644 --- a/src/Eve-O-Preview/AboutBox.cs +++ b/src/Eve-O-Preview/AboutBox.cs @@ -7,12 +7,9 @@ using System.Linq; using System.Reflection; using System.Windows.Forms; -namespace PreviewToy -{ - partial class AboutBox : Form - { - public AboutBox() - { +namespace PreviewToy { + partial class AboutBox : Form { + public AboutBox() { InitializeComponent(); this.Text = String.Format("About {0}", AssemblyTitle); this.labelProductName.Text = AssemblyProduct; @@ -20,7 +17,7 @@ namespace PreviewToy this.labelCopyright.Text = AssemblyCopyright; this.labelCompanyName.Text = AssemblyCompany; this.richTextBoxDescription.Rtf = -@"{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fnil\fcharset0 Calibri;}{\f2\fnil\fcharset2 Symbol;}} + @"{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fnil\fcharset0 Calibri;}{\f2\fnil\fcharset2 Symbol;}} {\*\generator Riched20 6.3.9600}\viewkind4\uc1 \pard\sa200\sl276\slmult1\qc\b\fs28\lang9 EVE-O Preview\par @@ -40,34 +37,29 @@ namespace PreviewToy }"; } - //StinkRay - private void labelCopyright_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { + // StinkRay + private void labelCopyright_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { string url = "https://forums.eveonline.com/default.aspx?g=posts&t=246157"; ProcessStartInfo sInfo = new ProcessStartInfo(new Uri(url).AbsoluteUri); Process.Start(sInfo); } - //New Thread - private void labelCompanyName_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { + // New Thread + private void labelCompanyName_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { string url = "https://forums.eveonline.com/default.aspx?g=posts&m=5264866"; ProcessStartInfo sInfo = new ProcessStartInfo(new Uri(url).AbsoluteUri); Process.Start(sInfo); } - #region Assembly Attribute Accessors +#region Assembly Attribute Accessors - public string AssemblyTitle - { - get - { - object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); - if (attributes.Length > 0) - { + public string AssemblyTitle { + get { + object[] attributes = + Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); + if (attributes.Length > 0) { AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; - if (titleAttribute.Title != "") - { + if (titleAttribute.Title != "") { return titleAttribute.Title; } } @@ -75,65 +67,53 @@ namespace PreviewToy } } - public string AssemblyVersion - { - get - { - return Assembly.GetExecutingAssembly().GetName().Version.ToString(); - } + public string AssemblyVersion { + get { return Assembly.GetExecutingAssembly().GetName().Version.ToString(); } } - public string AssemblyDescription - { - get - { - object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); - if (attributes.Length == 0) - { + public string AssemblyDescription { + get { + object[] attributes = + Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); + if (attributes.Length == 0) { return ""; } return ((AssemblyDescriptionAttribute)attributes[0]).Description; } } - public string AssemblyProduct - { - get - { - object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); - if (attributes.Length == 0) - { + public string AssemblyProduct { + get { + object[] attributes = + Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); + if (attributes.Length == 0) { return ""; } return ((AssemblyProductAttribute)attributes[0]).Product; } } - public string AssemblyCopyright - { - get - { - object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); - if (attributes.Length == 0) - { + public string AssemblyCopyright { + get { + object[] attributes = + Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); + if (attributes.Length == 0) { return ""; } return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; } } - public string AssemblyCompany - { - get - { - object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); - if (attributes.Length == 0) - { + public string AssemblyCompany { + get { + object[] attributes = + Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); + if (attributes.Length == 0) { return ""; } return ((AssemblyCompanyAttribute)attributes[0]).Company; } } - #endregion +#endregion } } diff --git a/src/Eve-O-Preview/ApplicationBase/ApplicationController.cs b/src/Eve-O-Preview/ApplicationBase/ApplicationController.cs index 5109d99..83e1724 100644 --- a/src/Eve-O-Preview/ApplicationBase/ApplicationController.cs +++ b/src/Eve-O-Preview/ApplicationBase/ApplicationController.cs @@ -1,69 +1,57 @@ -namespace EveOPreview -{ - public class ApplicationController : IApplicationController - { - private readonly IIocContainer _container; +namespace EveOPreview { + public class ApplicationController : IApplicationController { + private readonly IIocContainer _container; - public ApplicationController(IIocContainer container) - { - this._container = container; - this._container.RegisterInstance(this); - } + public ApplicationController(IIocContainer container) { + this._container = container; + this._container.RegisterInstance(this); + } - public IApplicationController RegisterView() - where TView : IView - where TImplementation : class, TView - { - this._container.Register(); - return this; - } + public IApplicationController RegisterView() + where TView : IView + where TImplementation : class, TView { + this._container.Register(); + return this; + } - public IApplicationController RegisterInstance(TArgument instance) - { - this._container.RegisterInstance(instance); - return this; - } + public IApplicationController RegisterInstance(TArgument instance) { + this._container.RegisterInstance(instance); + return this; + } - public IApplicationController RegisterService() - where TImplementation : class, TService - { - this._container.Register(); - return this; - } + public IApplicationController RegisterService() + where TImplementation : class, TService { + this._container.Register(); + return this; + } - public void Run() - where TPresenter : class, IPresenter - { - if (!this._container.IsRegistered()) - { - this._container.Register(); - } + public void Run() + where TPresenter : class, IPresenter { + if (!this._container.IsRegistered()) { + this._container.Register(); + } - TPresenter presenter = this._container.Resolve(); - presenter.Run(); - } + TPresenter presenter = this._container.Resolve(); + presenter.Run(); + } - public void Run(TParameter args) - where TPresenter : class, IPresenter - { - if (!this._container.IsRegistered()) - { - this._container.Register(); - } + public void Run(TParameter args) + where TPresenter : class, IPresenter { + if (!this._container.IsRegistered()) { + this._container.Register(); + } - TPresenter presenter = this._container.Resolve(); - presenter.Run(args); - } + TPresenter presenter = this._container.Resolve(); + presenter.Run(args); + } - public TService Create() - where TService : class - { - if (!this._container.IsRegistered()) - { - this._container.Register(); - } + public TService Create() + where TService : class { + if (!this._container.IsRegistered()) { + this._container.Register(); + } - return this._container.Resolve(); - } - } + return this._container.Resolve(); + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/ApplicationBase/ExceptionHandler.cs b/src/Eve-O-Preview/ApplicationBase/ExceptionHandler.cs index fc11559..88b2c18 100644 --- a/src/Eve-O-Preview/ApplicationBase/ExceptionHandler.cs +++ b/src/Eve-O-Preview/ApplicationBase/ExceptionHandler.cs @@ -3,53 +3,45 @@ using System.IO; using System.Threading; using System.Windows.Forms; -namespace EveOPreview -{ - // A really very primitive exception handler stuff here - // No IoC, no fancy DI containers - just a plain exception stacktrace dump - // If this code is called then something was gone really bad - // so even the DI infrastructure might be dead already. - // So this dumb and non elegant approach is used - sealed class ExceptionHandler - { - private const string EXCEPTION_DUMP_FILE_NAME = "EVE-O-Preview.log"; - private const string EXCEPTION_MESSAGE = "EVE-O-Preview has encountered a problem and needs to close. Additional information has been saved in the crash log file."; +namespace EveOPreview { + // A really very primitive exception handler stuff here + // No IoC, no fancy DI containers - just a plain exception stacktrace dump + // If this code is called then something was gone really bad + // so even the DI infrastructure might be dead already. + // So this dumb and non elegant approach is used + sealed class ExceptionHandler { + private const string EXCEPTION_DUMP_FILE_NAME = "EVE-O-Preview.log"; + private const string EXCEPTION_MESSAGE = + "EVE-O-Preview has encountered a problem and needs to close. Additional information has been saved in the crash log file."; - public void SetupExceptionHandlers() - { - if (System.Diagnostics.Debugger.IsAttached) - { - return; - } + public void SetupExceptionHandlers() { + if (System.Diagnostics.Debugger.IsAttached) { + return; + } - Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); - Application.ThreadException += delegate (Object sender, ThreadExceptionEventArgs e) - { - this.ExceptionEventHandler(e.Exception); - }; + Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); + Application.ThreadException += delegate(Object sender, ThreadExceptionEventArgs e) { + this.ExceptionEventHandler(e.Exception); + }; - AppDomain.CurrentDomain.UnhandledException += delegate (Object sender, UnhandledExceptionEventArgs e) - { - this.ExceptionEventHandler(e.ExceptionObject as Exception); - }; - } + AppDomain.CurrentDomain.UnhandledException += delegate(Object sender, UnhandledExceptionEventArgs e) { + this.ExceptionEventHandler(e.ExceptionObject as Exception); + }; + } - private void ExceptionEventHandler(Exception exception) - { - try - { - String exceptionMessage = exception.ToString(); - File.WriteAllText(ExceptionHandler.EXCEPTION_DUMP_FILE_NAME, exceptionMessage); + private void ExceptionEventHandler(Exception exception) { + try { + String exceptionMessage = exception.ToString(); + File.WriteAllText(ExceptionHandler.EXCEPTION_DUMP_FILE_NAME, exceptionMessage); - MessageBox.Show(ExceptionHandler.EXCEPTION_MESSAGE, @"EVE-O-Preview", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - catch - { - // We are in unstable state now so even this operation might fail - // Still we actually don't care anymore - anyway the application has been cashed - } + MessageBox.Show(ExceptionHandler.EXCEPTION_MESSAGE, @"EVE-O-Preview", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } catch { + // We are in unstable state now so even this operation might fail + // Still we actually don't care anymore - anyway the application has been cashed + } - System.Environment.Exit(1); - } - } + System.Environment.Exit(1); + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/ApplicationBase/IApplicationController.cs b/src/Eve-O-Preview/ApplicationBase/IApplicationController.cs index 0f07c48..0bae0a4 100644 --- a/src/Eve-O-Preview/ApplicationBase/IApplicationController.cs +++ b/src/Eve-O-Preview/ApplicationBase/IApplicationController.cs @@ -1,26 +1,22 @@ -namespace EveOPreview -{ - /// - /// Application controller - /// - public interface IApplicationController - { - IApplicationController RegisterView() - where TPresenter : class, TView - where TView : IView; +namespace EveOPreview { + /// + /// Application controller + /// + public interface IApplicationController { + IApplicationController RegisterView() + where TPresenter : class, TView + where TView : IView; - IApplicationController RegisterInstance(T instance); + IApplicationController RegisterInstance(T instance); - IApplicationController RegisterService() - where TImplementation : class, TService; + IApplicationController RegisterService() + where TImplementation : class, TService; - void Run() - where TPresenter : class, IPresenter; + void Run() + where TPresenter : class, IPresenter; - void Run(TArgument args) - where TPresenter : class, IPresenter; + void Run(TArgument args) + where TPresenter : class, IPresenter; - TService Create() - where TService : class; - } -} \ No newline at end of file + TService Create() + where TService : class; } } \ No newline at end of file diff --git a/src/Eve-O-Preview/ApplicationBase/IIocContainer.cs b/src/Eve-O-Preview/ApplicationBase/IIocContainer.cs index e5b694c..363e31c 100644 --- a/src/Eve-O-Preview/ApplicationBase/IIocContainer.cs +++ b/src/Eve-O-Preview/ApplicationBase/IIocContainer.cs @@ -3,24 +3,10 @@ using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; -namespace EveOPreview -{ - /// - /// Generic interface for an Inversion Of Control container - /// - public interface IIocContainer - { - void Register() - where TImplementation : TService; - void Register(Type serviceType, Assembly container); - void Register(); - void Register(Expression> factory); - void Register(Expression> factory); - void RegisterInstance(TService instance); - TService Resolve(); - IEnumerable ResolveAll(); - object Resolve(Type serviceType); - IEnumerable ResolveAll(Type serviceType); - bool IsRegistered(); - } -} \ No newline at end of file +namespace EveOPreview { + /// + /// Generic interface for an Inversion Of Control container + /// + public interface IIocContainer { + void Register() + where TImplementation : TService; void Register(Type serviceType, Assembly container); void Register(); void Register(Expression> factory); void Register(Expression> factory); void RegisterInstance(TService instance); TService Resolve(); IEnumerable ResolveAll(); object Resolve(Type serviceType); IEnumerable ResolveAll(Type serviceType); bool IsRegistered(); } } \ No newline at end of file diff --git a/src/Eve-O-Preview/ApplicationBase/IPresenter.cs b/src/Eve-O-Preview/ApplicationBase/IPresenter.cs index 34b6c70..321e3bb 100644 --- a/src/Eve-O-Preview/ApplicationBase/IPresenter.cs +++ b/src/Eve-O-Preview/ApplicationBase/IPresenter.cs @@ -1,7 +1,5 @@ -namespace EveOPreview -{ - public interface IPresenter - { - void Run(); - } +namespace EveOPreview { + public interface IPresenter { + void Run(); + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/ApplicationBase/IPresenterGeneric.cs b/src/Eve-O-Preview/ApplicationBase/IPresenterGeneric.cs index 915b855..73fcd01 100644 --- a/src/Eve-O-Preview/ApplicationBase/IPresenterGeneric.cs +++ b/src/Eve-O-Preview/ApplicationBase/IPresenterGeneric.cs @@ -1,7 +1,5 @@ -namespace EveOPreview -{ - public interface IPresenter - { - void Run(TArgument args); - } +namespace EveOPreview { + public interface IPresenter { + void Run(TArgument args); + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/ApplicationBase/IView.cs b/src/Eve-O-Preview/ApplicationBase/IView.cs index acfd9c0..d355b8e 100644 --- a/src/Eve-O-Preview/ApplicationBase/IView.cs +++ b/src/Eve-O-Preview/ApplicationBase/IView.cs @@ -1,12 +1,10 @@ -namespace EveOPreview -{ - /// - /// Properties and methods that are common for all views - /// - public interface IView - { - void Show(); - void Hide(); - void Close(); - } +namespace EveOPreview { + /// + /// Properties and methods that are common for all views + /// + public interface IView { + void Show(); + void Hide(); + void Close(); + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/ApplicationBase/LightInjectContainer.cs b/src/Eve-O-Preview/ApplicationBase/LightInjectContainer.cs index 3cceb94..d31efeb 100644 --- a/src/Eve-O-Preview/ApplicationBase/LightInjectContainer.cs +++ b/src/Eve-O-Preview/ApplicationBase/LightInjectContainer.cs @@ -4,96 +4,76 @@ using System.Linq.Expressions; using System.Reflection; using LightInject; -namespace EveOPreview -{ - // Adapts LighInject to the generic IoC interface - sealed class LightInjectContainer : IIocContainer - { - private readonly ServiceContainer _container; +namespace EveOPreview { + // Adapts LighInject to the generic IoC interface + sealed class LightInjectContainer : IIocContainer { + private readonly ServiceContainer _container; - public LightInjectContainer() - { - this._container = new ServiceContainer(ContainerOptions.Default); - } + public LightInjectContainer() { + this._container = new ServiceContainer(ContainerOptions.Default); + } - public bool IsRegistered() - { - return this._container.CanGetInstance(typeof(TService), ""); - } + public bool IsRegistered() { + return this._container.CanGetInstance(typeof(TService), ""); + } - public void Register(Type serviceType, Assembly container) - { - if (!serviceType.IsInterface) - { - this._container.Register(serviceType, new PerContainerLifetime()); - return; - } + public void Register(Type serviceType, Assembly container) { + if (!serviceType.IsInterface) { + this._container.Register(serviceType, new PerContainerLifetime()); + return; + } - if (serviceType.IsInterface && serviceType.IsGenericType) - { - this._container.RegisterAssembly(container, (st, it) => st.IsConstructedGenericType && st.GetGenericTypeDefinition() == serviceType); - } - else - { - foreach (TypeInfo implementationType in container.DefinedTypes) - { - if (!implementationType.IsClass || implementationType.IsAbstract) - { - continue; - } + if (serviceType.IsInterface && serviceType.IsGenericType) { + this._container.RegisterAssembly( + container, (st, it) => st.IsConstructedGenericType && st.GetGenericTypeDefinition() == serviceType); + } else { + foreach (TypeInfo implementationType in container.DefinedTypes) { + if (!implementationType.IsClass || implementationType.IsAbstract) { + continue; + } - if (serviceType.IsAssignableFrom(implementationType)) - { - this._container.Register(serviceType, implementationType, new PerContainerLifetime()); - } - } - } - } + if (serviceType.IsAssignableFrom(implementationType)) { + this._container.Register(serviceType, implementationType, new PerContainerLifetime()); + } + } + } + } - public void Register() - { - this.Register(typeof(TService), typeof(TService).Assembly); - } + public void Register() { + this.Register(typeof(TService), typeof(TService).Assembly); + } - public void Register() - where TImplementation : TService - { - this._container.Register(); - } + public void Register() + where TImplementation : TService { + this._container.Register(); + } - public void Register(Expression> factory) - { - this._container.Register(f => factory); - } + public void Register(Expression> factory) { + this._container.Register(f => factory); + } - public void Register(Expression> factory) - { - this._container.Register(f => factory); - } + public void Register(Expression> factory) { + this._container.Register(f => factory); + } - public void RegisterInstance(TService instance) - { - this._container.RegisterInstance(instance); - } + public void RegisterInstance(TService instance) { + this._container.RegisterInstance(instance); + } - public TService Resolve() - { - return this._container.GetInstance(); - } + public TService Resolve() { + return this._container.GetInstance(); + } - public IEnumerable ResolveAll() - { - return this._container.GetAllInstances(); - } + public IEnumerable ResolveAll() { + return this._container.GetAllInstances(); + } - public object Resolve(Type serviceType) - { - return this._container.GetInstance(serviceType); - } + public object Resolve(Type serviceType) { + return this._container.GetInstance(serviceType); + } - public IEnumerable ResolveAll(Type serviceType) - { - return this._container.GetAllInstances(serviceType); - } - } + public IEnumerable ResolveAll(Type serviceType) { + return this._container.GetAllInstances(serviceType); + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/ApplicationBase/Presenter.cs b/src/Eve-O-Preview/ApplicationBase/Presenter.cs index 6a42ed3..13f0c26 100644 --- a/src/Eve-O-Preview/ApplicationBase/Presenter.cs +++ b/src/Eve-O-Preview/ApplicationBase/Presenter.cs @@ -1,22 +1,18 @@ -namespace EveOPreview -{ - public abstract class Presenter : IPresenter - where TView : IView - { - // Properties are used instead of fields so the code remains CLS compliant - // 'protected readonly' fields would result in non-CLS compliant code - protected TView View { get; private set; } - protected IApplicationController Controller { get; private set; } +namespace EveOPreview { + public abstract class Presenter : IPresenter + where TView : IView { + // Properties are used instead of fields so the code remains CLS compliant + // 'protected readonly' fields would result in non-CLS compliant code + protected TView View { get; private set; } + protected IApplicationController Controller { get; private set; } - protected Presenter(IApplicationController controller, TView view) - { - this.Controller = controller; - this.View = view; - } + protected Presenter(IApplicationController controller, TView view) { + this.Controller = controller; + this.View = view; + } - public void Run() - { - this.View.Show(); - } - } + public void Run() { + this.View.Show(); + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/ApplicationBase/PresenterGeneric.cs b/src/Eve-O-Preview/ApplicationBase/PresenterGeneric.cs index 438161b..c24b29f 100644 --- a/src/Eve-O-Preview/ApplicationBase/PresenterGeneric.cs +++ b/src/Eve-O-Preview/ApplicationBase/PresenterGeneric.cs @@ -1,19 +1,16 @@ -namespace EveOPreview -{ - public abstract class Presenter : IPresenter - where TView : IView - { - // Properties are used instead of fields so the code remains CLS compliant - // 'protected readonly' fields would result in non-CLS compliant code - protected TView View { get; private set; } - protected IApplicationController Controller { get; private set; } +namespace EveOPreview { + public abstract class Presenter : IPresenter + where TView : IView { + // Properties are used instead of fields so the code remains CLS compliant + // 'protected readonly' fields would result in non-CLS compliant code + protected TView View { get; private set; } + protected IApplicationController Controller { get; private set; } - protected Presenter(IApplicationController controller, TView view) - { - this.Controller = controller; - this.View = view; - } + protected Presenter(IApplicationController controller, TView view) { + this.Controller = controller; + this.View = view; + } - public abstract void Run(TArgument args); - } + public abstract void Run(TArgument args); + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Configuration/Implementation/AppConfig.cs b/src/Eve-O-Preview/Configuration/Implementation/AppConfig.cs index daa7de0..3013566 100644 --- a/src/Eve-O-Preview/Configuration/Implementation/AppConfig.cs +++ b/src/Eve-O-Preview/Configuration/Implementation/AppConfig.cs @@ -1,13 +1,10 @@ -namespace EveOPreview.Configuration.Implementation -{ - class AppConfig : IAppConfig - { - public AppConfig() - { - // Default values - this.ConfigFileName = null; - } +namespace EveOPreview.Configuration.Implementation { + class AppConfig : IAppConfig { + public AppConfig() { + // Default values + this.ConfigFileName = null; + } - public string ConfigFileName { get; set; } - } + public string ConfigFileName { get; set; } + } } diff --git a/src/Eve-O-Preview/Configuration/Implementation/ConfigurationStorage.cs b/src/Eve-O-Preview/Configuration/Implementation/ConfigurationStorage.cs index 7eacd1c..9660231 100644 --- a/src/Eve-O-Preview/Configuration/Implementation/ConfigurationStorage.cs +++ b/src/Eve-O-Preview/Configuration/Implementation/ConfigurationStorage.cs @@ -1,63 +1,52 @@ using System.IO; using Newtonsoft.Json; -namespace EveOPreview.Configuration.Implementation -{ - class ConfigurationStorage : IConfigurationStorage - { - private const string CONFIGURATION_FILE_NAME = "EVE-O-Preview.json"; +namespace EveOPreview.Configuration.Implementation { + class ConfigurationStorage : IConfigurationStorage { + private const string CONFIGURATION_FILE_NAME = "EVE-O-Preview.json"; - private readonly IAppConfig _appConfig; - private readonly IThumbnailConfiguration _thumbnailConfiguration; + private readonly IAppConfig _appConfig; + private readonly IThumbnailConfiguration _thumbnailConfiguration; - public ConfigurationStorage(IAppConfig appConfig, IThumbnailConfiguration thumbnailConfiguration) - { - this._appConfig = appConfig; - this._thumbnailConfiguration = thumbnailConfiguration; - } + public ConfigurationStorage(IAppConfig appConfig, IThumbnailConfiguration thumbnailConfiguration) { + this._appConfig = appConfig; + this._thumbnailConfiguration = thumbnailConfiguration; + } - public void Load() - { - string filename = this.GetConfigFileName(); + public void Load() { + string filename = this.GetConfigFileName(); - if (!File.Exists(filename)) - { - return; - } + if (!File.Exists(filename)) { + return; + } - string rawData = File.ReadAllText(filename); + string rawData = File.ReadAllText(filename); - JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings() - { - ObjectCreationHandling = ObjectCreationHandling.Replace - }; + JsonSerializerSettings jsonSerializerSettings = + new JsonSerializerSettings() { ObjectCreationHandling = ObjectCreationHandling.Replace }; - // StageHotkeyArraysToAvoidDuplicates(rawData); + // StageHotkeyArraysToAvoidDuplicates(rawData); - JsonConvert.PopulateObject(rawData, this._thumbnailConfiguration, jsonSerializerSettings); + JsonConvert.PopulateObject(rawData, this._thumbnailConfiguration, jsonSerializerSettings); - // Validate data after loading it - this._thumbnailConfiguration.ApplyRestrictions(); - } + // Validate data after loading it + this._thumbnailConfiguration.ApplyRestrictions(); + } - public void Save() - { - string rawData = JsonConvert.SerializeObject(this._thumbnailConfiguration, Formatting.Indented); - string filename = this.GetConfigFileName(); + public void Save() { + string rawData = JsonConvert.SerializeObject(this._thumbnailConfiguration, Formatting.Indented); + string filename = this.GetConfigFileName(); - try - { - File.WriteAllText(filename, rawData); - } - catch (IOException) - { - // Ignore error if for some reason the updated config cannot be written down - } - } + try { + File.WriteAllText(filename, rawData); + } catch (IOException) { + // Ignore error if for some reason the updated config cannot be written down + } + } - private string GetConfigFileName() - { - return string.IsNullOrEmpty(this._appConfig.ConfigFileName) ? ConfigurationStorage.CONFIGURATION_FILE_NAME : this._appConfig.ConfigFileName; - } - } + private string GetConfigFileName() { + return string.IsNullOrEmpty(this._appConfig.ConfigFileName) ? ConfigurationStorage.CONFIGURATION_FILE_NAME + : this._appConfig.ConfigFileName; + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Configuration/Implementation/ThumbnailConfiguration.cs b/src/Eve-O-Preview/Configuration/Implementation/ThumbnailConfiguration.cs index 72d0152..ae7e8e1 100644 --- a/src/Eve-O-Preview/Configuration/Implementation/ThumbnailConfiguration.cs +++ b/src/Eve-O-Preview/Configuration/Implementation/ThumbnailConfiguration.cs @@ -5,438 +5,510 @@ using System.Linq; using System.Windows.Forms; using Newtonsoft.Json; -namespace EveOPreview.Configuration.Implementation -{ - sealed class ThumbnailConfiguration : IThumbnailConfiguration - { - #region Private fields - private bool _enablePerClientThumbnailLayouts; - private bool _enableClientLayoutTracking; - #endregion +namespace EveOPreview.Configuration.Implementation { + sealed class ThumbnailConfiguration : IThumbnailConfiguration { +#region Private fields + private bool _enablePerClientThumbnailLayouts; + private bool _enableClientLayoutTracking; +#endregion - public ThumbnailConfiguration() - { - this.ConfigVersion = 1; + public ThumbnailConfiguration() { + this.ConfigVersion = 1; - this.CycleGroup1ForwardHotkeys = new List { "F14", "Control+F14" }; - this.CycleGroup1BackwardHotkeys = new List { "F13", "Control+F13" }; - this.CycleGroup1ClientsOrder = new Dictionary - { - { "EVE - Example DPS Toon 1", 1 }, - { "EVE - Example DPS Toon 2", 2 }, - { "EVE - Example DPS Toon 3", 3 } - }; + this.CycleGroup1ForwardHotkeys = new List { "F14", "Control+F14" }; + this.CycleGroup1BackwardHotkeys = new List { "F13", "Control+F13" }; + this.CycleGroup1ClientsOrder = new Dictionary { + { "EVE - Example DPS Toon 1", 1 }, { "EVE - Example DPS Toon 2", 2 }, { "EVE - Example DPS Toon 3", 3 } + }; - this.CycleGroup2ForwardHotkeys = new List { "F16", "Control+F16" }; - this.CycleGroup2BackwardHotkeys = new List { "F15", "Control+F15" }; - this.CycleGroup2ClientsOrder = new Dictionary - { - { "EVE - Example Logi Toon 1", 1 }, - { "EVE - Example Scout Toon 2", 2 }, - { "EVE - Example Tackle Toon 3", 3 } - }; + this.CycleGroup2ForwardHotkeys = new List { "F16", "Control+F16" }; + this.CycleGroup2BackwardHotkeys = new List { "F15", "Control+F15" }; + this.CycleGroup2ClientsOrder = new Dictionary { { "EVE - Example Logi Toon 1", 1 }, + { "EVE - Example Scout Toon 2", 2 }, + { "EVE - Example Tackle Toon 3", 3 } }; - this.CycleGroup3ForwardHotkeys = new List { "" }; - this.CycleGroup3BackwardHotkeys = new List { "" }; - this.CycleGroup3ClientsOrder = new Dictionary - { - { "EVE - cycle group 3", 1 }, - }; - this.CycleGroup4ForwardHotkeys = new List { "" }; - this.CycleGroup4BackwardHotkeys = new List { "" }; - this.CycleGroup4ClientsOrder = new Dictionary - { - { "EVE - cycle group 4", 1 }, - }; - this.CycleGroup5ForwardHotkeys = new List { "" }; - this.CycleGroup5BackwardHotkeys = new List { "" }; - this.CycleGroup5ClientsOrder = new Dictionary - { - { "EVE - cycle group 5", 1 }, - }; + this.CycleGroup3ForwardHotkeys = new List { "" }; + this.CycleGroup3BackwardHotkeys = new List { "" }; + this.CycleGroup3ClientsOrder = new Dictionary { + { "EVE - cycle group 3", 1 }, + }; + this.CycleGroup4ForwardHotkeys = new List { "" }; + this.CycleGroup4BackwardHotkeys = new List { "" }; + this.CycleGroup4ClientsOrder = new Dictionary { + { "EVE - cycle group 4", 1 }, + }; + this.CycleGroup5ForwardHotkeys = new List { "" }; + this.CycleGroup5BackwardHotkeys = new List { "" }; + this.CycleGroup5ClientsOrder = new Dictionary { + { "EVE - cycle group 5", 1 }, + }; - this.PerClientActiveClientHighlightColor = new Dictionary - { - {"EVE - Example Toon 1", Color.Red}, - {"EVE - Example Toon 2", Color.Green} - }; + this.PerClientActiveClientHighlightColor = + new Dictionary { { "EVE - Example Toon 1", Color.Red }, + { "EVE - Example Toon 2", Color.Green } }; - this.PerClientThumbnailSize = new Dictionary - { - {"EVE - Example Toon 1", new Size(200, 200)}, - {"EVE - Example Toon 2", new Size(200, 200)} - }; + this.PerClientThumbnailSize = + new Dictionary { { "EVE - Example Toon 1", new Size(200, 200) }, + { "EVE - Example Toon 2", new Size(200, 200) } }; - this.PerClientZoomAnchor = new Dictionary - { - {"EVE - Example Toon 1", ZoomAnchor.N }, - {"EVE - Example Toon 2", ZoomAnchor.S} - }; + this.PerClientThumbnailRegion = new Dictionary(); - this.PerClientLayout = new Dictionary>(); - this.FlatLayout = new Dictionary(); - this.ClientLayout = new Dictionary(); - this.ClientHotkey = new Dictionary(); - this.DisableThumbnail = new Dictionary(); - this.PriorityClients = new List(); + this.PerClientZoomAnchor = new Dictionary { { "EVE - Example Toon 1", ZoomAnchor.N }, + { "EVE - Example Toon 2", ZoomAnchor.S } }; - this.ExecutablesToPreview = new List { "exefile" }; + this.PerClientLayout = new Dictionary>(); + this.FlatLayout = new Dictionary(); + this.ClientLayout = new Dictionary(); + this.ClientHotkey = new Dictionary(); + this.DisableThumbnail = new Dictionary(); + this.PriorityClients = new List(); - this.MinimizeToTray = false; - this.ThumbnailRefreshPeriod = 500; - this.ThumbnailResizeTimeoutPeriod = 500; + this.ExecutablesToPreview = new List { "exefile" }; + + this.MinimizeToTray = false; + this.ThumbnailRefreshPeriod = 500; + this.ThumbnailResizeTimeoutPeriod = 500; #if LINUX - this.EnableWineCompatibilityMode = true; + this.EnableWineCompatibilityMode = true; #else - this.EnableWineCompatibilityMode = false; + this.EnableWineCompatibilityMode = false; #endif - this.ThumbnailOpacity = 0.5; + this.ThumbnailOpacity = 0.5; - this.EnableClientLayoutTracking = false; - this.HideActiveClientThumbnail = false; - this.HideLoginClientThumbnail = false; - this.MinimizeInactiveClients = false; - this.WindowsAnimationStyle = AnimationStyle.NoAnimation; - this.ShowThumbnailsAlwaysOnTop = true; - this.EnablePerClientThumbnailLayouts = false; + this.EnableClientLayoutTracking = false; + this.HideActiveClientThumbnail = false; + this.HideLoginClientThumbnail = false; + this.MinimizeInactiveClients = false; + this.WindowsAnimationStyle = AnimationStyle.NoAnimation; + this.ShowThumbnailsAlwaysOnTop = true; + this.EnablePerClientThumbnailLayouts = false; - this.HideThumbnailsOnLostFocus = false; - this.HideThumbnailsDelay = 2; // 2 thumbnails refresh cycles (1.0 sec) + this.HideThumbnailsOnLostFocus = false; + this.HideThumbnailsDelay = 2; // 2 thumbnails refresh cycles (1.0 sec) - this.ThumbnailSize = new Size(384, 216); - this.ThumbnailMinimumSize = new Size(192, 108); - this.ThumbnailMaximumSize = new Size(960, 540); + this.ThumbnailSize = new Size(384, 216); + this.ThumbnailMinimumSize = new Size(192, 108); + this.ThumbnailMaximumSize = new Size(960, 540); - this.EnableThumbnailSnap = true; + this.EnableThumbnailSnap = true; - this.ThumbnailZoomEnabled = false; - this.ThumbnailZoomFactor = 2; - this.ThumbnailZoomAnchor = ZoomAnchor.NW; + this.ThumbnailZoomEnabled = false; + this.ThumbnailZoomFactor = 2; + this.ThumbnailZoomAnchor = ZoomAnchor.NW; this.OverlayLabelAnchor = ZoomAnchor.NW; this.ShowThumbnailOverlays = true; - this.ShowThumbnailFrames = false; - this.LockThumbnailLocation = false; + this.ShowThumbnailFrames = false; + this.LockThumbnailLocation = false; - this.ThumbnailSnapToGrid = true; - this.ThumbnailSnapToGridSizeX = 100; - this.ThumbnailSnapToGridSizeY = 50; + this.ThumbnailSnapToGrid = true; + this.ThumbnailSnapToGridSizeX = 100; + this.ThumbnailSnapToGridSizeY = 50; this.EnableActiveClientHighlight = false; - this.ActiveClientHighlightColor = Color.GreenYellow; - this.ActiveClientHighlightThickness = 3; + this.ActiveClientHighlightColor = Color.GreenYellow; + this.ActiveClientHighlightThickness = 3; - this.OverlayLabelColor = Color.Orange; - this.OverlayLabelSize = 10; + this.OverlayLabelColor = Color.Orange; + this.OverlayLabelSize = 10; - this.IconName = ""; + this.EnableThumbnailRegionSnipping = false; + this.DefaultThumbnailRegion = new Rectangle(0, 0, 384, 216); - this.LoginThumbnailLocation = new Point(5, 5); - } + this.CurrentProfile = "Default"; + this.AvailableProfiles = new List { "Default" }; + this.IconName = ""; - [JsonProperty("ConfigVersion")] - public int ConfigVersion { get; set; } + this.LoginThumbnailLocation = new Point(5, 5); + } - [JsonProperty("CycleGroup1ForwardHotkeys")] - public List CycleGroup1ForwardHotkeys { get; set; } + [JsonProperty("ConfigVersion")] + public int ConfigVersion { get; set; } - [JsonProperty("CycleGroup1BackwardHotkeys")] - public List CycleGroup1BackwardHotkeys { get; set; } + [JsonProperty("CycleGroup1ForwardHotkeys")] + public List CycleGroup1ForwardHotkeys { + get; set; + } - [JsonProperty("CycleGroup1ClientsOrder")] - public Dictionary CycleGroup1ClientsOrder { get; set; } + [JsonProperty("CycleGroup1BackwardHotkeys")] + public List CycleGroup1BackwardHotkeys { + get; set; + } - [JsonProperty("CycleGroup2ForwardHotkeys")] - public List CycleGroup2ForwardHotkeys { get; set; } + [JsonProperty("CycleGroup1ClientsOrder")] + public Dictionary CycleGroup1ClientsOrder { + get; set; + } - [JsonProperty("CycleGroup2BackwardHotkeys")] - public List CycleGroup2BackwardHotkeys { get; set; } + [JsonProperty("CycleGroup2ForwardHotkeys")] + public List CycleGroup2ForwardHotkeys { + get; set; + } - [JsonProperty("CycleGroup2ClientsOrder")] - public Dictionary CycleGroup2ClientsOrder { get; set; } + [JsonProperty("CycleGroup2BackwardHotkeys")] + public List CycleGroup2BackwardHotkeys { + get; set; + } - [JsonProperty("CycleGroup3ForwardHotkeys")] - public List CycleGroup3ForwardHotkeys { get; set; } + [JsonProperty("CycleGroup2ClientsOrder")] + public Dictionary CycleGroup2ClientsOrder { + get; set; + } - [JsonProperty("CycleGroup3BackwardHotkeys")] - public List CycleGroup3BackwardHotkeys { get; set; } + [JsonProperty("CycleGroup3ForwardHotkeys")] + public List CycleGroup3ForwardHotkeys { + get; set; + } - [JsonProperty("CycleGroup3ClientsOrder")] - public Dictionary CycleGroup3ClientsOrder { get; set; } + [JsonProperty("CycleGroup3BackwardHotkeys")] + public List CycleGroup3BackwardHotkeys { + get; set; + } - [JsonProperty("CycleGroup4ForwardHotkeys")] - public List CycleGroup4ForwardHotkeys { get; set; } + [JsonProperty("CycleGroup3ClientsOrder")] + public Dictionary CycleGroup3ClientsOrder { + get; set; + } - [JsonProperty("CycleGroup4BackwardHotkeys")] - public List CycleGroup4BackwardHotkeys { get; set; } + [JsonProperty("CycleGroup4ForwardHotkeys")] + public List CycleGroup4ForwardHotkeys { + get; set; + } - [JsonProperty("CycleGroup4ClientsOrder")] - public Dictionary CycleGroup4ClientsOrder { get; set; } + [JsonProperty("CycleGroup4BackwardHotkeys")] + public List CycleGroup4BackwardHotkeys { + get; set; + } - [JsonProperty("CycleGroup5ForwardHotkeys")] - public List CycleGroup5ForwardHotkeys { get; set; } + [JsonProperty("CycleGroup4ClientsOrder")] + public Dictionary CycleGroup4ClientsOrder { + get; set; + } - [JsonProperty("CycleGroup5BackwardHotkeys")] - public List CycleGroup5BackwardHotkeys { get; set; } + [JsonProperty("CycleGroup5ForwardHotkeys")] + public List CycleGroup5ForwardHotkeys { + get; set; + } - [JsonProperty("CycleGroup5ClientsOrder")] - public Dictionary CycleGroup5ClientsOrder { get; set; } + [JsonProperty("CycleGroup5BackwardHotkeys")] + public List CycleGroup5BackwardHotkeys { + get; set; + } - [JsonProperty("PerClientActiveClientHighlightColor")] - public Dictionary PerClientActiveClientHighlightColor { get; set; } + [JsonProperty("CycleGroup5ClientsOrder")] + public Dictionary CycleGroup5ClientsOrder { + get; set; + } - [JsonProperty("PerClientThumbnailSize")] - public Dictionary PerClientThumbnailSize { get; set; } + [JsonProperty("PerClientActiveClientHighlightColor")] + public Dictionary PerClientActiveClientHighlightColor { + get; set; + } - [JsonProperty("PerClientZoomAnchor")] - public Dictionary PerClientZoomAnchor{ get; set; } - public bool MinimizeToTray { get; set; } - public int ThumbnailRefreshPeriod { get; set; } - public int ThumbnailResizeTimeoutPeriod { get; set; } + [JsonProperty("PerClientThumbnailSize")] + public Dictionary PerClientThumbnailSize { + get; set; + } - [JsonProperty("WineCompatibilityMode")] - public bool EnableWineCompatibilityMode { get; set; } + [JsonProperty("PerClientThumbnailRegion")] + public Dictionary PerClientThumbnailRegion { + get; set; + } - [JsonProperty("ThumbnailsOpacity")] - public double ThumbnailOpacity { get; set; } + [JsonProperty("PerClientZoomAnchor")] + public Dictionary PerClientZoomAnchor { + get; set; + } + public bool MinimizeToTray { get; set; } + public int ThumbnailRefreshPeriod { get; set; } + public int ThumbnailResizeTimeoutPeriod { get; set; } - public bool EnableClientLayoutTracking - { - get => this._enableClientLayoutTracking; - set - { - if (!value) - { - this.ClientLayout.Clear(); - } + [JsonProperty("WineCompatibilityMode")] + public bool EnableWineCompatibilityMode { + get; set; + } - this._enableClientLayoutTracking = value; - } - } + [JsonProperty("ThumbnailsOpacity")] + public double ThumbnailOpacity { + get; set; + } - public bool HideActiveClientThumbnail { get; set; } - public bool HideLoginClientThumbnail { get; set; } - public bool MinimizeInactiveClients { get; set; } - public AnimationStyle WindowsAnimationStyle { get; set; } - public bool ShowThumbnailsAlwaysOnTop { get; set; } + public bool EnableClientLayoutTracking { + get => this._enableClientLayoutTracking; + set { + if (!value) { + this.ClientLayout.Clear(); + } - public bool EnablePerClientThumbnailLayouts - { - get => this._enablePerClientThumbnailLayouts; - set - { - if (!value) - { - this.PerClientLayout.Clear(); - } + this._enableClientLayoutTracking = value; + } + } - this._enablePerClientThumbnailLayouts = value; - } - } + public bool HideActiveClientThumbnail { get; set; } + public bool HideLoginClientThumbnail { get; set; } + public bool MinimizeInactiveClients { get; set; } + public AnimationStyle WindowsAnimationStyle { get; set; } + public bool ShowThumbnailsAlwaysOnTop { get; set; } - public bool HideThumbnailsOnLostFocus { get; set; } - public int HideThumbnailsDelay { get; set; } + public bool EnablePerClientThumbnailLayouts { + get => this._enablePerClientThumbnailLayouts; + set { + if (!value) { + this.PerClientLayout.Clear(); + } - public Size ThumbnailSize { get; set; } - public Size ThumbnailMaximumSize { get; set; } - public Size ThumbnailMinimumSize { get; set; } + this._enablePerClientThumbnailLayouts = value; + } + } - public bool EnableThumbnailSnap { get; set; } + public bool HideThumbnailsOnLostFocus { get; set; } + public int HideThumbnailsDelay { get; set; } - [JsonProperty("EnableThumbnailZoom")] - public bool ThumbnailZoomEnabled { get; set; } - public int ThumbnailZoomFactor { get; set; } - public ZoomAnchor ThumbnailZoomAnchor { get; set; } - public ZoomAnchor OverlayLabelAnchor { get; set; } + public Size ThumbnailSize { get; set; } + public Size ThumbnailMaximumSize { get; set; } + public Size ThumbnailMinimumSize { get; set; } - public bool ShowThumbnailOverlays { get; set; } - public bool ShowThumbnailFrames { get; set; } - public bool LockThumbnailLocation { get; set; } - public bool ThumbnailSnapToGrid { get; set; } - public int ThumbnailSnapToGridSizeX { get; set; } - public int ThumbnailSnapToGridSizeY { get; set; } + public bool EnableThumbnailSnap { get; set; } - public bool EnableActiveClientHighlight { get; set; } + [JsonProperty("EnableThumbnailZoom")] + public bool ThumbnailZoomEnabled { + get; set; + } + public int ThumbnailZoomFactor { get; set; } + public ZoomAnchor ThumbnailZoomAnchor { get; set; } + public ZoomAnchor OverlayLabelAnchor { get; set; } - public Color ActiveClientHighlightColor { get; set; } - public Color OverlayLabelColor { get; set; } - public int OverlayLabelSize { get; set; } - [JsonProperty("IconName")] - public string IconName { get; set; } + public bool ShowThumbnailOverlays { get; set; } + public bool ShowThumbnailFrames { get; set; } + public bool LockThumbnailLocation { get; set; } + public bool ThumbnailSnapToGrid { get; set; } + public int ThumbnailSnapToGridSizeX { get; set; } + public int ThumbnailSnapToGridSizeY { get; set; } - public int ActiveClientHighlightThickness { get; set; } + public bool EnableActiveClientHighlight { get; set; } - [JsonProperty("LoginThumbnailLocation")] - public Point LoginThumbnailLocation { get; set; } + public Color ActiveClientHighlightColor { get; set; } + public Color OverlayLabelColor { get; set; } + public int OverlayLabelSize { get; set; } - [JsonProperty("ToggleTrackingHotkey")] - public string ToggleTrackingHotkey { get; set; } + public bool EnableThumbnailRegionSnipping { get; set; } + public Rectangle DefaultThumbnailRegion { get; set; } - [JsonProperty] - private Dictionary> PerClientLayout { get; set; } - [JsonProperty] - private Dictionary FlatLayout { get; set; } - [JsonProperty] - private Dictionary ClientLayout { get; set; } - [JsonProperty] - private Dictionary ClientHotkey { get; set; } - [JsonProperty] - private Dictionary DisableThumbnail { get; set; } - [JsonProperty] - private List PriorityClients { get; set; } - [JsonProperty] - public List ExecutablesToPreview { get; set; } + public string CurrentProfile { get; set; } + public List AvailableProfiles { get; set; } + [JsonProperty("IconName")] + public string IconName { + get; set; + } - public Point GetThumbnailLocation(string currentClient, string activeClient, Point defaultLocation) - { - Point location; + public int ActiveClientHighlightThickness { get; set; } - // What this code does: - // If Per-Client layouts are enabled - // and client name is known - // and there is a separate thumbnails layout for this client - // and this layout contains an entry for the current client - // then return that entry - // otherwise try to get client layout from the flat all-clients layout - // If there is no layout too then use the default one - if (this.EnablePerClientThumbnailLayouts && !string.IsNullOrEmpty(activeClient)) - { - Dictionary layoutSource; - if (this.PerClientLayout.TryGetValue(activeClient, out layoutSource) && layoutSource.TryGetValue(currentClient, out location)) - { - return location; - } - } + [JsonProperty("LoginThumbnailLocation")] + public Point LoginThumbnailLocation { + get; set; + } - return this.FlatLayout.TryGetValue(currentClient, out location) ? location : defaultLocation; - } + [JsonProperty("ToggleTrackingHotkey")] + public string ToggleTrackingHotkey { + get; set; + } - public Size GetThumbnailSize(string currentClient, string activeClient, Size defaultSize) - { - Size sizeOfThumbnail; - return this.PerClientThumbnailSize.TryGetValue(currentClient, out sizeOfThumbnail) ? sizeOfThumbnail : defaultSize; - } - public ZoomAnchor GetZoomAnchor(string currentClient, ZoomAnchor defaultZoomAnchor) - { - ZoomAnchor zoomAnchor; - return this.PerClientZoomAnchor.TryGetValue(currentClient, out zoomAnchor) ? zoomAnchor : defaultZoomAnchor; - } + [JsonProperty] + private Dictionary> PerClientLayout { + get; set; + } + [JsonProperty] + private Dictionary FlatLayout { + get; set; + } + [JsonProperty] + private Dictionary ClientLayout { + get; set; + } + [JsonProperty] + private Dictionary ClientHotkey { + get; set; + } + [JsonProperty] + private Dictionary DisableThumbnail { + get; set; + } + [JsonProperty] + private List PriorityClients { + get; set; + } + [JsonProperty] + public List ExecutablesToPreview { + get; set; + } - public void SetThumbnailLocation(string currentClient, string activeClient, Point location) - { - Dictionary layoutSource; + public Point GetThumbnailLocation(string currentClient, string activeClient, Point defaultLocation) { + Point location; - if (this.EnablePerClientThumbnailLayouts) - { - if (string.IsNullOrEmpty(activeClient)) - { - return; - } + // What this code does: + // If Per-Client layouts are enabled + // and client name is known + // and there is a separate thumbnails layout for this client + // and this layout contains an entry for the current client + // then return that entry + // otherwise try to get client layout from the flat all-clients layout + // If there is no layout too then use the default one + if (this.EnablePerClientThumbnailLayouts && !string.IsNullOrEmpty(activeClient)) { + Dictionary layoutSource; + if (this.PerClientLayout.TryGetValue(activeClient, out layoutSource) && + layoutSource.TryGetValue(currentClient, out location)) { + return location; + } + } - if (!this.PerClientLayout.TryGetValue(activeClient, out layoutSource)) - { - layoutSource = new Dictionary(); - this.PerClientLayout[activeClient] = layoutSource; - } - } - else - { - layoutSource = this.FlatLayout; - } + return this.FlatLayout.TryGetValue(currentClient, out location) ? location : defaultLocation; + } - layoutSource[currentClient] = location; - } + public Size GetThumbnailSize(string currentClient, string activeClient, Size defaultSize) { + Size sizeOfThumbnail; + return this.PerClientThumbnailSize.TryGetValue(currentClient, out sizeOfThumbnail) ? sizeOfThumbnail + : defaultSize; + } - public ClientLayout GetClientLayout(string currentClient) - { - ClientLayout layout; - this.ClientLayout.TryGetValue(currentClient, out layout); + public Rectangle GetThumbnailRegion(string currentClient, Rectangle defaultRegion) { + Rectangle region; + return this.PerClientThumbnailRegion.TryGetValue(currentClient, out region) ? region : defaultRegion; + } - return layout; - } + public ZoomAnchor GetZoomAnchor(string currentClient, ZoomAnchor defaultZoomAnchor) { + ZoomAnchor zoomAnchor; + return this.PerClientZoomAnchor.TryGetValue(currentClient, out zoomAnchor) ? zoomAnchor : defaultZoomAnchor; + } - public void SetClientLayout(string currentClient, ClientLayout layout) - { - this.ClientLayout[currentClient] = layout; - } + public void SetThumbnailLocation(string currentClient, string activeClient, Point location) { + Dictionary layoutSource; - public Keys GetClientHotkey(string currentClient) - { - string hotkey; - if (this.ClientHotkey.TryGetValue(currentClient, out hotkey)) - { - // Protect from incorrect values - object rawValue = (new KeysConverter()).ConvertFromInvariantString(hotkey); - return rawValue != null ? (Keys)rawValue : Keys.None; - } + if (this.EnablePerClientThumbnailLayouts) { + if (string.IsNullOrEmpty(activeClient)) { + return; + } - return Keys.None; - } + if (!this.PerClientLayout.TryGetValue(activeClient, out layoutSource)) { + layoutSource = new Dictionary(); + this.PerClientLayout[activeClient] = layoutSource; + } + } else { + layoutSource = this.FlatLayout; + } - public void SetClientHotkey(string currentClient, Keys hotkey) - { - this.ClientHotkey[currentClient] = (new KeysConverter()).ConvertToInvariantString(hotkey); - } + layoutSource[currentClient] = location; + } - public Keys StringToKey(string hotkey) - { - object rawValue = (new KeysConverter()).ConvertFromInvariantString(hotkey); - return rawValue != null ? (Keys)rawValue : Keys.None; - } + public void SetThumbnailRegion(string currentClient, Rectangle region) { + this.PerClientThumbnailRegion[currentClient] = region; + } - public bool IsPriorityClient(string currentClient) - { - return this.PriorityClients.Contains(currentClient); - } - public bool IsExecutableToPreview(string processName) - { - return this.ExecutablesToPreview.Any(s => s.Equals(processName, StringComparison.OrdinalIgnoreCase)); - } + public void SaveProfile(string profileName) { + if (!this.AvailableProfiles.Contains(profileName)) { + this.AvailableProfiles.Add(profileName); + } + this.CurrentProfile = profileName; + } - public bool IsThumbnailDisabled(string currentClient) - { - return this.DisableThumbnail.TryGetValue(currentClient, out bool isDisabled) && isDisabled; - } + public void LoadProfile(string profileName) { + if (this.AvailableProfiles.Contains(profileName)) { + this.CurrentProfile = profileName; + } + } - public void ToggleThumbnail(string currentClient, bool isDisabled) - { - this.DisableThumbnail[currentClient] = isDisabled; - } + public void DeleteProfile(string profileName) { + if (profileName != "Default" && this.AvailableProfiles.Contains(profileName)) { + this.AvailableProfiles.Remove(profileName); + if (this.CurrentProfile == profileName) { + this.CurrentProfile = "Default"; + } + } + } - /// - /// Applies restrictions to different parameters of the config - /// - public void ApplyRestrictions() - { + public ClientLayout GetClientLayout(string currentClient) { + ClientLayout layout; + this.ClientLayout.TryGetValue(currentClient, out layout); + + return layout; + } + + public void SetClientLayout(string currentClient, ClientLayout layout) { + this.ClientLayout[currentClient] = layout; + } + + public Keys GetClientHotkey(string currentClient) { + string hotkey; + if (this.ClientHotkey.TryGetValue(currentClient, out hotkey)) { + // Protect from incorrect values + object rawValue = (new KeysConverter()).ConvertFromInvariantString(hotkey); + return rawValue != null ? (Keys)rawValue : Keys.None; + } + + return Keys.None; + } + + public void SetClientHotkey(string currentClient, Keys hotkey) { + this.ClientHotkey[currentClient] = (new KeysConverter()).ConvertToInvariantString(hotkey); + } + + public Keys StringToKey(string hotkey) { + object rawValue = (new KeysConverter()).ConvertFromInvariantString(hotkey); + return rawValue != null ? (Keys)rawValue : Keys.None; + } + + public bool IsPriorityClient(string currentClient) { + return this.PriorityClients.Contains(currentClient); + } + public bool IsExecutableToPreview(string processName) { + return this.ExecutablesToPreview.Any(s => s.Equals(processName, StringComparison.OrdinalIgnoreCase)); + } + + public bool IsThumbnailDisabled(string currentClient) { + return this.DisableThumbnail.TryGetValue(currentClient, out bool isDisabled) && isDisabled; + } + + public void ToggleThumbnail(string currentClient, bool isDisabled) { + this.DisableThumbnail[currentClient] = isDisabled; + } + + /// + /// Applies restrictions to different parameters of the config + /// + public void ApplyRestrictions() { #if LINUX - this.ThumbnailRefreshPeriod = ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailRefreshPeriod, 10, 1000); + this.ThumbnailRefreshPeriod = + ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailRefreshPeriod, 10, 1000); #else - this.ThumbnailRefreshPeriod = ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailRefreshPeriod, 300, 1000); + this.ThumbnailRefreshPeriod = + ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailRefreshPeriod, 300, 1000); #endif - this.ThumbnailResizeTimeoutPeriod = ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailResizeTimeoutPeriod, 200, 5000); - this.ThumbnailSize = new Size(ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailSize.Width, this.ThumbnailMinimumSize.Width, this.ThumbnailMaximumSize.Width), - ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailSize.Height, this.ThumbnailMinimumSize.Height, this.ThumbnailMaximumSize.Height)); - this.ThumbnailOpacity = ThumbnailConfiguration.ApplyRestrictions((int)(this.ThumbnailOpacity * 100.00), 20, 100) / 100.00; - this.ThumbnailZoomFactor = ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailZoomFactor, 2, 10); - this.ActiveClientHighlightThickness = ThumbnailConfiguration.ApplyRestrictions(this.ActiveClientHighlightThickness, 1, 6); - } + this.ThumbnailResizeTimeoutPeriod = + ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailResizeTimeoutPeriod, 200, 5000); + this.ThumbnailSize = new Size( + ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailSize.Width, this.ThumbnailMinimumSize.Width, + this.ThumbnailMaximumSize.Width), + ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailSize.Height, this.ThumbnailMinimumSize.Height, + this.ThumbnailMaximumSize.Height)); + this.ThumbnailOpacity = + ThumbnailConfiguration.ApplyRestrictions((int)(this.ThumbnailOpacity * 100.00), 20, 100) / 100.00; + this.ThumbnailZoomFactor = ThumbnailConfiguration.ApplyRestrictions(this.ThumbnailZoomFactor, 2, 10); + this.ActiveClientHighlightThickness = + ThumbnailConfiguration.ApplyRestrictions(this.ActiveClientHighlightThickness, 1, 6); + } - private static int ApplyRestrictions(int value, int minimum, int maximum) - { - if (value <= minimum) - { - return minimum; - } + private static int ApplyRestrictions(int value, int minimum, int maximum) { + if (value <= minimum) { + return minimum; + } - if (value >= maximum) - { - return maximum; - } + if (value >= maximum) { + return maximum; + } - return value; - } - } + return value; + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Configuration/Interface/AnimationStyle.cs b/src/Eve-O-Preview/Configuration/Interface/AnimationStyle.cs index 69dfdf9..fb896f3 100644 --- a/src/Eve-O-Preview/Configuration/Interface/AnimationStyle.cs +++ b/src/Eve-O-Preview/Configuration/Interface/AnimationStyle.cs @@ -1,8 +1,3 @@ -namespace EveOPreview.Configuration -{ - public enum AnimationStyle - { - OriginalAnimation, - NoAnimation - } +namespace EveOPreview.Configuration { + public enum AnimationStyle { OriginalAnimation, NoAnimation } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Configuration/Interface/ClientLayout.cs b/src/Eve-O-Preview/Configuration/Interface/ClientLayout.cs index c158401..07b7ffb 100644 --- a/src/Eve-O-Preview/Configuration/Interface/ClientLayout.cs +++ b/src/Eve-O-Preview/Configuration/Interface/ClientLayout.cs @@ -1,28 +1,23 @@ -namespace EveOPreview.Configuration -{ - public class ClientLayout - { - public ClientLayout() - { - } +namespace EveOPreview.Configuration { + public class ClientLayout { + public ClientLayout() {} - 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 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 X { get; set; } - public int Y { get; set; } + public int Y { get; set; } - public int Width { get; set; } + public int Width { get; set; } - public int Height { get; set; } + public int Height { get; set; } - public bool IsMaximized { get; set; } - } + public bool IsMaximized { get; set; } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Configuration/Interface/IAppConfig.cs b/src/Eve-O-Preview/Configuration/Interface/IAppConfig.cs index f5ba6bf..a94bdd4 100644 --- a/src/Eve-O-Preview/Configuration/Interface/IAppConfig.cs +++ b/src/Eve-O-Preview/Configuration/Interface/IAppConfig.cs @@ -1,10 +1,8 @@ -namespace EveOPreview.Configuration -{ - /// - /// Application configuration - /// - public interface IAppConfig - { - string ConfigFileName { get; set; } - } +namespace EveOPreview.Configuration { + /// + /// Application configuration + /// + public interface IAppConfig { + string ConfigFileName { get; set; } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Configuration/Interface/IConfigurationStorage.cs b/src/Eve-O-Preview/Configuration/Interface/IConfigurationStorage.cs index 5cc3e11..d1d4148 100644 --- a/src/Eve-O-Preview/Configuration/Interface/IConfigurationStorage.cs +++ b/src/Eve-O-Preview/Configuration/Interface/IConfigurationStorage.cs @@ -1,8 +1,6 @@ -namespace EveOPreview.Configuration -{ - public interface IConfigurationStorage - { - void Load(); - void Save(); - } +namespace EveOPreview.Configuration { + public interface IConfigurationStorage { + void Load(); + void Save(); + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Configuration/Interface/IThumbnailConfiguration.cs b/src/Eve-O-Preview/Configuration/Interface/IThumbnailConfiguration.cs index 83c8e2a..516c33b 100644 --- a/src/Eve-O-Preview/Configuration/Interface/IThumbnailConfiguration.cs +++ b/src/Eve-O-Preview/Configuration/Interface/IThumbnailConfiguration.cs @@ -2,100 +2,111 @@ using System.Drawing; using System.Windows.Forms; -namespace EveOPreview.Configuration -{ - public interface IThumbnailConfiguration - { - List CycleGroup1ForwardHotkeys { get; set; } - List CycleGroup1BackwardHotkeys { get; set; } - Dictionary CycleGroup1ClientsOrder { get; set; } +namespace EveOPreview.Configuration { + public interface IThumbnailConfiguration { + List CycleGroup1ForwardHotkeys { get; set; } + List CycleGroup1BackwardHotkeys { get; set; } + Dictionary CycleGroup1ClientsOrder { get; set; } - List CycleGroup2ForwardHotkeys { get; set; } - List CycleGroup2BackwardHotkeys { get; set; } - Dictionary CycleGroup2ClientsOrder { get; set; } + List CycleGroup2ForwardHotkeys { get; set; } + List CycleGroup2BackwardHotkeys { get; set; } + Dictionary CycleGroup2ClientsOrder { get; set; } - List CycleGroup3ForwardHotkeys { get; set; } - List CycleGroup3BackwardHotkeys { get; set; } - Dictionary CycleGroup3ClientsOrder { get; set; } + List CycleGroup3ForwardHotkeys { get; set; } + List CycleGroup3BackwardHotkeys { get; set; } + Dictionary CycleGroup3ClientsOrder { get; set; } - List CycleGroup4ForwardHotkeys { get; set; } - List CycleGroup4BackwardHotkeys { get; set; } - Dictionary CycleGroup4ClientsOrder { get; set; } + List CycleGroup4ForwardHotkeys { get; set; } + List CycleGroup4BackwardHotkeys { get; set; } + Dictionary CycleGroup4ClientsOrder { get; set; } - List CycleGroup5ForwardHotkeys { get; set; } - List CycleGroup5BackwardHotkeys { get; set; } - Dictionary CycleGroup5ClientsOrder { get; set; } + List CycleGroup5ForwardHotkeys { get; set; } + List CycleGroup5BackwardHotkeys { get; set; } + Dictionary CycleGroup5ClientsOrder { get; set; } - string ToggleTrackingHotkey { get; set; } + string ToggleTrackingHotkey { get; set; } - Dictionary PerClientActiveClientHighlightColor { get; set; } - Dictionary PerClientThumbnailSize { get; set; } + Dictionary PerClientActiveClientHighlightColor { get; set; } + Dictionary PerClientThumbnailSize { get; set; } + Dictionary PerClientThumbnailRegion { get; set; } - bool MinimizeToTray { get; set; } - int ThumbnailRefreshPeriod { get; set; } - int ThumbnailResizeTimeoutPeriod { get; set; } - bool EnableWineCompatibilityMode { get; set; } + bool MinimizeToTray { get; set; } + int ThumbnailRefreshPeriod { get; set; } + int ThumbnailResizeTimeoutPeriod { get; set; } + bool EnableWineCompatibilityMode { get; set; } - double ThumbnailOpacity { get; set; } + double ThumbnailOpacity { get; set; } - bool EnableClientLayoutTracking { get; set; } - bool HideActiveClientThumbnail { get; set; } - bool HideLoginClientThumbnail { get; set; } - bool MinimizeInactiveClients { get; set; } - AnimationStyle WindowsAnimationStyle { get; set; } - bool ShowThumbnailsAlwaysOnTop { get; set; } - bool EnablePerClientThumbnailLayouts { get; set; } + bool EnableClientLayoutTracking { get; set; } + bool HideActiveClientThumbnail { get; set; } + bool HideLoginClientThumbnail { get; set; } + bool MinimizeInactiveClients { get; set; } + AnimationStyle WindowsAnimationStyle { get; set; } + bool ShowThumbnailsAlwaysOnTop { get; set; } + bool EnablePerClientThumbnailLayouts { get; set; } - bool HideThumbnailsOnLostFocus { get; set; } - int HideThumbnailsDelay { get; set; } + bool HideThumbnailsOnLostFocus { get; set; } + int HideThumbnailsDelay { get; set; } - Size ThumbnailSize { get; set; } - Size ThumbnailMinimumSize { get; set; } - Size ThumbnailMaximumSize { get; set; } + Size ThumbnailSize { get; set; } + Size ThumbnailMinimumSize { get; set; } + Size ThumbnailMaximumSize { get; set; } - bool EnableThumbnailSnap { get; set; } + bool EnableThumbnailSnap { get; set; } - bool ThumbnailZoomEnabled { get; set; } - int ThumbnailZoomFactor { get; set; } - ZoomAnchor ThumbnailZoomAnchor { get; set; } - ZoomAnchor OverlayLabelAnchor { get; set; } + bool ThumbnailZoomEnabled { get; set; } + int ThumbnailZoomFactor { get; set; } + ZoomAnchor ThumbnailZoomAnchor { get; set; } + ZoomAnchor OverlayLabelAnchor { get; set; } - bool ShowThumbnailOverlays { get; set; } - bool ShowThumbnailFrames { get; set; } - bool LockThumbnailLocation { get; set; } - bool ThumbnailSnapToGrid { get; set; } - int ThumbnailSnapToGridSizeX { get; set; } - int ThumbnailSnapToGridSizeY { get; set; } + bool ShowThumbnailOverlays { get; set; } + bool ShowThumbnailFrames { get; set; } + bool LockThumbnailLocation { get; set; } + bool ThumbnailSnapToGrid { get; set; } + int ThumbnailSnapToGridSizeX { get; set; } + int ThumbnailSnapToGridSizeY { get; set; } - bool EnableActiveClientHighlight { get; set; } - Color ActiveClientHighlightColor { get; set; } - int ActiveClientHighlightThickness { get; set; } - Color OverlayLabelColor { get; set; } - int OverlayLabelSize { get; set; } + bool EnableActiveClientHighlight { get; set; } + Color ActiveClientHighlightColor { get; set; } + int ActiveClientHighlightThickness { get; set; } + Color OverlayLabelColor { get; set; } + int OverlayLabelSize { get; set; } - string IconName { get; set; } + bool EnableThumbnailRegionSnipping { get; set; } + Rectangle DefaultThumbnailRegion { get; set; } - Point LoginThumbnailLocation { get; set; } + string CurrentProfile { get; set; } + List AvailableProfiles { get; set; } - Point GetThumbnailLocation(string currentClient, string activeClient, Point defaultLocation); - Size GetThumbnailSize(string currentClient, string activeClient, Size defaultSize); - ZoomAnchor GetZoomAnchor(string currentClient, ZoomAnchor defaultZoomAnchor); - void SetThumbnailLocation(string currentClient, string activeClient, Point location); + string IconName { get; set; } - ClientLayout GetClientLayout(string currentClient); - void SetClientLayout(string currentClient, ClientLayout layout); + Point LoginThumbnailLocation { get; set; } - Keys GetClientHotkey(string currentClient); - void SetClientHotkey(string currentClient, Keys hotkey); - Keys StringToKey(string hotkey); + Point GetThumbnailLocation(string currentClient, string activeClient, Point defaultLocation); + Size GetThumbnailSize(string currentClient, string activeClient, Size defaultSize); + ZoomAnchor GetZoomAnchor(string currentClient, ZoomAnchor defaultZoomAnchor); + Rectangle GetThumbnailRegion(string currentClient, Rectangle defaultRegion); + void SetThumbnailLocation(string currentClient, string activeClient, Point location); + void SetThumbnailRegion(string currentClient, Rectangle region); - bool IsPriorityClient(string currentClient); - bool IsExecutableToPreview(string processName); - List ExecutablesToPreview { get; set; } + void SaveProfile(string profileName); + void LoadProfile(string profileName); + void DeleteProfile(string profileName); - bool IsThumbnailDisabled(string currentClient); - void ToggleThumbnail(string currentClient, bool isDisabled); + ClientLayout GetClientLayout(string currentClient); + void SetClientLayout(string currentClient, ClientLayout layout); - void ApplyRestrictions(); - } + Keys GetClientHotkey(string currentClient); + void SetClientHotkey(string currentClient, Keys hotkey); + Keys StringToKey(string hotkey); + + bool IsPriorityClient(string currentClient); + bool IsExecutableToPreview(string processName); + List ExecutablesToPreview { get; set; } + + bool IsThumbnailDisabled(string currentClient); + void ToggleThumbnail(string currentClient, bool isDisabled); + + void ApplyRestrictions(); + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Configuration/Interface/ZoomAnchor.cs b/src/Eve-O-Preview/Configuration/Interface/ZoomAnchor.cs index d344b7e..7bda723 100644 --- a/src/Eve-O-Preview/Configuration/Interface/ZoomAnchor.cs +++ b/src/Eve-O-Preview/Configuration/Interface/ZoomAnchor.cs @@ -1,15 +1,3 @@ -namespace EveOPreview.Configuration -{ - public enum ZoomAnchor - { - NW, - N, - NE, - W, - C, - E, - SW, - S, - SE - } +namespace EveOPreview.Configuration { + public enum ZoomAnchor { NW, N, NE, W, C, E, SW, S, SE } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Eve-O-Preview.csproj b/src/Eve-O-Preview/Eve-O-Preview.csproj index df84572..d0c3f9a 100644 --- a/src/Eve-O-Preview/Eve-O-Preview.csproj +++ b/src/Eve-O-Preview/Eve-O-Preview.csproj @@ -1,7 +1,7 @@  LINUX - net8.0-windows8.0 + net6.0-windows WinExe true true diff --git a/src/Eve-O-Preview/Hotkeys/HotkeyHandler.cs b/src/Eve-O-Preview/Hotkeys/HotkeyHandler.cs index bb95186..c829c67 100644 --- a/src/Eve-O-Preview/Hotkeys/HotkeyHandler.cs +++ b/src/Eve-O-Preview/Hotkeys/HotkeyHandler.cs @@ -2,131 +2,114 @@ using System; using System.Windows.Forms; using System.ComponentModel; -namespace EveOPreview.UI.Hotkeys -{ - class HotkeyHandler : IMessageFilter, IDisposable - { - private static int _currentId; - private const int MAX_ID = 0xBFFF; +namespace EveOPreview.UI.Hotkeys { + class HotkeyHandler : IMessageFilter, IDisposable { + private static int _currentId; + private const int MAX_ID = 0xBFFF; - #region Private fields - private readonly int _hotkeyId; - private readonly IntPtr _hotkeyTarget; - #endregion +#region Private fields + private readonly int _hotkeyId; + private readonly IntPtr _hotkeyTarget; +#endregion - public HotkeyHandler(IntPtr target, Keys hotkey) - { - this._hotkeyId = HotkeyHandler._currentId; - HotkeyHandler._currentId = (HotkeyHandler._currentId + 1) & HotkeyHandler.MAX_ID; + public HotkeyHandler(IntPtr target, Keys hotkey) { + this._hotkeyId = HotkeyHandler._currentId; + HotkeyHandler._currentId = (HotkeyHandler._currentId + 1) & HotkeyHandler.MAX_ID; - this._hotkeyTarget = target; + this._hotkeyTarget = target; - // Assign properties - this.IsRegistered = false; + // Assign properties + this.IsRegistered = false; - this.KeyCode = hotkey; - } + this.KeyCode = hotkey; + } - public void Dispose() - { - this.Unregister(); - GC.SuppressFinalize(this); - } + public void Dispose() { + this.Unregister(); + GC.SuppressFinalize(this); + } - ~HotkeyHandler() - { - // Unregister the hotkey if necessary - this.Unregister(); - } + ~HotkeyHandler() { + // Unregister the hotkey if necessary + this.Unregister(); + } - public bool IsRegistered { get; private set; } + public bool IsRegistered { get; private set; } - public Keys KeyCode { get; private set; } + public Keys KeyCode { get; private set; } - public event HandledEventHandler Pressed; + public event HandledEventHandler Pressed; - public bool CanRegister() - { - // Attempt to register - if (this.Register()) - { - // Unregister and say we managed it - this.Unregister(); - return true; - } + public bool CanRegister() { + // Attempt to register + if (this.Register()) { + // Unregister and say we managed it + this.Unregister(); + return true; + } - return false; - } + return false; + } - public bool Register() - { - // Check that we have not registered - if (this.IsRegistered) - { - return false; - } + public bool Register() { + // Check that we have not registered + if (this.IsRegistered) { + return false; + } - if (this.KeyCode == Keys.None) - { - return false; - } + if (this.KeyCode == Keys.None) { + return false; + } - // Remove all modifiers from the 'main' hotkey - uint key = (uint)this.KeyCode & (~(uint)Keys.Alt) & (~(uint)Keys.Control) & (~(uint)Keys.Shift); + // Remove all modifiers from the 'main' hotkey + uint key = (uint)this.KeyCode & (~(uint)Keys.Alt) & (~(uint)Keys.Control) & (~(uint)Keys.Shift); - // Get unmanaged version of the modifiers code - uint modifiers = (this.KeyCode.HasFlag(Keys.Alt) ? HotkeyHandlerNativeMethods.MOD_ALT : 0) - | (this.KeyCode.HasFlag(Keys.Control) ? HotkeyHandlerNativeMethods.MOD_CONTROL : 0) - | (this.KeyCode.HasFlag(Keys.Shift) ? HotkeyHandlerNativeMethods.MOD_SHIFT : 0); + // Get unmanaged version of the modifiers code + uint modifiers = (this.KeyCode.HasFlag(Keys.Alt) ? HotkeyHandlerNativeMethods.MOD_ALT : 0) | + (this.KeyCode.HasFlag(Keys.Control) ? HotkeyHandlerNativeMethods.MOD_CONTROL : 0) | + (this.KeyCode.HasFlag(Keys.Shift) ? HotkeyHandlerNativeMethods.MOD_SHIFT : 0); - // Register the hotkey - if (!HotkeyHandlerNativeMethods.RegisterHotKey(this._hotkeyTarget, this._hotkeyId, modifiers, key)) - { - return false; - } + // Register the hotkey + if (!HotkeyHandlerNativeMethods.RegisterHotKey(this._hotkeyTarget, this._hotkeyId, modifiers, key)) { + return false; + } - Application.AddMessageFilter(this); + Application.AddMessageFilter(this); - this.IsRegistered = true; + this.IsRegistered = true; - // We successfully registered - return true; - } + // We successfully registered + return true; + } - public void Unregister() - { - // Check that we have registered - if (!this.IsRegistered) - { - return; - } + public void Unregister() { + // Check that we have registered + if (!this.IsRegistered) { + return; + } - this.IsRegistered = false; + this.IsRegistered = false; - Application.RemoveMessageFilter(this); + Application.RemoveMessageFilter(this); - // Clean up after ourselves - HotkeyHandlerNativeMethods.UnregisterHotKey(this._hotkeyTarget, this._hotkeyId); - } + // Clean up after ourselves + HotkeyHandlerNativeMethods.UnregisterHotKey(this._hotkeyTarget, this._hotkeyId); + } - #region IMessageFilter - public bool PreFilterMessage(ref Message message) - { - return this.IsRegistered - && (message.Msg == HotkeyHandlerNativeMethods.WM_HOTKEY) - && (message.WParam.ToInt32() == this._hotkeyId) - && this.OnPressed(); - } - #endregion +#region IMessageFilter + public bool PreFilterMessage(ref Message message) { + return this.IsRegistered && (message.Msg == HotkeyHandlerNativeMethods.WM_HOTKEY) && + (message.WParam.ToInt32() == this._hotkeyId) && this.OnPressed(); + } +#endregion - private bool OnPressed() - { - // Fire the event if we can - HandledEventArgs handledEventArgs = new HandledEventArgs(false); - this.Pressed?.Invoke(this, handledEventArgs); + 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; - } - } + // Return whether we handled the event or not + return handledEventArgs.Handled; + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Hotkeys/HotkeyHandlerNativeMethods.cs b/src/Eve-O-Preview/Hotkeys/HotkeyHandlerNativeMethods.cs index f241316..d502e75 100644 --- a/src/Eve-O-Preview/Hotkeys/HotkeyHandlerNativeMethods.cs +++ b/src/Eve-O-Preview/Hotkeys/HotkeyHandlerNativeMethods.cs @@ -1,23 +1,21 @@ using System; using System.Runtime.InteropServices; -namespace EveOPreview.UI.Hotkeys -{ - static class HotkeyHandlerNativeMethods - { - [DllImport("user32.dll")] - public static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk); +namespace EveOPreview.UI.Hotkeys { + static class HotkeyHandlerNativeMethods { + [DllImport("user32.dll")] + public static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk); - [DllImport("user32.dll")] - public static extern bool UnregisterHotKey(IntPtr hWnd, int id); + [DllImport("user32.dll")] + public static extern bool UnregisterHotKey(IntPtr hWnd, int id); - public const uint WM_HOTKEY = 0x0312; + public const uint WM_HOTKEY = 0x0312; - 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 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; - } + public const uint ERROR_HOTKEY_ALREADY_REGISTERED = 1409; + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Handlers/Configuration/SaveConfigurationHandler.cs b/src/Eve-O-Preview/Mediator/Handlers/Configuration/SaveConfigurationHandler.cs index f1b2db2..09039dd 100644 --- a/src/Eve-O-Preview/Mediator/Handlers/Configuration/SaveConfigurationHandler.cs +++ b/src/Eve-O-Preview/Mediator/Handlers/Configuration/SaveConfigurationHandler.cs @@ -4,22 +4,18 @@ using EveOPreview.Configuration; using EveOPreview.Mediator.Messages; using MediatR; -namespace EveOPreview.Mediator.Handlers.Configuration -{ - sealed class SaveConfigurationHandler : IRequestHandler - { - private readonly IConfigurationStorage _storage; +namespace EveOPreview.Mediator.Handlers.Configuration { + sealed class SaveConfigurationHandler : IRequestHandler { + private readonly IConfigurationStorage _storage; - public SaveConfigurationHandler(IConfigurationStorage storage) - { - this._storage = storage; - } + public SaveConfigurationHandler(IConfigurationStorage storage) { + this._storage = storage; + } - public Task Handle(SaveConfiguration message, CancellationToken cancellationToken) - { - this._storage.Save(); + public Task Handle(SaveConfiguration message, CancellationToken cancellationToken) { + this._storage.Save(); - return Unit.Task; - } - } + return Unit.Task; + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Handlers/Services/StartStopServiceHandler.cs b/src/Eve-O-Preview/Mediator/Handlers/Services/StartStopServiceHandler.cs index 896ba68..0fdb2d2 100644 --- a/src/Eve-O-Preview/Mediator/Handlers/Services/StartStopServiceHandler.cs +++ b/src/Eve-O-Preview/Mediator/Handlers/Services/StartStopServiceHandler.cs @@ -4,29 +4,24 @@ using EveOPreview.Mediator.Messages; using EveOPreview.Services; using MediatR; -namespace EveOPreview.Mediator.Handlers.Services -{ - sealed class StartStopServiceHandler : IRequestHandler, IRequestHandler - { - private readonly IThumbnailManager _manager; +namespace EveOPreview.Mediator.Handlers.Services { + sealed class StartStopServiceHandler : IRequestHandler, IRequestHandler { + private readonly IThumbnailManager _manager; - public StartStopServiceHandler(IThumbnailManager manager) - { - this._manager = manager; - } + public StartStopServiceHandler(IThumbnailManager manager) { + this._manager = manager; + } - public Task Handle(StartService message, CancellationToken cancellationToken) - { - this._manager.Start(); + public Task Handle(StartService message, CancellationToken cancellationToken) { + this._manager.Start(); - return Unit.Task; - } + return Unit.Task; + } - public Task Handle(StopService message, CancellationToken cancellationToken) - { - this._manager.Stop(); + public Task Handle(StopService message, CancellationToken cancellationToken) { + this._manager.Stop(); - return Unit.Task; - } - } + return Unit.Task; + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailActiveSizeUpdatedHandler.cs b/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailActiveSizeUpdatedHandler.cs index d5a6e0f..92372d3 100644 --- a/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailActiveSizeUpdatedHandler.cs +++ b/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailActiveSizeUpdatedHandler.cs @@ -4,22 +4,18 @@ using EveOPreview.Mediator.Messages; using EveOPreview.Presenters; using MediatR; -namespace EveOPreview.Mediator.Handlers.Thumbnails -{ - sealed class ThumbnailActiveSizeUpdatedHandler : INotificationHandler - { - private readonly IMainFormPresenter _presenter; +namespace EveOPreview.Mediator.Handlers.Thumbnails { + sealed class ThumbnailActiveSizeUpdatedHandler : INotificationHandler { + private readonly IMainFormPresenter _presenter; - public ThumbnailActiveSizeUpdatedHandler(MainFormPresenter presenter) - { - this._presenter = presenter; - } + public ThumbnailActiveSizeUpdatedHandler(MainFormPresenter presenter) { + this._presenter = presenter; + } - public Task Handle(ThumbnailActiveSizeUpdated notification, CancellationToken cancellationToken) - { - this._presenter.UpdateThumbnailSize(notification.Value); + public Task Handle(ThumbnailActiveSizeUpdated notification, CancellationToken cancellationToken) { + this._presenter.UpdateThumbnailSize(notification.Value); - return Task.CompletedTask; - } - } + return Task.CompletedTask; + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailConfiguredSizeUpdatedHandler.cs b/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailConfiguredSizeUpdatedHandler.cs index 700c678..250de25 100644 --- a/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailConfiguredSizeUpdatedHandler.cs +++ b/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailConfiguredSizeUpdatedHandler.cs @@ -4,22 +4,18 @@ using EveOPreview.Mediator.Messages; using EveOPreview.Services; using MediatR; -namespace EveOPreview.Mediator.Handlers.Thumbnails -{ - sealed class ThumbnailConfiguredSizeUpdatedHandler : INotificationHandler - { - private readonly IThumbnailManager _manager; +namespace EveOPreview.Mediator.Handlers.Thumbnails { + sealed class ThumbnailConfiguredSizeUpdatedHandler : INotificationHandler { + private readonly IThumbnailManager _manager; - public ThumbnailConfiguredSizeUpdatedHandler(IThumbnailManager manager) - { - this._manager = manager; - } + public ThumbnailConfiguredSizeUpdatedHandler(IThumbnailManager manager) { + this._manager = manager; + } - public Task Handle(ThumbnailConfiguredSizeUpdated notification, CancellationToken cancellationToken) - { - this._manager.UpdateThumbnailsSize(); + public Task Handle(ThumbnailConfiguredSizeUpdated notification, CancellationToken cancellationToken) { + this._manager.UpdateThumbnailsSize(); - return Task.CompletedTask; - } - } + return Task.CompletedTask; + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailFrameSettingsUpdatedHandler.cs b/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailFrameSettingsUpdatedHandler.cs index 44cc2d4..e79bc06 100644 --- a/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailFrameSettingsUpdatedHandler.cs +++ b/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailFrameSettingsUpdatedHandler.cs @@ -4,22 +4,18 @@ using EveOPreview.Mediator.Messages; using EveOPreview.Services; using MediatR; -namespace EveOPreview.Mediator.Handlers.Thumbnails -{ - sealed class ThumbnailFrameSettingsUpdatedHandler : INotificationHandler - { - private readonly IThumbnailManager _manager; +namespace EveOPreview.Mediator.Handlers.Thumbnails { + sealed class ThumbnailFrameSettingsUpdatedHandler : INotificationHandler { + private readonly IThumbnailManager _manager; - public ThumbnailFrameSettingsUpdatedHandler(IThumbnailManager manager) - { - this._manager = manager; - } + public ThumbnailFrameSettingsUpdatedHandler(IThumbnailManager manager) { + this._manager = manager; + } - public Task Handle(ThumbnailFrameSettingsUpdated notification, CancellationToken cancellationToken) - { - this._manager.UpdateThumbnailFrames(); + public Task Handle(ThumbnailFrameSettingsUpdated notification, CancellationToken cancellationToken) { + this._manager.UpdateThumbnailFrames(); - return Task.CompletedTask; - } - } + return Task.CompletedTask; + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailListUpdatedHandler.cs b/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailListUpdatedHandler.cs index 88dd8b6..7f39710 100644 --- a/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailListUpdatedHandler.cs +++ b/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailListUpdatedHandler.cs @@ -4,32 +4,26 @@ using EveOPreview.Mediator.Messages; using EveOPreview.Presenters; using MediatR; -namespace EveOPreview.Mediator.Handlers.Thumbnails -{ - sealed class ThumbnailListUpdatedHandler : INotificationHandler - { - #region Private fields - private readonly IMainFormPresenter _presenter; - #endregion +namespace EveOPreview.Mediator.Handlers.Thumbnails { + sealed class ThumbnailListUpdatedHandler : INotificationHandler { +#region Private fields + private readonly IMainFormPresenter _presenter; +#endregion - public ThumbnailListUpdatedHandler(MainFormPresenter presenter) - { - this._presenter = presenter; - } + public ThumbnailListUpdatedHandler(MainFormPresenter presenter) { + this._presenter = presenter; + } - public Task Handle(ThumbnailListUpdated notification, CancellationToken cancellationToken) - { - if (notification.Added.Count > 0) - { - this._presenter.AddThumbnails(notification.Added); - } + public Task Handle(ThumbnailListUpdated notification, CancellationToken cancellationToken) { + if (notification.Added.Count > 0) { + this._presenter.AddThumbnails(notification.Added); + } - if (notification.Removed.Count > 0) - { - this._presenter.RemoveThumbnails(notification.Removed); - } - - return Task.CompletedTask; - } - } + if (notification.Removed.Count > 0) { + this._presenter.RemoveThumbnails(notification.Removed); + } + + return Task.CompletedTask; + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailLocationUpdatedHandler.cs b/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailLocationUpdatedHandler.cs index 397d4f1..7cd8061 100644 --- a/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailLocationUpdatedHandler.cs +++ b/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailLocationUpdatedHandler.cs @@ -4,24 +4,21 @@ using EveOPreview.Configuration; using EveOPreview.Mediator.Messages; using MediatR; -namespace EveOPreview.Mediator.Handlers.Thumbnails -{ - sealed class ThumbnailLocationUpdatedHandler : INotificationHandler - { - private readonly IMediator _mediator; - private readonly IThumbnailConfiguration _configuration; +namespace EveOPreview.Mediator.Handlers.Thumbnails { + sealed class ThumbnailLocationUpdatedHandler : INotificationHandler { + private readonly IMediator _mediator; + private readonly IThumbnailConfiguration _configuration; - public ThumbnailLocationUpdatedHandler(IMediator mediator, IThumbnailConfiguration configuration) - { - this._mediator = mediator; - this._configuration = configuration; - } + public ThumbnailLocationUpdatedHandler(IMediator mediator, IThumbnailConfiguration configuration) { + this._mediator = mediator; + this._configuration = configuration; + } - public Task Handle(ThumbnailLocationUpdated notification, CancellationToken cancellationToken) - { - this._configuration.SetThumbnailLocation(notification.ThumbnailName, notification.ActiveClientName, notification.Location); + public Task Handle(ThumbnailLocationUpdated notification, CancellationToken cancellationToken) { + this._configuration.SetThumbnailLocation(notification.ThumbnailName, notification.ActiveClientName, + notification.Location); - return this._mediator.Send(new SaveConfiguration(), cancellationToken); - } - } + return this._mediator.Send(new SaveConfiguration(), cancellationToken); + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailRegionSettingsUpdatedHandler.cs b/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailRegionSettingsUpdatedHandler.cs new file mode 100644 index 0000000..3b88bf7 --- /dev/null +++ b/src/Eve-O-Preview/Mediator/Handlers/Thumbnails/ThumbnailRegionSettingsUpdatedHandler.cs @@ -0,0 +1,20 @@ +using System.Threading; +using System.Threading.Tasks; +using EveOPreview.Mediator.Messages; +using EveOPreview.Services; +using MediatR; + +namespace EveOPreview.Mediator.Handlers.Thumbnails { + public class ThumbnailRegionSettingsUpdatedHandler : INotificationHandler { + private readonly IThumbnailManager _thumbnailManager; + + public ThumbnailRegionSettingsUpdatedHandler(IThumbnailManager thumbnailManager) { + this._thumbnailManager = thumbnailManager; + } + + public Task Handle(ThumbnailRegionSettingsUpdated notification, CancellationToken cancellationToken) { + this._thumbnailManager.UpdateThumbnailRegionSettings(); + return Task.CompletedTask; + } + } +} \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Messages/Base/NotificationBase.cs b/src/Eve-O-Preview/Mediator/Messages/Base/NotificationBase.cs index f604d39..a7e5cff 100644 --- a/src/Eve-O-Preview/Mediator/Messages/Base/NotificationBase.cs +++ b/src/Eve-O-Preview/Mediator/Messages/Base/NotificationBase.cs @@ -1,14 +1,11 @@ using MediatR; -namespace EveOPreview.Mediator.Messages -{ - abstract class NotificationBase : INotification - { - protected NotificationBase(TValue value) - { - this.Value = value; - } +namespace EveOPreview.Mediator.Messages { + abstract class NotificationBase : INotification { + protected NotificationBase(TValue value) { + this.Value = value; + } - public TValue Value { get; } - } + public TValue Value { get; } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Messages/Configuration/SaveConfiguration.cs b/src/Eve-O-Preview/Mediator/Messages/Configuration/SaveConfiguration.cs index 21a453f..409d271 100644 --- a/src/Eve-O-Preview/Mediator/Messages/Configuration/SaveConfiguration.cs +++ b/src/Eve-O-Preview/Mediator/Messages/Configuration/SaveConfiguration.cs @@ -1,8 +1,5 @@ using MediatR; -namespace EveOPreview.Mediator.Messages -{ - sealed class SaveConfiguration : IRequest - { - } +namespace EveOPreview.Mediator.Messages { + sealed class SaveConfiguration : IRequest {} } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Messages/Services/StartService.cs b/src/Eve-O-Preview/Mediator/Messages/Services/StartService.cs index 6c3beca..9085c86 100644 --- a/src/Eve-O-Preview/Mediator/Messages/Services/StartService.cs +++ b/src/Eve-O-Preview/Mediator/Messages/Services/StartService.cs @@ -1,8 +1,5 @@ using MediatR; -namespace EveOPreview.Mediator.Messages -{ - sealed class StartService : IRequest - { - } +namespace EveOPreview.Mediator.Messages { + sealed class StartService : IRequest {} } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Messages/Services/StopService.cs b/src/Eve-O-Preview/Mediator/Messages/Services/StopService.cs index c123c0b..29598fe 100644 --- a/src/Eve-O-Preview/Mediator/Messages/Services/StopService.cs +++ b/src/Eve-O-Preview/Mediator/Messages/Services/StopService.cs @@ -1,8 +1,5 @@ using MediatR; -namespace EveOPreview.Mediator.Messages -{ - sealed class StopService : IRequest - { - } +namespace EveOPreview.Mediator.Messages { + sealed class StopService : IRequest {} } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailActiveSizeUpdated.cs b/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailActiveSizeUpdated.cs index b0f67a2..7b63c7e 100644 --- a/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailActiveSizeUpdated.cs +++ b/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailActiveSizeUpdated.cs @@ -1,12 +1,7 @@ using System.Drawing; -namespace EveOPreview.Mediator.Messages -{ - sealed class ThumbnailActiveSizeUpdated : NotificationBase - { - public ThumbnailActiveSizeUpdated(Size size) - : base(size) - { - } - } +namespace EveOPreview.Mediator.Messages { + sealed class ThumbnailActiveSizeUpdated : NotificationBase { + public ThumbnailActiveSizeUpdated(Size size) : base(size) {} + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailConfiguredSizeUpdated.cs b/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailConfiguredSizeUpdated.cs index 5982a44..219d973 100644 --- a/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailConfiguredSizeUpdated.cs +++ b/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailConfiguredSizeUpdated.cs @@ -1,8 +1,5 @@ using MediatR; -namespace EveOPreview.Mediator.Messages -{ - sealed class ThumbnailConfiguredSizeUpdated : INotification - { - } +namespace EveOPreview.Mediator.Messages { + sealed class ThumbnailConfiguredSizeUpdated : INotification {} } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailFrameSettingsUpdated.cs b/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailFrameSettingsUpdated.cs index 396693b..16e55f1 100644 --- a/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailFrameSettingsUpdated.cs +++ b/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailFrameSettingsUpdated.cs @@ -1,8 +1,5 @@ using MediatR; -namespace EveOPreview.Mediator.Messages -{ - sealed class ThumbnailFrameSettingsUpdated : INotification - { - } +namespace EveOPreview.Mediator.Messages { + sealed class ThumbnailFrameSettingsUpdated : INotification {} } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailListUpdated.cs b/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailListUpdated.cs index adc5b56..e297287 100644 --- a/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailListUpdated.cs +++ b/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailListUpdated.cs @@ -1,17 +1,14 @@ using System.Collections.Generic; using MediatR; -namespace EveOPreview.Mediator.Messages -{ - sealed class ThumbnailListUpdated : INotification - { - public ThumbnailListUpdated(IList addedThumbnails, IList removedThumbnails) - { - this.Added = addedThumbnails; - this.Removed = removedThumbnails; - } +namespace EveOPreview.Mediator.Messages { + sealed class ThumbnailListUpdated : INotification { + public ThumbnailListUpdated(IList addedThumbnails, IList removedThumbnails) { + this.Added = addedThumbnails; + this.Removed = removedThumbnails; + } - public IList Added { get; } - public IList Removed { get; } - } + public IList Added { get; } + public IList Removed { get; } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailLocationUpdated.cs b/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailLocationUpdated.cs index a47e244..587930f 100644 --- a/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailLocationUpdated.cs +++ b/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailLocationUpdated.cs @@ -1,21 +1,18 @@ using System.Drawing; using MediatR; -namespace EveOPreview.Mediator.Messages -{ - sealed class ThumbnailLocationUpdated : INotification - { - public ThumbnailLocationUpdated(string thumbnailName, string activeClientName, Point location) - { - this.ThumbnailName = thumbnailName; - this.ActiveClientName = activeClientName; - this.Location = location; - } +namespace EveOPreview.Mediator.Messages { + sealed class ThumbnailLocationUpdated : INotification { + public ThumbnailLocationUpdated(string thumbnailName, string activeClientName, Point location) { + this.ThumbnailName = thumbnailName; + this.ActiveClientName = activeClientName; + this.Location = location; + } - public string ThumbnailName { get; } + public string ThumbnailName { get; } - public string ActiveClientName { get; } + public string ActiveClientName { get; } - public Point Location { get; } - } + public Point Location { get; } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailRegionSettingsUpdated.cs b/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailRegionSettingsUpdated.cs new file mode 100644 index 0000000..2813071 --- /dev/null +++ b/src/Eve-O-Preview/Mediator/Messages/Thumbnails/ThumbnailRegionSettingsUpdated.cs @@ -0,0 +1,5 @@ +using MediatR; + +namespace EveOPreview.Mediator.Messages { + public sealed class ThumbnailRegionSettingsUpdated : INotification {} +} \ No newline at end of file diff --git a/src/Eve-O-Preview/Presenters/Implementation/MainFormPresenter.cs b/src/Eve-O-Preview/Presenters/Implementation/MainFormPresenter.cs index 62892ac..38bdfbd 100644 --- a/src/Eve-O-Preview/Presenters/Implementation/MainFormPresenter.cs +++ b/src/Eve-O-Preview/Presenters/Implementation/MainFormPresenter.cs @@ -4,280 +4,274 @@ using System.Diagnostics; using System.Drawing; using EveOPreview.Configuration; using EveOPreview.Mediator.Messages; + using EveOPreview.View; using MediatR; -namespace EveOPreview.Presenters -{ - public class MainFormPresenter : Presenter, IMainFormPresenter - { - #region Private constants - private const string FORUM_URL = @"https://forum.eveonline.com/t/4202"; - #endregion +namespace EveOPreview.Presenters { + public class MainFormPresenter : Presenter, IMainFormPresenter { +#region Private constants + private const string FORUM_URL = @"https://forum.eveonline.com/t/4202"; +#endregion - #region Private fields - private readonly IMediator _mediator; - private readonly IThumbnailConfiguration _configuration; - private readonly IConfigurationStorage _configurationStorage; - private readonly IDictionary _descriptionsCache; - private bool _suppressSizeNotifications; +#region Private fields + private readonly IMediator _mediator; + private readonly IThumbnailConfiguration _configuration; + private readonly IConfigurationStorage _configurationStorage; + private readonly IDictionary _descriptionsCache; + private bool _suppressSizeNotifications; - private bool _exitApplication; - #endregion + private bool _exitApplication; +#endregion - public MainFormPresenter(IApplicationController controller, IMainFormView view, IMediator mediator, IThumbnailConfiguration configuration, IConfigurationStorage configurationStorage) - : base(controller, view) - { - this._mediator = mediator; - this._configuration = configuration; - this._configurationStorage = configurationStorage; + public MainFormPresenter(IApplicationController controller, IMainFormView view, IMediator mediator, + IThumbnailConfiguration configuration, IConfigurationStorage configurationStorage) + : base(controller, view) { + this._mediator = mediator; + this._configuration = configuration; + this._configurationStorage = configurationStorage; - this._descriptionsCache = new Dictionary(); + this._descriptionsCache = new Dictionary(); - this._suppressSizeNotifications = false; - this._exitApplication = false; + this._suppressSizeNotifications = false; + this._exitApplication = false; - this.View.FormActivated = this.Activate; - this.View.FormMinimized = this.Minimize; - this.View.FormCloseRequested = this.Close; - this.View.ApplicationSettingsChanged = this.SaveApplicationSettings; - this.View.ThumbnailsSizeChanged = this.UpdateThumbnailsSize; - this.View.ThumbnailStateChanged = this.UpdateThumbnailState; - this.View.DocumentationLinkActivated = this.OpenDocumentationLink; - this.View.ApplicationExitRequested = this.ExitApplication; + this.View.FormActivated = this.Activate; + this.View.FormMinimized = this.Minimize; + this.View.FormCloseRequested = this.Close; + this.View.ApplicationSettingsChanged = this.SaveApplicationSettings; + this.View.ThumbnailsSizeChanged = this.UpdateThumbnailsSize; + this.View.ThumbnailStateChanged = this.UpdateThumbnailState; + this.View.DocumentationLinkActivated = this.OpenDocumentationLink; + this.View.ApplicationExitRequested = this.ExitApplication; - this.View.IconName = this._configuration.IconName; - } + this.View.IconName = this._configuration.IconName; + } - private void Activate() - { - this._suppressSizeNotifications = true; - this.LoadApplicationSettings(); - this.View.SetDocumentationUrl(MainFormPresenter.FORUM_URL); - this.View.SetVersionInfo(this.GetApplicationVersion()); - if (this._configuration.MinimizeToTray) - { - this.View.Minimize(); - } + private void Activate() { + this._suppressSizeNotifications = true; + this.LoadApplicationSettings(); + this.View.SetDocumentationUrl(MainFormPresenter.FORUM_URL); + this.View.SetVersionInfo(this.GetApplicationVersion()); + if (this._configuration.MinimizeToTray) { + this.View.Minimize(); + } - this._mediator.Send(new StartService()); - this._suppressSizeNotifications = false; - } + this._mediator.Send(new StartService()); + this._suppressSizeNotifications = false; + } - private void Minimize() - { - if (!this._configuration.MinimizeToTray) - { - return; - } + private void Minimize() { + if (!this._configuration.MinimizeToTray) { + return; + } - this.View.Hide(); - } + this.View.Hide(); + } - private void Close(ViewCloseRequest request) - { - if (this._exitApplication || !this.View.MinimizeToTray) - { - this._mediator.Send(new StopService()).Wait(); + private void Close(ViewCloseRequest request) { + if (this._exitApplication || !this.View.MinimizeToTray) { + this._mediator.Send(new StopService()).Wait(); - this._configurationStorage.Save(); - request.Allow = true; - return; - } + this._configurationStorage.Save(); + request.Allow = true; + return; + } - request.Allow = false; - this.View.Minimize(); - } + request.Allow = false; + this.View.Minimize(); + } - private async void UpdateThumbnailsSize() - { - if (!this._suppressSizeNotifications) - { - this.SaveApplicationSettings(); - await this._mediator.Publish(new ThumbnailConfiguredSizeUpdated()); - } - } + private async void UpdateThumbnailsSize() { + if (!this._suppressSizeNotifications) { + this.SaveApplicationSettings(); + await this._mediator.Publish(new ThumbnailConfiguredSizeUpdated()); + } + } - private void LoadApplicationSettings() - { - this._configurationStorage.Load(); + private void LoadApplicationSettings() { + this._configurationStorage.Load(); - this.View.MinimizeToTray = this._configuration.MinimizeToTray; + this.View.MinimizeToTray = this._configuration.MinimizeToTray; - this.View.ThumbnailOpacity = this._configuration.ThumbnailOpacity; + this.View.ThumbnailOpacity = this._configuration.ThumbnailOpacity; - this.View.EnableClientLayoutTracking = this._configuration.EnableClientLayoutTracking; - this.View.HideActiveClientThumbnail = this._configuration.HideActiveClientThumbnail; - this.View.MinimizeInactiveClients = this._configuration.MinimizeInactiveClients; - this.View.WindowsAnimationStyle = ViewAnimationStyleConverter.Convert(this._configuration.WindowsAnimationStyle); - this.View.ShowThumbnailsAlwaysOnTop = this._configuration.ShowThumbnailsAlwaysOnTop; - this.View.HideThumbnailsOnLostFocus = this._configuration.HideThumbnailsOnLostFocus; - this.View.EnablePerClientThumbnailLayouts = this._configuration.EnablePerClientThumbnailLayouts; + this.View.EnableClientLayoutTracking = this._configuration.EnableClientLayoutTracking; + this.View.HideActiveClientThumbnail = this._configuration.HideActiveClientThumbnail; + this.View.MinimizeInactiveClients = this._configuration.MinimizeInactiveClients; + this.View.WindowsAnimationStyle = + ViewAnimationStyleConverter.Convert(this._configuration.WindowsAnimationStyle); + this.View.ShowThumbnailsAlwaysOnTop = this._configuration.ShowThumbnailsAlwaysOnTop; + this.View.HideThumbnailsOnLostFocus = this._configuration.HideThumbnailsOnLostFocus; + this.View.EnablePerClientThumbnailLayouts = this._configuration.EnablePerClientThumbnailLayouts; - this.View.SetThumbnailSizeLimitations(this._configuration.ThumbnailMinimumSize, this._configuration.ThumbnailMaximumSize); - this.View.ThumbnailSize = this._configuration.ThumbnailSize; + this.View.SetThumbnailSizeLimitations(this._configuration.ThumbnailMinimumSize, + this._configuration.ThumbnailMaximumSize); + this.View.ThumbnailSize = this._configuration.ThumbnailSize; - this.View.EnableThumbnailZoom = this._configuration.ThumbnailZoomEnabled; - this.View.ThumbnailZoomFactor = this._configuration.ThumbnailZoomFactor; - this.View.ThumbnailZoomAnchor = ViewZoomAnchorConverter.Convert(this._configuration.ThumbnailZoomAnchor); - this.View.OverlayLabelAnchor = ViewZoomAnchorConverter.Convert(this._configuration.OverlayLabelAnchor); + this.View.EnableThumbnailZoom = this._configuration.ThumbnailZoomEnabled; + this.View.ThumbnailZoomFactor = this._configuration.ThumbnailZoomFactor; + this.View.ThumbnailZoomAnchor = ViewZoomAnchorConverter.Convert(this._configuration.ThumbnailZoomAnchor); + this.View.OverlayLabelAnchor = ViewZoomAnchorConverter.Convert(this._configuration.OverlayLabelAnchor); - this.View.ShowThumbnailOverlays = this._configuration.ShowThumbnailOverlays; - this.View.ShowThumbnailFrames = this._configuration.ShowThumbnailFrames; - this.View.LockThumbnailLocation = this._configuration.LockThumbnailLocation; - this.View.ThumbnailSnapToGrid = this._configuration.ThumbnailSnapToGrid; - this.View.ThumbnailSnapToGridSizeX = this._configuration.ThumbnailSnapToGridSizeX; - this.View.ThumbnailSnapToGridSizeY = this._configuration.ThumbnailSnapToGridSizeY; - this.View.EnableActiveClientHighlight = this._configuration.EnableActiveClientHighlight; - this.View.ActiveClientHighlightColor = this._configuration.ActiveClientHighlightColor; + this.View.ShowThumbnailOverlays = this._configuration.ShowThumbnailOverlays; + this.View.ShowThumbnailFrames = this._configuration.ShowThumbnailFrames; + this.View.LockThumbnailLocation = this._configuration.LockThumbnailLocation; + this.View.ThumbnailSnapToGrid = this._configuration.ThumbnailSnapToGrid; + this.View.ThumbnailSnapToGridSizeX = this._configuration.ThumbnailSnapToGridSizeX; + this.View.ThumbnailSnapToGridSizeY = this._configuration.ThumbnailSnapToGridSizeY; + this.View.EnableActiveClientHighlight = this._configuration.EnableActiveClientHighlight; + this.View.ActiveClientHighlightColor = this._configuration.ActiveClientHighlightColor; - this.View.OverlayLabelColor = this._configuration.OverlayLabelColor; - this.View.OverlayLabelSize = this._configuration.OverlayLabelSize; + this.View.OverlayLabelColor = this._configuration.OverlayLabelColor; + this.View.OverlayLabelSize = this._configuration.OverlayLabelSize; - this.View.IconName = this._configuration.IconName; - } + this.View.EnableThumbnailRegionSnipping = this._configuration.EnableThumbnailRegionSnipping; + this.View.DefaultThumbnailRegion = this._configuration.DefaultThumbnailRegion; - private async void SaveApplicationSettings() - { - this._configuration.MinimizeToTray = this.View.MinimizeToTray; + this.View.AvailableProfiles = this._configuration.AvailableProfiles; + this.View.CurrentProfile = this._configuration.CurrentProfile; - this._configuration.ThumbnailOpacity = (float)this.View.ThumbnailOpacity; + this.View.IconName = this._configuration.IconName; + } - this._configuration.EnableClientLayoutTracking = this.View.EnableClientLayoutTracking; - this._configuration.HideActiveClientThumbnail = this.View.HideActiveClientThumbnail; - this._configuration.MinimizeInactiveClients = this.View.MinimizeInactiveClients; - this._configuration.WindowsAnimationStyle = ViewAnimationStyleConverter.Convert(this.View.WindowsAnimationStyle); + private async void SaveApplicationSettings() { + this._configuration.MinimizeToTray = this.View.MinimizeToTray; + + this._configuration.ThumbnailOpacity = (float)this.View.ThumbnailOpacity; + + this._configuration.EnableClientLayoutTracking = this.View.EnableClientLayoutTracking; + this._configuration.HideActiveClientThumbnail = this.View.HideActiveClientThumbnail; + this._configuration.MinimizeInactiveClients = this.View.MinimizeInactiveClients; + this._configuration.WindowsAnimationStyle = + ViewAnimationStyleConverter.Convert(this.View.WindowsAnimationStyle); this._configuration.ShowThumbnailsAlwaysOnTop = this.View.ShowThumbnailsAlwaysOnTop; - this._configuration.HideThumbnailsOnLostFocus = this.View.HideThumbnailsOnLostFocus; - this._configuration.EnablePerClientThumbnailLayouts = this.View.EnablePerClientThumbnailLayouts; + this._configuration.HideThumbnailsOnLostFocus = this.View.HideThumbnailsOnLostFocus; + this._configuration.EnablePerClientThumbnailLayouts = this.View.EnablePerClientThumbnailLayouts; - this._configuration.ThumbnailSize = this.View.ThumbnailSize; + this._configuration.ThumbnailSize = this.View.ThumbnailSize; - this._configuration.ThumbnailZoomEnabled = this.View.EnableThumbnailZoom; - this._configuration.ThumbnailZoomFactor = this.View.ThumbnailZoomFactor; - this._configuration.ThumbnailZoomAnchor = ViewZoomAnchorConverter.Convert(this.View.ThumbnailZoomAnchor); - this._configuration.OverlayLabelAnchor = ViewZoomAnchorConverter.Convert(this.View.OverlayLabelAnchor); + this._configuration.ThumbnailZoomEnabled = this.View.EnableThumbnailZoom; + this._configuration.ThumbnailZoomFactor = this.View.ThumbnailZoomFactor; + this._configuration.ThumbnailZoomAnchor = ViewZoomAnchorConverter.Convert(this.View.ThumbnailZoomAnchor); + this._configuration.OverlayLabelAnchor = ViewZoomAnchorConverter.Convert(this.View.OverlayLabelAnchor); - this._configuration.ShowThumbnailOverlays = this.View.ShowThumbnailOverlays; - if (this._configuration.ShowThumbnailFrames != this.View.ShowThumbnailFrames) - { - this._configuration.ShowThumbnailFrames = this.View.ShowThumbnailFrames; - await this._mediator.Publish(new ThumbnailFrameSettingsUpdated()); - } + this._configuration.ShowThumbnailOverlays = this.View.ShowThumbnailOverlays; + if (this._configuration.ShowThumbnailFrames != this.View.ShowThumbnailFrames) { + this._configuration.ShowThumbnailFrames = this.View.ShowThumbnailFrames; + await this._mediator.Publish(new ThumbnailFrameSettingsUpdated()); + } this._configuration.LockThumbnailLocation = this.View.LockThumbnailLocation; - this._configuration.ThumbnailSnapToGrid = this.View.ThumbnailSnapToGrid; - this._configuration.ThumbnailSnapToGridSizeX = this.View.ThumbnailSnapToGridSizeX; + this._configuration.ThumbnailSnapToGrid = this.View.ThumbnailSnapToGrid; + this._configuration.ThumbnailSnapToGridSizeX = this.View.ThumbnailSnapToGridSizeX; this._configuration.ThumbnailSnapToGridSizeY = this.View.ThumbnailSnapToGridSizeY; this._configuration.EnableActiveClientHighlight = this.View.EnableActiveClientHighlight; - this._configuration.ActiveClientHighlightColor = this.View.ActiveClientHighlightColor; + this._configuration.ActiveClientHighlightColor = this.View.ActiveClientHighlightColor; - this._configuration.OverlayLabelColor = this.View.OverlayLabelColor; - this._configuration.OverlayLabelSize = this.View.OverlayLabelSize; + this._configuration.OverlayLabelColor = this.View.OverlayLabelColor; + this._configuration.OverlayLabelSize = this.View.OverlayLabelSize; - this._configuration.IconName = this.View.IconName; + this._configuration.EnableThumbnailRegionSnipping = this.View.EnableThumbnailRegionSnipping; + this._configuration.DefaultThumbnailRegion = this.View.DefaultThumbnailRegion; - this._configurationStorage.Save(); + this._configuration.AvailableProfiles = this.View.AvailableProfiles; + this._configuration.CurrentProfile = this.View.CurrentProfile; - this.View.RefreshZoomSettings(); + // Publish region settings update if they changed + if (this._configuration.EnableThumbnailRegionSnipping != this.View.EnableThumbnailRegionSnipping || + this._configuration.DefaultThumbnailRegion != this.View.DefaultThumbnailRegion) { + await this._mediator.Publish(new ThumbnailRegionSettingsUpdated()); + } - await this._mediator.Send(new SaveConfiguration()); - } + this._configuration.IconName = this.View.IconName; + this._configurationStorage.Save(); - public void AddThumbnails(IList thumbnailTitles) - { - IList descriptions = new List(thumbnailTitles.Count); + this.View.RefreshZoomSettings(); - lock (this._descriptionsCache) - { - foreach (string title in thumbnailTitles) - { - IThumbnailDescription description = this.CreateThumbnailDescription(title); - this._descriptionsCache[title] = description; + await this._mediator.Send(new SaveConfiguration()); + } - descriptions.Add(description); - } - } + public void AddThumbnails(IList thumbnailTitles) { + IList descriptions = new List(thumbnailTitles.Count); - this.View.AddThumbnails(descriptions); - } + lock (this._descriptionsCache) { + foreach (string title in thumbnailTitles) { + IThumbnailDescription description = this.CreateThumbnailDescription(title); + this._descriptionsCache[title] = description; - public void RemoveThumbnails(IList thumbnailTitles) - { - IList descriptions = new List(thumbnailTitles.Count); + descriptions.Add(description); + } + } - lock (this._descriptionsCache) - { - foreach (string title in thumbnailTitles) - { - if (!this._descriptionsCache.TryGetValue(title, out IThumbnailDescription description)) - { - continue; - } + this.View.AddThumbnails(descriptions); + } - this._descriptionsCache.Remove(title); - descriptions.Add(description); - } - } + public void RemoveThumbnails(IList thumbnailTitles) { + IList descriptions = new List(thumbnailTitles.Count); - this.View.RemoveThumbnails(descriptions); - } + lock (this._descriptionsCache) { + foreach (string title in thumbnailTitles) { + if (!this._descriptionsCache.TryGetValue(title, out IThumbnailDescription description)) { + continue; + } - private IThumbnailDescription CreateThumbnailDescription(string title) - { - bool isDisabled = this._configuration.IsThumbnailDisabled(title); - return new ThumbnailDescription(title, isDisabled); - } + this._descriptionsCache.Remove(title); + descriptions.Add(description); + } + } - private async void UpdateThumbnailState(String title) - { - if (this._descriptionsCache.TryGetValue(title, out IThumbnailDescription description)) - { - this._configuration.ToggleThumbnail(title, description.IsDisabled); - } + this.View.RemoveThumbnails(descriptions); + } - await this._mediator.Send(new SaveConfiguration()); - } + private IThumbnailDescription CreateThumbnailDescription(string title) { + bool isDisabled = this._configuration.IsThumbnailDisabled(title); + return new ThumbnailDescription(title, isDisabled); + } - public void UpdateThumbnailSize(Size size) - { - this._suppressSizeNotifications = true; - this.View.ThumbnailSize = size; - this._suppressSizeNotifications = false; - } + private async void UpdateThumbnailState(String title) { + if (this._descriptionsCache.TryGetValue(title, out IThumbnailDescription description)) { + this._configuration.ToggleThumbnail(title, description.IsDisabled); + } - private void OpenDocumentationLink() - { - // funtimes - // https://brockallen.com/2016/09/24/process-start-for-urls-on-net-core/ - // https://github.com/dotnet/runtime/issues/17938 + await this._mediator.Send(new SaveConfiguration()); + } - // TODO Move out to a separate service / presenter / message handler + public void UpdateThumbnailSize(Size size) { + this._suppressSizeNotifications = true; + this.View.ThumbnailSize = size; + this._suppressSizeNotifications = false; + } + + private void OpenDocumentationLink() { + // funtimes + // https://brockallen.com/2016/09/24/process-start-for-urls-on-net-core/ + // https://github.com/dotnet/runtime/issues/17938 + + // TODO Move out to a separate service / presenter / message handler #if LINUX - Process.Start("xdg-open", new Uri(MainFormPresenter.FORUM_URL).AbsoluteUri); + Process.Start("xdg-open", new Uri(MainFormPresenter.FORUM_URL).AbsoluteUri); #else - ProcessStartInfo processStartInfo = new ProcessStartInfo(new Uri(MainFormPresenter.FORUM_URL).AbsoluteUri); - processStartInfo.UseShellExecute = true; - Process.Start(processStartInfo); + ProcessStartInfo processStartInfo = new ProcessStartInfo(new Uri(MainFormPresenter.FORUM_URL).AbsoluteUri); + processStartInfo.UseShellExecute = true; + Process.Start(processStartInfo); #endif - } + } - private string GetApplicationVersion() - { - Version version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version; - string target = "Windows"; + private string GetApplicationVersion() { + Version version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version; + string target = "Windows"; #if LINUX - target = "Linux"; + target = "Linux"; #endif - return $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision} {target}"; - } + return $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision} {target}"; + } - private void ExitApplication() - { - this._exitApplication = true; - this.View.Close(); - } - } + private void ExitApplication() { + this._exitApplication = true; + this.View.Close(); + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Presenters/Implementation/ViewAnimationStyleConverter.cs b/src/Eve-O-Preview/Presenters/Implementation/ViewAnimationStyleConverter.cs index 39515a9..03763ad 100644 --- a/src/Eve-O-Preview/Presenters/Implementation/ViewAnimationStyleConverter.cs +++ b/src/Eve-O-Preview/Presenters/Implementation/ViewAnimationStyleConverter.cs @@ -1,19 +1,15 @@ using EveOPreview.Configuration; -namespace EveOPreview.View -{ - static class ViewAnimationStyleConverter - { - public static AnimationStyle Convert(ViewAnimationStyle value) - { - // Cheat based on fact that the order and byte values of both enums are the same - return (AnimationStyle)((int)value); - } +namespace EveOPreview.View { + static class ViewAnimationStyleConverter { + public static AnimationStyle Convert(ViewAnimationStyle value) { + // Cheat based on fact that the order and byte values of both enums are the same + return (AnimationStyle)((int)value); + } - public static ViewAnimationStyle Convert(AnimationStyle value) - { - // Cheat based on fact that the order and byte values of both enums are the same - return (ViewAnimationStyle)((int)value); - } - } + public static ViewAnimationStyle Convert(AnimationStyle value) { + // Cheat based on fact that the order and byte values of both enums are the same + return (ViewAnimationStyle)((int)value); + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Presenters/Implementation/ViewZoomAnchorConverter.cs b/src/Eve-O-Preview/Presenters/Implementation/ViewZoomAnchorConverter.cs index 2c8f300..8034da6 100644 --- a/src/Eve-O-Preview/Presenters/Implementation/ViewZoomAnchorConverter.cs +++ b/src/Eve-O-Preview/Presenters/Implementation/ViewZoomAnchorConverter.cs @@ -1,19 +1,15 @@ using EveOPreview.Configuration; -namespace EveOPreview.View -{ - static class ViewZoomAnchorConverter - { - public static ZoomAnchor Convert(ViewZoomAnchor value) - { - // Cheat based on fact that the order and byte values of both enums are the same - return (ZoomAnchor)((int)value); - } +namespace EveOPreview.View { + static class ViewZoomAnchorConverter { + public static ZoomAnchor Convert(ViewZoomAnchor value) { + // Cheat based on fact that the order and byte values of both enums are the same + return (ZoomAnchor)((int)value); + } - public static ViewZoomAnchor Convert(ZoomAnchor value) - { - // Cheat based on fact that the order and byte values of both enums are the same - return (ViewZoomAnchor)((int)value); - } - } + public static ViewZoomAnchor Convert(ZoomAnchor value) { + // Cheat based on fact that the order and byte values of both enums are the same + return (ViewZoomAnchor)((int)value); + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Presenters/Interface/IMainFormPresenter.cs b/src/Eve-O-Preview/Presenters/Interface/IMainFormPresenter.cs index 8e6d3c8..4ccfcbb 100644 --- a/src/Eve-O-Preview/Presenters/Interface/IMainFormPresenter.cs +++ b/src/Eve-O-Preview/Presenters/Interface/IMainFormPresenter.cs @@ -1,13 +1,11 @@ using System.Collections.Generic; using System.Drawing; -namespace EveOPreview.Presenters -{ - interface IMainFormPresenter - { - void AddThumbnails(IList thumbnailTitles); - void RemoveThumbnails(IList thumbnailTitles); +namespace EveOPreview.Presenters { + interface IMainFormPresenter { + void AddThumbnails(IList thumbnailTitles); + void RemoveThumbnails(IList thumbnailTitles); - void UpdateThumbnailSize(Size size); - } + void UpdateThumbnailSize(Size size); + } } diff --git a/src/Eve-O-Preview/Presenters/Interface/ViewCloseRequest.cs b/src/Eve-O-Preview/Presenters/Interface/ViewCloseRequest.cs index b9b7ab3..843825a 100644 --- a/src/Eve-O-Preview/Presenters/Interface/ViewCloseRequest.cs +++ b/src/Eve-O-Preview/Presenters/Interface/ViewCloseRequest.cs @@ -1,12 +1,9 @@ -namespace EveOPreview.View -{ - public class ViewCloseRequest - { - public ViewCloseRequest() - { - this.Allow = true; - } +namespace EveOPreview.View { + public class ViewCloseRequest { + public ViewCloseRequest() { + this.Allow = true; + } - public bool Allow { get; set; } - } + public bool Allow { get; set; } + } } diff --git a/src/Eve-O-Preview/Program.cs b/src/Eve-O-Preview/Program.cs index 865f9f4..4202380 100644 --- a/src/Eve-O-Preview/Program.cs +++ b/src/Eve-O-Preview/Program.cs @@ -7,108 +7,96 @@ using EveOPreview.Services; using EveOPreview.View; using MediatR; -namespace EveOPreview -{ - static class Program - { - private static string MUTEX_NAME = "EVE-O-Preview Single Instance Mutex"; +namespace EveOPreview { + static class Program { + private static string MUTEX_NAME = "EVE-O-Preview Single Instance Mutex"; - private static Mutex _singleInstanceMutex; + private static Mutex _singleInstanceMutex; - /// The main entry point for the application. - [STAThread] - static void Main() - { - // The very usual Mutex-based single-instance screening - // 'token' variable is used to store reference to the instance Mutex - // during the app lifetime - Program._singleInstanceMutex = Program.GetInstanceToken(); + /// The main entry point for the application. + [STAThread] + static void Main() { + // The very usual Mutex-based single-instance screening + // 'token' variable is used to store reference to the instance Mutex + // during the app lifetime + Program._singleInstanceMutex = Program.GetInstanceToken(); - // If it was not possible to acquire the app token then another app instance is already running - // Nothing to do here - if (Program._singleInstanceMutex == null) - { - return; - } + // If it was not possible to acquire the app token then another app instance is already running + // Nothing to do here + if (Program._singleInstanceMutex == null) { + return; + } - ExceptionHandler handler = new ExceptionHandler(); - handler.SetupExceptionHandlers(); + ExceptionHandler handler = new ExceptionHandler(); + handler.SetupExceptionHandlers(); - IApplicationController controller = Program.InitializeApplicationController(); + IApplicationController controller = Program.InitializeApplicationController(); - Program.InitializeWinForms(); - controller.Run(); - } + Program.InitializeWinForms(); + controller.Run(); + } - private static Mutex GetInstanceToken() - { - // The code might look overcomplicated here for a single Mutex operation - // Yet we had already experienced a Windows-level issue - // where .NET finalizer thread was literally paralyzed by - // a failed Mutex operation. That did lead to weird OutOfMemory - // exceptions later - try - { - Mutex.OpenExisting(Program.MUTEX_NAME); - // if that didn't fail then another instance is already running - return null; - } - catch (UnauthorizedAccessException) - { - return null; - } - catch (Exception) - { - Mutex token = new Mutex(true, Program.MUTEX_NAME, out var result); - return result ? token : null; - } - } + private static Mutex GetInstanceToken() { + // The code might look overcomplicated here for a single Mutex operation + // Yet we had already experienced a Windows-level issue + // where .NET finalizer thread was literally paralyzed by + // a failed Mutex operation. That did lead to weird OutOfMemory + // exceptions later + try { + Mutex.OpenExisting(Program.MUTEX_NAME); + // if that didn't fail then another instance is already running + return null; + } catch (UnauthorizedAccessException) { + return null; + } catch (Exception) { + Mutex token = new Mutex(true, Program.MUTEX_NAME, out var result); + return result ? token : null; + } + } - private static void InitializeWinForms() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); + private static void InitializeWinForms() { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); #if WINDOWS - Application.SetHighDpiMode(HighDpiMode.PerMonitorV2); + Application.SetHighDpiMode(HighDpiMode.PerMonitorV2); #endif - } + } - private static IApplicationController InitializeApplicationController() - { - IIocContainer container = new LightInjectContainer(); + private static IApplicationController InitializeApplicationController() { + IIocContainer container = new LightInjectContainer(); - // Singleton registration is used for services - // Low-level services - container.Register(); - container.Register(); + // Singleton registration is used for services + // Low-level services + container.Register(); + container.Register(); - // MediatR - container.Register(); - container.RegisterInstance(t => container.Resolve(t)); - container.Register(typeof(INotificationHandler<>), typeof(Program).Assembly); - container.Register(typeof(IRequestHandler<>), typeof(Program).Assembly); - container.Register(typeof(IRequestHandler<,>), typeof(Program).Assembly); + // MediatR + container.Register(); + container.RegisterInstance(t => container.Resolve(t)); + container.Register(typeof(INotificationHandler<>), typeof(Program).Assembly); + container.Register(typeof(IRequestHandler<>), typeof(Program).Assembly); + container.Register(typeof(IRequestHandler<, >), typeof(Program).Assembly); - // Configuration services - container.Register(); - container.Register(); - container.Register(); + // Configuration services + container.Register(); + container.Register(); + container.Register(); - // Application services - container.Register(); - container.Register(); - container.Register(); + // Application services + container.Register(); + container.Register(); + container.Register(); - IApplicationController controller = new ApplicationController(container); + IApplicationController controller = new ApplicationController(container); - // UI classes - controller.RegisterView(); - controller.RegisterView(); + // UI classes + controller.RegisterView(); + controller.RegisterView(); - controller.RegisterView(); - controller.RegisterInstance(new ApplicationContext()); + controller.RegisterView(); + controller.RegisterInstance(new ApplicationContext()); - return controller; - } - } + return controller; + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Properties/Resources.Designer.cs b/src/Eve-O-Preview/Properties/Resources.Designer.cs index aea7a5f..428918d 100644 --- a/src/Eve-O-Preview/Properties/Resources.Designer.cs +++ b/src/Eve-O-Preview/Properties/Resources.Designer.cs @@ -10,8 +10,7 @@ namespace EveOPreview.Properties { using System; - - + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,45 +18,44 @@ namespace EveOPreview.Properties { // 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", "17.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", + "17.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() { - } - + + [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)] + [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("EveOPreview.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; } } - + /// /// 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)] + [global::System.ComponentModel.EditorBrowsableAttribute( + global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } + get { return resourceCulture; } + set { resourceCulture = value; } } } } diff --git a/src/Eve-O-Preview/Services/Implementation/DwmThumbnail.cs b/src/Eve-O-Preview/Services/Implementation/DwmThumbnail.cs index 7562929..1fb4128 100644 --- a/src/Eve-O-Preview/Services/Implementation/DwmThumbnail.cs +++ b/src/Eve-O-Preview/Services/Implementation/DwmThumbnail.cs @@ -2,102 +2,86 @@ using System.Runtime.InteropServices; using EveOPreview.Services.Interop; -namespace EveOPreview.Services.Implementation -{ - class DwmThumbnail : IDwmThumbnail - { - #region Private fields - private readonly IWindowManager _windowManager; - private IntPtr _handle; - private DWM_THUMBNAIL_PROPERTIES _properties; - #endregion +namespace EveOPreview.Services.Implementation { + class DwmThumbnail : IDwmThumbnail { +#region Private fields + private readonly IWindowManager _windowManager; + private IntPtr _handle; + private DWM_THUMBNAIL_PROPERTIES _properties; +#endregion - public DwmThumbnail(IWindowManager windowManager) - { - this._windowManager = windowManager; - this._handle = IntPtr.Zero; - } + public DwmThumbnail(IWindowManager windowManager) { + this._windowManager = windowManager; + this._handle = IntPtr.Zero; + } - public void Register(IntPtr destination, IntPtr source) - { - this._properties = new DWM_THUMBNAIL_PROPERTIES(); - this._properties.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._properties.opacity = 255; - this._properties.fVisible = true; - this._properties.fSourceClientAreaOnly = true; + public void Register(IntPtr destination, IntPtr source) { + this._properties = new DWM_THUMBNAIL_PROPERTIES(); + this._properties.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._properties.opacity = 255; + this._properties.fVisible = true; + this._properties.fSourceClientAreaOnly = true; + this._properties.rcSource = new RECT(0, 0, 0, 0); // Initialize with empty source rect - if (!this._windowManager.IsCompositionEnabled) - { - return; - } + if (!this._windowManager.IsCompositionEnabled) { + return; + } - try - { - this._handle = DwmNativeMethods.DwmRegisterThumbnail(destination, source); - } - catch (ArgumentException) - { - // This exception is raised if the source client is already closed - // Can happen on a really slow CPU's that the window is still being - // listed in the process list yet it already cannot be used as - // a thumbnail source - this._handle = IntPtr.Zero; - } - catch (COMException) - { - // This exception is raised if DWM is suddenly not available - // (f.e. when switching between Windows user accounts) - this._handle = IntPtr.Zero; - } - } + try { + this._handle = DwmNativeMethods.DwmRegisterThumbnail(destination, source); + } catch (ArgumentException) { + // This exception is raised if the source client is already closed + // Can happen on a really slow CPU's that the window is still being + // listed in the process list yet it already cannot be used as + // a thumbnail source + this._handle = IntPtr.Zero; + } catch (COMException) { + // This exception is raised if DWM is suddenly not available + // (f.e. when switching between Windows user accounts) + this._handle = IntPtr.Zero; + } + } - public void Unregister() - { - if ((!this._windowManager.IsCompositionEnabled) || (this._handle == IntPtr.Zero)) - { - return; - } + public void Unregister() { + if ((!this._windowManager.IsCompositionEnabled) || (this._handle == IntPtr.Zero)) { + return; + } - try - { - DwmNativeMethods.DwmUnregisterThumbnail(this._handle); - } - catch (ArgumentException) - { - } - catch (COMException) - { - // This exception is raised when DWM is not available for some reason - } - } + try { + DwmNativeMethods.DwmUnregisterThumbnail(this._handle); + } catch (ArgumentException) { + } catch (COMException) { + // This exception is raised when DWM is not available for some reason + } + } - public void Move(int left, int top, int right, int bottom) - { - this._properties.rcDestination = new RECT(left, top, right, bottom); - } + public void Move(int left, int top, int right, int bottom) { + this._properties.rcDestination = new RECT(left, top, right, bottom); + } - public void Update() - { - if ((!this._windowManager.IsCompositionEnabled) || (this._handle == IntPtr.Zero)) - { - return; - } + public void SetSourceRegion(int left, int top, int right, int bottom) { + this._properties.rcSource = new RECT(left, top, right, bottom); + this._properties.dwFlags |= DWM_TNP_CONSTANTS.DWM_TNP_RECTSOURCE; + } - try - { - DwmNativeMethods.DwmUpdateThumbnailProperties(this._handle, this._properties); - } - catch (ArgumentException) - { - // This exception will be thrown if the EVE client disappears while this method is running - } - catch (COMException) - { - // This exception is raised when DWM is not available for some reason - } - } - } + public void ClearSourceRegion() { + this._properties.dwFlags &= ~DWM_TNP_CONSTANTS.DWM_TNP_RECTSOURCE; + } + + public void Update() { + if ((!this._windowManager.IsCompositionEnabled) || (this._handle == IntPtr.Zero)) { + return; + } + + try { + DwmNativeMethods.DwmUpdateThumbnailProperties(this._handle, this._properties); + } catch (ArgumentException) { + // This exception will be thrown if the EVE client disappears while this method is running + } catch (COMException) { + // This exception is raised when DWM is not available for some reason + } + } + } } diff --git a/src/Eve-O-Preview/Services/Implementation/ProcessInfo.cs b/src/Eve-O-Preview/Services/Implementation/ProcessInfo.cs index 7021c3f..0eefbde 100644 --- a/src/Eve-O-Preview/Services/Implementation/ProcessInfo.cs +++ b/src/Eve-O-Preview/Services/Implementation/ProcessInfo.cs @@ -1,16 +1,13 @@ using System; -namespace EveOPreview.Services.Implementation -{ - sealed class ProcessInfo : IProcessInfo - { - public ProcessInfo(IntPtr handle, string title) - { - this.Handle = handle; - this.Title = title; - } +namespace EveOPreview.Services.Implementation { + sealed class ProcessInfo : IProcessInfo { + public ProcessInfo(IntPtr handle, string title) { + this.Handle = handle; + this.Title = title; + } - public IntPtr Handle { get; } - public string Title { get; } - } + public IntPtr Handle { get; } + public string Title { get; } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Services/Implementation/ProcessMonitor.cs b/src/Eve-O-Preview/Services/Implementation/ProcessMonitor.cs index 697c86d..c2b19ce 100644 --- a/src/Eve-O-Preview/Services/Implementation/ProcessMonitor.cs +++ b/src/Eve-O-Preview/Services/Implementation/ProcessMonitor.cs @@ -4,172 +4,148 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; -namespace EveOPreview.Services.Implementation -{ - sealed class ProcessMonitor : IProcessMonitor - { - #region Private constants - private const string DEFAULT_PROCESS_NAME = "Uwow-64"; - private const string CURRENT_PROCESS_NAME = "EVE-O Preview"; - #endregion +namespace EveOPreview.Services.Implementation { + sealed class ProcessMonitor : IProcessMonitor { +#region Private constants + private const string DEFAULT_PROCESS_NAME = "Uwow-64"; + private const string CURRENT_PROCESS_NAME = "EVE-O Preview"; +#endregion - #region Private fields - private readonly IDictionary _processCache; - private IProcessInfo _currentProcessInfo; - private readonly IThumbnailConfiguration _configuration; - private readonly HashSet _trackedPids; // Change to HashSet for multiple PIDs - #endregion +#region Private fields + private readonly IDictionary _processCache; + private IProcessInfo _currentProcessInfo; + private readonly IThumbnailConfiguration _configuration; + private readonly HashSet _trackedPids; // Change to HashSet for multiple PIDs +#endregion - public ProcessMonitor(IThumbnailConfiguration configuration) - { - this._processCache = new Dictionary(512); - this._configuration = configuration; - this._trackedPids = new HashSet(); // Initialize empty set + public ProcessMonitor(IThumbnailConfiguration configuration) { + this._processCache = new Dictionary(512); + this._configuration = configuration; + this._trackedPids = new HashSet(); // Initialize empty set - // This field cannot be initialized properly in constructor - // At the moment this code is executed the main application window is not yet initialized - this._currentProcessInfo = new ProcessInfo(IntPtr.Zero, ""); - } + // This field cannot be initialized properly in constructor + // At the moment this code is executed the main application window is not yet initialized + this._currentProcessInfo = new ProcessInfo(IntPtr.Zero, ""); + } - private bool IsMonitoredProcess(string processName, int processId) - { - // If we're tracking this specific PID, include it - if (_trackedPids.Contains(processId)) - { - return true; - } + private bool IsMonitoredProcess(string processName, int processId) { + // If we're tracking this specific PID, include it + if (_trackedPids.Contains(processId)) { + return true; + } - // Also include any processes that match executable tracking - return _configuration.IsExecutableToPreview(processName); - } + // Also include any processes that match executable tracking + return _configuration.IsExecutableToPreview(processName); + } - private IProcessInfo GetCurrentProcessInfo() - { - var currentProcess = Process.GetCurrentProcess(); - return new ProcessInfo(currentProcess.MainWindowHandle, currentProcess.MainWindowTitle); - } + private IProcessInfo GetCurrentProcessInfo() { + var currentProcess = Process.GetCurrentProcess(); + return new ProcessInfo(currentProcess.MainWindowHandle, currentProcess.MainWindowTitle); + } - public IProcessInfo GetMainProcess() - { - if (this._currentProcessInfo.Handle == IntPtr.Zero) - { - var processInfo = this.GetCurrentProcessInfo(); + public IProcessInfo GetMainProcess() { + if (this._currentProcessInfo.Handle == IntPtr.Zero) { + var processInfo = this.GetCurrentProcessInfo(); - // Are we initialized yet? - if (processInfo.Title != "") - { - this._currentProcessInfo = processInfo; - } - } + // Are we initialized yet? + if (processInfo.Title != "") { + this._currentProcessInfo = processInfo; + } + } - return this._currentProcessInfo; - } + return this._currentProcessInfo; + } - public ICollection GetAllProcesses() - { - ICollection result = new List(this._processCache.Count); + public ICollection GetAllProcesses() { + ICollection result = new List(this._processCache.Count); - // TODO Lock list here just in case - foreach (KeyValuePair entry in this._processCache) - { - result.Add(new ProcessInfo(entry.Key, entry.Value)); - } + // TODO Lock list here just in case + foreach (KeyValuePair entry in this._processCache) { + result.Add(new ProcessInfo(entry.Key, entry.Value)); + } - return result; - } + return result; + } - public void GetUpdatedProcesses(out ICollection addedProcesses, out ICollection updatedProcesses, out ICollection removedProcesses) - { - addedProcesses = new List(16); - updatedProcesses = new List(16); - removedProcesses = new List(16); + public void GetUpdatedProcesses(out ICollection addedProcesses, + out ICollection updatedProcesses, + out ICollection removedProcesses) { + addedProcesses = new List(16); + updatedProcesses = new List(16); + removedProcesses = new List(16); - IList knownProcesses = new List(this._processCache.Keys); - foreach (Process process in Process.GetProcesses()) - { - string processName = process.ProcessName; - int processId = process.Id; + IList knownProcesses = new List(this._processCache.Keys); + foreach (Process process in Process.GetProcesses()) { + string processName = process.ProcessName; + int processId = process.Id; - if (!this.IsMonitoredProcess(processName, processId)) - { - continue; - } + if (!this.IsMonitoredProcess(processName, processId)) { + continue; + } - IntPtr mainWindowHandle = process.MainWindowHandle; - if (mainWindowHandle == IntPtr.Zero) - { - continue; // No need to monitor non-visual processes - } + IntPtr mainWindowHandle = process.MainWindowHandle; + if (mainWindowHandle == IntPtr.Zero) { + continue; // No need to monitor non-visual processes + } - // Get all processes with same name and sort by PID - var sameNameProcesses = Process.GetProcessesByName(processName) - .Where(p => p.MainWindowHandle != IntPtr.Zero) - .OrderBy(p => p.Id) - .ToList(); + // Get all processes with same name and sort by PID + var sameNameProcesses = Process.GetProcessesByName(processName) + .Where(p => p.MainWindowHandle != IntPtr.Zero) + .OrderBy(p => p.Id) + .ToList(); - // Find index of current process in sorted list - int index = sameNameProcesses.FindIndex(p => p.Id == process.Id); - string mainWindowTitle = $"{process.MainWindowTitle} ({index + 1})"; + // Find index of current process in sorted list + int index = sameNameProcesses.FindIndex(p => p.Id == process.Id); + string mainWindowTitle = $"{process.MainWindowTitle} ({index + 1})"; - this._processCache.TryGetValue(mainWindowHandle, out string cachedTitle); + this._processCache.TryGetValue(mainWindowHandle, out string cachedTitle); - if (cachedTitle == null) - { - // This is a new process in the list - this._processCache.Add(mainWindowHandle, mainWindowTitle); - addedProcesses.Add(new ProcessInfo(mainWindowHandle, mainWindowTitle)); - } - else - { - // This is an already known process - if (cachedTitle != mainWindowTitle) - { - this._processCache[mainWindowHandle] = mainWindowTitle; - updatedProcesses.Add(new ProcessInfo(mainWindowHandle, mainWindowTitle)); - } - } + if (cachedTitle == null) { + // This is a new process in the list + this._processCache.Add(mainWindowHandle, mainWindowTitle); + addedProcesses.Add(new ProcessInfo(mainWindowHandle, mainWindowTitle)); + } else { + // This is an already known process + if (cachedTitle != mainWindowTitle) { + this._processCache[mainWindowHandle] = mainWindowTitle; + updatedProcesses.Add(new ProcessInfo(mainWindowHandle, mainWindowTitle)); + } + } - knownProcesses.Remove(mainWindowHandle); - } + knownProcesses.Remove(mainWindowHandle); + } - foreach (IntPtr index in knownProcesses) - { - string title = this._processCache[index]; - removedProcesses.Add(new ProcessInfo(index, title)); - this._processCache.Remove(index); - } - } + foreach (IntPtr index in knownProcesses) { + string title = this._processCache[index]; + removedProcesses.Add(new ProcessInfo(index, title)); + this._processCache.Remove(index); + } + } - // Update to handle multiple PIDs - public void SetTrackedPid(int pid) - { - if (pid == 0) // Special case: 0 means stop tracking all - { - this._trackedPids.Clear(); - return; - } + // Update to handle multiple PIDs + public void SetTrackedPid(int pid) { + if (pid == 0) // Special case: 0 means stop tracking all + { + this._trackedPids.Clear(); + return; + } - if (this._trackedPids.Contains(pid)) - { - this._trackedPids.Remove(pid); // Toggle off if already tracking - } - else - { - this._trackedPids.Add(pid); // Toggle on if not tracking - } - } + if (this._trackedPids.Contains(pid)) { + this._trackedPids.Remove(pid); // Toggle off if already tracking + } else { + this._trackedPids.Add(pid); // Toggle on if not tracking + } + } - // Update to return currently tracked PID (for compatibility) - public int GetTrackedPid() - { - // Return the first tracked PID, or 0 if none - return this._trackedPids.FirstOrDefault(); - } + // Update to return currently tracked PID (for compatibility) + public int GetTrackedPid() { + // Return the first tracked PID, or 0 if none + return this._trackedPids.FirstOrDefault(); + } - // Add method to get all tracked PIDs if needed - public IReadOnlyCollection GetTrackedPids() - { - return this._trackedPids; - } - } + // Add method to get all tracked PIDs if needed + public IReadOnlyCollection GetTrackedPids() { + return this._trackedPids; + } + } } diff --git a/src/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs b/src/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs index fa5836f..0568ef8 100644 --- a/src/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs +++ b/src/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs @@ -16,1038 +16,945 @@ using EveOPreview.UI.Hotkeys; using EveOPreview.View; using MediatR; -namespace EveOPreview.Services -{ - sealed class ThumbnailManager : IThumbnailManager - { - #region Private constants - private const int WINDOW_POSITION_THRESHOLD_LOW = -10_000; - private const int WINDOW_POSITION_THRESHOLD_HIGH = 31_000; - private const int WINDOW_SIZE_THRESHOLD = 10; - private const int FORCED_REFRESH_CYCLE_THRESHOLD = 2; - private const int DEFAULT_LOCATION_CHANGE_NOTIFICATION_DELAY = 2; +namespace EveOPreview.Services { + sealed class ThumbnailManager : IThumbnailManager { +#region Private constants + private const int WINDOW_POSITION_THRESHOLD_LOW = -10_000; + private const int WINDOW_POSITION_THRESHOLD_HIGH = 31_000; + private const int WINDOW_SIZE_THRESHOLD = 10; + private const int FORCED_REFRESH_CYCLE_THRESHOLD = 2; + private const int DEFAULT_LOCATION_CHANGE_NOTIFICATION_DELAY = 2; - private const string DEFAULT_CLIENT_TITLE = "EVE"; - #endregion + private const string DEFAULT_CLIENT_TITLE = "EVE"; +#endregion - #region Private fields - private readonly IMediator _mediator; - private readonly IProcessMonitor _processMonitor; - private readonly IWindowManager _windowManager; - private readonly IThumbnailConfiguration _configuration; - private readonly DispatcherTimer _thumbnailUpdateTimer; - private readonly IThumbnailViewFactory _thumbnailViewFactory; - private readonly Dictionary _thumbnailViews; +#region Private fields + private readonly IMediator _mediator; + private readonly IProcessMonitor _processMonitor; + private readonly IWindowManager _windowManager; + private readonly IThumbnailConfiguration _configuration; + private readonly DispatcherTimer _thumbnailUpdateTimer; + private readonly IThumbnailViewFactory _thumbnailViewFactory; + private readonly Dictionary _thumbnailViews; - private (IntPtr Handle, string Title) _activeClient; - private IntPtr _externalApplication; + private (IntPtr Handle, string Title) _activeClient; + private IntPtr _externalApplication; - private readonly object _locationChangeNotificationSyncRoot; - private (IntPtr Handle, string Title, string ActiveClient, Point Location, int Delay) _enqueuedLocationChangeNotification; + private readonly object _locationChangeNotificationSyncRoot; + private (IntPtr Handle, string Title, string ActiveClient, Point Location, + int Delay) _enqueuedLocationChangeNotification; - private bool _ignoreViewEvents; - private bool _isHoverEffectActive; + private bool _ignoreViewEvents; + private bool _isHoverEffectActive; - private int _refreshCycleCount; - private int _hideThumbnailsDelay; + private int _refreshCycleCount; + private int _hideThumbnailsDelay; - private List _cycleClientHotkeyHandlers = new List(); - private HotkeyHandler _toggleTrackingHotkey; - #endregion + private List _cycleClientHotkeyHandlers = new List(); + private HotkeyHandler _toggleTrackingHotkey; +#endregion - public ThumbnailManager(IMediator mediator, IThumbnailConfiguration configuration, IProcessMonitor processMonitor, IWindowManager windowManager, IThumbnailViewFactory factory) - { - this._mediator = mediator; - this._processMonitor = processMonitor; - this._windowManager = windowManager; - this._configuration = configuration; - this._thumbnailViewFactory = factory; + public ThumbnailManager(IMediator mediator, IThumbnailConfiguration configuration, + IProcessMonitor processMonitor, IWindowManager windowManager, + IThumbnailViewFactory factory) { + this._mediator = mediator; + this._processMonitor = processMonitor; + this._windowManager = windowManager; + this._configuration = configuration; + this._thumbnailViewFactory = factory; - this._activeClient = (IntPtr.Zero, ThumbnailManager.DEFAULT_CLIENT_TITLE); + this._activeClient = (IntPtr.Zero, ThumbnailManager.DEFAULT_CLIENT_TITLE); - this.EnableViewEvents(); - this._isHoverEffectActive = false; + this.EnableViewEvents(); + this._isHoverEffectActive = false; - this._refreshCycleCount = 0; - this._locationChangeNotificationSyncRoot = new object(); - this._enqueuedLocationChangeNotification = (IntPtr.Zero, null, null, Point.Empty, -1); + this._refreshCycleCount = 0; + this._locationChangeNotificationSyncRoot = new object(); + this._enqueuedLocationChangeNotification = (IntPtr.Zero, null, null, Point.Empty, -1); - this._thumbnailViews = new Dictionary(); + this._thumbnailViews = new Dictionary(); - // DispatcherTimer setup - this._thumbnailUpdateTimer = new DispatcherTimer(); - this._thumbnailUpdateTimer.Tick += ThumbnailUpdateTimerTick; - this._thumbnailUpdateTimer.Interval = new TimeSpan(0, 0, 0, 0, configuration.ThumbnailRefreshPeriod); + // DispatcherTimer setup + this._thumbnailUpdateTimer = new DispatcherTimer(); + this._thumbnailUpdateTimer.Tick += ThumbnailUpdateTimerTick; + this._thumbnailUpdateTimer.Interval = new TimeSpan(0, 0, 0, 0, configuration.ThumbnailRefreshPeriod); - this._hideThumbnailsDelay = this._configuration.HideThumbnailsDelay; + this._hideThumbnailsDelay = this._configuration.HideThumbnailsDelay; -// RegisterCycleClientHotkey(this._configuration.CycleGroup1ForwardHotkeys?.Select(x => this._configuration.StringToKey(x)), true, this._configuration.CycleGroup1ClientsOrder); -// RegisterCycleClientHotkey(this._configuration.CycleGroup1BackwardHotkeys?.Select(x => this._configuration.StringToKey(x)), false, this._configuration.CycleGroup1ClientsOrder); -// -// RegisterCycleClientHotkey(this._configuration.CycleGroup2ForwardHotkeys?.Select(x => this._configuration.StringToKey(x)), true, this._configuration.CycleGroup2ClientsOrder); -// RegisterCycleClientHotkey(this._configuration.CycleGroup2BackwardHotkeys?.Select(x => this._configuration.StringToKey(x)), false, this._configuration.CycleGroup2ClientsOrder); -// -// RegisterCycleClientHotkey(this._configuration.CycleGroup3ForwardHotkeys?.Select(x => this._configuration.StringToKey(x)), true, this._configuration.CycleGroup3ClientsOrder); -// RegisterCycleClientHotkey(this._configuration.CycleGroup3BackwardHotkeys?.Select(x => this._configuration.StringToKey(x)), false, this._configuration.CycleGroup3ClientsOrder); -// -// RegisterCycleClientHotkey(this._configuration.CycleGroup4ForwardHotkeys?.Select(x => this._configuration.StringToKey(x)), true, this._configuration.CycleGroup4ClientsOrder); -// RegisterCycleClientHotkey(this._configuration.CycleGroup4BackwardHotkeys?.Select(x => this._configuration.StringToKey(x)), false, this._configuration.CycleGroup4ClientsOrder); -// -// RegisterCycleClientHotkey(this._configuration.CycleGroup5ForwardHotkeys?.Select(x => this._configuration.StringToKey(x)), true, this._configuration.CycleGroup5ClientsOrder); -// RegisterCycleClientHotkey(this._configuration.CycleGroup5BackwardHotkeys?.Select(x => this._configuration.StringToKey(x)), false, this._configuration.CycleGroup5ClientsOrder); -// - // Setup toggle tracking hotkey (Ctrl+T) - var mainHandle = this._processMonitor.GetMainProcess().Handle; - System.Diagnostics.Debug.WriteLine($"Registering hotkey with main window handle: {mainHandle}"); - this._toggleTrackingHotkey = new HotkeyHandler(mainHandle, Keys.Alt | Keys.F16); - this._toggleTrackingHotkey.Pressed += (object s, HandledEventArgs e) => - { - var foregroundHandle = this._windowManager.GetForegroundWindowHandle(); - if (foregroundHandle != IntPtr.Zero) - { - uint processId; - GetWindowThreadProcessId(foregroundHandle, out processId); - var process = Process.GetProcessById((int)processId); + // RegisterCycleClientHotkey(this._configuration.CycleGroup1ForwardHotkeys?.Select(x => + // this._configuration.StringToKey(x)), true, this._configuration.CycleGroup1ClientsOrder); + // RegisterCycleClientHotkey(this._configuration.CycleGroup1BackwardHotkeys?.Select(x => + // this._configuration.StringToKey(x)), false, this._configuration.CycleGroup1ClientsOrder); + // + // RegisterCycleClientHotkey(this._configuration.CycleGroup2ForwardHotkeys?.Select(x => + // this._configuration.StringToKey(x)), true, this._configuration.CycleGroup2ClientsOrder); + // RegisterCycleClientHotkey(this._configuration.CycleGroup2BackwardHotkeys?.Select(x => + // this._configuration.StringToKey(x)), false, this._configuration.CycleGroup2ClientsOrder); + // + // RegisterCycleClientHotkey(this._configuration.CycleGroup3ForwardHotkeys?.Select(x => + // this._configuration.StringToKey(x)), true, this._configuration.CycleGroup3ClientsOrder); + // RegisterCycleClientHotkey(this._configuration.CycleGroup3BackwardHotkeys?.Select(x => + // this._configuration.StringToKey(x)), false, this._configuration.CycleGroup3ClientsOrder); + // + // RegisterCycleClientHotkey(this._configuration.CycleGroup4ForwardHotkeys?.Select(x => + // this._configuration.StringToKey(x)), true, this._configuration.CycleGroup4ClientsOrder); + // RegisterCycleClientHotkey(this._configuration.CycleGroup4BackwardHotkeys?.Select(x => + // this._configuration.StringToKey(x)), false, this._configuration.CycleGroup4ClientsOrder); + // + // RegisterCycleClientHotkey(this._configuration.CycleGroup5ForwardHotkeys?.Select(x => + // this._configuration.StringToKey(x)), true, this._configuration.CycleGroup5ClientsOrder); + // RegisterCycleClientHotkey(this._configuration.CycleGroup5BackwardHotkeys?.Select(x => + // this._configuration.StringToKey(x)), false, this._configuration.CycleGroup5ClientsOrder); + // + // Setup toggle tracking hotkey (Ctrl+T) + var mainHandle = this._processMonitor.GetMainProcess().Handle; + System.Diagnostics.Debug.WriteLine($"Registering hotkey with main window handle: {mainHandle}"); + this._toggleTrackingHotkey = new HotkeyHandler(mainHandle, Keys.Alt | Keys.F16); + this._toggleTrackingHotkey.Pressed += (object s, HandledEventArgs e) => { + var foregroundHandle = this._windowManager.GetForegroundWindowHandle(); + if (foregroundHandle != IntPtr.Zero) { + uint processId; + GetWindowThreadProcessId(foregroundHandle, out processId); + var process = Process.GetProcessById((int)processId); - if (process != null) - { - System.Diagnostics.Debug.WriteLine($"Found process: {process.ProcessName}"); - if (_configuration.IsExecutableToPreview(process.ProcessName)) - { - System.Diagnostics.Debug.WriteLine("Removing from executables to preview"); - var exesToPreview = _configuration.ExecutablesToPreview.ToList(); - exesToPreview.Remove(process.ProcessName.ToLower()); - _configuration.ExecutablesToPreview = exesToPreview; - } - else - { - System.Diagnostics.Debug.WriteLine("Adding to executables to preview"); - var exesToPreview = _configuration.ExecutablesToPreview.ToList(); - exesToPreview.Add(process.ProcessName.ToLower()); - _configuration.ExecutablesToPreview = exesToPreview; - } - e.Handled = true; - } - } - }; - var registered = this._toggleTrackingHotkey.Register(); - System.Diagnostics.Debug.WriteLine($"Hotkey registration result: {registered}"); + if (process != null) { + System.Diagnostics.Debug.WriteLine($"Found process: {process.ProcessName}"); + if (_configuration.IsExecutableToPreview(process.ProcessName)) { + System.Diagnostics.Debug.WriteLine("Removing from executables to preview"); + var exesToPreview = _configuration.ExecutablesToPreview.ToList(); + exesToPreview.Remove(process.ProcessName.ToLower()); + _configuration.ExecutablesToPreview = exesToPreview; + } else { + System.Diagnostics.Debug.WriteLine("Adding to executables to preview"); + var exesToPreview = _configuration.ExecutablesToPreview.ToList(); + exesToPreview.Add(process.ProcessName.ToLower()); + _configuration.ExecutablesToPreview = exesToPreview; + } + e.Handled = true; + } + } + }; + var registered = this._toggleTrackingHotkey.Register(); + System.Diagnostics.Debug.WriteLine($"Hotkey registration result: {registered}"); - // Setup single process tracking hotkey (Ctrl+F16) - var toggleSingleProcessHotkey = new HotkeyHandler(mainHandle, Keys.Control | Keys.F16); - toggleSingleProcessHotkey.Pressed += (object s, HandledEventArgs e) => - { - var foregroundHandle = this._windowManager.GetForegroundWindowHandle(); - if (foregroundHandle != IntPtr.Zero) - { - uint processId; - GetWindowThreadProcessId(foregroundHandle, out processId); - var process = Process.GetProcessById((int)processId); + // Setup single process tracking hotkey (Ctrl+F16) + var toggleSingleProcessHotkey = new HotkeyHandler(mainHandle, Keys.Control | Keys.F16); + toggleSingleProcessHotkey.Pressed += (object s, HandledEventArgs e) => { + var foregroundHandle = this._windowManager.GetForegroundWindowHandle(); + if (foregroundHandle != IntPtr.Zero) { + uint processId; + GetWindowThreadProcessId(foregroundHandle, out processId); + var process = Process.GetProcessById((int)processId); - if (process != null) - { - System.Diagnostics.Debug.WriteLine($"Found process: {process.ProcessName} (PID: {process.Id})"); - - // Get the current tracked PID from ProcessMonitor - var currentTrackedPid = this._processMonitor.GetTrackedPid(); - - if (currentTrackedPid == process.Id) - { - // Stop tracking this process - this._processMonitor.SetTrackedPid(0); - System.Diagnostics.Debug.WriteLine($"Stopped tracking process {process.Id}"); - } - else - { - // Start tracking this process - this._processMonitor.SetTrackedPid(process.Id); - System.Diagnostics.Debug.WriteLine($"Started tracking process {process.Id}"); - } - e.Handled = true; - } - } - }; - registered = toggleSingleProcessHotkey.Register(); - System.Diagnostics.Debug.WriteLine($"Single process hotkey registration result: {registered}"); - } + if (process != null) { + System.Diagnostics.Debug.WriteLine($"Found process: {process.ProcessName} (PID: {process.Id})"); - public IThumbnailView GetClientByTitle(string title) - { - return _thumbnailViews.FirstOrDefault(x => x.Value.Title == title).Value; - } + // Get the current tracked PID from ProcessMonitor + var currentTrackedPid = this._processMonitor.GetTrackedPid(); - public IThumbnailView GetClientByPointer(IntPtr ptr) - { - return _thumbnailViews.FirstOrDefault(x => x.Key == ptr).Value; - } + if (currentTrackedPid == process.Id) { + // Stop tracking this process + this._processMonitor.SetTrackedPid(0); + System.Diagnostics.Debug.WriteLine($"Stopped tracking process {process.Id}"); + } else { + // Start tracking this process + this._processMonitor.SetTrackedPid(process.Id); + System.Diagnostics.Debug.WriteLine($"Started tracking process {process.Id}"); + } + e.Handled = true; + } + } + }; + registered = toggleSingleProcessHotkey.Register(); + System.Diagnostics.Debug.WriteLine($"Single process hotkey registration result: {registered}"); + } - public IThumbnailView GetActiveClient() - { - return GetClientByPointer(this._activeClient.Handle); - } + public IThumbnailView GetClientByTitle(string title) { + return _thumbnailViews.FirstOrDefault(x => x.Value.Title == title).Value; + } - public void SetActive(KeyValuePair newClient) - { - this.GetActiveClient()?.ClearBorder(); + public IThumbnailView GetClientByPointer(IntPtr ptr) { + return _thumbnailViews.FirstOrDefault(x => x.Key == ptr).Value; + } + + public IThumbnailView GetActiveClient() { + return GetClientByPointer(this._activeClient.Handle); + } + + public void SetActive(KeyValuePair newClient) { + this.GetActiveClient()?.ClearBorder(); #if LINUX - this._windowManager.ActivateWindow(newClient.Key, newClient.Value.Title); + this._windowManager.ActivateWindow(newClient.Key, newClient.Value.Title); #else - this._windowManager.ActivateWindow(newClient.Key, this._configuration.WindowsAnimationStyle); + this._windowManager.ActivateWindow(newClient.Key, this._configuration.WindowsAnimationStyle); #endif - this.SwitchActiveClient(newClient.Key, newClient.Value.Title); - - newClient.Value.SetHighlight(); - newClient.Value.Refresh(true); - } - - public void CycleNextClient(bool isForwards, Dictionary cycleOrder) - { - IOrderedEnumerable> clientOrder; - Dictionary _cycleOrder = new Dictionary(cycleOrder); - - if ( _cycleOrder.Count == 0 ) - { - int order = 0; - foreach( var x in _thumbnailViews) - { - _cycleOrder.Add(x.Value.Title, order++); - } - } - - if (isForwards) - { - clientOrder = _cycleOrder.OrderBy(x => x.Value); - } - else - { - clientOrder = _cycleOrder.OrderByDescending(x => x.Value); - } - - bool setNextClient = false; - IThumbnailView lastClient = null; - - foreach (var t in clientOrder) - { - if (t.Key == _activeClient.Title && t.Key != "EVE") - { - setNextClient = true; - lastClient = _thumbnailViews.FirstOrDefault(x => x.Value.Title == t.Key).Value; - continue; - } - - // cycle through login screens ? - if (t.Key == _activeClient.Title && t.Key == "EVE") - { - lastClient = _thumbnailViews.FirstOrDefault(x => x.Value.Title == t.Key && x.Value.Id == _activeClient.Handle).Value; - if (lastClient == null) - { - setNextClient = true; - continue; - } - var possibleClients = (isForwards ? _thumbnailViews.OrderBy(x => x.Value.Id.ToInt64()) : _thumbnailViews.OrderByDescending(x => x.Value.Id.ToInt64())).Where(x => x.Value.Title == t.Key); - foreach (var pc in possibleClients) - { - if ( pc.Value.Id.Equals(lastClient.Id) ) - { - setNextClient = true; - continue; - } - - if (!setNextClient) - { - continue; - } - - // this is the next client (at login screen) - SetActive(pc); - return; - } - - // rolled off top of list - back to first (if any there!) - // set next client ? - continue; - } - - if (!setNextClient) - { - continue; - } - - if (_thumbnailViews.Any(x => x.Value.Title == t.Key)) - { - var ptr = t.Key.Equals("EVE") ? - (isForwards ? _thumbnailViews.OrderBy(x => x.Value.Id.ToInt64()) : _thumbnailViews.OrderByDescending(x => x.Value.Id.ToInt64())).First(x => x.Value.Title == t.Key) - : _thumbnailViews.First(x => x.Value.Title == t.Key); - SetActive(ptr); - return; - } - } - - // we didn't get a next one. just get the first one from the start. - foreach (var t in clientOrder) - { - if (_thumbnailViews.Any(x => x.Value.Title == t.Key)) - { - var ptr = t.Key.Equals("EVE") ? - (isForwards ? _thumbnailViews.OrderBy(x => x.Value.Id.ToInt64()) : _thumbnailViews.OrderByDescending(x => x.Value.Id.ToInt64())).First(x => x.Value.Title == t.Key) - : _thumbnailViews.First(x => x.Value.Title == t.Key); - SetActive(ptr); - _activeClient = (ptr.Key, t.Key); - return; - } - } - } - - public void RegisterCycleClientHotkey(IEnumerable keys, bool isForwards, Dictionary cycleOrder) - { - foreach (var hotkey in keys) - { - if (hotkey == Keys.None) - { - return; - } - - var newHandler = new HotkeyHandler(default(IntPtr), hotkey); - newHandler.Pressed += (object s, HandledEventArgs e) => - { - this.CycleNextClient(isForwards, cycleOrder); - e.Handled = true; - }; - - newHandler.Register(); - this._cycleClientHotkeyHandlers.Add(newHandler); - } - } - - public void Start() - { - this._thumbnailUpdateTimer.Start(); - - this.RefreshThumbnails(); - } - - public void Stop() - { - this._thumbnailUpdateTimer.Stop(); - } - - private void ThumbnailUpdateTimerTick(object sender, EventArgs e) - { - this.UpdateThumbnailsList(); - this.RefreshThumbnails(); - } - - private async void UpdateThumbnailsList() - { - this._processMonitor.GetUpdatedProcesses(out ICollection addedProcesses, out ICollection updatedProcesses, out ICollection removedProcesses); - - List viewsAdded = new List(); - List viewsRemoved = new List(); - - foreach (IProcessInfo process in addedProcesses) - { - Size initialSize = this._configuration.ThumbnailSize; - if (this._configuration.PerClientThumbnailSize.Any(x => x.Key == process.Title)) - { - initialSize = this._configuration.PerClientThumbnailSize[process.Title]; - } - - IThumbnailView view = this._thumbnailViewFactory.Create(process.Handle, process.Title, this._configuration.ThumbnailSize); - view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays; - view.SetFrames(this._configuration.ShowThumbnailFrames); - // Max/Min size limitations should be set AFTER the frames are disabled - // Otherwise thumbnail window will be unnecessary resized - view.SetSizeLimitations(this._configuration.ThumbnailMinimumSize, this._configuration.ThumbnailMaximumSize); - view.SetTopMost(this._configuration.ShowThumbnailsAlwaysOnTop); - - view.ThumbnailLocation = this.IsManageableThumbnail(view) - ? this._configuration.GetThumbnailLocation(view.Title, this._activeClient.Title, view.ThumbnailLocation) - : this._configuration.LoginThumbnailLocation; - - this._thumbnailViews.Add(view.Id, view); - - view.ThumbnailResized = this.ThumbnailViewResized; - view.ThumbnailMoved = this.ThumbnailViewMoved; - view.ThumbnailFocused = this.ThumbnailViewFocused; - view.ThumbnailLostFocus = this.ThumbnailViewLostFocus; - view.ThumbnailActivated = this.ThumbnailActivated; - view.ThumbnailDeactivated = this.ThumbnailDeactivated; - - view.RegisterHotkey(this._configuration.GetClientHotkey(view.Title)); - - this.ApplyClientLayout(view); - - // TODO Add extension filter here later - if (view.Title != ThumbnailManager.DEFAULT_CLIENT_TITLE) - { - viewsAdded.Add(view.Title); - } - } - - foreach (IProcessInfo process in updatedProcesses) - { - this._thumbnailViews.TryGetValue(process.Handle, out IThumbnailView view); - - if (view == null) - { - // Something went terribly wrong - continue; - } - - if (process.Title != view.Title) // update thumbnail title - { - viewsRemoved.Add(view.Title); - view.Title = process.Title; - viewsAdded.Add(view.Title); - - view.RegisterHotkey(this._configuration.GetClientHotkey(process.Title)); - - this.ApplyClientLayout(view); - } - } - - foreach (IProcessInfo process in removedProcesses) - { - IThumbnailView view = this._thumbnailViews[process.Handle]; - - this._thumbnailViews.Remove(view.Id); - if (view.Title != ThumbnailManager.DEFAULT_CLIENT_TITLE) - { - viewsRemoved.Add(view.Title); - } - - view.UnregisterHotkey(); - - view.ThumbnailResized = null; - view.ThumbnailMoved = null; - view.ThumbnailFocused = null; - view.ThumbnailLostFocus = null; - view.ThumbnailActivated = null; - - view.Close(); - } - - if ((viewsAdded.Count > 0) || (viewsRemoved.Count > 0)) - { - await this._mediator.Publish(new ThumbnailListUpdated(viewsAdded, viewsRemoved)); - } - } - - private void RefreshThumbnails() - { - // TODO Split this method - IntPtr foregroundWindowHandle = this._windowManager.GetForegroundWindowHandle(); - - // The foreground window can be NULL in certain circumstances, such as when a window is losing activation. - // It is safer to just skip this refresh round than to do something while the system state is undefined - if (foregroundWindowHandle == IntPtr.Zero) - { - return; - } - - string foregroundWindowTitle = null; - - // Check if the foreground window handle is one of the known handles for client windows or their thumbnails - bool isClientWindow = this.IsClientWindowActive(foregroundWindowHandle); - bool isMainWindowActive = this.IsMainWindowActive(foregroundWindowHandle); - - if (foregroundWindowHandle == this._activeClient.Handle) - { - foregroundWindowTitle = this._activeClient.Title; - } - else if (this._thumbnailViews.TryGetValue(foregroundWindowHandle, out IThumbnailView foregroundView)) - { - // This code will work only on Alt+Tab switch between clients - foregroundWindowTitle = foregroundView.Title; - } - else if (!isClientWindow) - { - this._externalApplication = foregroundWindowHandle; - } - - // No need to minimize EVE clients when switching out to non-EVE window (like thumbnail) - if (!string.IsNullOrEmpty(foregroundWindowTitle)) - { - this.SwitchActiveClient(foregroundWindowHandle, foregroundWindowTitle); - } - - bool hideAllThumbnails = this._configuration.HideThumbnailsOnLostFocus && !(isClientWindow || isMainWindowActive); - - // Wait for some time before hiding all previews - if (hideAllThumbnails) - { - this._hideThumbnailsDelay--; - if (this._hideThumbnailsDelay > 0) - { - hideAllThumbnails = false; // Postpone the 'hide all' operation - } - else - { - this._hideThumbnailsDelay = 0; // Stop the counter - } - } - else - { - this._hideThumbnailsDelay = this._configuration.HideThumbnailsDelay; // Reset the counter - } - - this._refreshCycleCount++; - - bool forceRefresh; - if (this._refreshCycleCount >= ThumbnailManager.FORCED_REFRESH_CYCLE_THRESHOLD) - { - this._refreshCycleCount = 0; - forceRefresh = true; - } - else - { - forceRefresh = false; - } - - this.DisableViewEvents(); - - // Snap thumbnail - // No need to update Thumbnails while one of them is highlighted - if ((!this._isHoverEffectActive) && this.TryDequeueLocationChange(out var locationChange)) - { - if ((locationChange.ActiveClient == this._activeClient.Title) && this._thumbnailViews.TryGetValue(locationChange.Handle, out var view)) - { - this.SnapThumbnailView(view); - - this.RaiseThumbnailLocationUpdatedNotification(view.Title); - } - else - { - this.RaiseThumbnailLocationUpdatedNotification(locationChange.Title); - } - } - - // Hide, show, resize and move - update ZoomAnchor setting - foreach (KeyValuePair entry in this._thumbnailViews) - { - IThumbnailView view = entry.Value; - - - // update ZoomAnchor regardless - view.ClientZoomAnchor = this._configuration.GetZoomAnchor(view.Title, this._configuration.ThumbnailZoomAnchor); - - - if (hideAllThumbnails || this._configuration.IsThumbnailDisabled(view.Title)) - { - if (view.IsActive) - { - view.Hide(); - } - continue; - } - - if (this._configuration.HideActiveClientThumbnail && (view.Id == this._activeClient.Handle)) - { - if (view.IsActive) - { - view.Hide(); - } - continue; - } - - if (this._configuration.HideLoginClientThumbnail && (view.Title == DEFAULT_CLIENT_TITLE )) - { - if (view.IsActive) - { - view.Hide(); - } - continue; - } - - // No need to update Thumbnails while one of them is highlighted - if (!this._isHoverEffectActive) - { - // Do not even move thumbnails with default caption - if (this.IsManageableThumbnail(view)) - { - view.ThumbnailLocation = this._configuration.GetThumbnailLocation(view.Title, this._activeClient.Title, view.ThumbnailLocation); - view.ThumbnailSize = this._configuration.GetThumbnailSize(view.Title, this._activeClient.Title, view.ThumbnailSize); - } - - view.SetOpacity(this._configuration.ThumbnailOpacity); - view.SetTopMost(this._configuration.ShowThumbnailsAlwaysOnTop); - } - - view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays; - - view.SetHighlight( - this._configuration.EnableActiveClientHighlight && (view.Id == this._activeClient.Handle), - this._configuration.ActiveClientHighlightThickness); - - if (!view.IsActive) - { - view.Show(); - } - else - { - view.Refresh(forceRefresh); - } - } - - this.EnableViewEvents(); - } - - public void UpdateThumbnailsSize() - { - this.SetThumbnailsSize(this._configuration.ThumbnailSize); - } - - private void SetThumbnailsSize(Size size) - { - this.DisableViewEvents(); - - foreach (KeyValuePair entry in this._thumbnailViews) - { - entry.Value.ThumbnailSize = size; - entry.Value.Refresh(false); - } - - this.EnableViewEvents(); - } - - public void UpdateThumbnailFrames() - { - this.DisableViewEvents(); - - foreach (KeyValuePair entry in this._thumbnailViews) - { - entry.Value.SetFrames(this._configuration.ShowThumbnailFrames); - } - - this.EnableViewEvents(); - } - - private void EnableViewEvents() - { - this._ignoreViewEvents = false; - } - - private void DisableViewEvents() - { - this._ignoreViewEvents = true; - } - - private void SwitchActiveClient(IntPtr foregroundClientHandle, string foregroundClientTitle) - { - // Check if any actions are needed - if (this._activeClient.Handle == foregroundClientHandle) - { - return; - } - - // Minimize the currently active client if needed - if (this._configuration.MinimizeInactiveClients && !this._configuration.IsPriorityClient(this._activeClient.Title)) - { - this._windowManager.MinimizeWindow(this._activeClient.Handle, this._configuration.WindowsAnimationStyle, false); + this.SwitchActiveClient(newClient.Key, newClient.Value.Title); + + newClient.Value.SetHighlight(); + newClient.Value.Refresh(true); + } + + public void CycleNextClient(bool isForwards, Dictionary cycleOrder) { + IOrderedEnumerable> clientOrder; + Dictionary _cycleOrder = new Dictionary(cycleOrder); + + if (_cycleOrder.Count == 0) { + int order = 0; + foreach (var x in _thumbnailViews) { + _cycleOrder.Add(x.Value.Title, order++); + } + } + + if (isForwards) { + clientOrder = _cycleOrder.OrderBy(x => x.Value); + } else { + clientOrder = _cycleOrder.OrderByDescending(x => x.Value); + } + + bool setNextClient = false; + IThumbnailView lastClient = null; + + foreach (var t in clientOrder) { + if (t.Key == _activeClient.Title && t.Key != "EVE") { + setNextClient = true; + lastClient = _thumbnailViews.FirstOrDefault(x => x.Value.Title == t.Key).Value; + continue; + } + + // cycle through login screens ? + if (t.Key == _activeClient.Title && t.Key == "EVE") { + lastClient = _thumbnailViews + .FirstOrDefault(x => x.Value.Title == t.Key && x.Value.Id == _activeClient.Handle) + .Value; + if (lastClient == null) { + setNextClient = true; + continue; + } + var possibleClients = (isForwards ? _thumbnailViews.OrderBy(x => x.Value.Id.ToInt64()) + : _thumbnailViews.OrderByDescending(x => x.Value.Id.ToInt64())) + .Where(x => x.Value.Title == t.Key); + foreach (var pc in possibleClients) { + if (pc.Value.Id.Equals(lastClient.Id)) { + setNextClient = true; + continue; + } + + if (!setNextClient) { + continue; + } + + // this is the next client (at login screen) + SetActive(pc); + return; + } + + // rolled off top of list - back to first (if any there!) + // set next client ? + continue; + } + + if (!setNextClient) { + continue; + } + + if (_thumbnailViews.Any(x => x.Value.Title == t.Key)) { + var ptr = t.Key.Equals("EVE") + ? (isForwards ? _thumbnailViews.OrderBy(x => x.Value.Id.ToInt64()) + : _thumbnailViews.OrderByDescending(x => x.Value.Id.ToInt64())) + .First(x => x.Value.Title == t.Key) + : _thumbnailViews.First(x => x.Value.Title == t.Key); + SetActive(ptr); + return; + } + } + + // we didn't get a next one. just get the first one from the start. + foreach (var t in clientOrder) { + if (_thumbnailViews.Any(x => x.Value.Title == t.Key)) { + var ptr = t.Key.Equals("EVE") + ? (isForwards ? _thumbnailViews.OrderBy(x => x.Value.Id.ToInt64()) + : _thumbnailViews.OrderByDescending(x => x.Value.Id.ToInt64())) + .First(x => x.Value.Title == t.Key) + : _thumbnailViews.First(x => x.Value.Title == t.Key); + SetActive(ptr); + _activeClient = (ptr.Key, t.Key); + return; + } + } + } + + public void RegisterCycleClientHotkey(IEnumerable keys, bool isForwards, + Dictionary cycleOrder) { + foreach (var hotkey in keys) { + if (hotkey == Keys.None) { + return; + } + + var newHandler = new HotkeyHandler(default(IntPtr), hotkey); + newHandler.Pressed += (object s, HandledEventArgs e) => { + this.CycleNextClient(isForwards, cycleOrder); + e.Handled = true; + }; + + newHandler.Register(); + this._cycleClientHotkeyHandlers.Add(newHandler); + } + } + + public void Start() { + this._thumbnailUpdateTimer.Start(); + + this.RefreshThumbnails(); + } + + public void Stop() { + this._thumbnailUpdateTimer.Stop(); + } + + private void ThumbnailUpdateTimerTick(object sender, EventArgs e) { + this.UpdateThumbnailsList(); + this.RefreshThumbnails(); + } + + private async void UpdateThumbnailsList() { + this._processMonitor.GetUpdatedProcesses(out ICollection addedProcesses, + out ICollection updatedProcesses, + out ICollection removedProcesses); + + List viewsAdded = new List(); + List viewsRemoved = new List(); + + foreach (IProcessInfo process in addedProcesses) { + Size initialSize = this._configuration.ThumbnailSize; + if (this._configuration.PerClientThumbnailSize.Any(x => x.Key == process.Title)) { + initialSize = this._configuration.PerClientThumbnailSize[process.Title]; + } + + IThumbnailView view = + this._thumbnailViewFactory.Create(process.Handle, process.Title, this._configuration.ThumbnailSize); + view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays; + view.SetFrames(this._configuration.ShowThumbnailFrames); + // Max/Min size limitations should be set AFTER the frames are disabled + // Otherwise thumbnail window will be unnecessary resized + view.SetSizeLimitations(this._configuration.ThumbnailMinimumSize, + this._configuration.ThumbnailMaximumSize); + view.SetTopMost(this._configuration.ShowThumbnailsAlwaysOnTop); + + view.ThumbnailLocation = this.IsManageableThumbnail(view) + ? this._configuration.GetThumbnailLocation( + view.Title, this._activeClient.Title, view.ThumbnailLocation) + : this._configuration.LoginThumbnailLocation; + + this._thumbnailViews.Add(view.Id, view); + + view.ThumbnailResized = this.ThumbnailViewResized; + view.ThumbnailMoved = this.ThumbnailViewMoved; + view.ThumbnailFocused = this.ThumbnailViewFocused; + view.ThumbnailLostFocus = this.ThumbnailViewLostFocus; + view.ThumbnailActivated = this.ThumbnailActivated; + view.ThumbnailDeactivated = this.ThumbnailDeactivated; + + view.RegisterHotkey(this._configuration.GetClientHotkey(view.Title)); + + this.ApplyClientLayout(view); + + // TODO Add extension filter here later + if (view.Title != ThumbnailManager.DEFAULT_CLIENT_TITLE) { + viewsAdded.Add(view.Title); + } + } + + foreach (IProcessInfo process in updatedProcesses) { + this._thumbnailViews.TryGetValue(process.Handle, out IThumbnailView view); + + if (view == null) { + // Something went terribly wrong + continue; + } + + if (process.Title != view.Title) // update thumbnail title + { + viewsRemoved.Add(view.Title); + view.Title = process.Title; + viewsAdded.Add(view.Title); + + view.RegisterHotkey(this._configuration.GetClientHotkey(process.Title)); + + this.ApplyClientLayout(view); + } + } + + foreach (IProcessInfo process in removedProcesses) { + IThumbnailView view = this._thumbnailViews[process.Handle]; + + this._thumbnailViews.Remove(view.Id); + if (view.Title != ThumbnailManager.DEFAULT_CLIENT_TITLE) { + viewsRemoved.Add(view.Title); + } + + view.UnregisterHotkey(); + + view.ThumbnailResized = null; + view.ThumbnailMoved = null; + view.ThumbnailFocused = null; + view.ThumbnailLostFocus = null; + view.ThumbnailActivated = null; + + view.Close(); + } + + if ((viewsAdded.Count > 0) || (viewsRemoved.Count > 0)) { + await this._mediator.Publish(new ThumbnailListUpdated(viewsAdded, viewsRemoved)); + } + } + + private void RefreshThumbnails() { + // TODO Split this method + IntPtr foregroundWindowHandle = this._windowManager.GetForegroundWindowHandle(); + + // The foreground window can be NULL in certain circumstances, such as when a window is losing activation. + // It is safer to just skip this refresh round than to do something while the system state is undefined + if (foregroundWindowHandle == IntPtr.Zero) { + return; + } + + string foregroundWindowTitle = null; + + // Check if the foreground window handle is one of the known handles for client windows or their thumbnails + bool isClientWindow = this.IsClientWindowActive(foregroundWindowHandle); + bool isMainWindowActive = this.IsMainWindowActive(foregroundWindowHandle); + + if (foregroundWindowHandle == this._activeClient.Handle) { + foregroundWindowTitle = this._activeClient.Title; + } else if (this._thumbnailViews.TryGetValue(foregroundWindowHandle, out IThumbnailView foregroundView)) { + // This code will work only on Alt+Tab switch between clients + foregroundWindowTitle = foregroundView.Title; + } else if (!isClientWindow) { + this._externalApplication = foregroundWindowHandle; + } + + // No need to minimize EVE clients when switching out to non-EVE window (like thumbnail) + if (!string.IsNullOrEmpty(foregroundWindowTitle)) { + this.SwitchActiveClient(foregroundWindowHandle, foregroundWindowTitle); + } + + bool hideAllThumbnails = + this._configuration.HideThumbnailsOnLostFocus && !(isClientWindow || isMainWindowActive); + + // Wait for some time before hiding all previews + if (hideAllThumbnails) { + this._hideThumbnailsDelay--; + if (this._hideThumbnailsDelay > 0) { + hideAllThumbnails = false; // Postpone the 'hide all' operation + } else { + this._hideThumbnailsDelay = 0; // Stop the counter + } + } else { + this._hideThumbnailsDelay = this._configuration.HideThumbnailsDelay; // Reset the counter + } + + this._refreshCycleCount++; + + bool forceRefresh; + if (this._refreshCycleCount >= ThumbnailManager.FORCED_REFRESH_CYCLE_THRESHOLD) { + this._refreshCycleCount = 0; + forceRefresh = true; + } else { + forceRefresh = false; + } + + this.DisableViewEvents(); + + // Snap thumbnail + // No need to update Thumbnails while one of them is highlighted + if ((!this._isHoverEffectActive) && this.TryDequeueLocationChange(out var locationChange)) { + if ((locationChange.ActiveClient == this._activeClient.Title) && + this._thumbnailViews.TryGetValue(locationChange.Handle, out var view)) { + this.SnapThumbnailView(view); + + this.RaiseThumbnailLocationUpdatedNotification(view.Title); + } else { + this.RaiseThumbnailLocationUpdatedNotification(locationChange.Title); + } + } + + // Hide, show, resize and move - update ZoomAnchor setting + foreach (KeyValuePair entry in this._thumbnailViews) { + IThumbnailView view = entry.Value; + + // update ZoomAnchor regardless + view.ClientZoomAnchor = + this._configuration.GetZoomAnchor(view.Title, this._configuration.ThumbnailZoomAnchor); + + if (hideAllThumbnails || this._configuration.IsThumbnailDisabled(view.Title)) { + if (view.IsActive) { + view.Hide(); + } + continue; + } + + if (this._configuration.HideActiveClientThumbnail && (view.Id == this._activeClient.Handle)) { + if (view.IsActive) { + view.Hide(); + } + continue; + } + + if (this._configuration.HideLoginClientThumbnail && (view.Title == DEFAULT_CLIENT_TITLE)) { + if (view.IsActive) { + view.Hide(); + } + continue; + } + + // No need to update Thumbnails while one of them is highlighted + if (!this._isHoverEffectActive) { + // Do not even move thumbnails with default caption + if (this.IsManageableThumbnail(view)) { + view.ThumbnailLocation = this._configuration.GetThumbnailLocation( + view.Title, this._activeClient.Title, view.ThumbnailLocation); + view.ThumbnailSize = this._configuration.GetThumbnailSize(view.Title, this._activeClient.Title, + view.ThumbnailSize); + } + + view.SetOpacity(this._configuration.ThumbnailOpacity); + view.SetTopMost(this._configuration.ShowThumbnailsAlwaysOnTop); + } + + view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays; + + view.SetHighlight( + this._configuration.EnableActiveClientHighlight && (view.Id == this._activeClient.Handle), + this._configuration.ActiveClientHighlightThickness); + + if (!view.IsActive) { + view.Show(); + } else { + view.Refresh(forceRefresh); + } + } + + this.EnableViewEvents(); + } + + public void UpdateThumbnailsSize() { + this.SetThumbnailsSize(this._configuration.ThumbnailSize); + } + + private void SetThumbnailsSize(Size size) { + this.DisableViewEvents(); + + foreach (KeyValuePair entry in this._thumbnailViews) { + entry.Value.ThumbnailSize = size; + entry.Value.Refresh(false); + } + + this.EnableViewEvents(); + } + + public void UpdateThumbnailFrames() { + this.DisableViewEvents(); + + foreach (KeyValuePair entry in this._thumbnailViews) { + entry.Value.SetFrames(this._configuration.ShowThumbnailFrames); + } + + this.EnableViewEvents(); + } + + public void UpdateThumbnailRegionSettings() { + this.DisableViewEvents(); + + foreach (KeyValuePair entry in this._thumbnailViews) { + entry.Value.Refresh(true); + } + + this.EnableViewEvents(); + } + + private void EnableViewEvents() { + this._ignoreViewEvents = false; + } + + private void DisableViewEvents() { + this._ignoreViewEvents = true; + } + + private void SwitchActiveClient(IntPtr foregroundClientHandle, string foregroundClientTitle) { + // Check if any actions are needed + if (this._activeClient.Handle == foregroundClientHandle) { + return; + } + + // Minimize the currently active client if needed + if (this._configuration.MinimizeInactiveClients && + !this._configuration.IsPriorityClient(this._activeClient.Title)) { + this._windowManager.MinimizeWindow(this._activeClient.Handle, this._configuration.WindowsAnimationStyle, + false); #if LINUX - this._windowManager.ActivateWindow(foregroundClientHandle, foregroundClientTitle); + this._windowManager.ActivateWindow(foregroundClientHandle, foregroundClientTitle); #else - this._windowManager.ActivateWindow(foregroundClientHandle, this._configuration.WindowsAnimationStyle); + this._windowManager.ActivateWindow(foregroundClientHandle, this._configuration.WindowsAnimationStyle); #endif - } + } - this._activeClient = (foregroundClientHandle, foregroundClientTitle); - } + this._activeClient = (foregroundClientHandle, foregroundClientTitle); + } - private void ThumbnailViewFocused(IntPtr id) - { - if (this._isHoverEffectActive) - { - return; - } + private void ThumbnailViewFocused(IntPtr id) { + if (this._isHoverEffectActive) { + return; + } - this._isHoverEffectActive = true; + this._isHoverEffectActive = true; - IThumbnailView view = this._thumbnailViews[id]; + IThumbnailView view = this._thumbnailViews[id]; - view.SetTopMost(true); - view.SetOpacity(1.0); + view.SetTopMost(true); + view.SetOpacity(1.0); - if (this._configuration.ThumbnailZoomEnabled) - { - this.ThumbnailZoomIn(view); - } - } + if (this._configuration.ThumbnailZoomEnabled) { + this.ThumbnailZoomIn(view); + } + } - private void ThumbnailViewLostFocus(IntPtr id) - { - if (!this._isHoverEffectActive) - { - return; - } + private void ThumbnailViewLostFocus(IntPtr id) { + if (!this._isHoverEffectActive) { + return; + } - IThumbnailView view = this._thumbnailViews[id]; + IThumbnailView view = this._thumbnailViews[id]; - if (this._configuration.ThumbnailZoomEnabled) - { - this.ThumbnailZoomOut(view); - } + if (this._configuration.ThumbnailZoomEnabled) { + this.ThumbnailZoomOut(view); + } - view.SetOpacity(this._configuration.ThumbnailOpacity); + view.SetOpacity(this._configuration.ThumbnailOpacity); - this._isHoverEffectActive = false; - } + this._isHoverEffectActive = false; + } - private void ThumbnailActivated(IntPtr id) - { - IThumbnailView view = this._thumbnailViews[id]; + private void ThumbnailActivated(IntPtr id) { + IThumbnailView view = this._thumbnailViews[id]; - Task.Run(() => - { + Task.Run(() => { #if LINUX - this._windowManager.ActivateWindow(view.Id, view.Title); + this._windowManager.ActivateWindow(view.Id, view.Title); #else this._windowManager.ActivateWindow(view.Id, this._configuration.WindowsAnimationStyle); #endif - }) - .ContinueWith((task) => - { - // This code should be executed on UI thread - this.SwitchActiveClient(view.Id, view.Title); - this.UpdateClientLayouts(); - this.RefreshThumbnails(); - }, TaskScheduler.FromCurrentSynchronizationContext()); - } + }) + .ContinueWith((task) => { + // This code should be executed on UI thread + this.SwitchActiveClient(view.Id, view.Title); + this.UpdateClientLayouts(); + this.RefreshThumbnails(); + }, TaskScheduler.FromCurrentSynchronizationContext()); + } - private void ThumbnailDeactivated(IntPtr id, bool switchOut) - { - if (switchOut) - { + private void ThumbnailDeactivated(IntPtr id, bool switchOut) { + if (switchOut) { #if LINUX - this._windowManager.ActivateWindow(this._externalApplication, null); + this._windowManager.ActivateWindow(this._externalApplication, null); #else - this._windowManager.ActivateWindow(this._externalApplication, this._configuration.WindowsAnimationStyle); + this._windowManager.ActivateWindow(this._externalApplication, + this._configuration.WindowsAnimationStyle); #endif - } - else - { - if (!this._thumbnailViews.TryGetValue(id, out IThumbnailView view)) - { - return; - } - - this._windowManager.MinimizeWindow(view.Id, this._configuration.WindowsAnimationStyle, true); - this.RefreshThumbnails(); - } - } - - private async void ThumbnailViewResized(IntPtr id) - { - if (this._ignoreViewEvents) - { - return; - } - - IThumbnailView view = this._thumbnailViews[id]; - - this.SetThumbnailsSize(view.ThumbnailSize); - - view.Refresh(false); - - await this._mediator.Publish(new ThumbnailActiveSizeUpdated(view.ThumbnailSize)); - } - - private void ThumbnailViewMoved(IntPtr id) - { - if (this._ignoreViewEvents) - { - return; - } - - IThumbnailView view = this._thumbnailViews[id]; - view.Refresh(false); - this.EnqueueLocationChange(view); - } - - // Checks whether currently active window belongs to an EVE client or its thumbnail - private bool IsClientWindowActive(IntPtr windowHandle) - { - if (windowHandle == IntPtr.Zero) - { - return false; - } - - foreach (KeyValuePair entry in this._thumbnailViews) - { - IThumbnailView view = entry.Value; - - if (view.IsKnownHandle(windowHandle)) - { - return true; - } - } - - return false; - } - - // Check whether the currently active window belongs to EVE-O-Preview itself - private bool IsMainWindowActive(IntPtr windowHandle) - { - return (this._processMonitor.GetMainProcess().Handle == windowHandle); - } - - private void ThumbnailZoomIn(IThumbnailView view) - { - this.DisableViewEvents(); - - view.ZoomIn(ViewZoomAnchorConverter.Convert(view.ClientZoomAnchor), this._configuration.ThumbnailZoomFactor); - view.Refresh(false); - - this.EnableViewEvents(); - } - - private void ThumbnailZoomOut(IThumbnailView view) - { - this.DisableViewEvents(); - - view.ZoomOut(); - view.Refresh(false); - - this.EnableViewEvents(); - } - - private void SnapThumbnailView(IThumbnailView view) - { - // Check if this feature is enabled - if (!this._configuration.EnableThumbnailSnap) - { - return; - } - - // Only borderless thumbnails can be docked - if (this._configuration.ShowThumbnailFrames) - { - return; - } - - int width = this._configuration.ThumbnailSize.Width; - int height = this._configuration.ThumbnailSize.Height; - - // TODO Extract method - int baseX = view.ThumbnailLocation.X; - int baseY = view.ThumbnailLocation.Y; - - Point[] viewPoints = { new Point(baseX, baseY), new Point(baseX + width, baseY), new Point(baseX, baseY + height), new Point(baseX + width, baseY + height) }; - - // TODO Extract constants - int thresholdX = Math.Max(20, width / 10); - int thresholdY = Math.Max(20, height / 10); - - foreach (var entry in this._thumbnailViews) - { - IThumbnailView testView = entry.Value; - - if (view.Id == testView.Id) - { - continue; - } - - int testX = testView.ThumbnailLocation.X; - int testY = testView.ThumbnailLocation.Y; - - Point[] testPoints = { new Point(testX, testY), new Point(testX + width, testY), new Point(testX, testY + height), new Point(testX + width, testY + height) }; - - var delta = ThumbnailManager.TestViewPoints(viewPoints, testPoints, thresholdX, thresholdY); - - if ((delta.X == 0) && (delta.Y == 0)) - { - continue; - } - - view.ThumbnailLocation = new Point(view.ThumbnailLocation.X + delta.X, view.ThumbnailLocation.Y + delta.Y); - this._configuration.SetThumbnailLocation(view.Title, this._activeClient.Title, view.ThumbnailLocation); - break; - } - } - - private static (int X, int Y) TestViewPoints(Point[] viewPoints, Point[] testPoints, int thresholdX, int thresholdY) - { - // Point combinations that we need to check - // No need to check all 4x4 combinations - (int ViewOffset, int TestOffset)[] testOffsets = - { ( 0, 3 ), ( 0, 2 ), ( 1, 2 ), - ( 0, 1 ), ( 0, 0 ), ( 1, 0 ), - ( 2, 1 ), ( 2, 0 ), ( 3, 0 )}; - - foreach (var testOffset in testOffsets) - { - Point viewPoint = viewPoints[testOffset.ViewOffset]; - Point testPoint = testPoints[testOffset.TestOffset]; - - int deltaX = testPoint.X - viewPoint.X; - int deltaY = testPoint.Y - viewPoint.Y; - - if ((Math.Abs(deltaX) <= thresholdX) && (Math.Abs(deltaY) <= thresholdY)) - { - return (deltaX, deltaY); - } - } - - return (0, 0); - } - - private void ApplyClientLayout(IThumbnailView view) - { - IntPtr clientHandle = view.Id; - string clientTitle = view.Title; - - if (!this._configuration.EnableClientLayoutTracking) - { - return; - } - - // No need to apply layout for not yet logged-in clients - if (clientTitle == ThumbnailManager.DEFAULT_CLIENT_TITLE) - { - return; - } - - ClientLayout clientLayout = this._configuration.GetClientLayout(clientTitle); - - if (clientLayout == null) - { - return; - } - - if (clientLayout.IsMaximized) - { - this._windowManager.MaximizeWindow(clientHandle); - } - else - { - this._windowManager.MoveWindow(clientHandle, clientLayout.X, clientLayout.Y, clientLayout.Width, clientLayout.Height); - } - } - - private void UpdateClientLayouts() - { - if (!this._configuration.EnableClientLayoutTracking) - { - return; - } - - foreach (KeyValuePair entry in this._thumbnailViews) - { - IThumbnailView view = entry.Value; - - // No need to save layout for not yet logged-in clients - if (view.Title == ThumbnailManager.DEFAULT_CLIENT_TITLE) - { - continue; - } - - (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); - - 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, isMaximized)); - } - } - - private void EnqueueLocationChange(IThumbnailView view) - { - string activeClientTitle = this._activeClient.Title; - // TODO ?? - this._configuration.SetThumbnailLocation(view.Title, activeClientTitle, view.ThumbnailLocation); - - lock (this._locationChangeNotificationSyncRoot) - { - if (this._enqueuedLocationChangeNotification.Handle == IntPtr.Zero) - { - this._enqueuedLocationChangeNotification = (view.Id, view.Title, activeClientTitle, view.ThumbnailLocation, ThumbnailManager.DEFAULT_LOCATION_CHANGE_NOTIFICATION_DELAY); - return; - } - - // Reset the delay and exit - if ((this._enqueuedLocationChangeNotification.Handle == view.Id) && - (this._enqueuedLocationChangeNotification.ActiveClient == activeClientTitle)) - { - this._enqueuedLocationChangeNotification.Delay = ThumbnailManager.DEFAULT_LOCATION_CHANGE_NOTIFICATION_DELAY; - return; - } - - this.RaiseThumbnailLocationUpdatedNotification(this._enqueuedLocationChangeNotification.Title); - this._enqueuedLocationChangeNotification = (view.Id, view.Title, activeClientTitle, view.ThumbnailLocation, ThumbnailManager.DEFAULT_LOCATION_CHANGE_NOTIFICATION_DELAY); - } - } - - private bool TryDequeueLocationChange(out (IntPtr Handle, string Title, string ActiveClient, Point Location) change) - { - lock (this._locationChangeNotificationSyncRoot) - { - change = (IntPtr.Zero, null, null, Point.Empty); - - if (this._enqueuedLocationChangeNotification.Handle == IntPtr.Zero) - { - return false; - } - - this._enqueuedLocationChangeNotification.Delay--; - - if (this._enqueuedLocationChangeNotification.Delay > 0) - { - return false; - } - - change = (this._enqueuedLocationChangeNotification.Handle, this._enqueuedLocationChangeNotification.Title, this._enqueuedLocationChangeNotification.ActiveClient, this._enqueuedLocationChangeNotification.Location); - this._enqueuedLocationChangeNotification = (IntPtr.Zero, null, null, Point.Empty, -1); - - return true; - } - } - - private async void RaiseThumbnailLocationUpdatedNotification(string title) - { - if (string.IsNullOrEmpty(title) || (title == ThumbnailManager.DEFAULT_CLIENT_TITLE)) - { - return; - } - - await this._mediator.Send(new SaveConfiguration()); - } - - // We shouldn't manage some thumbnails (like thumbnail of the EVE client sitting on the login screen) - // TODO Move to a service (?) - private bool IsManageableThumbnail(IThumbnailView view) - { - return view.Title != ThumbnailManager.DEFAULT_CLIENT_TITLE; - } - - // Quick sanity check that the window is not minimized - private bool IsValidWindowPosition(int left, int top, int width, int height) - { - return (left > ThumbnailManager.WINDOW_POSITION_THRESHOLD_LOW) && (left < ThumbnailManager.WINDOW_POSITION_THRESHOLD_HIGH) - && (top > ThumbnailManager.WINDOW_POSITION_THRESHOLD_LOW) && (top < ThumbnailManager.WINDOW_POSITION_THRESHOLD_HIGH) - && (width > ThumbnailManager.WINDOW_SIZE_THRESHOLD) && (height > ThumbnailManager.WINDOW_SIZE_THRESHOLD); - } - - [DllImport("user32.dll")] - private static extern bool EnumWindows(EnumWindowsProc enumProc, IntPtr lParam); - - [DllImport("user32.dll")] - private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint processId); - - [DllImport("user32.dll")] - private static extern bool IsWindow(IntPtr hWnd); - - [DllImport("user32.dll")] - private static extern bool IsWindowVisible(IntPtr hWnd); - - [DllImport("user32.dll", CharSet = CharSet.Unicode)] - private static extern int GetWindowText(IntPtr hWnd, StringBuilder strText, int maxCount); - - private delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam); - } + } else { + if (!this._thumbnailViews.TryGetValue(id, out IThumbnailView view)) { + return; + } + + this._windowManager.MinimizeWindow(view.Id, this._configuration.WindowsAnimationStyle, true); + this.RefreshThumbnails(); + } + } + + private async void ThumbnailViewResized(IntPtr id) { + if (this._ignoreViewEvents) { + return; + } + + IThumbnailView view = this._thumbnailViews[id]; + + this.SetThumbnailsSize(view.ThumbnailSize); + + view.Refresh(false); + + await this._mediator.Publish(new ThumbnailActiveSizeUpdated(view.ThumbnailSize)); + } + + private void ThumbnailViewMoved(IntPtr id) { + if (this._ignoreViewEvents) { + return; + } + + IThumbnailView view = this._thumbnailViews[id]; + view.Refresh(false); + this.EnqueueLocationChange(view); + } + + // Checks whether currently active window belongs to an EVE client or its thumbnail + private bool IsClientWindowActive(IntPtr windowHandle) { + if (windowHandle == IntPtr.Zero) { + return false; + } + + foreach (KeyValuePair entry in this._thumbnailViews) { + IThumbnailView view = entry.Value; + + if (view.IsKnownHandle(windowHandle)) { + return true; + } + } + + return false; + } + + // Check whether the currently active window belongs to EVE-O-Preview itself + private bool IsMainWindowActive(IntPtr windowHandle) { + return (this._processMonitor.GetMainProcess().Handle == windowHandle); + } + + private void ThumbnailZoomIn(IThumbnailView view) { + this.DisableViewEvents(); + + view.ZoomIn(ViewZoomAnchorConverter.Convert(view.ClientZoomAnchor), + this._configuration.ThumbnailZoomFactor); + view.Refresh(false); + + this.EnableViewEvents(); + } + + private void ThumbnailZoomOut(IThumbnailView view) { + this.DisableViewEvents(); + + view.ZoomOut(); + view.Refresh(false); + + this.EnableViewEvents(); + } + + private void SnapThumbnailView(IThumbnailView view) { + // Check if this feature is enabled + if (!this._configuration.EnableThumbnailSnap) { + return; + } + + // Only borderless thumbnails can be docked + if (this._configuration.ShowThumbnailFrames) { + return; + } + + int width = this._configuration.ThumbnailSize.Width; + int height = this._configuration.ThumbnailSize.Height; + + // TODO Extract method + int baseX = view.ThumbnailLocation.X; + int baseY = view.ThumbnailLocation.Y; + + Point[] viewPoints = { new Point(baseX, baseY), new Point(baseX + width, baseY), + new Point(baseX, baseY + height), new Point(baseX + width, baseY + height) }; + + // TODO Extract constants + int thresholdX = Math.Max(20, width / 10); + int thresholdY = Math.Max(20, height / 10); + + foreach (var entry in this._thumbnailViews) { + IThumbnailView testView = entry.Value; + + if (view.Id == testView.Id) { + continue; + } + + int testX = testView.ThumbnailLocation.X; + int testY = testView.ThumbnailLocation.Y; + + Point[] testPoints = { new Point(testX, testY), new Point(testX + width, testY), + new Point(testX, testY + height), new Point(testX + width, testY + height) }; + + var delta = ThumbnailManager.TestViewPoints(viewPoints, testPoints, thresholdX, thresholdY); + + if ((delta.X == 0) && (delta.Y == 0)) { + continue; + } + + view.ThumbnailLocation = + new Point(view.ThumbnailLocation.X + delta.X, view.ThumbnailLocation.Y + delta.Y); + this._configuration.SetThumbnailLocation(view.Title, this._activeClient.Title, view.ThumbnailLocation); + break; + } + } + + private static (int X, int Y) + TestViewPoints(Point[] viewPoints, Point[] testPoints, int thresholdX, int thresholdY) { + // Point combinations that we need to check + // No need to check all 4x4 combinations + (int ViewOffset, int TestOffset)[] testOffsets = { (0, 3), (0, 2), (1, 2), (0, 1), (0, 0), + (1, 0), (2, 1), (2, 0), (3, 0) }; + + foreach (var testOffset in testOffsets) { + Point viewPoint = viewPoints[testOffset.ViewOffset]; + Point testPoint = testPoints[testOffset.TestOffset]; + + int deltaX = testPoint.X - viewPoint.X; + int deltaY = testPoint.Y - viewPoint.Y; + + if ((Math.Abs(deltaX) <= thresholdX) && (Math.Abs(deltaY) <= thresholdY)) { + return (deltaX, deltaY); + } + } + + return (0, 0); + } + + private void ApplyClientLayout(IThumbnailView view) { + IntPtr clientHandle = view.Id; + string clientTitle = view.Title; + + if (!this._configuration.EnableClientLayoutTracking) { + return; + } + + // No need to apply layout for not yet logged-in clients + if (clientTitle == ThumbnailManager.DEFAULT_CLIENT_TITLE) { + return; + } + + ClientLayout clientLayout = this._configuration.GetClientLayout(clientTitle); + + if (clientLayout == null) { + return; + } + + if (clientLayout.IsMaximized) { + this._windowManager.MaximizeWindow(clientHandle); + } else { + this._windowManager.MoveWindow(clientHandle, clientLayout.X, clientLayout.Y, clientLayout.Width, + clientLayout.Height); + } + } + + private void UpdateClientLayouts() { + if (!this._configuration.EnableClientLayoutTracking) { + return; + } + + foreach (KeyValuePair entry in this._thumbnailViews) { + IThumbnailView view = entry.Value; + + // No need to save layout for not yet logged-in clients + if (view.Title == ThumbnailManager.DEFAULT_CLIENT_TITLE) { + continue; + } + + (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); + + 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, isMaximized)); + } + } + + private void EnqueueLocationChange(IThumbnailView view) { + string activeClientTitle = this._activeClient.Title; + // TODO ?? + this._configuration.SetThumbnailLocation(view.Title, activeClientTitle, view.ThumbnailLocation); + + lock (this._locationChangeNotificationSyncRoot) { + if (this._enqueuedLocationChangeNotification.Handle == IntPtr.Zero) { + this._enqueuedLocationChangeNotification = + (view.Id, view.Title, activeClientTitle, view.ThumbnailLocation, + ThumbnailManager.DEFAULT_LOCATION_CHANGE_NOTIFICATION_DELAY); + return; + } + + // Reset the delay and exit + if ((this._enqueuedLocationChangeNotification.Handle == view.Id) && + (this._enqueuedLocationChangeNotification.ActiveClient == activeClientTitle)) { + this._enqueuedLocationChangeNotification.Delay = + ThumbnailManager.DEFAULT_LOCATION_CHANGE_NOTIFICATION_DELAY; + return; + } + + this.RaiseThumbnailLocationUpdatedNotification(this._enqueuedLocationChangeNotification.Title); + this._enqueuedLocationChangeNotification = + (view.Id, view.Title, activeClientTitle, view.ThumbnailLocation, + ThumbnailManager.DEFAULT_LOCATION_CHANGE_NOTIFICATION_DELAY); + } + } + + private bool TryDequeueLocationChange(out(IntPtr Handle, string Title, string ActiveClient, Point Location) + change) { + lock (this._locationChangeNotificationSyncRoot) { + change = (IntPtr.Zero, null, null, Point.Empty); + + if (this._enqueuedLocationChangeNotification.Handle == IntPtr.Zero) { + return false; + } + + this._enqueuedLocationChangeNotification.Delay--; + + if (this._enqueuedLocationChangeNotification.Delay > 0) { + return false; + } + + change = + (this._enqueuedLocationChangeNotification.Handle, this._enqueuedLocationChangeNotification.Title, + this._enqueuedLocationChangeNotification.ActiveClient, + this._enqueuedLocationChangeNotification.Location); + this._enqueuedLocationChangeNotification = (IntPtr.Zero, null, null, Point.Empty, -1); + + return true; + } + } + + private async void RaiseThumbnailLocationUpdatedNotification(string title) { + if (string.IsNullOrEmpty(title) || (title == ThumbnailManager.DEFAULT_CLIENT_TITLE)) { + return; + } + + await this._mediator.Send(new SaveConfiguration()); + } + + // We shouldn't manage some thumbnails (like thumbnail of the EVE client sitting on the login screen) + // TODO Move to a service (?) + private bool IsManageableThumbnail(IThumbnailView view) { + return view.Title != ThumbnailManager.DEFAULT_CLIENT_TITLE; + } + + // Quick sanity check that the window is not minimized + private bool IsValidWindowPosition(int left, int top, int width, int height) { + return (left > ThumbnailManager.WINDOW_POSITION_THRESHOLD_LOW) && + (left < ThumbnailManager.WINDOW_POSITION_THRESHOLD_HIGH) && + (top > ThumbnailManager.WINDOW_POSITION_THRESHOLD_LOW) && + (top < ThumbnailManager.WINDOW_POSITION_THRESHOLD_HIGH) && + (width > ThumbnailManager.WINDOW_SIZE_THRESHOLD) && + (height > ThumbnailManager.WINDOW_SIZE_THRESHOLD); + } + + [DllImport("user32.dll")] + private static extern bool EnumWindows(EnumWindowsProc enumProc, IntPtr lParam); + + [DllImport("user32.dll")] + private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint processId); + + [DllImport("user32.dll")] + private static extern bool IsWindow(IntPtr hWnd); + + [DllImport("user32.dll")] + private static extern bool IsWindowVisible(IntPtr hWnd); + + [DllImport("user32.dll", CharSet = CharSet.Unicode)] + private static extern int GetWindowText(IntPtr hWnd, StringBuilder strText, int maxCount); + + private delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam); + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Services/Implementation/WindowManager.cs b/src/Eve-O-Preview/Services/Implementation/WindowManager.cs index 9a8768f..531d577 100644 --- a/src/Eve-O-Preview/Services/Implementation/WindowManager.cs +++ b/src/Eve-O-Preview/Services/Implementation/WindowManager.cs @@ -5,321 +5,278 @@ using System.Runtime.InteropServices; using EveOPreview.Configuration; using EveOPreview.Services.Interop; -namespace EveOPreview.Services.Implementation -{ - public class WindowManager : IWindowManager - { - #region Private constants - private const int WINDOW_SIZE_THRESHOLD = 300; - private const int NO_ANIMATION = 0; - #endregion +namespace EveOPreview.Services.Implementation { + public class WindowManager : IWindowManager { +#region Private constants + private const int WINDOW_SIZE_THRESHOLD = 300; + private const int NO_ANIMATION = 0; +#endregion - #region Private fields - private readonly bool _enableWineCompatabilityMode; - private string _bashLocation; - private string _wmctrlLocation; - private const string EXCEPTION_DUMP_FILE_NAME = "EVE-O-Preview.log"; - #endregion +#region Private fields + private readonly bool _enableWineCompatabilityMode; + private string _bashLocation; + private string _wmctrlLocation; + private const string EXCEPTION_DUMP_FILE_NAME = "EVE-O-Preview.log"; +#endregion - - public WindowManager(IThumbnailConfiguration configuration) - { + public WindowManager(IThumbnailConfiguration configuration) { #if LINUX - this._enableWineCompatabilityMode = configuration.EnableWineCompatibilityMode; - this._bashLocation = FindLinuxBinLocation("bash"); - this._wmctrlLocation = FindLinuxBinLocation("wmctrl"); + this._enableWineCompatabilityMode = configuration.EnableWineCompatibilityMode; + this._bashLocation = FindLinuxBinLocation("bash"); + this._wmctrlLocation = FindLinuxBinLocation("wmctrl"); #endif - // Composition is always enabled for Windows 8+ - this.IsCompositionEnabled = - ((Environment.OSVersion.Version.Major == 6) && (Environment.OSVersion.Version.Minor >= 2)) // Win 8 and Win 8.1 - || (Environment.OSVersion.Version.Major >= 10) // Win 10 - || DwmNativeMethods.DwmIsCompositionEnabled(); // In case of Win 7 an API call is requiredWin 7 - _animationParam.cbSize = (System.UInt32)Marshal.SizeOf(typeof(ANIMATIONINFO)); - } + // Composition is always enabled for Windows 8+ + this.IsCompositionEnabled = + ((Environment.OSVersion.Version.Major == 6) && + (Environment.OSVersion.Version.Minor >= 2)) // Win 8 and Win 8.1 + || (Environment.OSVersion.Version.Major >= 10) // Win 10 + || DwmNativeMethods.DwmIsCompositionEnabled(); // In case of Win 7 an API call is requiredWin 7 + _animationParam.cbSize = (System.UInt32)Marshal.SizeOf(typeof(ANIMATIONINFO)); + } #if LINUX - private string FindLinuxBinLocation(string command) - { - // Check common paths for command - string[] paths = { "/run/host/usr/bin", "/bin", "/usr/bin" }; - foreach (var path in paths) - { - string locationToCheck = $"{path}/{command}"; - if (System.IO.File.Exists(locationToCheck)) - { - string binLocation = System.IO.Path.GetDirectoryName(locationToCheck); - string binLocationUnixStyle = binLocation.Replace("\\", "/"); + private string FindLinuxBinLocation(string command) { + // Check common paths for command + string[] paths = { "/run/host/usr/bin", "/bin", "/usr/bin" }; + foreach (var path in paths) { + string locationToCheck = $"{path}/{command}"; + if (System.IO.File.Exists(locationToCheck)) { + string binLocation = System.IO.Path.GetDirectoryName(locationToCheck); + string binLocationUnixStyle = binLocation.Replace("\\", "/"); - return binLocationUnixStyle; - } - } + return binLocationUnixStyle; + } + } - WriteToLog($"[{DateTime.Now}] Error: {command} not found in expected locations."); - return null; - } + WriteToLog($"[{DateTime.Now}] Error: {command} not found in expected locations."); + return null; + } #endif - private void WriteToLog(string message) - { - try - { - System.IO.File.AppendAllText(EXCEPTION_DUMP_FILE_NAME, message + Environment.NewLine); - } - catch (Exception ex) - { - Console.WriteLine($"Failed to write to log file: {ex.Message}"); - } - } + private void WriteToLog(string message) { + try { + System.IO.File.AppendAllText(EXCEPTION_DUMP_FILE_NAME, message + Environment.NewLine); + } catch (Exception ex) { + Console.WriteLine($"Failed to write to log file: {ex.Message}"); + } + } - private int? _currentAnimationSetting = null; - private ANIMATIONINFO _animationParam = new ANIMATIONINFO(); + private int? _currentAnimationSetting = null; + private ANIMATIONINFO _animationParam = new ANIMATIONINFO(); - public bool IsCompositionEnabled { get; } + public bool IsCompositionEnabled { get; } - public IntPtr GetForegroundWindowHandle() - { - return User32NativeMethods.GetForegroundWindow(); - } + public IntPtr GetForegroundWindowHandle() { + return User32NativeMethods.GetForegroundWindow(); + } - private void TurnOffAnimation() - { - var currentAnimationSetup = User32NativeMethods.SystemParametersInfo(User32NativeMethods.SPI_GETANIMATION, (System.Int32)Marshal.SizeOf(typeof(ANIMATIONINFO)), ref _animationParam, 0); - if (_currentAnimationSetting == null) - { - // Store the current Animation Setting - _currentAnimationSetting = _animationParam.iMinAnimate; - } + private void TurnOffAnimation() { + var currentAnimationSetup = User32NativeMethods.SystemParametersInfo( + User32NativeMethods.SPI_GETANIMATION, (System.Int32)Marshal.SizeOf(typeof(ANIMATIONINFO)), + ref _animationParam, 0); + if (_currentAnimationSetting == null) { + // Store the current Animation Setting + _currentAnimationSetting = _animationParam.iMinAnimate; + } - if (currentAnimationSetup != NO_ANIMATION) - { - // Turn off Animation - _animationParam.iMinAnimate = NO_ANIMATION; - var animationOffReturn = User32NativeMethods.SystemParametersInfo(User32NativeMethods.SPI_SETANIMATION, (System.Int32)Marshal.SizeOf(typeof(ANIMATIONINFO)), ref _animationParam, 0); - } - } + if (currentAnimationSetup != NO_ANIMATION) { + // Turn off Animation + _animationParam.iMinAnimate = NO_ANIMATION; + var animationOffReturn = User32NativeMethods.SystemParametersInfo( + User32NativeMethods.SPI_SETANIMATION, (System.Int32)Marshal.SizeOf(typeof(ANIMATIONINFO)), + ref _animationParam, 0); + } + } - private void RestoreAnimation() - { - var currentAnimationSetup = User32NativeMethods.SystemParametersInfo(User32NativeMethods.SPI_GETANIMATION, (System.Int32)Marshal.SizeOf(typeof(ANIMATIONINFO)), ref _animationParam, 0); - // Restore current Animation Settings - if (_animationParam.iMinAnimate != (int)_currentAnimationSetting) - { - _animationParam.iMinAnimate = (int)_currentAnimationSetting; - var animationResetReturn = User32NativeMethods.SystemParametersInfo(User32NativeMethods.SPI_SETANIMATION, (System.Int32)Marshal.SizeOf(typeof(ANIMATIONINFO)), ref _animationParam, 0); - } - } + private void RestoreAnimation() { + var currentAnimationSetup = User32NativeMethods.SystemParametersInfo( + User32NativeMethods.SPI_GETANIMATION, (System.Int32)Marshal.SizeOf(typeof(ANIMATIONINFO)), + ref _animationParam, 0); + // Restore current Animation Settings + if (_animationParam.iMinAnimate != (int)_currentAnimationSetting) { + _animationParam.iMinAnimate = (int)_currentAnimationSetting; + var animationResetReturn = User32NativeMethods.SystemParametersInfo( + User32NativeMethods.SPI_SETANIMATION, (System.Int32)Marshal.SizeOf(typeof(ANIMATIONINFO)), + ref _animationParam, 0); + } + } - // if building for LINUX the window handling is slightly different + // if building for LINUX the window handling is slightly different #if LINUX - private void WindowsActivateWindow(IntPtr handle) - { - User32NativeMethods.SetForegroundWindow(handle); - User32NativeMethods.SetFocus(handle); + private void WindowsActivateWindow(IntPtr handle) { + User32NativeMethods.SetForegroundWindow(handle); + User32NativeMethods.SetFocus(handle); - int style = User32NativeMethods.GetWindowLong(handle, InteropConstants.GWL_STYLE); + int style = User32NativeMethods.GetWindowLong(handle, InteropConstants.GWL_STYLE); - if ((style & InteropConstants.WS_MINIMIZE) == InteropConstants.WS_MINIMIZE) - { - User32NativeMethods.ShowWindowAsync(handle, InteropConstants.SW_RESTORE); - } - } + if ((style & InteropConstants.WS_MINIMIZE) == InteropConstants.WS_MINIMIZE) { + User32NativeMethods.ShowWindowAsync(handle, InteropConstants.SW_RESTORE); + } + } - private void WineActivateWindow(string windowName) - { - // On Wine it is not possible to manipulate windows directly. - // They are managed by native Window Manager - // So a separate command-line utility is used - if (string.IsNullOrEmpty(windowName)) - { - return; - } + private void WineActivateWindow(string windowName) { + // On Wine it is not possible to manipulate windows directly. + // They are managed by native Window Manager + // So a separate command-line utility is used + if (string.IsNullOrEmpty(windowName)) { + return; + } string cmd = ""; - try - { + try { // If we are in a flatpak, then use flatpak-spawn to run wmctrl outside the sandbox - if (Environment.GetEnvironmentVariable("container") == "flatpak") - { + if (Environment.GetEnvironmentVariable("container") == "flatpak") { cmd = $"-c \"flatpak-spawn --host wmctrl -a \"\"" + windowName + "\"\"\""; - } - else - { + } else { cmd = $"-c \"{this._wmctrlLocation}/wmctrl -a \"\"" + windowName + "\"\"\""; } - // Configure and start the process - var processStartInfo = new System.Diagnostics.ProcessStartInfo - { - FileName = $"{this._bashLocation}/bash", - Arguments = cmd, - UseShellExecute = false, - CreateNoWindow = false - }; + // Configure and start the process + var processStartInfo = + new System.Diagnostics.ProcessStartInfo { FileName = $"{this._bashLocation}/bash", Arguments = cmd, + UseShellExecute = false, CreateNoWindow = false }; - using (var process = System.Diagnostics.Process.Start(processStartInfo)) - { - process.WaitForExit(); - } - } - catch (Exception ex) - { - WriteToLog($"[{DateTime.Now}] executing wmctrl - Exception: {ex.Message}"); - } - } - - public void ActivateWindow(IntPtr handle, string windowName) - { - if (this._enableWineCompatabilityMode) - { - this.WineActivateWindow(windowName); + using (var process = System.Diagnostics.Process.Start(processStartInfo)) { + process.WaitForExit(); + } + } catch (Exception ex) { + WriteToLog($"[{DateTime.Now}] executing wmctrl - Exception: {ex.Message}"); } - else - { + } + + public void ActivateWindow(IntPtr handle, string windowName) { + if (this._enableWineCompatabilityMode) { + this.WineActivateWindow(windowName); + } else { this.WindowsActivateWindow(handle); } } - public void MinimizeWindow(IntPtr handle, bool enableAnimation) - { - if (enableAnimation) - { - User32NativeMethods.SendMessage(handle, InteropConstants.WM_SYSCOMMAND, InteropConstants.SC_MINIMIZE, 0); - } - else - { - WINDOWPLACEMENT param = new WINDOWPLACEMENT(); - param.length = Marshal.SizeOf(typeof(WINDOWPLACEMENT)); - User32NativeMethods.GetWindowPlacement(handle, ref param); - param.showCmd = WINDOWPLACEMENT.SW_MINIMIZE; - User32NativeMethods.SetWindowPlacement(handle, ref param); - } - } + public void MinimizeWindow(IntPtr handle, bool enableAnimation) { + if (enableAnimation) { + User32NativeMethods.SendMessage(handle, InteropConstants.WM_SYSCOMMAND, InteropConstants.SC_MINIMIZE, + 0); + } else { + WINDOWPLACEMENT param = new WINDOWPLACEMENT(); + param.length = Marshal.SizeOf(typeof(WINDOWPLACEMENT)); + User32NativeMethods.GetWindowPlacement(handle, ref param); + param.showCmd = WINDOWPLACEMENT.SW_MINIMIZE; + User32NativeMethods.SetWindowPlacement(handle, ref param); + } + } #endif #if WINDOWS - public void ActivateWindow(IntPtr handle, AnimationStyle animation) - { - User32NativeMethods.SetForegroundWindow(handle); - User32NativeMethods.SetFocus(handle); + public void ActivateWindow(IntPtr handle, AnimationStyle animation) { + User32NativeMethods.SetForegroundWindow(handle); + User32NativeMethods.SetFocus(handle); - int style = User32NativeMethods.GetWindowLong(handle, InteropConstants.GWL_STYLE); + int style = User32NativeMethods.GetWindowLong(handle, InteropConstants.GWL_STYLE); - if ((style & InteropConstants.WS_MINIMIZE) == InteropConstants.WS_MINIMIZE) - { - switch (animation) - { - case AnimationStyle.OriginalAnimation: - User32NativeMethods.ShowWindowAsync(handle, InteropConstants.SW_RESTORE); - break; - case AnimationStyle.NoAnimation: - TurnOffAnimation(); - User32NativeMethods.ShowWindowAsync(handle, InteropConstants.SW_RESTORE); - RestoreAnimation(); - break; - } - } - } - - public void MinimizeWindow(IntPtr handle, AnimationStyle animation, bool enableAnimation) - { - if (enableAnimation) - { - switch (animation) - { - case AnimationStyle.OriginalAnimation: - User32NativeMethods.SendMessage(handle, InteropConstants.WM_SYSCOMMAND, InteropConstants.SC_MINIMIZE, 0); - break; - case AnimationStyle.NoAnimation: - TurnOffAnimation(); - User32NativeMethods.SendMessage(handle, InteropConstants.WM_SYSCOMMAND, InteropConstants.SC_MINIMIZE, 0); - RestoreAnimation(); - break; - } - } - else - { - switch (animation) - { - case AnimationStyle.OriginalAnimation: - WINDOWPLACEMENT param = new WINDOWPLACEMENT(); - param.length = Marshal.SizeOf(typeof(WINDOWPLACEMENT)); - User32NativeMethods.GetWindowPlacement(handle, ref param); - param.showCmd = WINDOWPLACEMENT.SW_MINIMIZE; - User32NativeMethods.SetWindowPlacement(handle, ref param); - break; - case AnimationStyle.NoAnimation: - TurnOffAnimation(); - User32NativeMethods.SendMessage(handle, InteropConstants.WM_SYSCOMMAND, InteropConstants.SC_MINIMIZE, 0); - RestoreAnimation(); - break; - } - } - } -#endif - - public void MoveWindow(IntPtr handle, int left, int top, int width, int height) - { - User32NativeMethods.MoveWindow(handle, left, top, width, height, true); - } - - public void MaximizeWindow(IntPtr handle) - { - User32NativeMethods.ShowWindowAsync(handle, InteropConstants.SW_SHOWMAXIMIZED); + if ((style & InteropConstants.WS_MINIMIZE) == InteropConstants.WS_MINIMIZE) { + switch (animation) { + case AnimationStyle.OriginalAnimation: + User32NativeMethods.ShowWindowAsync(handle, InteropConstants.SW_RESTORE); + break; + case AnimationStyle.NoAnimation: + TurnOffAnimation(); + User32NativeMethods.ShowWindowAsync(handle, InteropConstants.SW_RESTORE); + RestoreAnimation(); + break; + } + } } - public (int Left, int Top, int Right, int Bottom) GetWindowPosition(IntPtr handle) - { - User32NativeMethods.GetWindowRect(handle, out RECT windowRectangle); + public void MinimizeWindow(IntPtr handle, AnimationStyle animation, bool enableAnimation) { + if (enableAnimation) { + switch (animation) { + case AnimationStyle.OriginalAnimation: + User32NativeMethods.SendMessage(handle, InteropConstants.WM_SYSCOMMAND, + InteropConstants.SC_MINIMIZE, 0); + break; + case AnimationStyle.NoAnimation: + TurnOffAnimation(); + User32NativeMethods.SendMessage(handle, InteropConstants.WM_SYSCOMMAND, + InteropConstants.SC_MINIMIZE, 0); + RestoreAnimation(); + break; + } + } else { + switch (animation) { + case AnimationStyle.OriginalAnimation: + WINDOWPLACEMENT param = new WINDOWPLACEMENT(); + param.length = Marshal.SizeOf(typeof(WINDOWPLACEMENT)); + User32NativeMethods.GetWindowPlacement(handle, ref param); + param.showCmd = WINDOWPLACEMENT.SW_MINIMIZE; + User32NativeMethods.SetWindowPlacement(handle, ref param); + break; + case AnimationStyle.NoAnimation: + TurnOffAnimation(); + User32NativeMethods.SendMessage(handle, InteropConstants.WM_SYSCOMMAND, + InteropConstants.SC_MINIMIZE, 0); + RestoreAnimation(); + break; + } + } + } +#endif - return (windowRectangle.Left, windowRectangle.Top, windowRectangle.Right, windowRectangle.Bottom); - } + public void MoveWindow(IntPtr handle, int left, int top, int width, int height) { + User32NativeMethods.MoveWindow(handle, left, top, width, height, true); + } - public bool IsWindowMaximized(IntPtr handle) - { - return User32NativeMethods.IsZoomed(handle); - } + public void MaximizeWindow(IntPtr handle) { + User32NativeMethods.ShowWindowAsync(handle, InteropConstants.SW_SHOWMAXIMIZED); + } - public bool IsWindowMinimized(IntPtr handle) - { - return User32NativeMethods.IsIconic(handle); - } + public (int Left, int Top, int Right, int Bottom) GetWindowPosition(IntPtr handle) { + User32NativeMethods.GetWindowRect(handle, out RECT windowRectangle); - public IDwmThumbnail GetLiveThumbnail(IntPtr destination, IntPtr source) - { - IDwmThumbnail thumbnail = new DwmThumbnail(this); - thumbnail.Register(destination, source); + return (windowRectangle.Left, windowRectangle.Top, windowRectangle.Right, windowRectangle.Bottom); + } - return thumbnail; - } + public bool IsWindowMaximized(IntPtr handle) { + return User32NativeMethods.IsZoomed(handle); + } - public Image GetStaticThumbnail(IntPtr source) - { - var sourceContext = User32NativeMethods.GetDC(source); + public bool IsWindowMinimized(IntPtr handle) { + return User32NativeMethods.IsIconic(handle); + } - User32NativeMethods.GetClientRect(source, out RECT windowRect); + public IDwmThumbnail GetLiveThumbnail(IntPtr destination, IntPtr source) { + IDwmThumbnail thumbnail = new DwmThumbnail(this); + thumbnail.Register(destination, source); - var width = windowRect.Right - windowRect.Left; - var height = windowRect.Bottom - windowRect.Top; + return thumbnail; + } - // Check if there is anything to make thumbnail of - if ((width < WINDOW_SIZE_THRESHOLD) || (height < WINDOW_SIZE_THRESHOLD)) - { - return null; - } + public Image GetStaticThumbnail(IntPtr source) { + var sourceContext = User32NativeMethods.GetDC(source); - var destContext = Gdi32NativeMethods.CreateCompatibleDC(sourceContext); - var bitmap = Gdi32NativeMethods.CreateCompatibleBitmap(sourceContext, width, height); + User32NativeMethods.GetClientRect(source, out RECT windowRect); - var oldBitmap = Gdi32NativeMethods.SelectObject(destContext, bitmap); - Gdi32NativeMethods.BitBlt(destContext, 0, 0, width, height, sourceContext, 0, 0, Gdi32NativeMethods.SRCCOPY); - Gdi32NativeMethods.SelectObject(destContext, oldBitmap); - Gdi32NativeMethods.DeleteDC(destContext); - User32NativeMethods.ReleaseDC(source, sourceContext); + var width = windowRect.Right - windowRect.Left; + var height = windowRect.Bottom - windowRect.Top; - Image image = Image.FromHbitmap(bitmap); - Gdi32NativeMethods.DeleteObject(bitmap); + // Check if there is anything to make thumbnail of + if ((width < WINDOW_SIZE_THRESHOLD) || (height < WINDOW_SIZE_THRESHOLD)) { + return null; + } - return image; - } - } + var destContext = Gdi32NativeMethods.CreateCompatibleDC(sourceContext); + var bitmap = Gdi32NativeMethods.CreateCompatibleBitmap(sourceContext, width, height); + + var oldBitmap = Gdi32NativeMethods.SelectObject(destContext, bitmap); + Gdi32NativeMethods.BitBlt(destContext, 0, 0, width, height, sourceContext, 0, 0, + Gdi32NativeMethods.SRCCOPY); + Gdi32NativeMethods.SelectObject(destContext, oldBitmap); + Gdi32NativeMethods.DeleteDC(destContext); + User32NativeMethods.ReleaseDC(source, sourceContext); + + Image image = Image.FromHbitmap(bitmap); + Gdi32NativeMethods.DeleteObject(bitmap); + + return image; + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Services/Interface/IDwmThumbnail.cs b/src/Eve-O-Preview/Services/Interface/IDwmThumbnail.cs index 31fabcd..40afec4 100644 --- a/src/Eve-O-Preview/Services/Interface/IDwmThumbnail.cs +++ b/src/Eve-O-Preview/Services/Interface/IDwmThumbnail.cs @@ -1,13 +1,13 @@ using System; -namespace EveOPreview.Services -{ - public interface IDwmThumbnail - { - void Register(IntPtr destination, IntPtr source); - void Unregister(); +namespace EveOPreview.Services { + public interface IDwmThumbnail { + void Register(IntPtr destination, IntPtr source); + void Unregister(); - void Move(int left, int top, int right, int bottom); - void Update(); - } + void Move(int left, int top, int right, int bottom); + void SetSourceRegion(int left, int top, int right, int bottom); + void ClearSourceRegion(); + void Update(); + } } diff --git a/src/Eve-O-Preview/Services/Interface/IProcessInfo.cs b/src/Eve-O-Preview/Services/Interface/IProcessInfo.cs index d86e9ac..87e8509 100644 --- a/src/Eve-O-Preview/Services/Interface/IProcessInfo.cs +++ b/src/Eve-O-Preview/Services/Interface/IProcessInfo.cs @@ -1,10 +1,8 @@ using System; -namespace EveOPreview.Services -{ - public interface IProcessInfo - { - IntPtr Handle { get; } - string Title { get; } - } +namespace EveOPreview.Services { + public interface IProcessInfo { + IntPtr Handle { get; } + string Title { get; } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Services/Interface/IProcessMonitor.cs b/src/Eve-O-Preview/Services/Interface/IProcessMonitor.cs index 865bd0f..0b0b1b2 100644 --- a/src/Eve-O-Preview/Services/Interface/IProcessMonitor.cs +++ b/src/Eve-O-Preview/Services/Interface/IProcessMonitor.cs @@ -1,13 +1,13 @@ using System.Collections.Generic; -namespace EveOPreview.Services -{ - public interface IProcessMonitor - { - IProcessInfo GetMainProcess(); - ICollection GetAllProcesses(); - void GetUpdatedProcesses(out ICollection addedProcesses, out ICollection updatedProcesses, out ICollection removedProcesses); - int GetTrackedPid(); - void SetTrackedPid(int pid); - } +namespace EveOPreview.Services { + public interface IProcessMonitor { + IProcessInfo GetMainProcess(); + ICollection GetAllProcesses(); + void GetUpdatedProcesses(out ICollection addedProcesses, + out ICollection updatedProcesses, + out ICollection removedProcesses); + int GetTrackedPid(); + void SetTrackedPid(int pid); + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Services/Interface/IThumbnailManager.cs b/src/Eve-O-Preview/Services/Interface/IThumbnailManager.cs index 5830516..9551cdc 100644 --- a/src/Eve-O-Preview/Services/Interface/IThumbnailManager.cs +++ b/src/Eve-O-Preview/Services/Interface/IThumbnailManager.cs @@ -1,17 +1,16 @@ using EveOPreview.View; -namespace EveOPreview.Services -{ - public interface IThumbnailManager - { - void Start(); - void Stop(); +namespace EveOPreview.Services { + public interface IThumbnailManager { + void Start(); + void Stop(); - void UpdateThumbnailsSize(); - void UpdateThumbnailFrames(); + void UpdateThumbnailsSize(); + void UpdateThumbnailFrames(); + void UpdateThumbnailRegionSettings(); - IThumbnailView GetClientByTitle(string title); - IThumbnailView GetClientByPointer(System.IntPtr ptr); - IThumbnailView GetActiveClient(); - } + IThumbnailView GetClientByTitle(string title); + IThumbnailView GetClientByPointer(System.IntPtr ptr); + IThumbnailView GetActiveClient(); + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Services/Interface/IWindowManager.cs b/src/Eve-O-Preview/Services/Interface/IWindowManager.cs index 5e64ce9..423cc84 100644 --- a/src/Eve-O-Preview/Services/Interface/IWindowManager.cs +++ b/src/Eve-O-Preview/Services/Interface/IWindowManager.cs @@ -2,25 +2,23 @@ using System; using System.Drawing; -namespace EveOPreview.Services -{ - public interface IWindowManager - { - bool IsCompositionEnabled { get; } +namespace EveOPreview.Services { + public interface IWindowManager { + bool IsCompositionEnabled { get; } - IntPtr GetForegroundWindowHandle(); + IntPtr GetForegroundWindowHandle(); #if LINUX - void ActivateWindow(IntPtr handle, string windowName); + void ActivateWindow(IntPtr handle, string windowName); #else - void ActivateWindow(IntPtr handle, AnimationStyle animation); + void ActivateWindow(IntPtr handle, AnimationStyle animation); #endif - void MinimizeWindow(IntPtr handle, AnimationStyle animation, 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); - } + void MinimizeWindow(IntPtr handle, AnimationStyle animation, 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); + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Services/Interface/InteropConstants.cs b/src/Eve-O-Preview/Services/Interface/InteropConstants.cs index 5fdd320..9709633 100644 --- a/src/Eve-O-Preview/Services/Interface/InteropConstants.cs +++ b/src/Eve-O-Preview/Services/Interface/InteropConstants.cs @@ -1,83 +1,81 @@ using System; -namespace EveOPreview.Services -{ - public static class InteropConstants - { - public const int GWL_ID = (-12); - public const int GWL_STYLE = (-16); - public const int GWL_EXSTYLE = (-20); +namespace EveOPreview.Services { + public static class InteropConstants { + public const int GWL_ID = (-12); + public const int GWL_STYLE = (-16); + public const int GWL_EXSTYLE = (-20); - // Window Styles - public const UInt32 WS_OVERLAPPED = 0; - public const UInt32 WS_POPUP = 0x80000000; - public const UInt32 WS_CHILD = 0x40000000; - public const UInt32 WS_MINIMIZE = 0x20000000; - public const UInt32 WS_VISIBLE = 0x10000000; - public const UInt32 WS_DISABLED = 0x8000000; - public const UInt32 WS_CLIPSIBLINGS = 0x4000000; - public const UInt32 WS_CLIPCHILDREN = 0x2000000; - public const UInt32 WS_MAXIMIZE = 0x1000000; - public const UInt32 WS_CAPTION = 0xC00000; // WS_BORDER or WS_DLGFRAME - public const UInt32 WS_BORDER = 0x800000; - public const UInt32 WS_DLGFRAME = 0x400000; - public const UInt32 WS_VSCROLL = 0x200000; - public const UInt32 WS_HSCROLL = 0x100000; - public const UInt32 WS_SYSMENU = 0x80000; - public const UInt32 WS_THICKFRAME = 0x40000; - public const UInt32 WS_GROUP = 0x20000; - public const UInt32 WS_TABSTOP = 0x10000; - public const UInt32 WS_MINIMIZEBOX = 0x20000; - public const UInt32 WS_MAXIMIZEBOX = 0x10000; - public const UInt32 WS_TILED = WS_OVERLAPPED; - public const UInt32 WS_ICONIC = WS_MINIMIZE; - public const UInt32 WS_SIZEBOX = WS_THICKFRAME; + // Window Styles + public const UInt32 WS_OVERLAPPED = 0; + public const UInt32 WS_POPUP = 0x80000000; + public const UInt32 WS_CHILD = 0x40000000; + public const UInt32 WS_MINIMIZE = 0x20000000; + public const UInt32 WS_VISIBLE = 0x10000000; + public const UInt32 WS_DISABLED = 0x8000000; + public const UInt32 WS_CLIPSIBLINGS = 0x4000000; + public const UInt32 WS_CLIPCHILDREN = 0x2000000; + public const UInt32 WS_MAXIMIZE = 0x1000000; + public const UInt32 WS_CAPTION = 0xC00000; // WS_BORDER or WS_DLGFRAME + public const UInt32 WS_BORDER = 0x800000; + public const UInt32 WS_DLGFRAME = 0x400000; + public const UInt32 WS_VSCROLL = 0x200000; + public const UInt32 WS_HSCROLL = 0x100000; + public const UInt32 WS_SYSMENU = 0x80000; + public const UInt32 WS_THICKFRAME = 0x40000; + public const UInt32 WS_GROUP = 0x20000; + public const UInt32 WS_TABSTOP = 0x10000; + public const UInt32 WS_MINIMIZEBOX = 0x20000; + public const UInt32 WS_MAXIMIZEBOX = 0x10000; + public const UInt32 WS_TILED = WS_OVERLAPPED; + public const UInt32 WS_ICONIC = WS_MINIMIZE; + public const UInt32 WS_SIZEBOX = WS_THICKFRAME; - // Extended Window Styles - public const UInt32 WS_EX_DLGMODALFRAME = 0x0001; - public const UInt32 WS_EX_NOPARENTNOTIFY = 0x0004; - public const UInt32 WS_EX_TOPMOST = 0x0008; - public const UInt32 WS_EX_ACCEPTFILES = 0x0010; - public const UInt32 WS_EX_TRANSPARENT = 0x0020; - public const UInt32 WS_EX_MDICHILD = 0x0040; - public const UInt32 WS_EX_TOOLWINDOW = 0x0080; - public const UInt32 WS_EX_WINDOWEDGE = 0x0100; - public const UInt32 WS_EX_CLIENTEDGE = 0x0200; - public const UInt32 WS_EX_CONTEXTHELP = 0x0400; - public const UInt32 WS_EX_RIGHT = 0x1000; - public const UInt32 WS_EX_LEFT = 0x0000; - public const UInt32 WS_EX_RTLREADING = 0x2000; - public const UInt32 WS_EX_LTRREADING = 0x0000; - public const UInt32 WS_EX_LEFTSCROLLBAR = 0x4000; - public const UInt32 WS_EX_RIGHTSCROLLBAR = 0x0000; - public const UInt32 WS_EX_CONTROLPARENT = 0x10000; - public const UInt32 WS_EX_STATICEDGE = 0x20000; - public const UInt32 WS_EX_APPWINDOW = 0x40000; - 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 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; + // Extended Window Styles + public const UInt32 WS_EX_DLGMODALFRAME = 0x0001; + public const UInt32 WS_EX_NOPARENTNOTIFY = 0x0004; + public const UInt32 WS_EX_TOPMOST = 0x0008; + public const UInt32 WS_EX_ACCEPTFILES = 0x0010; + public const UInt32 WS_EX_TRANSPARENT = 0x0020; + public const UInt32 WS_EX_MDICHILD = 0x0040; + public const UInt32 WS_EX_TOOLWINDOW = 0x0080; + public const UInt32 WS_EX_WINDOWEDGE = 0x0100; + public const UInt32 WS_EX_CLIENTEDGE = 0x0200; + public const UInt32 WS_EX_CONTEXTHELP = 0x0400; + public const UInt32 WS_EX_RIGHT = 0x1000; + public const UInt32 WS_EX_LEFT = 0x0000; + public const UInt32 WS_EX_RTLREADING = 0x2000; + public const UInt32 WS_EX_LTRREADING = 0x0000; + public const UInt32 WS_EX_LEFTSCROLLBAR = 0x4000; + public const UInt32 WS_EX_RIGHTSCROLLBAR = 0x0000; + public const UInt32 WS_EX_CONTROLPARENT = 0x10000; + public const UInt32 WS_EX_STATICEDGE = 0x20000; + public const UInt32 WS_EX_APPWINDOW = 0x40000; + 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 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; - public const int WM_SIZE = 5; - public const int WM_SYSCOMMAND = 0x0112; + public const int WM_SIZE = 5; + public const int WM_SYSCOMMAND = 0x0112; - public const int SC_MINIMIZE = 0xf020; + public const int SC_MINIMIZE = 0xf020; - 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; + 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; - public const int WM_NCLBUTTONDOWN = 0xA1; - public const int HTCAPTION = 0x2; + public const int WM_NCLBUTTONDOWN = 0xA1; + public const int HTCAPTION = 0x2; - public const int SW_SHOWNORMAL = 1; - public const int SW_SHOWMINIMIZED = 2; - public const int SW_SHOWMAXIMIZED = 3; - public const int SW_RESTORE = 9; - } + 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 diff --git a/src/Eve-O-Preview/Services/Interop/ANIMATIONINFO.cs b/src/Eve-O-Preview/Services/Interop/ANIMATIONINFO.cs index cc8eb56..5c3eec3 100644 --- a/src/Eve-O-Preview/Services/Interop/ANIMATIONINFO.cs +++ b/src/Eve-O-Preview/Services/Interop/ANIMATIONINFO.cs @@ -1,12 +1,10 @@ using MediatR; using System.Runtime.InteropServices; -namespace EveOPreview.Services.Interop -{ +namespace EveOPreview.Services.Interop { // Definition for Window Placement Structure [StructLayout(LayoutKind.Sequential)] - struct ANIMATIONINFO - { + struct ANIMATIONINFO { public uint cbSize; public int iMinAnimate; } diff --git a/src/Eve-O-Preview/Services/Interop/DWM_BLURBEHIND.cs b/src/Eve-O-Preview/Services/Interop/DWM_BLURBEHIND.cs index fd6423e..d020b68 100644 --- a/src/Eve-O-Preview/Services/Interop/DWM_BLURBEHIND.cs +++ b/src/Eve-O-Preview/Services/Interop/DWM_BLURBEHIND.cs @@ -1,20 +1,18 @@ using System; using System.Runtime.InteropServices; -namespace EveOPreview.Services.Interop -{ - [StructLayout(LayoutKind.Sequential)] - class DWM_BLURBEHIND - { - public uint dwFlags; - [MarshalAs(UnmanagedType.Bool)] - public bool fEnable; - public IntPtr hRegionBlur; - [MarshalAs(UnmanagedType.Bool)] - public bool fTransitionOnMaximized; +namespace EveOPreview.Services.Interop { + [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; - } + 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/src/Eve-O-Preview/Services/Interop/DWM_THUMBNAIL_PROPERTIES.cs b/src/Eve-O-Preview/Services/Interop/DWM_THUMBNAIL_PROPERTIES.cs index e8f46cd..dbf531a 100644 --- a/src/Eve-O-Preview/Services/Interop/DWM_THUMBNAIL_PROPERTIES.cs +++ b/src/Eve-O-Preview/Services/Interop/DWM_THUMBNAIL_PROPERTIES.cs @@ -1,17 +1,15 @@ using System.Runtime.InteropServices; -namespace EveOPreview.Services.Interop -{ - [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; - } +namespace EveOPreview.Services.Interop { + [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/src/Eve-O-Preview/Services/Interop/DWM_TNP_CONSTANTS.cs b/src/Eve-O-Preview/Services/Interop/DWM_TNP_CONSTANTS.cs index a426ff7..aa63fb2 100644 --- a/src/Eve-O-Preview/Services/Interop/DWM_TNP_CONSTANTS.cs +++ b/src/Eve-O-Preview/Services/Interop/DWM_TNP_CONSTANTS.cs @@ -1,11 +1,9 @@ -namespace EveOPreview.Services.Interop -{ - 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; - } +namespace EveOPreview.Services.Interop { + 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/src/Eve-O-Preview/Services/Interop/DwmNativeMethods.cs b/src/Eve-O-Preview/Services/Interop/DwmNativeMethods.cs index 5cb7325..fc8729e 100644 --- a/src/Eve-O-Preview/Services/Interop/DwmNativeMethods.cs +++ b/src/Eve-O-Preview/Services/Interop/DwmNativeMethods.cs @@ -2,37 +2,34 @@ using System; using System.Runtime.InteropServices; using System.Drawing; -namespace EveOPreview.Services.Interop -{ - static class DwmNativeMethods - { - [DllImport("dwmapi.dll", PreserveSig = false)] - public static extern void DwmEnableBlurBehindWindow(IntPtr hWnd, DWM_BLURBEHIND pBlurBehind); +namespace EveOPreview.Services.Interop { + static class DwmNativeMethods { + [DllImport("dwmapi.dll", PreserveSig = false)] + public static extern void DwmEnableBlurBehindWindow(IntPtr hWnd, DWM_BLURBEHIND pBlurBehind); - [DllImport("dwmapi.dll", PreserveSig = false)] - public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, MARGINS pMargins); + [DllImport("dwmapi.dll", PreserveSig = false)] + public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, MARGINS pMargins); - [DllImport("dwmapi.dll", PreserveSig = false)] - public static extern bool DwmIsCompositionEnabled(); + [DllImport("dwmapi.dll", PreserveSig = false)] + public static extern bool DwmIsCompositionEnabled(); - [DllImport("dwmapi.dll", PreserveSig = false)] - public static extern void DwmGetColorizationColor( - out int pcrColorization, - [MarshalAs(UnmanagedType.Bool)]out bool pfOpaqueBlend); + [DllImport("dwmapi.dll", PreserveSig = false)] + public static extern void DwmGetColorizationColor(out int pcrColorization, + [MarshalAs(UnmanagedType.Bool)] out bool pfOpaqueBlend); - [DllImport("dwmapi.dll", PreserveSig = false)] - public static extern void DwmEnableComposition(bool bEnable); + [DllImport("dwmapi.dll", PreserveSig = false)] + public static extern void DwmEnableComposition(bool bEnable); - [DllImport("dwmapi.dll", PreserveSig = false)] - public static extern IntPtr DwmRegisterThumbnail(IntPtr dest, IntPtr source); + [DllImport("dwmapi.dll", PreserveSig = false)] + public static extern IntPtr DwmRegisterThumbnail(IntPtr dest, IntPtr source); - [DllImport("dwmapi.dll", PreserveSig = false)] - public static extern void DwmUnregisterThumbnail(IntPtr hThumbnail); + [DllImport("dwmapi.dll", PreserveSig = false)] + public static extern void DwmUnregisterThumbnail(IntPtr hThumbnail); - [DllImport("dwmapi.dll", PreserveSig = false)] - public static extern void DwmUpdateThumbnailProperties(IntPtr hThumbnail, DWM_THUMBNAIL_PROPERTIES props); + [DllImport("dwmapi.dll", PreserveSig = false)] + public static extern void DwmUpdateThumbnailProperties(IntPtr hThumbnail, DWM_THUMBNAIL_PROPERTIES props); - [DllImport("dwmapi.dll", PreserveSig = false)] - public static extern void DwmQueryThumbnailSourceSize(IntPtr hThumbnail, out Size size); - } + [DllImport("dwmapi.dll", PreserveSig = false)] + public static extern void DwmQueryThumbnailSourceSize(IntPtr hThumbnail, out Size size); + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Services/Interop/Gdi32NativeMethods.cs b/src/Eve-O-Preview/Services/Interop/Gdi32NativeMethods.cs index f966511..b2be4ff 100644 --- a/src/Eve-O-Preview/Services/Interop/Gdi32NativeMethods.cs +++ b/src/Eve-O-Preview/Services/Interop/Gdi32NativeMethods.cs @@ -1,28 +1,27 @@ using System; using System.Runtime.InteropServices; -namespace EveOPreview.Services.Interop -{ - static class Gdi32NativeMethods - { - public const int SRCCOPY = 13369376; +namespace EveOPreview.Services.Interop { + static class Gdi32NativeMethods { + public const int SRCCOPY = 13369376; - [DllImport("gdi32.dll")] - public static extern IntPtr CreateCompatibleDC(IntPtr hdc); + [DllImport("gdi32.dll")] + public static extern IntPtr CreateCompatibleDC(IntPtr hdc); - [DllImport("gdi32.dll")] - public static extern bool DeleteDC(IntPtr hdc); + [DllImport("gdi32.dll")] + public static extern bool DeleteDC(IntPtr hdc); - [DllImport("gdi32.dll")] - public static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int width, int height); + [DllImport("gdi32.dll")] + public static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int width, int height); - [DllImport("gdi32.dll")] - public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hObject); + [DllImport("gdi32.dll")] + public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hObject); - [DllImport("gdi32.dll")] - public static extern bool DeleteObject(IntPtr hObject); + [DllImport("gdi32.dll")] + public static extern bool DeleteObject(IntPtr hObject); - [DllImport("gdi32.dll")] - public static extern bool BitBlt(IntPtr hObject, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hObjectSource, int nXSrc, int nYSrc, int dwRop); - } + [DllImport("gdi32.dll")] + public static extern bool BitBlt(IntPtr hObject, int nXDest, int nYDest, int nWidth, int nHeight, + IntPtr hObjectSource, int nXSrc, int nYSrc, int dwRop); + } } diff --git a/src/Eve-O-Preview/Services/Interop/MARGINS.cs b/src/Eve-O-Preview/Services/Interop/MARGINS.cs index af132ff..f32c6da 100644 --- a/src/Eve-O-Preview/Services/Interop/MARGINS.cs +++ b/src/Eve-O-Preview/Services/Interop/MARGINS.cs @@ -1,21 +1,18 @@ using System.Runtime.InteropServices; -namespace EveOPreview.Services.Interop -{ - [StructLayout(LayoutKind.Sequential)] - class MARGINS - { - public int cxLeftWidth; - public int cxRightWidth; - public int cyTopHeight; - public int cyBottomHeight; +namespace EveOPreview.Services.Interop { + [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; - } - } + 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/src/Eve-O-Preview/Services/Interop/RECT.cs b/src/Eve-O-Preview/Services/Interop/RECT.cs index 8582f90..cad8728 100644 --- a/src/Eve-O-Preview/Services/Interop/RECT.cs +++ b/src/Eve-O-Preview/Services/Interop/RECT.cs @@ -1,21 +1,18 @@ using System.Runtime.InteropServices; -namespace EveOPreview.Services.Interop -{ - [StructLayout(LayoutKind.Sequential)] - struct RECT - { - public int Left; - public int Top; - public int Right; - public int Bottom; +namespace EveOPreview.Services.Interop { + [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; - } - } + 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/src/Eve-O-Preview/Services/Interop/User32NativeMethods.cs b/src/Eve-O-Preview/Services/Interop/User32NativeMethods.cs index f243957..64c108a 100644 --- a/src/Eve-O-Preview/Services/Interop/User32NativeMethods.cs +++ b/src/Eve-O-Preview/Services/Interop/User32NativeMethods.cs @@ -1,70 +1,69 @@ using System; using System.Runtime.InteropServices; -namespace EveOPreview.Services.Interop -{ - static class User32NativeMethods - { - public const uint SPI_SETANIMATION = 0x0049; - public const uint SPI_GETANIMATION = 0x0048; +namespace EveOPreview.Services.Interop { + static class User32NativeMethods { + public const uint SPI_SETANIMATION = 0x0049; + public const uint SPI_GETANIMATION = 0x0048; - [DllImport("user32.dll")] - public static extern IntPtr GetForegroundWindow(); + [DllImport("user32.dll")] + public static extern IntPtr GetForegroundWindow(); - [DllImport("user32.dll")] - public static extern bool SetForegroundWindow(IntPtr window); + [DllImport("user32.dll")] + public static extern bool SetForegroundWindow(IntPtr window); - [DllImport("user32.dll")] - public static extern void SetFocus(IntPtr window); + [DllImport("user32.dll")] + public static extern void SetFocus(IntPtr window); - [DllImport("user32.dll")] - public static extern void EnableWindow(IntPtr window, bool isEnabled); + [DllImport("user32.dll")] + public static extern void EnableWindow(IntPtr window, bool isEnabled); - [DllImport("user32.dll")] - public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); + [DllImport("user32.dll")] + public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); - [DllImport("User32.dll")] - public static extern bool ReleaseCapture(); + [DllImport("User32.dll")] + public static extern bool ReleaseCapture(); - [DllImport("User32.dll")] - public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); + [DllImport("User32.dll")] + public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); - [DllImport("user32.dll", SetLastError = true)] - public static extern int GetWindowLong(IntPtr hWnd, int nIndex); + [DllImport("user32.dll", SetLastError = true)] + public static extern int GetWindowLong(IntPtr hWnd, int nIndex); - [DllImport("user32.dll")] - public static extern int GetWindowRect(IntPtr hWnd, out RECT rect); + [DllImport("user32.dll")] + public static extern int GetWindowRect(IntPtr hWnd, out RECT rect); - [DllImport("user32.dll")] - public static extern bool GetClientRect(IntPtr hWnd, out RECT rect); + [DllImport("user32.dll")] + public static extern bool GetClientRect(IntPtr hWnd, out RECT rect); - [DllImport("user32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl); + [DllImport("user32.dll", SetLastError = true)] + [return:MarshalAs(UnmanagedType.Bool)] + public static extern bool GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl); - [DllImport("user32.dll")] - public static extern bool SetWindowPlacement(IntPtr hWnd, [In] ref WINDOWPLACEMENT lpwndpl); + [DllImport("user32.dll")] + public static extern bool SetWindowPlacement(IntPtr hWnd, [In] ref WINDOWPLACEMENT lpwndpl); - [DllImport("user32.dll")] - public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint); + [DllImport("user32.dll")] + public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint); - [DllImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool IsIconic(IntPtr hWnd); + [DllImport("user32.dll")] + [return:MarshalAs(UnmanagedType.Bool)] + public static extern bool IsIconic(IntPtr hWnd); - [DllImport("user32.dll")] - public static extern bool IsZoomed(IntPtr hWnd); + [DllImport("user32.dll")] + public static extern bool IsZoomed(IntPtr hWnd); - [DllImport("user32.dll")] - public static extern IntPtr GetWindowDC(IntPtr hWnd); + [DllImport("user32.dll")] + public static extern IntPtr GetWindowDC(IntPtr hWnd); - [DllImport("user32.dll")] - public static extern IntPtr GetDC(IntPtr hWnd); + [DllImport("user32.dll")] + public static extern IntPtr GetDC(IntPtr hWnd); - [DllImport("user32.dll")] - public static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hdc); + [DllImport("user32.dll")] + public static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hdc); - [DllImport("user32.dll")] - public static extern long SystemParametersInfo(long uAction, int lpvParam, ref ANIMATIONINFO uParam, int fuWinIni); - } + [DllImport("user32.dll")] + public static extern long SystemParametersInfo(long uAction, int lpvParam, ref ANIMATIONINFO uParam, + int fuWinIni); + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/Services/Interop/WINDOWPLACEMENT.cs b/src/Eve-O-Preview/Services/Interop/WINDOWPLACEMENT.cs index 283373c..f55ee37 100644 --- a/src/Eve-O-Preview/Services/Interop/WINDOWPLACEMENT.cs +++ b/src/Eve-O-Preview/Services/Interop/WINDOWPLACEMENT.cs @@ -1,30 +1,28 @@ using System.Runtime.InteropServices; -namespace EveOPreview.Services.Interop -{ - //Definition for Window Placement Structure - [StructLayout(LayoutKind.Sequential)] - struct WINDOWPLACEMENT - { - public int length; - public int flags; - public int showCmd; - public System.Drawing.Point ptMinPosition; - public System.Drawing.Point ptMaxPosition; - public System.Drawing.Rectangle rcNormalPosition; +namespace EveOPreview.Services.Interop { + // Definition for Window Placement Structure + [StructLayout(LayoutKind.Sequential)] + struct WINDOWPLACEMENT { + public int length; + public int flags; + public int showCmd; + public System.Drawing.Point ptMinPosition; + public System.Drawing.Point ptMaxPosition; + public System.Drawing.Rectangle rcNormalPosition; - //Definitions For Different Window Placement Constants - public const int SW_HIDE = 0; - public const int SW_SHOWNORMAL = 1; - public const int SW_NORMAL = 1; - public const int SW_SHOWMINIMIZED = 2; - public const int SW_SHOWMAXIMIZED = 3; - public const int SW_MAXIMIZE = 3; - public const int SW_SHOWNOACTIVATE = 4; - public const int SW_SHOW = 5; - public const int SW_MINIMIZE = 6; - public const int SW_SHOWMINNOACTIVE = 7; - public const int SW_SHOWNA = 8; - public const int SW_RESTORE = 9; - } + // Definitions For Different Window Placement Constants + public const int SW_HIDE = 0; + public const int SW_SHOWNORMAL = 1; + public const int SW_NORMAL = 1; + public const int SW_SHOWMINIMIZED = 2; + public const int SW_SHOWMAXIMIZED = 3; + public const int SW_MAXIMIZE = 3; + public const int SW_SHOWNOACTIVATE = 4; + public const int SW_SHOW = 5; + public const int SW_MINIMIZE = 6; + public const int SW_SHOWMINNOACTIVE = 7; + public const int SW_SHOWNA = 8; + public const int SW_RESTORE = 9; + } } diff --git a/src/Eve-O-Preview/View/Implementation/InputDialog.cs b/src/Eve-O-Preview/View/Implementation/InputDialog.cs new file mode 100644 index 0000000..e682c74 --- /dev/null +++ b/src/Eve-O-Preview/View/Implementation/InputDialog.cs @@ -0,0 +1,71 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace EveOPreview.View.Implementation { + public partial class InputDialog : Form { + private TextBox _inputTextBox; + private Button _okButton; + private Button _cancelButton; + private Label _promptLabel; + + public string InputText => _inputTextBox.Text; + + public InputDialog(string title, string prompt) { + InitializeComponent(); + this.Text = title; + _promptLabel.Text = prompt; + } + + private void InitializeComponent() { + this._promptLabel = new Label(); + this._inputTextBox = new TextBox(); + this._okButton = new Button(); + this._cancelButton = new Button(); + this.SuspendLayout(); + + // Form + this.AcceptButton = this._okButton; + this.CancelButton = this._cancelButton; + this.ClientSize = new Size(300, 120); + this.FormBorderStyle = FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.StartPosition = FormStartPosition.CenterParent; + + // Prompt Label + this._promptLabel.AutoSize = true; + this._promptLabel.Location = new Point(12, 15); + this._promptLabel.Size = new Size(35, 15); + this._promptLabel.Text = "Prompt:"; + + // Input TextBox + this._inputTextBox.Location = new Point(12, 35); + this._inputTextBox.Size = new Size(270, 23); + this._inputTextBox.TabIndex = 0; + + // OK Button + this._okButton.DialogResult = DialogResult.OK; + this._okButton.Location = new Point(120, 70); + this._okButton.Size = new Size(75, 23); + this._okButton.TabIndex = 1; + this._okButton.Text = "OK"; + + // Cancel Button + this._cancelButton.DialogResult = DialogResult.Cancel; + this._cancelButton.Location = new Point(210, 70); + this._cancelButton.Size = new Size(75, 23); + this._cancelButton.TabIndex = 2; + this._cancelButton.Text = "Cancel"; + + // Controls + this.Controls.Add(this._promptLabel); + this.Controls.Add(this._inputTextBox); + this.Controls.Add(this._okButton); + this.Controls.Add(this._cancelButton); + + this.ResumeLayout(false); + this.PerformLayout(); + } + } +} \ No newline at end of file diff --git a/src/Eve-O-Preview/View/Implementation/LiveThumbnailView.cs b/src/Eve-O-Preview/View/Implementation/LiveThumbnailView.cs index 0c4a7f9..715c5e7 100644 --- a/src/Eve-O-Preview/View/Implementation/LiveThumbnailView.cs +++ b/src/Eve-O-Preview/View/Implementation/LiveThumbnailView.cs @@ -3,61 +3,76 @@ using System.Drawing; using EveOPreview.Configuration; using EveOPreview.Services; -namespace EveOPreview.View -{ - sealed class LiveThumbnailView : ThumbnailView - { - #region Private fields - private IDwmThumbnail _thumbnail; - private Point _startLocation; - private Point _endLocation; - private IThumbnailConfiguration _config; - #endregion +namespace EveOPreview.View { + sealed class LiveThumbnailView : ThumbnailView { +#region Private fields + private IDwmThumbnail _thumbnail; + private Point _startLocation; + private Point _endLocation; + private IThumbnailConfiguration _config; +#endregion - public LiveThumbnailView(IWindowManager windowManager, IThumbnailConfiguration config, IThumbnailManager thumbnailManager) - : base(windowManager, config, thumbnailManager) - { - this._startLocation = new Point(0, 0); - this._endLocation = new Point(this.ClientSize); - this._config = config; - } + public LiveThumbnailView(IWindowManager windowManager, IThumbnailConfiguration config, + IThumbnailManager thumbnailManager) + : base(windowManager, config, thumbnailManager) { + this._startLocation = new Point(0, 0); + this._endLocation = new Point(this.ClientSize); + this._config = config; + } - protected override void RefreshThumbnail(bool forceRefresh) - { - // To prevent flickering the old broken thumbnail is removed AFTER the new shiny one is created - IDwmThumbnail obsoleteThumbnail = forceRefresh ? this._thumbnail : null; + protected override void RefreshThumbnail(bool forceRefresh) { + // To prevent flickering the old broken thumbnail is removed AFTER the new shiny one is created + IDwmThumbnail obsoleteThumbnail = forceRefresh ? this._thumbnail : null; - if ((this._thumbnail == null) || forceRefresh) - { - this.RegisterThumbnail(); - } + if ((this._thumbnail == null) || forceRefresh) { + this.RegisterThumbnail(); + } - obsoleteThumbnail?.Unregister(); - } + obsoleteThumbnail?.Unregister(); + } - protected override void ResizeThumbnail(int baseWidth, int baseHeight, int highlightWidthTop, int highlightWidthRight, int highlightWidthBottom, int highlightWidthLeft) - { - var left = 0 + highlightWidthLeft; - var top = 0 + highlightWidthTop; - var right = baseWidth - highlightWidthRight; - var bottom = baseHeight - highlightWidthBottom; + protected override void ApplyRegionSettings() { + if (this._thumbnail == null) + return; - if ((this._startLocation.X == left) && (this._startLocation.Y == top) && (this._endLocation.X == right) && (this._endLocation.Y == bottom)) - { - return; // No update required - } - this._startLocation = new Point(left, top); - this._endLocation = new Point(right, bottom); + if (this._config.EnableThumbnailRegionSnipping) { + var region = this._config.GetThumbnailRegion(this.Title, this._config.DefaultThumbnailRegion); + if (region.Width > 0 && region.Height > 0) { + this._thumbnail.SetSourceRegion(region.Left, region.Top, region.Right, region.Bottom); + } else { + this._thumbnail.ClearSourceRegion(); + } + } else { + this._thumbnail.ClearSourceRegion(); + } - this._thumbnail.Move(left, top, right, bottom); - this._thumbnail.Update(); - } + this._thumbnail.Update(); + } - private void RegisterThumbnail() - { - this._thumbnail = this.WindowManager.GetLiveThumbnail(this.Handle, this.Id); - this._thumbnail.Move(this._startLocation.X, this._startLocation.Y, this._endLocation.X, this._endLocation.Y); - this._thumbnail.Update(); - } - } + protected override void ResizeThumbnail(int baseWidth, int baseHeight, int highlightWidthTop, + int highlightWidthRight, int highlightWidthBottom, + int highlightWidthLeft) { + var left = 0 + highlightWidthLeft; + var top = 0 + highlightWidthTop; + var right = baseWidth - highlightWidthRight; + var bottom = baseHeight - highlightWidthBottom; + + if ((this._startLocation.X == left) && (this._startLocation.Y == top) && (this._endLocation.X == right) && + (this._endLocation.Y == bottom)) { + return; // No update required + } + this._startLocation = new Point(left, top); + this._endLocation = new Point(right, bottom); + + this._thumbnail.Move(left, top, right, bottom); + this._thumbnail.Update(); + } + + private void RegisterThumbnail() { + this._thumbnail = this.WindowManager.GetLiveThumbnail(this.Handle, this.Id); + this._thumbnail.Move(this._startLocation.X, this._startLocation.Y, this._endLocation.X, + this._endLocation.Y); + this._thumbnail.Update(); + } + } } diff --git a/src/Eve-O-Preview/View/Implementation/MainForm.Designer.cs b/src/Eve-O-Preview/View/Implementation/MainForm.Designer.cs index 56a0b37..16bfaa8 100644 --- a/src/Eve-O-Preview/View/Implementation/MainForm.Designer.cs +++ b/src/Eve-O-Preview/View/Implementation/MainForm.Designer.cs @@ -1,1278 +1,1478 @@ using System.Drawing; using System.Windows.Forms; -namespace EveOPreview.View -{ - partial class MainForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; +namespace EveOPreview.View { + partial class MainForm { + /// + /// 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); - } + /// + /// 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 +#region Windows Form Designer generated code - /// s - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - ToolStripMenuItem RestoreWindowMenuItem; - ToolStripMenuItem ExitMenuItem; - ToolStripMenuItem TitleMenuItem; - ToolStripSeparator SeparatorMenuItem; - TabControl ContentTabControl; - TabPage GeneralTabPage; - Panel GeneralSettingsPanel; - Label label4; - TabPage ThumbnailTabPage; - Panel ThumbnailSettingsPanel; - Label HeigthLabel; - Label WidthLabel; - Label OpacityLabel; - Panel ZoomSettingsPanel; - Label ZoomFactorLabel; - Label ZoomAnchorLabel; - TabPage OverlayTabPage; - Panel OverlaySettingsPanel; - TabPage ClientsTabPage; - Panel ClientsPanel; - Label ThumbnailsListLabel; - TabPage AboutTabPage; - Panel AboutPanel; - Label CreditMaintLabel; - Label DocumentationLinkLabel; - Label DescriptionLabel; - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); - Label NameLabel; - AnimationStyleCombo = new ComboBox(); - MinimizeInactiveClientsCheckBox = new CheckBox(); - EnableClientLayoutTrackingCheckBox = new CheckBox(); - HideActiveClientThumbnailCheckBox = new CheckBox(); - ShowThumbnailsAlwaysOnTopCheckBox = new CheckBox(); - HideThumbnailsOnLostFocusCheckBox = new CheckBox(); - EnablePerClientThumbnailsLayoutsCheckBox = new CheckBox(); - MinimizeToTrayCheckBox = new CheckBox(); - ThumbnailSnapToGridCheckBox = new CheckBox(); - ThumbnailSnapToGridSizeYNumericEdit = new NumericUpDown(); - SnapYLabel = new Label(); - ThumbnailSnapToGridSizeXNumericEdit = new NumericUpDown(); - SnapXLabel = new Label(); - LockThumbnailLocationCheckbox = new CheckBox(); - ThumbnailsWidthNumericEdit = new NumericUpDown(); - ThumbnailsHeightNumericEdit = new NumericUpDown(); - ThumbnailOpacityTrackBar = new TrackBar(); - ZoomTabPage = new TabPage(); - ZoomAnchorPanel = new Panel(); - ZoomAanchorNWRadioButton = new RadioButton(); - ZoomAanchorNRadioButton = new RadioButton(); - ZoomAanchorNERadioButton = new RadioButton(); - ZoomAanchorWRadioButton = new RadioButton(); - ZoomAanchorSERadioButton = new RadioButton(); - ZoomAanchorCRadioButton = new RadioButton(); - ZoomAanchorSRadioButton = new RadioButton(); - ZoomAanchorERadioButton = new RadioButton(); - ZoomAanchorSWRadioButton = new RadioButton(); - EnableThumbnailZoomCheckBox = new CheckBox(); - ThumbnailZoomFactorNumericEdit = new NumericUpDown(); - label3 = new Label(); - label2 = new Label(); - OverlayLabelColorButton = new Panel(); - OverlayLabelSizeNumericEdit = new NumericUpDown(); - panel1 = new Panel(); - OverlayLabelNWRadioButton = new RadioButton(); - OverlayLabelNRadioButton = new RadioButton(); - OverlayLabelNERadioButton = new RadioButton(); - OverlayLabelWRadioButton = new RadioButton(); - OverlayLabelSERadioButton = new RadioButton(); - OverlayLabelCRadioButton = new RadioButton(); - OverlayLabelSRadioButton = new RadioButton(); - OverlayLabelERadioButton = new RadioButton(); - OverlayLabelSWRadioButton = new RadioButton(); - label1 = new Label(); - HighlightColorLabel = new Label(); - ActiveClientHighlightColorButton = new Panel(); - EnableActiveClientHighlightCheckBox = new CheckBox(); - ShowThumbnailOverlaysCheckBox = new CheckBox(); - ShowThumbnailFramesCheckBox = new CheckBox(); - ThumbnailsList = new CheckedListBox(); - VersionLabel = new Label(); - DocumentationLink = new LinkLabel(); - NotifyIcon = new NotifyIcon(components); - TrayMenu = new ContextMenuStrip(components); - RestoreWindowMenuItem = new ToolStripMenuItem(); - ExitMenuItem = new ToolStripMenuItem(); - TitleMenuItem = new ToolStripMenuItem(); - SeparatorMenuItem = new ToolStripSeparator(); - ContentTabControl = new TabControl(); - GeneralTabPage = new TabPage(); - GeneralSettingsPanel = new Panel(); - label4 = new Label(); - ThumbnailTabPage = new TabPage(); - ThumbnailSettingsPanel = new Panel(); - HeigthLabel = new Label(); - WidthLabel = new Label(); - OpacityLabel = new Label(); - ZoomSettingsPanel = new Panel(); - ZoomFactorLabel = new Label(); - ZoomAnchorLabel = new Label(); - OverlayTabPage = new TabPage(); - OverlaySettingsPanel = new Panel(); - ClientsTabPage = new TabPage(); - ClientsPanel = new Panel(); - ThumbnailsListLabel = new Label(); - AboutTabPage = new TabPage(); - AboutPanel = new Panel(); - CreditMaintLabel = new Label(); - DocumentationLinkLabel = new Label(); - DescriptionLabel = new Label(); - NameLabel = new Label(); - ContentTabControl.SuspendLayout(); - GeneralTabPage.SuspendLayout(); - GeneralSettingsPanel.SuspendLayout(); - ThumbnailTabPage.SuspendLayout(); - ThumbnailSettingsPanel.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)ThumbnailSnapToGridSizeYNumericEdit).BeginInit(); - ((System.ComponentModel.ISupportInitialize)ThumbnailSnapToGridSizeXNumericEdit).BeginInit(); - ((System.ComponentModel.ISupportInitialize)ThumbnailsWidthNumericEdit).BeginInit(); - ((System.ComponentModel.ISupportInitialize)ThumbnailsHeightNumericEdit).BeginInit(); - ((System.ComponentModel.ISupportInitialize)ThumbnailOpacityTrackBar).BeginInit(); - ZoomTabPage.SuspendLayout(); - ZoomSettingsPanel.SuspendLayout(); - ZoomAnchorPanel.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)ThumbnailZoomFactorNumericEdit).BeginInit(); - OverlayTabPage.SuspendLayout(); - OverlaySettingsPanel.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)OverlayLabelSizeNumericEdit).BeginInit(); - panel1.SuspendLayout(); - ClientsTabPage.SuspendLayout(); - ClientsPanel.SuspendLayout(); - AboutTabPage.SuspendLayout(); - AboutPanel.SuspendLayout(); - TrayMenu.SuspendLayout(); - SuspendLayout(); - // - // RestoreWindowMenuItem - // - RestoreWindowMenuItem.Name = "RestoreWindowMenuItem"; - RestoreWindowMenuItem.Size = new Size(201, 32); - RestoreWindowMenuItem.Text = "Restore"; - RestoreWindowMenuItem.Click += RestoreMainForm_Handler; - // - // ExitMenuItem - // - ExitMenuItem.Name = "ExitMenuItem"; - ExitMenuItem.Size = new Size(201, 32); - ExitMenuItem.Text = "Exit"; - ExitMenuItem.Click += ExitMenuItemClick_Handler; - // - // TitleMenuItem - // - TitleMenuItem.Enabled = false; - TitleMenuItem.Name = "TitleMenuItem"; - TitleMenuItem.Size = new Size(201, 32); - TitleMenuItem.Text = "EVE-O-Preview"; - // - // SeparatorMenuItem - // - SeparatorMenuItem.Name = "SeparatorMenuItem"; - SeparatorMenuItem.Size = new Size(198, 6); - // - // ContentTabControl - // - ContentTabControl.Alignment = TabAlignment.Left; - ContentTabControl.Controls.Add(GeneralTabPage); - ContentTabControl.Controls.Add(ThumbnailTabPage); - ContentTabControl.Controls.Add(ZoomTabPage); - ContentTabControl.Controls.Add(OverlayTabPage); - ContentTabControl.Controls.Add(ClientsTabPage); - ContentTabControl.Controls.Add(AboutTabPage); - ContentTabControl.Dock = DockStyle.Fill; - ContentTabControl.DrawMode = TabDrawMode.OwnerDrawFixed; - ContentTabControl.ItemSize = new Size(35, 120); - ContentTabControl.Location = new Point(0, 0); - ContentTabControl.Margin = new Padding(5, 6, 5, 6); - ContentTabControl.Multiline = true; - ContentTabControl.Name = "ContentTabControl"; - ContentTabControl.SelectedIndex = 0; - ContentTabControl.Size = new Size(650, 419); - ContentTabControl.SizeMode = TabSizeMode.Fixed; - ContentTabControl.TabIndex = 6; - ContentTabControl.DrawItem += ContentTabControl_DrawItem; - // - // GeneralTabPage - // - GeneralTabPage.BackColor = SystemColors.Control; - GeneralTabPage.Controls.Add(GeneralSettingsPanel); - GeneralTabPage.Location = new Point(124, 4); - GeneralTabPage.Margin = new Padding(5, 6, 5, 6); - GeneralTabPage.Name = "GeneralTabPage"; - GeneralTabPage.Padding = new Padding(5, 6, 5, 6); - GeneralTabPage.Size = new Size(522, 411); - GeneralTabPage.TabIndex = 0; - GeneralTabPage.Text = "General"; - // - // GeneralSettingsPanel - // - GeneralSettingsPanel.BorderStyle = BorderStyle.FixedSingle; - GeneralSettingsPanel.Controls.Add(label4); - GeneralSettingsPanel.Controls.Add(AnimationStyleCombo); - GeneralSettingsPanel.Controls.Add(MinimizeInactiveClientsCheckBox); - GeneralSettingsPanel.Controls.Add(EnableClientLayoutTrackingCheckBox); - GeneralSettingsPanel.Controls.Add(HideActiveClientThumbnailCheckBox); - GeneralSettingsPanel.Controls.Add(ShowThumbnailsAlwaysOnTopCheckBox); - GeneralSettingsPanel.Controls.Add(HideThumbnailsOnLostFocusCheckBox); - GeneralSettingsPanel.Controls.Add(EnablePerClientThumbnailsLayoutsCheckBox); - GeneralSettingsPanel.Controls.Add(MinimizeToTrayCheckBox); - GeneralSettingsPanel.Dock = DockStyle.Fill; - GeneralSettingsPanel.Location = new Point(5, 6); - GeneralSettingsPanel.Margin = new Padding(5, 6, 5, 6); - GeneralSettingsPanel.Name = "GeneralSettingsPanel"; - GeneralSettingsPanel.Size = new Size(512, 399); - GeneralSettingsPanel.TabIndex = 18; - GeneralSettingsPanel.Paint += GeneralSettingsPanel_Paint; - // - // label4 - // - label4.AutoSize = true; - label4.Location = new Point(8, 192); - label4.Margin = new Padding(5, 0, 5, 0); - label4.Name = "label4"; - label4.Size = new Size(136, 25); - label4.TabIndex = 27; - label4.Text = "Animation Style"; - // - // AnimationStyleCombo - // - AnimationStyleCombo.DropDownStyle = ComboBoxStyle.DropDownList; - AnimationStyleCombo.FormattingEnabled = true; - AnimationStyleCombo.Location = new Point(150, 187); - AnimationStyleCombo.Margin = new Padding(5, 6, 5, 6); - AnimationStyleCombo.Name = "AnimationStyleCombo"; - AnimationStyleCombo.Size = new Size(251, 33); - AnimationStyleCombo.TabIndex = 26; - AnimationStyleCombo.SelectedIndexChanged += OptionChanged_Handler; - // - // MinimizeInactiveClientsCheckBox - // - MinimizeInactiveClientsCheckBox.AutoSize = true; - MinimizeInactiveClientsCheckBox.Location = new Point(13, 150); - MinimizeInactiveClientsCheckBox.Margin = new Padding(5, 6, 5, 6); - MinimizeInactiveClientsCheckBox.Name = "MinimizeInactiveClientsCheckBox"; - MinimizeInactiveClientsCheckBox.Size = new Size(261, 29); - MinimizeInactiveClientsCheckBox.TabIndex = 24; - MinimizeInactiveClientsCheckBox.Text = "Minimize inactive EVE clients"; - MinimizeInactiveClientsCheckBox.UseVisualStyleBackColor = true; - MinimizeInactiveClientsCheckBox.CheckedChanged += OptionChanged_Handler; - // - // EnableClientLayoutTrackingCheckBox - // - EnableClientLayoutTrackingCheckBox.AutoSize = true; - EnableClientLayoutTrackingCheckBox.Location = new Point(13, 60); - EnableClientLayoutTrackingCheckBox.Margin = new Padding(5, 6, 5, 6); - EnableClientLayoutTrackingCheckBox.Name = "EnableClientLayoutTrackingCheckBox"; - EnableClientLayoutTrackingCheckBox.Size = new Size(199, 29); - EnableClientLayoutTrackingCheckBox.TabIndex = 19; - EnableClientLayoutTrackingCheckBox.Text = "Track client locations"; - EnableClientLayoutTrackingCheckBox.UseVisualStyleBackColor = true; - EnableClientLayoutTrackingCheckBox.CheckedChanged += OptionChanged_Handler; - // - // HideActiveClientThumbnailCheckBox - // - HideActiveClientThumbnailCheckBox.AutoSize = true; - HideActiveClientThumbnailCheckBox.Checked = true; - HideActiveClientThumbnailCheckBox.CheckState = CheckState.Checked; - HideActiveClientThumbnailCheckBox.Location = new Point(13, 106); - HideActiveClientThumbnailCheckBox.Margin = new Padding(5, 6, 5, 6); - HideActiveClientThumbnailCheckBox.Name = "HideActiveClientThumbnailCheckBox"; - HideActiveClientThumbnailCheckBox.Size = new Size(293, 29); - HideActiveClientThumbnailCheckBox.TabIndex = 20; - HideActiveClientThumbnailCheckBox.Text = "Hide preview of active EVE client"; - HideActiveClientThumbnailCheckBox.UseVisualStyleBackColor = true; - HideActiveClientThumbnailCheckBox.CheckedChanged += OptionChanged_Handler; - // - // ShowThumbnailsAlwaysOnTopCheckBox - // - ShowThumbnailsAlwaysOnTopCheckBox.AutoSize = true; - ShowThumbnailsAlwaysOnTopCheckBox.Checked = true; - ShowThumbnailsAlwaysOnTopCheckBox.CheckState = CheckState.Checked; - ShowThumbnailsAlwaysOnTopCheckBox.Location = new Point(13, 238); - ShowThumbnailsAlwaysOnTopCheckBox.Margin = new Padding(5, 6, 5, 6); - ShowThumbnailsAlwaysOnTopCheckBox.Name = "ShowThumbnailsAlwaysOnTopCheckBox"; - ShowThumbnailsAlwaysOnTopCheckBox.RightToLeft = RightToLeft.No; - ShowThumbnailsAlwaysOnTopCheckBox.Size = new Size(222, 29); - ShowThumbnailsAlwaysOnTopCheckBox.TabIndex = 21; - ShowThumbnailsAlwaysOnTopCheckBox.Text = "Previews always on top"; - ShowThumbnailsAlwaysOnTopCheckBox.UseVisualStyleBackColor = true; - ShowThumbnailsAlwaysOnTopCheckBox.CheckedChanged += OptionChanged_Handler; - // - // HideThumbnailsOnLostFocusCheckBox - // - HideThumbnailsOnLostFocusCheckBox.AutoSize = true; - HideThumbnailsOnLostFocusCheckBox.Checked = true; - HideThumbnailsOnLostFocusCheckBox.CheckState = CheckState.Checked; - HideThumbnailsOnLostFocusCheckBox.Location = new Point(13, 285); - HideThumbnailsOnLostFocusCheckBox.Margin = new Padding(5, 6, 5, 6); - HideThumbnailsOnLostFocusCheckBox.Name = "HideThumbnailsOnLostFocusCheckBox"; - HideThumbnailsOnLostFocusCheckBox.Size = new Size(375, 29); - HideThumbnailsOnLostFocusCheckBox.TabIndex = 22; - HideThumbnailsOnLostFocusCheckBox.Text = "Hide previews when EVE client is not active"; - HideThumbnailsOnLostFocusCheckBox.UseVisualStyleBackColor = true; - HideThumbnailsOnLostFocusCheckBox.CheckedChanged += OptionChanged_Handler; - // - // EnablePerClientThumbnailsLayoutsCheckBox - // - EnablePerClientThumbnailsLayoutsCheckBox.AutoSize = true; - EnablePerClientThumbnailsLayoutsCheckBox.Checked = true; - EnablePerClientThumbnailsLayoutsCheckBox.CheckState = CheckState.Checked; - EnablePerClientThumbnailsLayoutsCheckBox.Location = new Point(13, 331); - EnablePerClientThumbnailsLayoutsCheckBox.Margin = new Padding(5, 6, 5, 6); - EnablePerClientThumbnailsLayoutsCheckBox.Name = "EnablePerClientThumbnailsLayoutsCheckBox"; - EnablePerClientThumbnailsLayoutsCheckBox.Size = new Size(297, 29); - EnablePerClientThumbnailsLayoutsCheckBox.TabIndex = 23; - EnablePerClientThumbnailsLayoutsCheckBox.Text = "Unique layout for each EVE client"; - EnablePerClientThumbnailsLayoutsCheckBox.UseVisualStyleBackColor = true; - EnablePerClientThumbnailsLayoutsCheckBox.CheckedChanged += OptionChanged_Handler; - // - // MinimizeToTrayCheckBox - // - MinimizeToTrayCheckBox.AutoSize = true; - MinimizeToTrayCheckBox.Location = new Point(13, 13); - MinimizeToTrayCheckBox.Margin = new Padding(5, 6, 5, 6); - MinimizeToTrayCheckBox.Name = "MinimizeToTrayCheckBox"; - MinimizeToTrayCheckBox.Size = new Size(229, 29); - MinimizeToTrayCheckBox.TabIndex = 18; - MinimizeToTrayCheckBox.Text = "Minimize to System Tray"; - MinimizeToTrayCheckBox.UseVisualStyleBackColor = true; - MinimizeToTrayCheckBox.CheckedChanged += OptionChanged_Handler; - // - // ThumbnailTabPage - // - ThumbnailTabPage.BackColor = SystemColors.Control; - ThumbnailTabPage.Controls.Add(ThumbnailSettingsPanel); - ThumbnailTabPage.Location = new Point(124, 4); - ThumbnailTabPage.Margin = new Padding(5, 6, 5, 6); - ThumbnailTabPage.Name = "ThumbnailTabPage"; - ThumbnailTabPage.Padding = new Padding(5, 6, 5, 6); - ThumbnailTabPage.Size = new Size(522, 411); - ThumbnailTabPage.TabIndex = 1; - ThumbnailTabPage.Text = "Thumbnail"; - // - // ThumbnailSettingsPanel - // - ThumbnailSettingsPanel.BorderStyle = BorderStyle.FixedSingle; - ThumbnailSettingsPanel.Controls.Add(ThumbnailSnapToGridCheckBox); - ThumbnailSettingsPanel.Controls.Add(ThumbnailSnapToGridSizeYNumericEdit); - ThumbnailSettingsPanel.Controls.Add(SnapYLabel); - ThumbnailSettingsPanel.Controls.Add(ThumbnailSnapToGridSizeXNumericEdit); - ThumbnailSettingsPanel.Controls.Add(SnapXLabel); - ThumbnailSettingsPanel.Controls.Add(LockThumbnailLocationCheckbox); - ThumbnailSettingsPanel.Controls.Add(HeigthLabel); - ThumbnailSettingsPanel.Controls.Add(WidthLabel); - ThumbnailSettingsPanel.Controls.Add(ThumbnailsWidthNumericEdit); - ThumbnailSettingsPanel.Controls.Add(ThumbnailsHeightNumericEdit); - ThumbnailSettingsPanel.Controls.Add(ThumbnailOpacityTrackBar); - ThumbnailSettingsPanel.Controls.Add(OpacityLabel); - ThumbnailSettingsPanel.Dock = DockStyle.Fill; - ThumbnailSettingsPanel.Location = new Point(5, 6); - ThumbnailSettingsPanel.Margin = new Padding(5, 6, 5, 6); - ThumbnailSettingsPanel.Name = "ThumbnailSettingsPanel"; - ThumbnailSettingsPanel.Size = new Size(512, 399); - ThumbnailSettingsPanel.TabIndex = 19; - // - // ThumbnailSnapToGridCheckBox - // - ThumbnailSnapToGridCheckBox.AutoSize = true; - ThumbnailSnapToGridCheckBox.Location = new Point(18, 200); - ThumbnailSnapToGridCheckBox.Margin = new Padding(5, 6, 5, 6); - ThumbnailSnapToGridCheckBox.Name = "ThumbnailSnapToGridCheckBox"; - ThumbnailSnapToGridCheckBox.Size = new Size(226, 29); - ThumbnailSnapToGridCheckBox.TabIndex = 32; - ThumbnailSnapToGridCheckBox.Text = "Thumbnail Snap to Grid"; - ThumbnailSnapToGridCheckBox.UseVisualStyleBackColor = true; - ThumbnailSnapToGridCheckBox.CheckedChanged += OptionChanged_Handler; - // - // ThumbnailSnapToGridSizeYNumericEdit - // - ThumbnailSnapToGridSizeYNumericEdit.BackColor = SystemColors.Window; - ThumbnailSnapToGridSizeYNumericEdit.BorderStyle = BorderStyle.FixedSingle; - ThumbnailSnapToGridSizeYNumericEdit.CausesValidation = false; - ThumbnailSnapToGridSizeYNumericEdit.Increment = new decimal(new int[] { 10, 0, 0, 0 }); - ThumbnailSnapToGridSizeYNumericEdit.Location = new Point(217, 235); - ThumbnailSnapToGridSizeYNumericEdit.Margin = new Padding(5, 6, 5, 6); - ThumbnailSnapToGridSizeYNumericEdit.Maximum = new decimal(new int[] { 999999, 0, 0, 0 }); - ThumbnailSnapToGridSizeYNumericEdit.Name = "ThumbnailSnapToGridSizeYNumericEdit"; - ThumbnailSnapToGridSizeYNumericEdit.Size = new Size(80, 31); - ThumbnailSnapToGridSizeYNumericEdit.TabIndex = 31; - ThumbnailSnapToGridSizeYNumericEdit.Value = new decimal(new int[] { 100, 0, 0, 0 }); - ThumbnailSnapToGridSizeYNumericEdit.ValueChanged += OptionChanged_Handler; - // - // SnapYLabel - // - SnapYLabel.AutoSize = true; - SnapYLabel.Location = new Point(183, 238); - SnapYLabel.Margin = new Padding(5, 0, 5, 0); - SnapYLabel.Name = "SnapYLabel"; - SnapYLabel.Size = new Size(22, 25); - SnapYLabel.TabIndex = 30; - SnapYLabel.Text = "Y"; - // - // ThumbnailSnapToGridSizeXNumericEdit - // - ThumbnailSnapToGridSizeXNumericEdit.BackColor = SystemColors.Window; - ThumbnailSnapToGridSizeXNumericEdit.BorderStyle = BorderStyle.FixedSingle; - ThumbnailSnapToGridSizeXNumericEdit.CausesValidation = false; - ThumbnailSnapToGridSizeXNumericEdit.Increment = new decimal(new int[] { 10, 0, 0, 0 }); - ThumbnailSnapToGridSizeXNumericEdit.Location = new Point(93, 235); - ThumbnailSnapToGridSizeXNumericEdit.Margin = new Padding(5, 6, 5, 6); - ThumbnailSnapToGridSizeXNumericEdit.Maximum = new decimal(new int[] { 999999, 0, 0, 0 }); - ThumbnailSnapToGridSizeXNumericEdit.Name = "ThumbnailSnapToGridSizeXNumericEdit"; - ThumbnailSnapToGridSizeXNumericEdit.Size = new Size(80, 31); - ThumbnailSnapToGridSizeXNumericEdit.TabIndex = 29; - ThumbnailSnapToGridSizeXNumericEdit.Value = new decimal(new int[] { 100, 0, 0, 0 }); - ThumbnailSnapToGridSizeXNumericEdit.ValueChanged += OptionChanged_Handler; - // - // SnapXLabel - // - SnapXLabel.AutoSize = true; - SnapXLabel.Location = new Point(13, 238); - SnapXLabel.Margin = new Padding(5, 0, 5, 0); - SnapXLabel.Name = "SnapXLabel"; - SnapXLabel.Size = new Size(68, 25); - SnapXLabel.TabIndex = 28; - SnapXLabel.Text = "Snap X"; - // - // LockThumbnailLocationCheckbox - // - LockThumbnailLocationCheckbox.AutoSize = true; - LockThumbnailLocationCheckbox.Location = new Point(18, 156); - LockThumbnailLocationCheckbox.Margin = new Padding(5, 6, 5, 6); - LockThumbnailLocationCheckbox.Name = "LockThumbnailLocationCheckbox"; - LockThumbnailLocationCheckbox.Size = new Size(234, 29); - LockThumbnailLocationCheckbox.TabIndex = 26; - LockThumbnailLocationCheckbox.Text = "Lock Thumbnail Location"; - LockThumbnailLocationCheckbox.UseVisualStyleBackColor = true; - LockThumbnailLocationCheckbox.CheckedChanged += OptionChanged_Handler; - // - // HeigthLabel - // - HeigthLabel.AutoSize = true; - HeigthLabel.Location = new Point(13, 110); - HeigthLabel.Margin = new Padding(5, 0, 5, 0); - HeigthLabel.Name = "HeigthLabel"; - HeigthLabel.Size = new Size(153, 25); - HeigthLabel.TabIndex = 24; - HeigthLabel.Text = "Thumbnail Height"; - // - // WidthLabel - // - WidthLabel.AutoSize = true; - WidthLabel.Location = new Point(13, 63); - WidthLabel.Margin = new Padding(5, 0, 5, 0); - WidthLabel.Name = "WidthLabel"; - WidthLabel.Size = new Size(148, 25); - WidthLabel.TabIndex = 23; - WidthLabel.Text = "Thumbnail Width"; - // - // ThumbnailsWidthNumericEdit - // - ThumbnailsWidthNumericEdit.BackColor = SystemColors.Window; - ThumbnailsWidthNumericEdit.BorderStyle = BorderStyle.FixedSingle; - ThumbnailsWidthNumericEdit.CausesValidation = false; - ThumbnailsWidthNumericEdit.Increment = new decimal(new int[] { 10, 0, 0, 0 }); - ThumbnailsWidthNumericEdit.Location = new Point(175, 60); - ThumbnailsWidthNumericEdit.Margin = new Padding(5, 6, 5, 6); - ThumbnailsWidthNumericEdit.Maximum = new decimal(new int[] { 999999, 0, 0, 0 }); - ThumbnailsWidthNumericEdit.Name = "ThumbnailsWidthNumericEdit"; - ThumbnailsWidthNumericEdit.Size = new Size(80, 31); - ThumbnailsWidthNumericEdit.TabIndex = 21; - ThumbnailsWidthNumericEdit.Value = new decimal(new int[] { 100, 0, 0, 0 }); - ThumbnailsWidthNumericEdit.ValueChanged += ThumbnailSizeChanged_Handler; - // - // ThumbnailsHeightNumericEdit - // - ThumbnailsHeightNumericEdit.BackColor = SystemColors.Window; - ThumbnailsHeightNumericEdit.BorderStyle = BorderStyle.FixedSingle; - ThumbnailsHeightNumericEdit.CausesValidation = false; - ThumbnailsHeightNumericEdit.Increment = new decimal(new int[] { 10, 0, 0, 0 }); - ThumbnailsHeightNumericEdit.Location = new Point(175, 106); - ThumbnailsHeightNumericEdit.Margin = new Padding(5, 6, 5, 6); - ThumbnailsHeightNumericEdit.Maximum = new decimal(new int[] { 99999999, 0, 0, 0 }); - ThumbnailsHeightNumericEdit.Name = "ThumbnailsHeightNumericEdit"; - ThumbnailsHeightNumericEdit.Size = new Size(80, 31); - ThumbnailsHeightNumericEdit.TabIndex = 22; - ThumbnailsHeightNumericEdit.Value = new decimal(new int[] { 70, 0, 0, 0 }); - ThumbnailsHeightNumericEdit.ValueChanged += ThumbnailSizeChanged_Handler; - // - // ThumbnailOpacityTrackBar - // - ThumbnailOpacityTrackBar.AutoSize = false; - ThumbnailOpacityTrackBar.LargeChange = 10; - ThumbnailOpacityTrackBar.Location = new Point(102, 12); - ThumbnailOpacityTrackBar.Margin = new Padding(5, 6, 5, 6); - ThumbnailOpacityTrackBar.Maximum = 100; - ThumbnailOpacityTrackBar.Minimum = 20; - ThumbnailOpacityTrackBar.Name = "ThumbnailOpacityTrackBar"; - ThumbnailOpacityTrackBar.Size = new Size(318, 42); - ThumbnailOpacityTrackBar.TabIndex = 20; - ThumbnailOpacityTrackBar.TickFrequency = 10; - ThumbnailOpacityTrackBar.Value = 20; - ThumbnailOpacityTrackBar.ValueChanged += OptionChanged_Handler; - // - // OpacityLabel - // - OpacityLabel.AutoSize = true; - OpacityLabel.Location = new Point(13, 17); - OpacityLabel.Margin = new Padding(5, 0, 5, 0); - OpacityLabel.Name = "OpacityLabel"; - OpacityLabel.Size = new Size(73, 25); - OpacityLabel.TabIndex = 19; - OpacityLabel.Text = "Opacity"; - // - // ZoomTabPage - // - ZoomTabPage.BackColor = SystemColors.Control; - ZoomTabPage.Controls.Add(ZoomSettingsPanel); - ZoomTabPage.Location = new Point(124, 4); - ZoomTabPage.Margin = new Padding(5, 6, 5, 6); - ZoomTabPage.Name = "ZoomTabPage"; - ZoomTabPage.Size = new Size(522, 411); - ZoomTabPage.TabIndex = 2; - ZoomTabPage.Text = "Zoom"; - // - // ZoomSettingsPanel - // - ZoomSettingsPanel.BorderStyle = BorderStyle.FixedSingle; - ZoomSettingsPanel.Controls.Add(ZoomFactorLabel); - ZoomSettingsPanel.Controls.Add(ZoomAnchorPanel); - ZoomSettingsPanel.Controls.Add(ZoomAnchorLabel); - ZoomSettingsPanel.Controls.Add(EnableThumbnailZoomCheckBox); - ZoomSettingsPanel.Controls.Add(ThumbnailZoomFactorNumericEdit); - ZoomSettingsPanel.Dock = DockStyle.Fill; - ZoomSettingsPanel.Location = new Point(0, 0); - ZoomSettingsPanel.Margin = new Padding(5, 6, 5, 6); - ZoomSettingsPanel.Name = "ZoomSettingsPanel"; - ZoomSettingsPanel.Size = new Size(522, 411); - ZoomSettingsPanel.TabIndex = 36; - // - // ZoomFactorLabel - // - ZoomFactorLabel.AutoSize = true; - ZoomFactorLabel.Location = new Point(13, 63); - ZoomFactorLabel.Margin = new Padding(5, 0, 5, 0); - ZoomFactorLabel.Name = "ZoomFactorLabel"; - ZoomFactorLabel.Size = new Size(113, 25); - ZoomFactorLabel.TabIndex = 39; - ZoomFactorLabel.Text = "Zoom Factor"; - // - // ZoomAnchorPanel - // - ZoomAnchorPanel.BorderStyle = BorderStyle.FixedSingle; - ZoomAnchorPanel.Controls.Add(ZoomAanchorNWRadioButton); - ZoomAnchorPanel.Controls.Add(ZoomAanchorNRadioButton); - ZoomAnchorPanel.Controls.Add(ZoomAanchorNERadioButton); - ZoomAnchorPanel.Controls.Add(ZoomAanchorWRadioButton); - ZoomAnchorPanel.Controls.Add(ZoomAanchorSERadioButton); - ZoomAnchorPanel.Controls.Add(ZoomAanchorCRadioButton); - ZoomAnchorPanel.Controls.Add(ZoomAanchorSRadioButton); - ZoomAnchorPanel.Controls.Add(ZoomAanchorERadioButton); - ZoomAnchorPanel.Controls.Add(ZoomAanchorSWRadioButton); - ZoomAnchorPanel.Location = new Point(135, 104); - ZoomAnchorPanel.Margin = new Padding(5, 6, 5, 6); - ZoomAnchorPanel.Name = "ZoomAnchorPanel"; - ZoomAnchorPanel.Size = new Size(127, 139); - ZoomAnchorPanel.TabIndex = 38; - // - // ZoomAanchorNWRadioButton - // - ZoomAanchorNWRadioButton.AutoSize = true; - ZoomAanchorNWRadioButton.Location = new Point(5, 6); - ZoomAanchorNWRadioButton.Margin = new Padding(5, 6, 5, 6); - ZoomAanchorNWRadioButton.Name = "ZoomAanchorNWRadioButton"; - ZoomAanchorNWRadioButton.Size = new Size(21, 20); - ZoomAanchorNWRadioButton.TabIndex = 0; - ZoomAanchorNWRadioButton.TabStop = true; - ZoomAanchorNWRadioButton.UseVisualStyleBackColor = true; - ZoomAanchorNWRadioButton.CheckedChanged += OptionChanged_Handler; - // - // ZoomAanchorNRadioButton - // - ZoomAanchorNRadioButton.AutoSize = true; - ZoomAanchorNRadioButton.Location = new Point(52, 6); - ZoomAanchorNRadioButton.Margin = new Padding(5, 6, 5, 6); - ZoomAanchorNRadioButton.Name = "ZoomAanchorNRadioButton"; - ZoomAanchorNRadioButton.Size = new Size(21, 20); - ZoomAanchorNRadioButton.TabIndex = 1; - ZoomAanchorNRadioButton.TabStop = true; - ZoomAanchorNRadioButton.UseVisualStyleBackColor = true; - ZoomAanchorNRadioButton.CheckedChanged += OptionChanged_Handler; - // - // ZoomAanchorNERadioButton - // - ZoomAanchorNERadioButton.AutoSize = true; - ZoomAanchorNERadioButton.Location = new Point(98, 6); - ZoomAanchorNERadioButton.Margin = new Padding(5, 6, 5, 6); - ZoomAanchorNERadioButton.Name = "ZoomAanchorNERadioButton"; - ZoomAanchorNERadioButton.Size = new Size(21, 20); - ZoomAanchorNERadioButton.TabIndex = 2; - ZoomAanchorNERadioButton.TabStop = true; - ZoomAanchorNERadioButton.UseVisualStyleBackColor = true; - ZoomAanchorNERadioButton.CheckedChanged += OptionChanged_Handler; - // - // ZoomAanchorWRadioButton - // - ZoomAanchorWRadioButton.AutoSize = true; - ZoomAanchorWRadioButton.Location = new Point(5, 56); - ZoomAanchorWRadioButton.Margin = new Padding(5, 6, 5, 6); - ZoomAanchorWRadioButton.Name = "ZoomAanchorWRadioButton"; - ZoomAanchorWRadioButton.Size = new Size(21, 20); - ZoomAanchorWRadioButton.TabIndex = 3; - ZoomAanchorWRadioButton.TabStop = true; - ZoomAanchorWRadioButton.UseVisualStyleBackColor = true; - ZoomAanchorWRadioButton.CheckedChanged += OptionChanged_Handler; - // - // ZoomAanchorSERadioButton - // - ZoomAanchorSERadioButton.AutoSize = true; - ZoomAanchorSERadioButton.Location = new Point(98, 106); - ZoomAanchorSERadioButton.Margin = new Padding(5, 6, 5, 6); - ZoomAanchorSERadioButton.Name = "ZoomAanchorSERadioButton"; - ZoomAanchorSERadioButton.Size = new Size(21, 20); - ZoomAanchorSERadioButton.TabIndex = 8; - ZoomAanchorSERadioButton.TabStop = true; - ZoomAanchorSERadioButton.UseVisualStyleBackColor = true; - ZoomAanchorSERadioButton.CheckedChanged += OptionChanged_Handler; - // - // ZoomAanchorCRadioButton - // - ZoomAanchorCRadioButton.AutoSize = true; - ZoomAanchorCRadioButton.Location = new Point(52, 56); - ZoomAanchorCRadioButton.Margin = new Padding(5, 6, 5, 6); - ZoomAanchorCRadioButton.Name = "ZoomAanchorCRadioButton"; - ZoomAanchorCRadioButton.Size = new Size(21, 20); - ZoomAanchorCRadioButton.TabIndex = 4; - ZoomAanchorCRadioButton.TabStop = true; - ZoomAanchorCRadioButton.UseVisualStyleBackColor = true; - ZoomAanchorCRadioButton.CheckedChanged += OptionChanged_Handler; - // - // ZoomAanchorSRadioButton - // - ZoomAanchorSRadioButton.AutoSize = true; - ZoomAanchorSRadioButton.Location = new Point(52, 106); - ZoomAanchorSRadioButton.Margin = new Padding(5, 6, 5, 6); - ZoomAanchorSRadioButton.Name = "ZoomAanchorSRadioButton"; - ZoomAanchorSRadioButton.Size = new Size(21, 20); - ZoomAanchorSRadioButton.TabIndex = 7; - ZoomAanchorSRadioButton.TabStop = true; - ZoomAanchorSRadioButton.UseVisualStyleBackColor = true; - ZoomAanchorSRadioButton.CheckedChanged += OptionChanged_Handler; - // - // ZoomAanchorERadioButton - // - ZoomAanchorERadioButton.AutoSize = true; - ZoomAanchorERadioButton.Location = new Point(98, 56); - ZoomAanchorERadioButton.Margin = new Padding(5, 6, 5, 6); - ZoomAanchorERadioButton.Name = "ZoomAanchorERadioButton"; - ZoomAanchorERadioButton.Size = new Size(21, 20); - ZoomAanchorERadioButton.TabIndex = 5; - ZoomAanchorERadioButton.TabStop = true; - ZoomAanchorERadioButton.UseVisualStyleBackColor = true; - ZoomAanchorERadioButton.CheckedChanged += OptionChanged_Handler; - // - // ZoomAanchorSWRadioButton - // - ZoomAanchorSWRadioButton.AutoSize = true; - ZoomAanchorSWRadioButton.Location = new Point(5, 106); - ZoomAanchorSWRadioButton.Margin = new Padding(5, 6, 5, 6); - ZoomAanchorSWRadioButton.Name = "ZoomAanchorSWRadioButton"; - ZoomAanchorSWRadioButton.Size = new Size(21, 20); - ZoomAanchorSWRadioButton.TabIndex = 6; - ZoomAanchorSWRadioButton.TabStop = true; - ZoomAanchorSWRadioButton.UseVisualStyleBackColor = true; - ZoomAanchorSWRadioButton.CheckedChanged += OptionChanged_Handler; - // - // ZoomAnchorLabel - // - ZoomAnchorLabel.AutoSize = true; - ZoomAnchorLabel.Location = new Point(13, 110); - ZoomAnchorLabel.Margin = new Padding(5, 0, 5, 0); - ZoomAnchorLabel.Name = "ZoomAnchorLabel"; - ZoomAnchorLabel.Size = new Size(69, 25); - ZoomAnchorLabel.TabIndex = 40; - ZoomAnchorLabel.Text = "Anchor"; - // - // EnableThumbnailZoomCheckBox - // - EnableThumbnailZoomCheckBox.AutoSize = true; - EnableThumbnailZoomCheckBox.Checked = true; - EnableThumbnailZoomCheckBox.CheckState = CheckState.Checked; - EnableThumbnailZoomCheckBox.Location = new Point(13, 13); - EnableThumbnailZoomCheckBox.Margin = new Padding(5, 6, 5, 6); - EnableThumbnailZoomCheckBox.Name = "EnableThumbnailZoomCheckBox"; - EnableThumbnailZoomCheckBox.RightToLeft = RightToLeft.No; - EnableThumbnailZoomCheckBox.Size = new Size(162, 29); - EnableThumbnailZoomCheckBox.TabIndex = 36; - EnableThumbnailZoomCheckBox.Text = "Zoom on hover"; - EnableThumbnailZoomCheckBox.UseVisualStyleBackColor = true; - EnableThumbnailZoomCheckBox.CheckedChanged += OptionChanged_Handler; - // - // ThumbnailZoomFactorNumericEdit - // - ThumbnailZoomFactorNumericEdit.BackColor = SystemColors.Window; - ThumbnailZoomFactorNumericEdit.BorderStyle = BorderStyle.FixedSingle; - ThumbnailZoomFactorNumericEdit.Location = new Point(135, 60); - ThumbnailZoomFactorNumericEdit.Margin = new Padding(5, 6, 5, 6); - ThumbnailZoomFactorNumericEdit.Maximum = new decimal(new int[] { 10, 0, 0, 0 }); - ThumbnailZoomFactorNumericEdit.Minimum = new decimal(new int[] { 2, 0, 0, 0 }); - ThumbnailZoomFactorNumericEdit.Name = "ThumbnailZoomFactorNumericEdit"; - ThumbnailZoomFactorNumericEdit.Size = new Size(63, 31); - ThumbnailZoomFactorNumericEdit.TabIndex = 37; - ThumbnailZoomFactorNumericEdit.Value = new decimal(new int[] { 2, 0, 0, 0 }); - ThumbnailZoomFactorNumericEdit.ValueChanged += OptionChanged_Handler; - // - // OverlayTabPage - // - OverlayTabPage.BackColor = SystemColors.Control; - OverlayTabPage.Controls.Add(OverlaySettingsPanel); - OverlayTabPage.Location = new Point(124, 4); - OverlayTabPage.Margin = new Padding(5, 6, 5, 6); - OverlayTabPage.Name = "OverlayTabPage"; - OverlayTabPage.Size = new Size(522, 411); - OverlayTabPage.TabIndex = 3; - OverlayTabPage.Text = "Overlay"; - // - // OverlaySettingsPanel - // - OverlaySettingsPanel.BorderStyle = BorderStyle.FixedSingle; - OverlaySettingsPanel.Controls.Add(label3); - OverlaySettingsPanel.Controls.Add(label2); - OverlaySettingsPanel.Controls.Add(OverlayLabelColorButton); - OverlaySettingsPanel.Controls.Add(OverlayLabelSizeNumericEdit); - OverlaySettingsPanel.Controls.Add(panel1); - OverlaySettingsPanel.Controls.Add(label1); - OverlaySettingsPanel.Controls.Add(HighlightColorLabel); - OverlaySettingsPanel.Controls.Add(ActiveClientHighlightColorButton); - OverlaySettingsPanel.Controls.Add(EnableActiveClientHighlightCheckBox); - OverlaySettingsPanel.Controls.Add(ShowThumbnailOverlaysCheckBox); - OverlaySettingsPanel.Controls.Add(ShowThumbnailFramesCheckBox); - OverlaySettingsPanel.Dock = DockStyle.Fill; - OverlaySettingsPanel.Location = new Point(0, 0); - OverlaySettingsPanel.Margin = new Padding(5, 6, 5, 6); - OverlaySettingsPanel.Name = "OverlaySettingsPanel"; - OverlaySettingsPanel.Size = new Size(522, 411); - OverlaySettingsPanel.TabIndex = 25; - // - // label3 - // - label3.AutoSize = true; - label3.Location = new Point(8, 281); - label3.Margin = new Padding(5, 0, 5, 0); - label3.Name = "label3"; - label3.Size = new Size(75, 25); - label3.TabIndex = 43; - label3.Text = "Position"; - // - // label2 - // - label2.AutoSize = true; - label2.Location = new Point(8, 244); - label2.Margin = new Padding(5, 0, 5, 0); - label2.Name = "label2"; - label2.Size = new Size(55, 25); - label2.TabIndex = 42; - label2.Text = "Color"; - // - // OverlayLabelColorButton - // - OverlayLabelColorButton.BorderStyle = BorderStyle.FixedSingle; - OverlayLabelColorButton.Location = new Point(70, 242); - OverlayLabelColorButton.Margin = new Padding(5, 6, 5, 6); - OverlayLabelColorButton.Name = "OverlayLabelColorButton"; - OverlayLabelColorButton.Size = new Size(154, 31); - OverlayLabelColorButton.TabIndex = 41; - OverlayLabelColorButton.Click += OverlayLabelColorButton_Click; - // - // OverlayLabelSizeNumericEdit - // - OverlayLabelSizeNumericEdit.BackColor = SystemColors.Window; - OverlayLabelSizeNumericEdit.BorderStyle = BorderStyle.FixedSingle; - OverlayLabelSizeNumericEdit.CausesValidation = false; - OverlayLabelSizeNumericEdit.Location = new Point(145, 192); - OverlayLabelSizeNumericEdit.Margin = new Padding(5, 6, 5, 6); - OverlayLabelSizeNumericEdit.Maximum = new decimal(new int[] { 30, 0, 0, 0 }); - OverlayLabelSizeNumericEdit.Minimum = new decimal(new int[] { 5, 0, 0, 0 }); - OverlayLabelSizeNumericEdit.Name = "OverlayLabelSizeNumericEdit"; - OverlayLabelSizeNumericEdit.Size = new Size(80, 31); - OverlayLabelSizeNumericEdit.TabIndex = 40; - OverlayLabelSizeNumericEdit.Value = new decimal(new int[] { 30, 0, 0, 0 }); - OverlayLabelSizeNumericEdit.ValueChanged += OptionChanged_Handler; - // - // panel1 - // - panel1.BorderStyle = BorderStyle.FixedSingle; - panel1.Controls.Add(OverlayLabelNWRadioButton); - panel1.Controls.Add(OverlayLabelNRadioButton); - panel1.Controls.Add(OverlayLabelNERadioButton); - panel1.Controls.Add(OverlayLabelWRadioButton); - panel1.Controls.Add(OverlayLabelSERadioButton); - panel1.Controls.Add(OverlayLabelCRadioButton); - panel1.Controls.Add(OverlayLabelSRadioButton); - panel1.Controls.Add(OverlayLabelERadioButton); - panel1.Controls.Add(OverlayLabelSWRadioButton); - panel1.Location = new Point(120, 287); - panel1.Margin = new Padding(5, 6, 5, 6); - panel1.Name = "panel1"; - panel1.Size = new Size(104, 108); - panel1.TabIndex = 39; - // - // OverlayLabelNWRadioButton - // - OverlayLabelNWRadioButton.AutoSize = true; - OverlayLabelNWRadioButton.Location = new Point(5, 6); - OverlayLabelNWRadioButton.Margin = new Padding(5, 6, 5, 6); - OverlayLabelNWRadioButton.Name = "OverlayLabelNWRadioButton"; - OverlayLabelNWRadioButton.Size = new Size(21, 20); - OverlayLabelNWRadioButton.TabIndex = 0; - OverlayLabelNWRadioButton.TabStop = true; - OverlayLabelNWRadioButton.UseVisualStyleBackColor = true; - OverlayLabelNWRadioButton.CheckedChanged += OptionChanged_Handler; - // - // OverlayLabelNRadioButton - // - OverlayLabelNRadioButton.AutoSize = true; - OverlayLabelNRadioButton.Location = new Point(38, 6); - OverlayLabelNRadioButton.Margin = new Padding(5, 6, 5, 6); - OverlayLabelNRadioButton.Name = "OverlayLabelNRadioButton"; - OverlayLabelNRadioButton.Size = new Size(21, 20); - OverlayLabelNRadioButton.TabIndex = 1; - OverlayLabelNRadioButton.TabStop = true; - OverlayLabelNRadioButton.UseVisualStyleBackColor = true; - OverlayLabelNRadioButton.CheckedChanged += OptionChanged_Handler; - // - // OverlayLabelNERadioButton - // - OverlayLabelNERadioButton.AutoSize = true; - OverlayLabelNERadioButton.Location = new Point(72, 6); - OverlayLabelNERadioButton.Margin = new Padding(5, 6, 5, 6); - OverlayLabelNERadioButton.Name = "OverlayLabelNERadioButton"; - OverlayLabelNERadioButton.Size = new Size(21, 20); - OverlayLabelNERadioButton.TabIndex = 2; - OverlayLabelNERadioButton.TabStop = true; - OverlayLabelNERadioButton.UseVisualStyleBackColor = true; - OverlayLabelNERadioButton.CheckedChanged += OptionChanged_Handler; - // - // OverlayLabelWRadioButton - // - OverlayLabelWRadioButton.AutoSize = true; - OverlayLabelWRadioButton.Location = new Point(5, 42); - OverlayLabelWRadioButton.Margin = new Padding(5, 6, 5, 6); - OverlayLabelWRadioButton.Name = "OverlayLabelWRadioButton"; - OverlayLabelWRadioButton.Size = new Size(21, 20); - OverlayLabelWRadioButton.TabIndex = 3; - OverlayLabelWRadioButton.TabStop = true; - OverlayLabelWRadioButton.UseVisualStyleBackColor = true; - OverlayLabelWRadioButton.CheckedChanged += OptionChanged_Handler; - // - // OverlayLabelSERadioButton - // - OverlayLabelSERadioButton.AutoSize = true; - OverlayLabelSERadioButton.Location = new Point(72, 77); - OverlayLabelSERadioButton.Margin = new Padding(5, 6, 5, 6); - OverlayLabelSERadioButton.Name = "OverlayLabelSERadioButton"; - OverlayLabelSERadioButton.Size = new Size(21, 20); - OverlayLabelSERadioButton.TabIndex = 8; - OverlayLabelSERadioButton.TabStop = true; - OverlayLabelSERadioButton.UseVisualStyleBackColor = true; - OverlayLabelSERadioButton.CheckedChanged += OptionChanged_Handler; - // - // OverlayLabelCRadioButton - // - OverlayLabelCRadioButton.AutoSize = true; - OverlayLabelCRadioButton.Location = new Point(38, 42); - OverlayLabelCRadioButton.Margin = new Padding(5, 6, 5, 6); - OverlayLabelCRadioButton.Name = "OverlayLabelCRadioButton"; - OverlayLabelCRadioButton.Size = new Size(21, 20); - OverlayLabelCRadioButton.TabIndex = 4; - OverlayLabelCRadioButton.TabStop = true; - OverlayLabelCRadioButton.UseVisualStyleBackColor = true; - OverlayLabelCRadioButton.CheckedChanged += OptionChanged_Handler; - // - // OverlayLabelSRadioButton - // - OverlayLabelSRadioButton.AutoSize = true; - OverlayLabelSRadioButton.Location = new Point(38, 77); - OverlayLabelSRadioButton.Margin = new Padding(5, 6, 5, 6); - OverlayLabelSRadioButton.Name = "OverlayLabelSRadioButton"; - OverlayLabelSRadioButton.Size = new Size(21, 20); - OverlayLabelSRadioButton.TabIndex = 7; - OverlayLabelSRadioButton.TabStop = true; - OverlayLabelSRadioButton.UseVisualStyleBackColor = true; - OverlayLabelSRadioButton.CheckedChanged += OptionChanged_Handler; - // - // OverlayLabelERadioButton - // - OverlayLabelERadioButton.AutoSize = true; - OverlayLabelERadioButton.Location = new Point(72, 42); - OverlayLabelERadioButton.Margin = new Padding(5, 6, 5, 6); - OverlayLabelERadioButton.Name = "OverlayLabelERadioButton"; - OverlayLabelERadioButton.Size = new Size(21, 20); - OverlayLabelERadioButton.TabIndex = 5; - OverlayLabelERadioButton.TabStop = true; - OverlayLabelERadioButton.UseVisualStyleBackColor = true; - OverlayLabelERadioButton.CheckedChanged += OptionChanged_Handler; - // - // OverlayLabelSWRadioButton - // - OverlayLabelSWRadioButton.AutoSize = true; - OverlayLabelSWRadioButton.Location = new Point(5, 77); - OverlayLabelSWRadioButton.Margin = new Padding(5, 6, 5, 6); - OverlayLabelSWRadioButton.Name = "OverlayLabelSWRadioButton"; - OverlayLabelSWRadioButton.Size = new Size(21, 20); - OverlayLabelSWRadioButton.TabIndex = 6; - OverlayLabelSWRadioButton.TabStop = true; - OverlayLabelSWRadioButton.UseVisualStyleBackColor = true; - OverlayLabelSWRadioButton.CheckedChanged += OptionChanged_Handler; - // - // label1 - // - label1.AutoSize = true; - label1.Location = new Point(8, 196); - label1.Margin = new Padding(5, 0, 5, 0); - label1.Name = "label1"; - label1.Size = new Size(89, 25); - label1.TabIndex = 30; - label1.Text = "Label Size"; - // - // HighlightColorLabel - // - HighlightColorLabel.AutoSize = true; - HighlightColorLabel.Location = new Point(8, 150); - HighlightColorLabel.Margin = new Padding(5, 0, 5, 0); - HighlightColorLabel.Name = "HighlightColorLabel"; - HighlightColorLabel.Size = new Size(55, 25); - HighlightColorLabel.TabIndex = 29; - HighlightColorLabel.Text = "Color"; - // - // ActiveClientHighlightColorButton - // - ActiveClientHighlightColorButton.BorderStyle = BorderStyle.FixedSingle; - ActiveClientHighlightColorButton.Location = new Point(70, 148); - ActiveClientHighlightColorButton.Margin = new Padding(5, 6, 5, 6); - ActiveClientHighlightColorButton.Name = "ActiveClientHighlightColorButton"; - ActiveClientHighlightColorButton.Size = new Size(154, 31); - ActiveClientHighlightColorButton.TabIndex = 28; - ActiveClientHighlightColorButton.Click += ActiveClientHighlightColorButton_Click; - // - // EnableActiveClientHighlightCheckBox - // - EnableActiveClientHighlightCheckBox.AutoSize = true; - EnableActiveClientHighlightCheckBox.Checked = true; - EnableActiveClientHighlightCheckBox.CheckState = CheckState.Checked; - EnableActiveClientHighlightCheckBox.Location = new Point(13, 106); - EnableActiveClientHighlightCheckBox.Margin = new Padding(5, 6, 5, 6); - EnableActiveClientHighlightCheckBox.Name = "EnableActiveClientHighlightCheckBox"; - EnableActiveClientHighlightCheckBox.RightToLeft = RightToLeft.No; - EnableActiveClientHighlightCheckBox.Size = new Size(207, 29); - EnableActiveClientHighlightCheckBox.TabIndex = 27; - EnableActiveClientHighlightCheckBox.Text = "Highlight active client"; - EnableActiveClientHighlightCheckBox.UseVisualStyleBackColor = true; - EnableActiveClientHighlightCheckBox.CheckedChanged += OptionChanged_Handler; - // - // ShowThumbnailOverlaysCheckBox - // - ShowThumbnailOverlaysCheckBox.AutoSize = true; - ShowThumbnailOverlaysCheckBox.Checked = true; - ShowThumbnailOverlaysCheckBox.CheckState = CheckState.Checked; - ShowThumbnailOverlaysCheckBox.Location = new Point(13, 13); - ShowThumbnailOverlaysCheckBox.Margin = new Padding(5, 6, 5, 6); - ShowThumbnailOverlaysCheckBox.Name = "ShowThumbnailOverlaysCheckBox"; - ShowThumbnailOverlaysCheckBox.RightToLeft = RightToLeft.No; - ShowThumbnailOverlaysCheckBox.Size = new Size(144, 29); - ShowThumbnailOverlaysCheckBox.TabIndex = 25; - ShowThumbnailOverlaysCheckBox.Text = "Show overlay"; - ShowThumbnailOverlaysCheckBox.UseVisualStyleBackColor = true; - ShowThumbnailOverlaysCheckBox.CheckedChanged += OptionChanged_Handler; - // - // ShowThumbnailFramesCheckBox - // - ShowThumbnailFramesCheckBox.AutoSize = true; - ShowThumbnailFramesCheckBox.Checked = true; - ShowThumbnailFramesCheckBox.CheckState = CheckState.Checked; - ShowThumbnailFramesCheckBox.Location = new Point(13, 60); - ShowThumbnailFramesCheckBox.Margin = new Padding(5, 6, 5, 6); - ShowThumbnailFramesCheckBox.Name = "ShowThumbnailFramesCheckBox"; - ShowThumbnailFramesCheckBox.RightToLeft = RightToLeft.No; - ShowThumbnailFramesCheckBox.Size = new Size(141, 29); - ShowThumbnailFramesCheckBox.TabIndex = 26; - ShowThumbnailFramesCheckBox.Text = "Show frames"; - ShowThumbnailFramesCheckBox.UseVisualStyleBackColor = true; - ShowThumbnailFramesCheckBox.CheckedChanged += OptionChanged_Handler; - // - // ClientsTabPage - // - ClientsTabPage.BackColor = SystemColors.Control; - ClientsTabPage.Controls.Add(ClientsPanel); - ClientsTabPage.Location = new Point(124, 4); - ClientsTabPage.Margin = new Padding(5, 6, 5, 6); - ClientsTabPage.Name = "ClientsTabPage"; - ClientsTabPage.Size = new Size(522, 411); - ClientsTabPage.TabIndex = 4; - ClientsTabPage.Text = "Active Clients"; - // - // ClientsPanel - // - ClientsPanel.BorderStyle = BorderStyle.FixedSingle; - ClientsPanel.Controls.Add(ThumbnailsList); - ClientsPanel.Controls.Add(ThumbnailsListLabel); - ClientsPanel.Dock = DockStyle.Fill; - ClientsPanel.Location = new Point(0, 0); - ClientsPanel.Margin = new Padding(5, 6, 5, 6); - ClientsPanel.Name = "ClientsPanel"; - ClientsPanel.Size = new Size(522, 411); - ClientsPanel.TabIndex = 32; - // - // ThumbnailsList - // - ThumbnailsList.BackColor = SystemColors.Window; - ThumbnailsList.BorderStyle = BorderStyle.FixedSingle; - ThumbnailsList.CheckOnClick = true; - ThumbnailsList.Dock = DockStyle.Bottom; - ThumbnailsList.FormattingEnabled = true; - ThumbnailsList.IntegralHeight = false; - ThumbnailsList.Location = new Point(0, 65); - ThumbnailsList.Margin = new Padding(5, 6, 5, 6); - ThumbnailsList.Name = "ThumbnailsList"; - ThumbnailsList.Size = new Size(520, 344); - ThumbnailsList.TabIndex = 34; - ThumbnailsList.ItemCheck += ThumbnailsList_ItemCheck_Handler; - // - // ThumbnailsListLabel - // - ThumbnailsListLabel.AutoSize = true; - ThumbnailsListLabel.Location = new Point(13, 17); - ThumbnailsListLabel.Margin = new Padding(5, 0, 5, 0); - ThumbnailsListLabel.Name = "ThumbnailsListLabel"; - ThumbnailsListLabel.Size = new Size(268, 25); - ThumbnailsListLabel.TabIndex = 33; - ThumbnailsListLabel.Text = "Thumbnails (check to force hide)"; - // - // AboutTabPage - // - AboutTabPage.BackColor = SystemColors.Control; - AboutTabPage.Controls.Add(AboutPanel); - AboutTabPage.Location = new Point(124, 4); - AboutTabPage.Margin = new Padding(5, 6, 5, 6); - AboutTabPage.Name = "AboutTabPage"; - AboutTabPage.Size = new Size(522, 411); - AboutTabPage.TabIndex = 5; - AboutTabPage.Text = "About"; - // - // AboutPanel - // - AboutPanel.BackColor = Color.Transparent; - AboutPanel.BorderStyle = BorderStyle.FixedSingle; - AboutPanel.Controls.Add(CreditMaintLabel); - AboutPanel.Controls.Add(DocumentationLinkLabel); - AboutPanel.Controls.Add(DescriptionLabel); - AboutPanel.Controls.Add(VersionLabel); - AboutPanel.Controls.Add(NameLabel); - AboutPanel.Controls.Add(DocumentationLink); - AboutPanel.Dock = DockStyle.Fill; - AboutPanel.Location = new Point(0, 0); - AboutPanel.Margin = new Padding(5, 6, 5, 6); - AboutPanel.Name = "AboutPanel"; - AboutPanel.Size = new Size(522, 411); - AboutPanel.TabIndex = 2; - // - // CreditMaintLabel - // - CreditMaintLabel.AutoSize = true; - CreditMaintLabel.Location = new Point(0, 275); - CreditMaintLabel.Margin = new Padding(5, 0, 5, 0); - CreditMaintLabel.Name = "CreditMaintLabel"; - CreditMaintLabel.Padding = new Padding(13, 6, 13, 6); - CreditMaintLabel.Size = new Size(435, 37); - CreditMaintLabel.TabIndex = 7; - CreditMaintLabel.Text = "Credit to previous maintainer: Phrynohyas Tig-Rah"; - // - // DocumentationLinkLabel - // - DocumentationLinkLabel.AutoSize = true; - DocumentationLinkLabel.Location = new Point(0, 313); - DocumentationLinkLabel.Margin = new Padding(5, 0, 5, 0); - DocumentationLinkLabel.Name = "DocumentationLinkLabel"; - DocumentationLinkLabel.Padding = new Padding(13, 6, 13, 6); - DocumentationLinkLabel.Size = new Size(389, 37); - DocumentationLinkLabel.TabIndex = 6; - DocumentationLinkLabel.Text = "For more information visit the forum thread:"; - // - // DescriptionLabel - // - DescriptionLabel.BackColor = Color.Transparent; - DescriptionLabel.Location = new Point(0, 56); - DescriptionLabel.Margin = new Padding(5, 0, 5, 0); - DescriptionLabel.Name = "DescriptionLabel"; - DescriptionLabel.Padding = new Padding(13, 6, 13, 6); - DescriptionLabel.Size = new Size(435, 279); - DescriptionLabel.TabIndex = 5; - DescriptionLabel.Text = resources.GetString("DescriptionLabel.Text"); - // - // VersionLabel - // - VersionLabel.AutoSize = true; - VersionLabel.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point, 204); - VersionLabel.Location = new Point(222, 17); - VersionLabel.Margin = new Padding(5, 0, 5, 0); - VersionLabel.Name = "VersionLabel"; - VersionLabel.Size = new Size(69, 29); - VersionLabel.TabIndex = 4; - VersionLabel.Text = "1.0.0"; - // - // NameLabel - // - NameLabel.AutoSize = true; - NameLabel.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point, 204); - NameLabel.Location = new Point(7, 17); - NameLabel.Margin = new Padding(5, 0, 5, 0); - NameLabel.Name = "NameLabel"; - NameLabel.Size = new Size(195, 29); - NameLabel.TabIndex = 3; - NameLabel.Text = "EVE-O-Preview"; - // - // DocumentationLink - // - DocumentationLink.Location = new Point(0, 340); - DocumentationLink.Margin = new Padding(50, 6, 5, 6); - DocumentationLink.Name = "DocumentationLink"; - DocumentationLink.Padding = new Padding(13, 6, 13, 6); - DocumentationLink.Size = new Size(437, 63); - DocumentationLink.TabIndex = 2; - DocumentationLink.TabStop = true; - DocumentationLink.Text = "to be set from prresenter to be set from prresenter to be set from prresenter to be set from prresenter"; - DocumentationLink.LinkClicked += DocumentationLinkClicked_Handler; - // - // NotifyIcon - // - NotifyIcon.ContextMenuStrip = TrayMenu; - NotifyIcon.Icon = (Icon)resources.GetObject("NotifyIcon.Icon"); - NotifyIcon.Text = "EVE-O-Preview"; - NotifyIcon.Visible = true; - NotifyIcon.MouseDoubleClick += RestoreMainForm_Handler; - // - // TrayMenu - // - TrayMenu.ImageScalingSize = new Size(24, 24); - TrayMenu.Items.AddRange(new ToolStripItem[] { TitleMenuItem, RestoreWindowMenuItem, SeparatorMenuItem, ExitMenuItem }); - TrayMenu.Name = "contextMenuStrip1"; - TrayMenu.Size = new Size(202, 106); - // - // MainForm - // - AutoScaleDimensions = new SizeF(10F, 25F); - AutoScaleMode = AutoScaleMode.Font; - BackColor = SystemColors.Control; - ClientSize = new Size(650, 419); - Controls.Add(ContentTabControl); - FormBorderStyle = FormBorderStyle.FixedSingle; - Icon = (Icon)resources.GetObject("$this.Icon"); - Margin = new Padding(0); - MaximizeBox = false; - Name = "MainForm"; - Text = "EVE-O-Preview"; - TopMost = true; - FormClosing += MainFormClosing_Handler; - Load += MainFormResize_Handler; - Resize += MainFormResize_Handler; - ContentTabControl.ResumeLayout(false); - GeneralTabPage.ResumeLayout(false); - GeneralSettingsPanel.ResumeLayout(false); - GeneralSettingsPanel.PerformLayout(); - ThumbnailTabPage.ResumeLayout(false); - ThumbnailSettingsPanel.ResumeLayout(false); - ThumbnailSettingsPanel.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)ThumbnailSnapToGridSizeYNumericEdit).EndInit(); - ((System.ComponentModel.ISupportInitialize)ThumbnailSnapToGridSizeXNumericEdit).EndInit(); - ((System.ComponentModel.ISupportInitialize)ThumbnailsWidthNumericEdit).EndInit(); - ((System.ComponentModel.ISupportInitialize)ThumbnailsHeightNumericEdit).EndInit(); - ((System.ComponentModel.ISupportInitialize)ThumbnailOpacityTrackBar).EndInit(); - ZoomTabPage.ResumeLayout(false); - ZoomSettingsPanel.ResumeLayout(false); - ZoomSettingsPanel.PerformLayout(); - ZoomAnchorPanel.ResumeLayout(false); - ZoomAnchorPanel.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)ThumbnailZoomFactorNumericEdit).EndInit(); - OverlayTabPage.ResumeLayout(false); - OverlaySettingsPanel.ResumeLayout(false); - OverlaySettingsPanel.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)OverlayLabelSizeNumericEdit).EndInit(); - panel1.ResumeLayout(false); - panel1.PerformLayout(); - ClientsTabPage.ResumeLayout(false); - ClientsPanel.ResumeLayout(false); - ClientsPanel.PerformLayout(); - AboutTabPage.ResumeLayout(false); - AboutPanel.ResumeLayout(false); - AboutPanel.PerformLayout(); - TrayMenu.ResumeLayout(false); - ResumeLayout(false); + /// s + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + components = new System.ComponentModel.Container(); + ToolStripMenuItem RestoreWindowMenuItem; + ToolStripMenuItem ExitMenuItem; + ToolStripMenuItem TitleMenuItem; + ToolStripSeparator SeparatorMenuItem; + TabControl ContentTabControl; + TabPage GeneralTabPage; + Panel GeneralSettingsPanel; + Label label4; + TabPage ThumbnailTabPage; + Panel ThumbnailSettingsPanel; + Label HeigthLabel; + Label WidthLabel; + Label OpacityLabel; + Panel ZoomSettingsPanel; + Label ZoomFactorLabel; + Label ZoomAnchorLabel; + TabPage OverlayTabPage; + Panel OverlaySettingsPanel; + TabPage ClientsTabPage; + Panel ClientsPanel; + Label ThumbnailsListLabel; + TabPage AboutTabPage; + Panel AboutPanel; + Label CreditMaintLabel; + Label DocumentationLinkLabel; + Label DescriptionLabel; + System.ComponentModel.ComponentResourceManager resources = + new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); + Label NameLabel; + AnimationStyleCombo = new ComboBox(); + MinimizeInactiveClientsCheckBox = new CheckBox(); + EnableClientLayoutTrackingCheckBox = new CheckBox(); + HideActiveClientThumbnailCheckBox = new CheckBox(); + ShowThumbnailsAlwaysOnTopCheckBox = new CheckBox(); + HideThumbnailsOnLostFocusCheckBox = new CheckBox(); + EnablePerClientThumbnailsLayoutsCheckBox = new CheckBox(); + MinimizeToTrayCheckBox = new CheckBox(); + ThumbnailSnapToGridCheckBox = new CheckBox(); + ThumbnailSnapToGridSizeYNumericEdit = new NumericUpDown(); + SnapYLabel = new Label(); + ThumbnailSnapToGridSizeXNumericEdit = new NumericUpDown(); + SnapXLabel = new Label(); + LockThumbnailLocationCheckbox = new CheckBox(); + ThumbnailsWidthNumericEdit = new NumericUpDown(); + ThumbnailsHeightNumericEdit = new NumericUpDown(); + ThumbnailOpacityTrackBar = new TrackBar(); + ZoomTabPage = new TabPage(); + ZoomAnchorPanel = new Panel(); + ZoomAanchorNWRadioButton = new RadioButton(); + ZoomAanchorNRadioButton = new RadioButton(); + ZoomAanchorNERadioButton = new RadioButton(); + ZoomAanchorWRadioButton = new RadioButton(); + ZoomAanchorSERadioButton = new RadioButton(); + ZoomAanchorCRadioButton = new RadioButton(); + ZoomAanchorSRadioButton = new RadioButton(); + ZoomAanchorERadioButton = new RadioButton(); + ZoomAanchorSWRadioButton = new RadioButton(); + EnableThumbnailZoomCheckBox = new CheckBox(); + ThumbnailZoomFactorNumericEdit = new NumericUpDown(); + label3 = new Label(); + label2 = new Label(); + OverlayLabelColorButton = new Panel(); + OverlayLabelSizeNumericEdit = new NumericUpDown(); + panel1 = new Panel(); + OverlayLabelNWRadioButton = new RadioButton(); + OverlayLabelNRadioButton = new RadioButton(); + OverlayLabelNERadioButton = new RadioButton(); + OverlayLabelWRadioButton = new RadioButton(); + OverlayLabelSERadioButton = new RadioButton(); + OverlayLabelCRadioButton = new RadioButton(); + OverlayLabelSRadioButton = new RadioButton(); + OverlayLabelERadioButton = new RadioButton(); + OverlayLabelSWRadioButton = new RadioButton(); + label1 = new Label(); + HighlightColorLabel = new Label(); + ActiveClientHighlightColorButton = new Panel(); + EnableActiveClientHighlightCheckBox = new CheckBox(); + ShowThumbnailOverlaysCheckBox = new CheckBox(); + ShowThumbnailFramesCheckBox = new CheckBox(); + EnableThumbnailRegionSnippingCheckBox = new CheckBox(); + RegionLeftNumericEdit = new NumericUpDown(); + RegionTopNumericEdit = new NumericUpDown(); + RegionWidthNumericEdit = new NumericUpDown(); + RegionHeightNumericEdit = new NumericUpDown(); + RegionLeftLabel = new Label(); + RegionTopLabel = new Label(); + RegionWidthLabel = new Label(); + RegionHeightLabel = new Label(); + PickRegionButton = new Button(); + ProfileComboBox = new ComboBox(); + SaveProfileButton = new Button(); + DeleteProfileButton = new Button(); + ProfileLabel = new Label(); + ThumbnailsList = new CheckedListBox(); + VersionLabel = new Label(); + DocumentationLink = new LinkLabel(); + NotifyIcon = new NotifyIcon(components); + TrayMenu = new ContextMenuStrip(components); + RestoreWindowMenuItem = new ToolStripMenuItem(); + ExitMenuItem = new ToolStripMenuItem(); + TitleMenuItem = new ToolStripMenuItem(); + SeparatorMenuItem = new ToolStripSeparator(); + ContentTabControl = new TabControl(); + GeneralTabPage = new TabPage(); + GeneralSettingsPanel = new Panel(); + label4 = new Label(); + ThumbnailTabPage = new TabPage(); + ThumbnailSettingsPanel = new Panel(); + HeigthLabel = new Label(); + WidthLabel = new Label(); + OpacityLabel = new Label(); + ZoomSettingsPanel = new Panel(); + ZoomFactorLabel = new Label(); + ZoomAnchorLabel = new Label(); + OverlayTabPage = new TabPage(); + OverlaySettingsPanel = new Panel(); + ClientsTabPage = new TabPage(); + ClientsPanel = new Panel(); + ThumbnailsListLabel = new Label(); + AboutTabPage = new TabPage(); + AboutPanel = new Panel(); + CreditMaintLabel = new Label(); + DocumentationLinkLabel = new Label(); + DescriptionLabel = new Label(); + NameLabel = new Label(); + ContentTabControl.SuspendLayout(); + GeneralTabPage.SuspendLayout(); + GeneralSettingsPanel.SuspendLayout(); + ThumbnailTabPage.SuspendLayout(); + ThumbnailSettingsPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)ThumbnailSnapToGridSizeYNumericEdit).BeginInit(); + ((System.ComponentModel.ISupportInitialize)ThumbnailSnapToGridSizeXNumericEdit).BeginInit(); + ((System.ComponentModel.ISupportInitialize)ThumbnailsWidthNumericEdit).BeginInit(); + ((System.ComponentModel.ISupportInitialize)ThumbnailsHeightNumericEdit).BeginInit(); + ((System.ComponentModel.ISupportInitialize)ThumbnailOpacityTrackBar).BeginInit(); + ZoomTabPage.SuspendLayout(); + ZoomSettingsPanel.SuspendLayout(); + ZoomAnchorPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)ThumbnailZoomFactorNumericEdit).BeginInit(); + OverlayTabPage.SuspendLayout(); + OverlaySettingsPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)OverlayLabelSizeNumericEdit).BeginInit(); + panel1.SuspendLayout(); + ClientsTabPage.SuspendLayout(); + ClientsPanel.SuspendLayout(); + AboutTabPage.SuspendLayout(); + AboutPanel.SuspendLayout(); + TrayMenu.SuspendLayout(); + SuspendLayout(); + // + // RestoreWindowMenuItem + // + RestoreWindowMenuItem.Name = "RestoreWindowMenuItem"; + RestoreWindowMenuItem.Size = new Size(201, 32); + RestoreWindowMenuItem.Text = "Restore"; + RestoreWindowMenuItem.Click += RestoreMainForm_Handler; + // + // ExitMenuItem + // + ExitMenuItem.Name = "ExitMenuItem"; + ExitMenuItem.Size = new Size(201, 32); + ExitMenuItem.Text = "Exit"; + ExitMenuItem.Click += ExitMenuItemClick_Handler; + // + // TitleMenuItem + // + TitleMenuItem.Enabled = false; + TitleMenuItem.Name = "TitleMenuItem"; + TitleMenuItem.Size = new Size(201, 32); + TitleMenuItem.Text = "EVE-O-Preview"; + // + // SeparatorMenuItem + // + SeparatorMenuItem.Name = "SeparatorMenuItem"; + SeparatorMenuItem.Size = new Size(198, 6); + // + // ContentTabControl + // + ContentTabControl.Alignment = TabAlignment.Left; + ContentTabControl.Controls.Add(GeneralTabPage); + ContentTabControl.Controls.Add(ThumbnailTabPage); + ContentTabControl.Controls.Add(ZoomTabPage); + ContentTabControl.Controls.Add(OverlayTabPage); + ContentTabControl.Controls.Add(ClientsTabPage); + ContentTabControl.Controls.Add(AboutTabPage); + ContentTabControl.Dock = DockStyle.Fill; + ContentTabControl.DrawMode = TabDrawMode.OwnerDrawFixed; + ContentTabControl.ItemSize = new Size(35, 120); + ContentTabControl.Location = new Point(0, 0); + ContentTabControl.Margin = new Padding(5, 6, 5, 6); + ContentTabControl.Multiline = true; + ContentTabControl.Name = "ContentTabControl"; + ContentTabControl.SelectedIndex = 0; + ContentTabControl.Size = new Size(650, 419); + ContentTabControl.SizeMode = TabSizeMode.Fixed; + ContentTabControl.TabIndex = 6; + ContentTabControl.DrawItem += ContentTabControl_DrawItem; + // + // GeneralTabPage + // + GeneralTabPage.BackColor = SystemColors.Control; + GeneralTabPage.Controls.Add(GeneralSettingsPanel); + GeneralTabPage.Location = new Point(124, 4); + GeneralTabPage.Margin = new Padding(5, 6, 5, 6); + GeneralTabPage.Name = "GeneralTabPage"; + GeneralTabPage.Padding = new Padding(5, 6, 5, 6); + GeneralTabPage.Size = new Size(522, 411); + GeneralTabPage.TabIndex = 0; + GeneralTabPage.Text = "General"; + // + // GeneralSettingsPanel + // + GeneralSettingsPanel.BorderStyle = BorderStyle.FixedSingle; + GeneralSettingsPanel.Controls.Add(label4); + GeneralSettingsPanel.Controls.Add(AnimationStyleCombo); + GeneralSettingsPanel.Controls.Add(MinimizeInactiveClientsCheckBox); + GeneralSettingsPanel.Controls.Add(EnableClientLayoutTrackingCheckBox); + GeneralSettingsPanel.Controls.Add(HideActiveClientThumbnailCheckBox); + GeneralSettingsPanel.Controls.Add(ShowThumbnailsAlwaysOnTopCheckBox); + GeneralSettingsPanel.Controls.Add(HideThumbnailsOnLostFocusCheckBox); + GeneralSettingsPanel.Controls.Add(EnablePerClientThumbnailsLayoutsCheckBox); + GeneralSettingsPanel.Controls.Add(MinimizeToTrayCheckBox); + GeneralSettingsPanel.Dock = DockStyle.Fill; + GeneralSettingsPanel.Location = new Point(5, 6); + GeneralSettingsPanel.Margin = new Padding(5, 6, 5, 6); + GeneralSettingsPanel.Name = "GeneralSettingsPanel"; + GeneralSettingsPanel.Size = new Size(512, 399); + GeneralSettingsPanel.TabIndex = 18; + GeneralSettingsPanel.Paint += GeneralSettingsPanel_Paint; + // + // label4 + // + label4.AutoSize = true; + label4.Location = new Point(8, 192); + label4.Margin = new Padding(5, 0, 5, 0); + label4.Name = "label4"; + label4.Size = new Size(136, 25); + label4.TabIndex = 27; + label4.Text = "Animation Style"; + // + // AnimationStyleCombo + // + AnimationStyleCombo.DropDownStyle = ComboBoxStyle.DropDownList; + AnimationStyleCombo.FormattingEnabled = true; + AnimationStyleCombo.Location = new Point(150, 187); + AnimationStyleCombo.Margin = new Padding(5, 6, 5, 6); + AnimationStyleCombo.Name = "AnimationStyleCombo"; + AnimationStyleCombo.Size = new Size(251, 33); + AnimationStyleCombo.TabIndex = 26; + AnimationStyleCombo.SelectedIndexChanged += OptionChanged_Handler; + // + // MinimizeInactiveClientsCheckBox + // + MinimizeInactiveClientsCheckBox.AutoSize = true; + MinimizeInactiveClientsCheckBox.Location = new Point(13, 150); + MinimizeInactiveClientsCheckBox.Margin = new Padding(5, 6, 5, 6); + MinimizeInactiveClientsCheckBox.Name = "MinimizeInactiveClientsCheckBox"; + MinimizeInactiveClientsCheckBox.Size = new Size(261, 29); + MinimizeInactiveClientsCheckBox.TabIndex = 24; + MinimizeInactiveClientsCheckBox.Text = "Minimize inactive EVE clients"; + MinimizeInactiveClientsCheckBox.UseVisualStyleBackColor = true; + MinimizeInactiveClientsCheckBox.CheckedChanged += OptionChanged_Handler; + // + // EnableClientLayoutTrackingCheckBox + // + EnableClientLayoutTrackingCheckBox.AutoSize = true; + EnableClientLayoutTrackingCheckBox.Location = new Point(13, 60); + EnableClientLayoutTrackingCheckBox.Margin = new Padding(5, 6, 5, 6); + EnableClientLayoutTrackingCheckBox.Name = "EnableClientLayoutTrackingCheckBox"; + EnableClientLayoutTrackingCheckBox.Size = new Size(199, 29); + EnableClientLayoutTrackingCheckBox.TabIndex = 19; + EnableClientLayoutTrackingCheckBox.Text = "Track client locations"; + EnableClientLayoutTrackingCheckBox.UseVisualStyleBackColor = true; + EnableClientLayoutTrackingCheckBox.CheckedChanged += OptionChanged_Handler; + // + // HideActiveClientThumbnailCheckBox + // + HideActiveClientThumbnailCheckBox.AutoSize = true; + HideActiveClientThumbnailCheckBox.Checked = true; + HideActiveClientThumbnailCheckBox.CheckState = CheckState.Checked; + HideActiveClientThumbnailCheckBox.Location = new Point(13, 106); + HideActiveClientThumbnailCheckBox.Margin = new Padding(5, 6, 5, 6); + HideActiveClientThumbnailCheckBox.Name = "HideActiveClientThumbnailCheckBox"; + HideActiveClientThumbnailCheckBox.Size = new Size(293, 29); + HideActiveClientThumbnailCheckBox.TabIndex = 20; + HideActiveClientThumbnailCheckBox.Text = "Hide preview of active EVE client"; + HideActiveClientThumbnailCheckBox.UseVisualStyleBackColor = true; + HideActiveClientThumbnailCheckBox.CheckedChanged += OptionChanged_Handler; + // + // ShowThumbnailsAlwaysOnTopCheckBox + // + ShowThumbnailsAlwaysOnTopCheckBox.AutoSize = true; + ShowThumbnailsAlwaysOnTopCheckBox.Checked = true; + ShowThumbnailsAlwaysOnTopCheckBox.CheckState = CheckState.Checked; + ShowThumbnailsAlwaysOnTopCheckBox.Location = new Point(13, 238); + ShowThumbnailsAlwaysOnTopCheckBox.Margin = new Padding(5, 6, 5, 6); + ShowThumbnailsAlwaysOnTopCheckBox.Name = "ShowThumbnailsAlwaysOnTopCheckBox"; + ShowThumbnailsAlwaysOnTopCheckBox.RightToLeft = RightToLeft.No; + ShowThumbnailsAlwaysOnTopCheckBox.Size = new Size(222, 29); + ShowThumbnailsAlwaysOnTopCheckBox.TabIndex = 21; + ShowThumbnailsAlwaysOnTopCheckBox.Text = "Previews always on top"; + ShowThumbnailsAlwaysOnTopCheckBox.UseVisualStyleBackColor = true; + ShowThumbnailsAlwaysOnTopCheckBox.CheckedChanged += OptionChanged_Handler; + // + // HideThumbnailsOnLostFocusCheckBox + // + HideThumbnailsOnLostFocusCheckBox.AutoSize = true; + HideThumbnailsOnLostFocusCheckBox.Checked = true; + HideThumbnailsOnLostFocusCheckBox.CheckState = CheckState.Checked; + HideThumbnailsOnLostFocusCheckBox.Location = new Point(13, 285); + HideThumbnailsOnLostFocusCheckBox.Margin = new Padding(5, 6, 5, 6); + HideThumbnailsOnLostFocusCheckBox.Name = "HideThumbnailsOnLostFocusCheckBox"; + HideThumbnailsOnLostFocusCheckBox.Size = new Size(375, 29); + HideThumbnailsOnLostFocusCheckBox.TabIndex = 22; + HideThumbnailsOnLostFocusCheckBox.Text = "Hide previews when EVE client is not active"; + HideThumbnailsOnLostFocusCheckBox.UseVisualStyleBackColor = true; + HideThumbnailsOnLostFocusCheckBox.CheckedChanged += OptionChanged_Handler; + // + // EnablePerClientThumbnailsLayoutsCheckBox + // + EnablePerClientThumbnailsLayoutsCheckBox.AutoSize = true; + EnablePerClientThumbnailsLayoutsCheckBox.Checked = true; + EnablePerClientThumbnailsLayoutsCheckBox.CheckState = CheckState.Checked; + EnablePerClientThumbnailsLayoutsCheckBox.Location = new Point(13, 331); + EnablePerClientThumbnailsLayoutsCheckBox.Margin = new Padding(5, 6, 5, 6); + EnablePerClientThumbnailsLayoutsCheckBox.Name = "EnablePerClientThumbnailsLayoutsCheckBox"; + EnablePerClientThumbnailsLayoutsCheckBox.Size = new Size(297, 29); + EnablePerClientThumbnailsLayoutsCheckBox.TabIndex = 23; + EnablePerClientThumbnailsLayoutsCheckBox.Text = "Unique layout for each EVE client"; + EnablePerClientThumbnailsLayoutsCheckBox.UseVisualStyleBackColor = true; + EnablePerClientThumbnailsLayoutsCheckBox.CheckedChanged += OptionChanged_Handler; + // + // MinimizeToTrayCheckBox + // + MinimizeToTrayCheckBox.AutoSize = true; + MinimizeToTrayCheckBox.Location = new Point(13, 13); + MinimizeToTrayCheckBox.Margin = new Padding(5, 6, 5, 6); + MinimizeToTrayCheckBox.Name = "MinimizeToTrayCheckBox"; + MinimizeToTrayCheckBox.Size = new Size(229, 29); + MinimizeToTrayCheckBox.TabIndex = 18; + MinimizeToTrayCheckBox.Text = "Minimize to System Tray"; + MinimizeToTrayCheckBox.UseVisualStyleBackColor = true; + MinimizeToTrayCheckBox.CheckedChanged += OptionChanged_Handler; + // + // ThumbnailTabPage + // + ThumbnailTabPage.BackColor = SystemColors.Control; + ThumbnailTabPage.Controls.Add(ThumbnailSettingsPanel); + ThumbnailTabPage.Location = new Point(124, 4); + ThumbnailTabPage.Margin = new Padding(5, 6, 5, 6); + ThumbnailTabPage.Name = "ThumbnailTabPage"; + ThumbnailTabPage.Padding = new Padding(5, 6, 5, 6); + ThumbnailTabPage.Size = new Size(522, 411); + ThumbnailTabPage.TabIndex = 1; + ThumbnailTabPage.Text = "Thumbnail"; + // + // ThumbnailSettingsPanel + // + ThumbnailSettingsPanel.BorderStyle = BorderStyle.FixedSingle; + ThumbnailSettingsPanel.Controls.Add(EnableThumbnailRegionSnippingCheckBox); + ThumbnailSettingsPanel.Controls.Add(RegionLeftLabel); + ThumbnailSettingsPanel.Controls.Add(RegionLeftNumericEdit); + ThumbnailSettingsPanel.Controls.Add(RegionTopLabel); + ThumbnailSettingsPanel.Controls.Add(RegionTopNumericEdit); + ThumbnailSettingsPanel.Controls.Add(RegionWidthLabel); + ThumbnailSettingsPanel.Controls.Add(RegionWidthNumericEdit); + ThumbnailSettingsPanel.Controls.Add(RegionHeightLabel); + ThumbnailSettingsPanel.Controls.Add(RegionHeightNumericEdit); + ThumbnailSettingsPanel.Controls.Add(PickRegionButton); + ThumbnailSettingsPanel.Controls.Add(ProfileLabel); + ThumbnailSettingsPanel.Controls.Add(ProfileComboBox); + ThumbnailSettingsPanel.Controls.Add(SaveProfileButton); + ThumbnailSettingsPanel.Controls.Add(DeleteProfileButton); + ThumbnailSettingsPanel.Controls.Add(ThumbnailSnapToGridCheckBox); + ThumbnailSettingsPanel.Controls.Add(ThumbnailSnapToGridSizeYNumericEdit); + ThumbnailSettingsPanel.Controls.Add(SnapYLabel); + ThumbnailSettingsPanel.Controls.Add(ThumbnailSnapToGridSizeXNumericEdit); + ThumbnailSettingsPanel.Controls.Add(SnapXLabel); + ThumbnailSettingsPanel.Controls.Add(LockThumbnailLocationCheckbox); + ThumbnailSettingsPanel.Controls.Add(HeigthLabel); + ThumbnailSettingsPanel.Controls.Add(WidthLabel); + ThumbnailSettingsPanel.Controls.Add(ThumbnailsWidthNumericEdit); + ThumbnailSettingsPanel.Controls.Add(ThumbnailsHeightNumericEdit); + ThumbnailSettingsPanel.Controls.Add(ThumbnailOpacityTrackBar); + ThumbnailSettingsPanel.Controls.Add(OpacityLabel); + ThumbnailSettingsPanel.Dock = DockStyle.Fill; + ThumbnailSettingsPanel.Location = new Point(5, 6); + ThumbnailSettingsPanel.Margin = new Padding(5, 6, 5, 6); + ThumbnailSettingsPanel.Name = "ThumbnailSettingsPanel"; + ThumbnailSettingsPanel.Size = new Size(512, 399); + ThumbnailSettingsPanel.TabIndex = 19; + // + // EnableThumbnailRegionSnippingCheckBox + // + EnableThumbnailRegionSnippingCheckBox.AutoSize = true; + EnableThumbnailRegionSnippingCheckBox.Location = new Point(18, 270); + EnableThumbnailRegionSnippingCheckBox.Margin = new Padding(5, 6, 5, 6); + EnableThumbnailRegionSnippingCheckBox.Name = "EnableThumbnailRegionSnippingCheckBox"; + EnableThumbnailRegionSnippingCheckBox.Size = new Size(280, 29); + EnableThumbnailRegionSnippingCheckBox.TabIndex = 40; + EnableThumbnailRegionSnippingCheckBox.Text = "Enable Region Snipping"; + EnableThumbnailRegionSnippingCheckBox.UseVisualStyleBackColor = true; + EnableThumbnailRegionSnippingCheckBox.CheckedChanged += OptionChanged_Handler; + // + // RegionLeftLabel + // + RegionLeftLabel.AutoSize = true; + RegionLeftLabel.Location = new Point(13, 310); + RegionLeftLabel.Margin = new Padding(5, 0, 5, 0); + RegionLeftLabel.Name = "RegionLeftLabel"; + RegionLeftLabel.Size = new Size(45, 25); + RegionLeftLabel.TabIndex = 41; + RegionLeftLabel.Text = "Left"; + // + // RegionLeftNumericEdit + // + RegionLeftNumericEdit.BackColor = SystemColors.Window; + RegionLeftNumericEdit.BorderStyle = BorderStyle.FixedSingle; + RegionLeftNumericEdit.CausesValidation = false; + RegionLeftNumericEdit.Increment = new decimal(new int[] { 10, 0, 0, 0 }); + RegionLeftNumericEdit.Location = new Point(93, 305); + RegionLeftNumericEdit.Margin = new Padding(5, 6, 5, 6); + RegionLeftNumericEdit.Maximum = new decimal(new int[] { 999999, 0, 0, 0 }); + RegionLeftNumericEdit.Name = "RegionLeftNumericEdit"; + RegionLeftNumericEdit.Size = new Size(80, 31); + RegionLeftNumericEdit.TabIndex = 42; + RegionLeftNumericEdit.ValueChanged += OptionChanged_Handler; + // + // RegionTopLabel + // + RegionTopLabel.AutoSize = true; + RegionTopLabel.Location = new Point(183, 308); + RegionTopLabel.Margin = new Padding(5, 0, 5, 0); + RegionTopLabel.Name = "RegionTopLabel"; + RegionTopLabel.Size = new Size(42, 25); + RegionTopLabel.TabIndex = 43; + RegionTopLabel.Text = "Top"; + // + // RegionTopNumericEdit + // + RegionTopNumericEdit.BackColor = SystemColors.Window; + RegionTopNumericEdit.BorderStyle = BorderStyle.FixedSingle; + RegionTopNumericEdit.CausesValidation = false; + RegionTopNumericEdit.Increment = new decimal(new int[] { 10, 0, 0, 0 }); + RegionTopNumericEdit.Location = new Point(230, 305); + RegionTopNumericEdit.Margin = new Padding(5, 6, 5, 6); + RegionTopNumericEdit.Maximum = new decimal(new int[] { 999999, 0, 0, 0 }); + RegionTopNumericEdit.Name = "RegionTopNumericEdit"; + RegionTopNumericEdit.Size = new Size(80, 31); + RegionTopNumericEdit.TabIndex = 44; + RegionTopNumericEdit.ValueChanged += OptionChanged_Handler; + // + // RegionWidthLabel + // + RegionWidthLabel.AutoSize = true; + RegionWidthLabel.Location = new Point(13, 350); + RegionWidthLabel.Margin = new Padding(5, 0, 5, 0); + RegionWidthLabel.Name = "RegionWidthLabel"; + RegionWidthLabel.Size = new Size(65, 25); + RegionWidthLabel.TabIndex = 45; + RegionWidthLabel.Text = "Width"; + // + // RegionWidthNumericEdit + // + RegionWidthNumericEdit.BackColor = SystemColors.Window; + RegionWidthNumericEdit.BorderStyle = BorderStyle.FixedSingle; + RegionWidthNumericEdit.CausesValidation = false; + RegionWidthNumericEdit.Increment = new decimal(new int[] { 10, 0, 0, 0 }); + RegionWidthNumericEdit.Location = new Point(93, 345); + RegionWidthNumericEdit.Margin = new Padding(5, 6, 5, 6); + RegionWidthNumericEdit.Maximum = new decimal(new int[] { 999999, 0, 0, 0 }); + RegionWidthNumericEdit.Name = "RegionWidthNumericEdit"; + RegionWidthNumericEdit.Size = new Size(80, 31); + RegionWidthNumericEdit.TabIndex = 46; + RegionWidthNumericEdit.ValueChanged += OptionChanged_Handler; + // + // RegionHeightLabel + // + RegionHeightLabel.AutoSize = true; + RegionHeightLabel.Location = new Point(183, 348); + RegionHeightLabel.Margin = new Padding(5, 0, 5, 0); + RegionHeightLabel.Name = "RegionHeightLabel"; + RegionHeightLabel.Size = new Size(70, 25); + RegionHeightLabel.TabIndex = 47; + RegionHeightLabel.Text = "Height"; + // + // RegionHeightNumericEdit + // + RegionHeightNumericEdit.BackColor = SystemColors.Window; + RegionHeightNumericEdit.BorderStyle = BorderStyle.FixedSingle; + RegionHeightNumericEdit.CausesValidation = false; + RegionHeightNumericEdit.Increment = new decimal(new int[] { 10, 0, 0, 0 }); + RegionHeightNumericEdit.Location = new Point(230, 345); + RegionHeightNumericEdit.Margin = new Padding(5, 6, 5, 6); + RegionHeightNumericEdit.Maximum = new decimal(new int[] { 999999, 0, 0, 0 }); + RegionHeightNumericEdit.Name = "RegionHeightNumericEdit"; + RegionHeightNumericEdit.Size = new Size(80, 31); + RegionHeightNumericEdit.TabIndex = 48; + RegionHeightNumericEdit.ValueChanged += OptionChanged_Handler; + // + // PickRegionButton + // + PickRegionButton.Location = new Point(330, 305); + PickRegionButton.Margin = new Padding(5, 6, 5, 6); + PickRegionButton.Name = "PickRegionButton"; + PickRegionButton.Size = new Size(120, 35); + PickRegionButton.TabIndex = 49; + PickRegionButton.Text = "Pick Region"; + PickRegionButton.UseVisualStyleBackColor = true; + PickRegionButton.Click += PickRegionButton_Click; + // + // ProfileLabel + // + ProfileLabel.AutoSize = true; + ProfileLabel.Location = new Point(13, 270); + ProfileLabel.Margin = new Padding(5, 0, 5, 0); + ProfileLabel.Name = "ProfileLabel"; + ProfileLabel.Size = new Size(55, 25); + ProfileLabel.TabIndex = 50; + ProfileLabel.Text = "Profile"; + // + // ProfileComboBox + // + ProfileComboBox.DropDownStyle = ComboBoxStyle.DropDownList; + ProfileComboBox.Location = new Point(93, 265); + ProfileComboBox.Margin = new Padding(5, 6, 5, 6); + ProfileComboBox.Name = "ProfileComboBox"; + ProfileComboBox.Size = new Size(150, 33); + ProfileComboBox.TabIndex = 51; + ProfileComboBox.SelectedIndexChanged += ProfileComboBox_SelectedIndexChanged; + // + // SaveProfileButton + // + SaveProfileButton.Location = new Point(260, 265); + SaveProfileButton.Margin = new Padding(5, 6, 5, 6); + SaveProfileButton.Name = "SaveProfileButton"; + SaveProfileButton.Size = new Size(80, 35); + SaveProfileButton.TabIndex = 52; + SaveProfileButton.Text = "Save"; + SaveProfileButton.UseVisualStyleBackColor = true; + SaveProfileButton.Click += SaveProfileButton_Click; + // + // DeleteProfileButton + // + DeleteProfileButton.Location = new Point(360, 265); + DeleteProfileButton.Margin = new Padding(5, 6, 5, 6); + DeleteProfileButton.Name = "DeleteProfileButton"; + DeleteProfileButton.Size = new Size(80, 35); + DeleteProfileButton.TabIndex = 53; + DeleteProfileButton.Text = "Delete"; + DeleteProfileButton.UseVisualStyleBackColor = true; + DeleteProfileButton.Click += DeleteProfileButton_Click; + // + // ThumbnailSnapToGridCheckBox + // + ThumbnailSnapToGridCheckBox.AutoSize = true; + ThumbnailSnapToGridCheckBox.Location = new Point(18, 320); + ThumbnailSnapToGridCheckBox.Margin = new Padding(5, 6, 5, 6); + ThumbnailSnapToGridCheckBox.Name = "ThumbnailSnapToGridCheckBox"; + ThumbnailSnapToGridCheckBox.Size = new Size(226, 29); + ThumbnailSnapToGridCheckBox.TabIndex = 32; + ThumbnailSnapToGridCheckBox.Text = "Thumbnail Snap to Grid"; + ThumbnailSnapToGridCheckBox.UseVisualStyleBackColor = true; + ThumbnailSnapToGridCheckBox.CheckedChanged += OptionChanged_Handler; + // + // ThumbnailSnapToGridSizeYNumericEdit + // + ThumbnailSnapToGridSizeYNumericEdit.BackColor = SystemColors.Window; + ThumbnailSnapToGridSizeYNumericEdit.BorderStyle = BorderStyle.FixedSingle; + ThumbnailSnapToGridSizeYNumericEdit.CausesValidation = false; + ThumbnailSnapToGridSizeYNumericEdit.Increment = new decimal(new int[] { 10, 0, 0, 0 }); + ThumbnailSnapToGridSizeYNumericEdit.Location = new Point(217, 355); + ThumbnailSnapToGridSizeYNumericEdit.Margin = new Padding(5, 6, 5, 6); + ThumbnailSnapToGridSizeYNumericEdit.Maximum = new decimal(new int[] { 999999, 0, 0, 0 }); + ThumbnailSnapToGridSizeYNumericEdit.Name = "ThumbnailSnapToGridSizeYNumericEdit"; + ThumbnailSnapToGridSizeYNumericEdit.Size = new Size(80, 31); + ThumbnailSnapToGridSizeYNumericEdit.TabIndex = 31; + ThumbnailSnapToGridSizeYNumericEdit.Value = new decimal(new int[] { 100, 0, 0, 0 }); + ThumbnailSnapToGridSizeYNumericEdit.ValueChanged += OptionChanged_Handler; + // + // SnapYLabel + // + SnapYLabel.AutoSize = true; + SnapYLabel.Location = new Point(183, 358); + SnapYLabel.Margin = new Padding(5, 0, 5, 0); + SnapYLabel.Name = "SnapYLabel"; + SnapYLabel.Size = new Size(22, 25); + SnapYLabel.TabIndex = 30; + SnapYLabel.Text = "Y"; + // + // ThumbnailSnapToGridSizeXNumericEdit + // + ThumbnailSnapToGridSizeXNumericEdit.BackColor = SystemColors.Window; + ThumbnailSnapToGridSizeXNumericEdit.BorderStyle = BorderStyle.FixedSingle; + ThumbnailSnapToGridSizeXNumericEdit.CausesValidation = false; + ThumbnailSnapToGridSizeXNumericEdit.Increment = new decimal(new int[] { 10, 0, 0, 0 }); + ThumbnailSnapToGridSizeXNumericEdit.Location = new Point(93, 355); + ThumbnailSnapToGridSizeXNumericEdit.Margin = new Padding(5, 6, 5, 6); + ThumbnailSnapToGridSizeXNumericEdit.Maximum = new decimal(new int[] { 999999, 0, 0, 0 }); + ThumbnailSnapToGridSizeXNumericEdit.Name = "ThumbnailSnapToGridSizeXNumericEdit"; + ThumbnailSnapToGridSizeXNumericEdit.Size = new Size(80, 31); + ThumbnailSnapToGridSizeXNumericEdit.TabIndex = 29; + ThumbnailSnapToGridSizeXNumericEdit.Value = new decimal(new int[] { 100, 0, 0, 0 }); + ThumbnailSnapToGridSizeXNumericEdit.ValueChanged += OptionChanged_Handler; + // + // SnapXLabel + // + SnapXLabel.AutoSize = true; + SnapXLabel.Location = new Point(13, 358); + SnapXLabel.Margin = new Padding(5, 0, 5, 0); + SnapXLabel.Name = "SnapXLabel"; + SnapXLabel.Size = new Size(68, 25); + SnapXLabel.TabIndex = 28; + SnapXLabel.Text = "Snap X"; + // + // LockThumbnailLocationCheckbox + // + LockThumbnailLocationCheckbox.AutoSize = true; + LockThumbnailLocationCheckbox.Location = new Point(18, 156); + LockThumbnailLocationCheckbox.Margin = new Padding(5, 6, 5, 6); + LockThumbnailLocationCheckbox.Name = "LockThumbnailLocationCheckbox"; + LockThumbnailLocationCheckbox.Size = new Size(234, 29); + LockThumbnailLocationCheckbox.TabIndex = 26; + LockThumbnailLocationCheckbox.Text = "Lock Thumbnail Location"; + LockThumbnailLocationCheckbox.UseVisualStyleBackColor = true; + LockThumbnailLocationCheckbox.CheckedChanged += OptionChanged_Handler; + // + // HeigthLabel + // + HeigthLabel.AutoSize = true; + HeigthLabel.Location = new Point(13, 110); + HeigthLabel.Margin = new Padding(5, 0, 5, 0); + HeigthLabel.Name = "HeigthLabel"; + HeigthLabel.Size = new Size(153, 25); + HeigthLabel.TabIndex = 24; + HeigthLabel.Text = "Thumbnail Height"; + // + // WidthLabel + // + WidthLabel.AutoSize = true; + WidthLabel.Location = new Point(13, 63); + WidthLabel.Margin = new Padding(5, 0, 5, 0); + WidthLabel.Name = "WidthLabel"; + WidthLabel.Size = new Size(148, 25); + WidthLabel.TabIndex = 23; + WidthLabel.Text = "Thumbnail Width"; + // + // ThumbnailsWidthNumericEdit + // + ThumbnailsWidthNumericEdit.BackColor = SystemColors.Window; + ThumbnailsWidthNumericEdit.BorderStyle = BorderStyle.FixedSingle; + ThumbnailsWidthNumericEdit.CausesValidation = false; + ThumbnailsWidthNumericEdit.Increment = new decimal(new int[] { 10, 0, 0, 0 }); + ThumbnailsWidthNumericEdit.Location = new Point(175, 60); + ThumbnailsWidthNumericEdit.Margin = new Padding(5, 6, 5, 6); + ThumbnailsWidthNumericEdit.Maximum = new decimal(new int[] { 999999, 0, 0, 0 }); + ThumbnailsWidthNumericEdit.Name = "ThumbnailsWidthNumericEdit"; + ThumbnailsWidthNumericEdit.Size = new Size(80, 31); + ThumbnailsWidthNumericEdit.TabIndex = 21; + ThumbnailsWidthNumericEdit.Value = new decimal(new int[] { 100, 0, 0, 0 }); + ThumbnailsWidthNumericEdit.ValueChanged += ThumbnailSizeChanged_Handler; + // + // ThumbnailsHeightNumericEdit + // + ThumbnailsHeightNumericEdit.BackColor = SystemColors.Window; + ThumbnailsHeightNumericEdit.BorderStyle = BorderStyle.FixedSingle; + ThumbnailsHeightNumericEdit.CausesValidation = false; + ThumbnailsHeightNumericEdit.Increment = new decimal(new int[] { 10, 0, 0, 0 }); + ThumbnailsHeightNumericEdit.Location = new Point(175, 106); + ThumbnailsHeightNumericEdit.Margin = new Padding(5, 6, 5, 6); + ThumbnailsHeightNumericEdit.Maximum = new decimal(new int[] { 99999999, 0, 0, 0 }); + ThumbnailsHeightNumericEdit.Name = "ThumbnailsHeightNumericEdit"; + ThumbnailsHeightNumericEdit.Size = new Size(80, 31); + ThumbnailsHeightNumericEdit.TabIndex = 22; + ThumbnailsHeightNumericEdit.Value = new decimal(new int[] { 70, 0, 0, 0 }); + ThumbnailsHeightNumericEdit.ValueChanged += ThumbnailSizeChanged_Handler; + // + // ThumbnailOpacityTrackBar + // + ThumbnailOpacityTrackBar.AutoSize = false; + ThumbnailOpacityTrackBar.LargeChange = 10; + ThumbnailOpacityTrackBar.Location = new Point(102, 12); + ThumbnailOpacityTrackBar.Margin = new Padding(5, 6, 5, 6); + ThumbnailOpacityTrackBar.Maximum = 100; + ThumbnailOpacityTrackBar.Minimum = 20; + ThumbnailOpacityTrackBar.Name = "ThumbnailOpacityTrackBar"; + ThumbnailOpacityTrackBar.Size = new Size(318, 42); + ThumbnailOpacityTrackBar.TabIndex = 20; + ThumbnailOpacityTrackBar.TickFrequency = 10; + ThumbnailOpacityTrackBar.Value = 20; + ThumbnailOpacityTrackBar.ValueChanged += OptionChanged_Handler; + // + // OpacityLabel + // + OpacityLabel.AutoSize = true; + OpacityLabel.Location = new Point(13, 17); + OpacityLabel.Margin = new Padding(5, 0, 5, 0); + OpacityLabel.Name = "OpacityLabel"; + OpacityLabel.Size = new Size(73, 25); + OpacityLabel.TabIndex = 19; + OpacityLabel.Text = "Opacity"; + // + // ZoomTabPage + // + ZoomTabPage.BackColor = SystemColors.Control; + ZoomTabPage.Controls.Add(ZoomSettingsPanel); + ZoomTabPage.Location = new Point(124, 4); + ZoomTabPage.Margin = new Padding(5, 6, 5, 6); + ZoomTabPage.Name = "ZoomTabPage"; + ZoomTabPage.Size = new Size(522, 411); + ZoomTabPage.TabIndex = 2; + ZoomTabPage.Text = "Zoom"; + // + // ZoomSettingsPanel + // + ZoomSettingsPanel.BorderStyle = BorderStyle.FixedSingle; + ZoomSettingsPanel.Controls.Add(ZoomFactorLabel); + ZoomSettingsPanel.Controls.Add(ZoomAnchorPanel); + ZoomSettingsPanel.Controls.Add(ZoomAnchorLabel); + ZoomSettingsPanel.Controls.Add(EnableThumbnailZoomCheckBox); + ZoomSettingsPanel.Controls.Add(ThumbnailZoomFactorNumericEdit); + ZoomSettingsPanel.Dock = DockStyle.Fill; + ZoomSettingsPanel.Location = new Point(0, 0); + ZoomSettingsPanel.Margin = new Padding(5, 6, 5, 6); + ZoomSettingsPanel.Name = "ZoomSettingsPanel"; + ZoomSettingsPanel.Size = new Size(522, 411); + ZoomSettingsPanel.TabIndex = 36; + // + // ZoomFactorLabel + // + ZoomFactorLabel.AutoSize = true; + ZoomFactorLabel.Location = new Point(13, 63); + ZoomFactorLabel.Margin = new Padding(5, 0, 5, 0); + ZoomFactorLabel.Name = "ZoomFactorLabel"; + ZoomFactorLabel.Size = new Size(113, 25); + ZoomFactorLabel.TabIndex = 39; + ZoomFactorLabel.Text = "Zoom Factor"; + // + // ZoomAnchorPanel + // + ZoomAnchorPanel.BorderStyle = BorderStyle.FixedSingle; + ZoomAnchorPanel.Controls.Add(ZoomAanchorNWRadioButton); + ZoomAnchorPanel.Controls.Add(ZoomAanchorNRadioButton); + ZoomAnchorPanel.Controls.Add(ZoomAanchorNERadioButton); + ZoomAnchorPanel.Controls.Add(ZoomAanchorWRadioButton); + ZoomAnchorPanel.Controls.Add(ZoomAanchorSERadioButton); + ZoomAnchorPanel.Controls.Add(ZoomAanchorCRadioButton); + ZoomAnchorPanel.Controls.Add(ZoomAanchorSRadioButton); + ZoomAnchorPanel.Controls.Add(ZoomAanchorERadioButton); + ZoomAnchorPanel.Controls.Add(ZoomAanchorSWRadioButton); + ZoomAnchorPanel.Location = new Point(135, 104); + ZoomAnchorPanel.Margin = new Padding(5, 6, 5, 6); + ZoomAnchorPanel.Name = "ZoomAnchorPanel"; + ZoomAnchorPanel.Size = new Size(127, 139); + ZoomAnchorPanel.TabIndex = 38; + // + // ZoomAanchorNWRadioButton + // + ZoomAanchorNWRadioButton.AutoSize = true; + ZoomAanchorNWRadioButton.Location = new Point(5, 6); + ZoomAanchorNWRadioButton.Margin = new Padding(5, 6, 5, 6); + ZoomAanchorNWRadioButton.Name = "ZoomAanchorNWRadioButton"; + ZoomAanchorNWRadioButton.Size = new Size(21, 20); + ZoomAanchorNWRadioButton.TabIndex = 0; + ZoomAanchorNWRadioButton.TabStop = true; + ZoomAanchorNWRadioButton.UseVisualStyleBackColor = true; + ZoomAanchorNWRadioButton.CheckedChanged += OptionChanged_Handler; + // + // ZoomAanchorNRadioButton + // + ZoomAanchorNRadioButton.AutoSize = true; + ZoomAanchorNRadioButton.Location = new Point(52, 6); + ZoomAanchorNRadioButton.Margin = new Padding(5, 6, 5, 6); + ZoomAanchorNRadioButton.Name = "ZoomAanchorNRadioButton"; + ZoomAanchorNRadioButton.Size = new Size(21, 20); + ZoomAanchorNRadioButton.TabIndex = 1; + ZoomAanchorNRadioButton.TabStop = true; + ZoomAanchorNRadioButton.UseVisualStyleBackColor = true; + ZoomAanchorNRadioButton.CheckedChanged += OptionChanged_Handler; + // + // ZoomAanchorNERadioButton + // + ZoomAanchorNERadioButton.AutoSize = true; + ZoomAanchorNERadioButton.Location = new Point(98, 6); + ZoomAanchorNERadioButton.Margin = new Padding(5, 6, 5, 6); + ZoomAanchorNERadioButton.Name = "ZoomAanchorNERadioButton"; + ZoomAanchorNERadioButton.Size = new Size(21, 20); + ZoomAanchorNERadioButton.TabIndex = 2; + ZoomAanchorNERadioButton.TabStop = true; + ZoomAanchorNERadioButton.UseVisualStyleBackColor = true; + ZoomAanchorNERadioButton.CheckedChanged += OptionChanged_Handler; + // + // ZoomAanchorWRadioButton + // + ZoomAanchorWRadioButton.AutoSize = true; + ZoomAanchorWRadioButton.Location = new Point(5, 56); + ZoomAanchorWRadioButton.Margin = new Padding(5, 6, 5, 6); + ZoomAanchorWRadioButton.Name = "ZoomAanchorWRadioButton"; + ZoomAanchorWRadioButton.Size = new Size(21, 20); + ZoomAanchorWRadioButton.TabIndex = 3; + ZoomAanchorWRadioButton.TabStop = true; + ZoomAanchorWRadioButton.UseVisualStyleBackColor = true; + ZoomAanchorWRadioButton.CheckedChanged += OptionChanged_Handler; + // + // ZoomAanchorSERadioButton + // + ZoomAanchorSERadioButton.AutoSize = true; + ZoomAanchorSERadioButton.Location = new Point(98, 106); + ZoomAanchorSERadioButton.Margin = new Padding(5, 6, 5, 6); + ZoomAanchorSERadioButton.Name = "ZoomAanchorSERadioButton"; + ZoomAanchorSERadioButton.Size = new Size(21, 20); + ZoomAanchorSERadioButton.TabIndex = 8; + ZoomAanchorSERadioButton.TabStop = true; + ZoomAanchorSERadioButton.UseVisualStyleBackColor = true; + ZoomAanchorSERadioButton.CheckedChanged += OptionChanged_Handler; + // + // ZoomAanchorCRadioButton + // + ZoomAanchorCRadioButton.AutoSize = true; + ZoomAanchorCRadioButton.Location = new Point(52, 56); + ZoomAanchorCRadioButton.Margin = new Padding(5, 6, 5, 6); + ZoomAanchorCRadioButton.Name = "ZoomAanchorCRadioButton"; + ZoomAanchorCRadioButton.Size = new Size(21, 20); + ZoomAanchorCRadioButton.TabIndex = 4; + ZoomAanchorCRadioButton.TabStop = true; + ZoomAanchorCRadioButton.UseVisualStyleBackColor = true; + ZoomAanchorCRadioButton.CheckedChanged += OptionChanged_Handler; + // + // ZoomAanchorSRadioButton + // + ZoomAanchorSRadioButton.AutoSize = true; + ZoomAanchorSRadioButton.Location = new Point(52, 106); + ZoomAanchorSRadioButton.Margin = new Padding(5, 6, 5, 6); + ZoomAanchorSRadioButton.Name = "ZoomAanchorSRadioButton"; + ZoomAanchorSRadioButton.Size = new Size(21, 20); + ZoomAanchorSRadioButton.TabIndex = 7; + ZoomAanchorSRadioButton.TabStop = true; + ZoomAanchorSRadioButton.UseVisualStyleBackColor = true; + ZoomAanchorSRadioButton.CheckedChanged += OptionChanged_Handler; + // + // ZoomAanchorERadioButton + // + ZoomAanchorERadioButton.AutoSize = true; + ZoomAanchorERadioButton.Location = new Point(98, 56); + ZoomAanchorERadioButton.Margin = new Padding(5, 6, 5, 6); + ZoomAanchorERadioButton.Name = "ZoomAanchorERadioButton"; + ZoomAanchorERadioButton.Size = new Size(21, 20); + ZoomAanchorERadioButton.TabIndex = 5; + ZoomAanchorERadioButton.TabStop = true; + ZoomAanchorERadioButton.UseVisualStyleBackColor = true; + ZoomAanchorERadioButton.CheckedChanged += OptionChanged_Handler; + // + // ZoomAanchorSWRadioButton + // + ZoomAanchorSWRadioButton.AutoSize = true; + ZoomAanchorSWRadioButton.Location = new Point(5, 106); + ZoomAanchorSWRadioButton.Margin = new Padding(5, 6, 5, 6); + ZoomAanchorSWRadioButton.Name = "ZoomAanchorSWRadioButton"; + ZoomAanchorSWRadioButton.Size = new Size(21, 20); + ZoomAanchorSWRadioButton.TabIndex = 6; + ZoomAanchorSWRadioButton.TabStop = true; + ZoomAanchorSWRadioButton.UseVisualStyleBackColor = true; + ZoomAanchorSWRadioButton.CheckedChanged += OptionChanged_Handler; + // + // ZoomAnchorLabel + // + ZoomAnchorLabel.AutoSize = true; + ZoomAnchorLabel.Location = new Point(13, 110); + ZoomAnchorLabel.Margin = new Padding(5, 0, 5, 0); + ZoomAnchorLabel.Name = "ZoomAnchorLabel"; + ZoomAnchorLabel.Size = new Size(69, 25); + ZoomAnchorLabel.TabIndex = 40; + ZoomAnchorLabel.Text = "Anchor"; + // + // EnableThumbnailZoomCheckBox + // + EnableThumbnailZoomCheckBox.AutoSize = true; + EnableThumbnailZoomCheckBox.Checked = true; + EnableThumbnailZoomCheckBox.CheckState = CheckState.Checked; + EnableThumbnailZoomCheckBox.Location = new Point(13, 13); + EnableThumbnailZoomCheckBox.Margin = new Padding(5, 6, 5, 6); + EnableThumbnailZoomCheckBox.Name = "EnableThumbnailZoomCheckBox"; + EnableThumbnailZoomCheckBox.RightToLeft = RightToLeft.No; + EnableThumbnailZoomCheckBox.Size = new Size(162, 29); + EnableThumbnailZoomCheckBox.TabIndex = 36; + EnableThumbnailZoomCheckBox.Text = "Zoom on hover"; + EnableThumbnailZoomCheckBox.UseVisualStyleBackColor = true; + EnableThumbnailZoomCheckBox.CheckedChanged += OptionChanged_Handler; + // + // ThumbnailZoomFactorNumericEdit + // + ThumbnailZoomFactorNumericEdit.BackColor = SystemColors.Window; + ThumbnailZoomFactorNumericEdit.BorderStyle = BorderStyle.FixedSingle; + ThumbnailZoomFactorNumericEdit.Location = new Point(135, 60); + ThumbnailZoomFactorNumericEdit.Margin = new Padding(5, 6, 5, 6); + ThumbnailZoomFactorNumericEdit.Maximum = new decimal(new int[] { 10, 0, 0, 0 }); + ThumbnailZoomFactorNumericEdit.Minimum = new decimal(new int[] { 2, 0, 0, 0 }); + ThumbnailZoomFactorNumericEdit.Name = "ThumbnailZoomFactorNumericEdit"; + ThumbnailZoomFactorNumericEdit.Size = new Size(63, 31); + ThumbnailZoomFactorNumericEdit.TabIndex = 37; + ThumbnailZoomFactorNumericEdit.Value = new decimal(new int[] { 2, 0, 0, 0 }); + ThumbnailZoomFactorNumericEdit.ValueChanged += OptionChanged_Handler; + // + // OverlayTabPage + // + OverlayTabPage.BackColor = SystemColors.Control; + OverlayTabPage.Controls.Add(OverlaySettingsPanel); + OverlayTabPage.Location = new Point(124, 4); + OverlayTabPage.Margin = new Padding(5, 6, 5, 6); + OverlayTabPage.Name = "OverlayTabPage"; + OverlayTabPage.Size = new Size(522, 411); + OverlayTabPage.TabIndex = 3; + OverlayTabPage.Text = "Overlay"; + // + // OverlaySettingsPanel + // + OverlaySettingsPanel.BorderStyle = BorderStyle.FixedSingle; + OverlaySettingsPanel.Controls.Add(label3); + OverlaySettingsPanel.Controls.Add(label2); + OverlaySettingsPanel.Controls.Add(OverlayLabelColorButton); + OverlaySettingsPanel.Controls.Add(OverlayLabelSizeNumericEdit); + OverlaySettingsPanel.Controls.Add(panel1); + OverlaySettingsPanel.Controls.Add(label1); + OverlaySettingsPanel.Controls.Add(HighlightColorLabel); + OverlaySettingsPanel.Controls.Add(ActiveClientHighlightColorButton); + OverlaySettingsPanel.Controls.Add(EnableActiveClientHighlightCheckBox); + OverlaySettingsPanel.Controls.Add(ShowThumbnailOverlaysCheckBox); + OverlaySettingsPanel.Controls.Add(ShowThumbnailFramesCheckBox); + OverlaySettingsPanel.Dock = DockStyle.Fill; + OverlaySettingsPanel.Location = new Point(0, 0); + OverlaySettingsPanel.Margin = new Padding(5, 6, 5, 6); + OverlaySettingsPanel.Name = "OverlaySettingsPanel"; + OverlaySettingsPanel.Size = new Size(522, 411); + OverlaySettingsPanel.TabIndex = 25; + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(8, 281); + label3.Margin = new Padding(5, 0, 5, 0); + label3.Name = "label3"; + label3.Size = new Size(75, 25); + label3.TabIndex = 43; + label3.Text = "Position"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(8, 244); + label2.Margin = new Padding(5, 0, 5, 0); + label2.Name = "label2"; + label2.Size = new Size(55, 25); + label2.TabIndex = 42; + label2.Text = "Color"; + // + // OverlayLabelColorButton + // + OverlayLabelColorButton.BorderStyle = BorderStyle.FixedSingle; + OverlayLabelColorButton.Location = new Point(70, 242); + OverlayLabelColorButton.Margin = new Padding(5, 6, 5, 6); + OverlayLabelColorButton.Name = "OverlayLabelColorButton"; + OverlayLabelColorButton.Size = new Size(154, 31); + OverlayLabelColorButton.TabIndex = 41; + OverlayLabelColorButton.Click += OverlayLabelColorButton_Click; + // + // OverlayLabelSizeNumericEdit + // + OverlayLabelSizeNumericEdit.BackColor = SystemColors.Window; + OverlayLabelSizeNumericEdit.BorderStyle = BorderStyle.FixedSingle; + OverlayLabelSizeNumericEdit.CausesValidation = false; + OverlayLabelSizeNumericEdit.Location = new Point(145, 192); + OverlayLabelSizeNumericEdit.Margin = new Padding(5, 6, 5, 6); + OverlayLabelSizeNumericEdit.Maximum = new decimal(new int[] { 30, 0, 0, 0 }); + OverlayLabelSizeNumericEdit.Minimum = new decimal(new int[] { 5, 0, 0, 0 }); + OverlayLabelSizeNumericEdit.Name = "OverlayLabelSizeNumericEdit"; + OverlayLabelSizeNumericEdit.Size = new Size(80, 31); + OverlayLabelSizeNumericEdit.TabIndex = 40; + OverlayLabelSizeNumericEdit.Value = new decimal(new int[] { 30, 0, 0, 0 }); + OverlayLabelSizeNumericEdit.ValueChanged += OptionChanged_Handler; + // + // panel1 + // + panel1.BorderStyle = BorderStyle.FixedSingle; + panel1.Controls.Add(OverlayLabelNWRadioButton); + panel1.Controls.Add(OverlayLabelNRadioButton); + panel1.Controls.Add(OverlayLabelNERadioButton); + panel1.Controls.Add(OverlayLabelWRadioButton); + panel1.Controls.Add(OverlayLabelSERadioButton); + panel1.Controls.Add(OverlayLabelCRadioButton); + panel1.Controls.Add(OverlayLabelSRadioButton); + panel1.Controls.Add(OverlayLabelERadioButton); + panel1.Controls.Add(OverlayLabelSWRadioButton); + panel1.Location = new Point(120, 287); + panel1.Margin = new Padding(5, 6, 5, 6); + panel1.Name = "panel1"; + panel1.Size = new Size(104, 108); + panel1.TabIndex = 39; + // + // OverlayLabelNWRadioButton + // + OverlayLabelNWRadioButton.AutoSize = true; + OverlayLabelNWRadioButton.Location = new Point(5, 6); + OverlayLabelNWRadioButton.Margin = new Padding(5, 6, 5, 6); + OverlayLabelNWRadioButton.Name = "OverlayLabelNWRadioButton"; + OverlayLabelNWRadioButton.Size = new Size(21, 20); + OverlayLabelNWRadioButton.TabIndex = 0; + OverlayLabelNWRadioButton.TabStop = true; + OverlayLabelNWRadioButton.UseVisualStyleBackColor = true; + OverlayLabelNWRadioButton.CheckedChanged += OptionChanged_Handler; + // + // OverlayLabelNRadioButton + // + OverlayLabelNRadioButton.AutoSize = true; + OverlayLabelNRadioButton.Location = new Point(38, 6); + OverlayLabelNRadioButton.Margin = new Padding(5, 6, 5, 6); + OverlayLabelNRadioButton.Name = "OverlayLabelNRadioButton"; + OverlayLabelNRadioButton.Size = new Size(21, 20); + OverlayLabelNRadioButton.TabIndex = 1; + OverlayLabelNRadioButton.TabStop = true; + OverlayLabelNRadioButton.UseVisualStyleBackColor = true; + OverlayLabelNRadioButton.CheckedChanged += OptionChanged_Handler; + // + // OverlayLabelNERadioButton + // + OverlayLabelNERadioButton.AutoSize = true; + OverlayLabelNERadioButton.Location = new Point(72, 6); + OverlayLabelNERadioButton.Margin = new Padding(5, 6, 5, 6); + OverlayLabelNERadioButton.Name = "OverlayLabelNERadioButton"; + OverlayLabelNERadioButton.Size = new Size(21, 20); + OverlayLabelNERadioButton.TabIndex = 2; + OverlayLabelNERadioButton.TabStop = true; + OverlayLabelNERadioButton.UseVisualStyleBackColor = true; + OverlayLabelNERadioButton.CheckedChanged += OptionChanged_Handler; + // + // OverlayLabelWRadioButton + // + OverlayLabelWRadioButton.AutoSize = true; + OverlayLabelWRadioButton.Location = new Point(5, 42); + OverlayLabelWRadioButton.Margin = new Padding(5, 6, 5, 6); + OverlayLabelWRadioButton.Name = "OverlayLabelWRadioButton"; + OverlayLabelWRadioButton.Size = new Size(21, 20); + OverlayLabelWRadioButton.TabIndex = 3; + OverlayLabelWRadioButton.TabStop = true; + OverlayLabelWRadioButton.UseVisualStyleBackColor = true; + OverlayLabelWRadioButton.CheckedChanged += OptionChanged_Handler; + // + // OverlayLabelSERadioButton + // + OverlayLabelSERadioButton.AutoSize = true; + OverlayLabelSERadioButton.Location = new Point(72, 77); + OverlayLabelSERadioButton.Margin = new Padding(5, 6, 5, 6); + OverlayLabelSERadioButton.Name = "OverlayLabelSERadioButton"; + OverlayLabelSERadioButton.Size = new Size(21, 20); + OverlayLabelSERadioButton.TabIndex = 8; + OverlayLabelSERadioButton.TabStop = true; + OverlayLabelSERadioButton.UseVisualStyleBackColor = true; + OverlayLabelSERadioButton.CheckedChanged += OptionChanged_Handler; + // + // OverlayLabelCRadioButton + // + OverlayLabelCRadioButton.AutoSize = true; + OverlayLabelCRadioButton.Location = new Point(38, 42); + OverlayLabelCRadioButton.Margin = new Padding(5, 6, 5, 6); + OverlayLabelCRadioButton.Name = "OverlayLabelCRadioButton"; + OverlayLabelCRadioButton.Size = new Size(21, 20); + OverlayLabelCRadioButton.TabIndex = 4; + OverlayLabelCRadioButton.TabStop = true; + OverlayLabelCRadioButton.UseVisualStyleBackColor = true; + OverlayLabelCRadioButton.CheckedChanged += OptionChanged_Handler; + // + // OverlayLabelSRadioButton + // + OverlayLabelSRadioButton.AutoSize = true; + OverlayLabelSRadioButton.Location = new Point(38, 77); + OverlayLabelSRadioButton.Margin = new Padding(5, 6, 5, 6); + OverlayLabelSRadioButton.Name = "OverlayLabelSRadioButton"; + OverlayLabelSRadioButton.Size = new Size(21, 20); + OverlayLabelSRadioButton.TabIndex = 7; + OverlayLabelSRadioButton.TabStop = true; + OverlayLabelSRadioButton.UseVisualStyleBackColor = true; + OverlayLabelSRadioButton.CheckedChanged += OptionChanged_Handler; + // + // OverlayLabelERadioButton + // + OverlayLabelERadioButton.AutoSize = true; + OverlayLabelERadioButton.Location = new Point(72, 42); + OverlayLabelERadioButton.Margin = new Padding(5, 6, 5, 6); + OverlayLabelERadioButton.Name = "OverlayLabelERadioButton"; + OverlayLabelERadioButton.Size = new Size(21, 20); + OverlayLabelERadioButton.TabIndex = 5; + OverlayLabelERadioButton.TabStop = true; + OverlayLabelERadioButton.UseVisualStyleBackColor = true; + OverlayLabelERadioButton.CheckedChanged += OptionChanged_Handler; + // + // OverlayLabelSWRadioButton + // + OverlayLabelSWRadioButton.AutoSize = true; + OverlayLabelSWRadioButton.Location = new Point(5, 77); + OverlayLabelSWRadioButton.Margin = new Padding(5, 6, 5, 6); + OverlayLabelSWRadioButton.Name = "OverlayLabelSWRadioButton"; + OverlayLabelSWRadioButton.Size = new Size(21, 20); + OverlayLabelSWRadioButton.TabIndex = 6; + OverlayLabelSWRadioButton.TabStop = true; + OverlayLabelSWRadioButton.UseVisualStyleBackColor = true; + OverlayLabelSWRadioButton.CheckedChanged += OptionChanged_Handler; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(8, 196); + label1.Margin = new Padding(5, 0, 5, 0); + label1.Name = "label1"; + label1.Size = new Size(89, 25); + label1.TabIndex = 30; + label1.Text = "Label Size"; + // + // HighlightColorLabel + // + HighlightColorLabel.AutoSize = true; + HighlightColorLabel.Location = new Point(8, 150); + HighlightColorLabel.Margin = new Padding(5, 0, 5, 0); + HighlightColorLabel.Name = "HighlightColorLabel"; + HighlightColorLabel.Size = new Size(55, 25); + HighlightColorLabel.TabIndex = 29; + HighlightColorLabel.Text = "Color"; + // + // ActiveClientHighlightColorButton + // + ActiveClientHighlightColorButton.BorderStyle = BorderStyle.FixedSingle; + ActiveClientHighlightColorButton.Location = new Point(70, 148); + ActiveClientHighlightColorButton.Margin = new Padding(5, 6, 5, 6); + ActiveClientHighlightColorButton.Name = "ActiveClientHighlightColorButton"; + ActiveClientHighlightColorButton.Size = new Size(154, 31); + ActiveClientHighlightColorButton.TabIndex = 28; + ActiveClientHighlightColorButton.Click += ActiveClientHighlightColorButton_Click; + // + // EnableActiveClientHighlightCheckBox + // + EnableActiveClientHighlightCheckBox.AutoSize = true; + EnableActiveClientHighlightCheckBox.Checked = true; + EnableActiveClientHighlightCheckBox.CheckState = CheckState.Checked; + EnableActiveClientHighlightCheckBox.Location = new Point(13, 106); + EnableActiveClientHighlightCheckBox.Margin = new Padding(5, 6, 5, 6); + EnableActiveClientHighlightCheckBox.Name = "EnableActiveClientHighlightCheckBox"; + EnableActiveClientHighlightCheckBox.RightToLeft = RightToLeft.No; + EnableActiveClientHighlightCheckBox.Size = new Size(207, 29); + EnableActiveClientHighlightCheckBox.TabIndex = 27; + EnableActiveClientHighlightCheckBox.Text = "Highlight active client"; + EnableActiveClientHighlightCheckBox.UseVisualStyleBackColor = true; + EnableActiveClientHighlightCheckBox.CheckedChanged += OptionChanged_Handler; + // + // ShowThumbnailOverlaysCheckBox + // + ShowThumbnailOverlaysCheckBox.AutoSize = true; + ShowThumbnailOverlaysCheckBox.Checked = true; + ShowThumbnailOverlaysCheckBox.CheckState = CheckState.Checked; + ShowThumbnailOverlaysCheckBox.Location = new Point(13, 13); + ShowThumbnailOverlaysCheckBox.Margin = new Padding(5, 6, 5, 6); + ShowThumbnailOverlaysCheckBox.Name = "ShowThumbnailOverlaysCheckBox"; + ShowThumbnailOverlaysCheckBox.RightToLeft = RightToLeft.No; + ShowThumbnailOverlaysCheckBox.Size = new Size(144, 29); + ShowThumbnailOverlaysCheckBox.TabIndex = 25; + ShowThumbnailOverlaysCheckBox.Text = "Show overlay"; + ShowThumbnailOverlaysCheckBox.UseVisualStyleBackColor = true; + ShowThumbnailOverlaysCheckBox.CheckedChanged += OptionChanged_Handler; + // + // ShowThumbnailFramesCheckBox + // + ShowThumbnailFramesCheckBox.AutoSize = true; + ShowThumbnailFramesCheckBox.Checked = true; + ShowThumbnailFramesCheckBox.CheckState = CheckState.Checked; + ShowThumbnailFramesCheckBox.Location = new Point(13, 60); + ShowThumbnailFramesCheckBox.Margin = new Padding(5, 6, 5, 6); + ShowThumbnailFramesCheckBox.Name = "ShowThumbnailFramesCheckBox"; + ShowThumbnailFramesCheckBox.RightToLeft = RightToLeft.No; + ShowThumbnailFramesCheckBox.Size = new Size(141, 29); + ShowThumbnailFramesCheckBox.TabIndex = 26; + ShowThumbnailFramesCheckBox.Text = "Show frames"; + ShowThumbnailFramesCheckBox.UseVisualStyleBackColor = true; + ShowThumbnailFramesCheckBox.CheckedChanged += OptionChanged_Handler; + // + // ClientsTabPage + // + ClientsTabPage.BackColor = SystemColors.Control; + ClientsTabPage.Controls.Add(ClientsPanel); + ClientsTabPage.Location = new Point(124, 4); + ClientsTabPage.Margin = new Padding(5, 6, 5, 6); + ClientsTabPage.Name = "ClientsTabPage"; + ClientsTabPage.Size = new Size(522, 411); + ClientsTabPage.TabIndex = 4; + ClientsTabPage.Text = "Active Clients"; + // + // ClientsPanel + // + ClientsPanel.BorderStyle = BorderStyle.FixedSingle; + ClientsPanel.Controls.Add(ThumbnailsList); + ClientsPanel.Controls.Add(ThumbnailsListLabel); + ClientsPanel.Dock = DockStyle.Fill; + ClientsPanel.Location = new Point(0, 0); + ClientsPanel.Margin = new Padding(5, 6, 5, 6); + ClientsPanel.Name = "ClientsPanel"; + ClientsPanel.Size = new Size(522, 411); + ClientsPanel.TabIndex = 32; + // + // ThumbnailsList + // + ThumbnailsList.BackColor = SystemColors.Window; + ThumbnailsList.BorderStyle = BorderStyle.FixedSingle; + ThumbnailsList.CheckOnClick = true; + ThumbnailsList.Dock = DockStyle.Bottom; + ThumbnailsList.FormattingEnabled = true; + ThumbnailsList.IntegralHeight = false; + ThumbnailsList.Location = new Point(0, 65); + ThumbnailsList.Margin = new Padding(5, 6, 5, 6); + ThumbnailsList.Name = "ThumbnailsList"; + ThumbnailsList.Size = new Size(520, 344); + ThumbnailsList.TabIndex = 34; + ThumbnailsList.ItemCheck += ThumbnailsList_ItemCheck_Handler; + // + // ThumbnailsListLabel + // + ThumbnailsListLabel.AutoSize = true; + ThumbnailsListLabel.Location = new Point(13, 17); + ThumbnailsListLabel.Margin = new Padding(5, 0, 5, 0); + ThumbnailsListLabel.Name = "ThumbnailsListLabel"; + ThumbnailsListLabel.Size = new Size(268, 25); + ThumbnailsListLabel.TabIndex = 33; + ThumbnailsListLabel.Text = "Thumbnails (check to force hide)"; + // + // AboutTabPage + // + AboutTabPage.BackColor = SystemColors.Control; + AboutTabPage.Controls.Add(AboutPanel); + AboutTabPage.Location = new Point(124, 4); + AboutTabPage.Margin = new Padding(5, 6, 5, 6); + AboutTabPage.Name = "AboutTabPage"; + AboutTabPage.Size = new Size(522, 411); + AboutTabPage.TabIndex = 5; + AboutTabPage.Text = "About"; + // + // AboutPanel + // + AboutPanel.BackColor = Color.Transparent; + AboutPanel.BorderStyle = BorderStyle.FixedSingle; + AboutPanel.Controls.Add(CreditMaintLabel); + AboutPanel.Controls.Add(DocumentationLinkLabel); + AboutPanel.Controls.Add(DescriptionLabel); + AboutPanel.Controls.Add(VersionLabel); + AboutPanel.Controls.Add(NameLabel); + AboutPanel.Controls.Add(DocumentationLink); + AboutPanel.Dock = DockStyle.Fill; + AboutPanel.Location = new Point(0, 0); + AboutPanel.Margin = new Padding(5, 6, 5, 6); + AboutPanel.Name = "AboutPanel"; + AboutPanel.Size = new Size(522, 411); + AboutPanel.TabIndex = 2; + // + // CreditMaintLabel + // + CreditMaintLabel.AutoSize = true; + CreditMaintLabel.Location = new Point(0, 275); + CreditMaintLabel.Margin = new Padding(5, 0, 5, 0); + CreditMaintLabel.Name = "CreditMaintLabel"; + CreditMaintLabel.Padding = new Padding(13, 6, 13, 6); + CreditMaintLabel.Size = new Size(435, 37); + CreditMaintLabel.TabIndex = 7; + CreditMaintLabel.Text = "Credit to previous maintainer: Phrynohyas Tig-Rah"; + // + // DocumentationLinkLabel + // + DocumentationLinkLabel.AutoSize = true; + DocumentationLinkLabel.Location = new Point(0, 313); + DocumentationLinkLabel.Margin = new Padding(5, 0, 5, 0); + DocumentationLinkLabel.Name = "DocumentationLinkLabel"; + DocumentationLinkLabel.Padding = new Padding(13, 6, 13, 6); + DocumentationLinkLabel.Size = new Size(389, 37); + DocumentationLinkLabel.TabIndex = 6; + DocumentationLinkLabel.Text = "For more information visit the forum thread:"; + // + // DescriptionLabel + // + DescriptionLabel.BackColor = Color.Transparent; + DescriptionLabel.Location = new Point(0, 56); + DescriptionLabel.Margin = new Padding(5, 0, 5, 0); + DescriptionLabel.Name = "DescriptionLabel"; + DescriptionLabel.Padding = new Padding(13, 6, 13, 6); + DescriptionLabel.Size = new Size(435, 279); + DescriptionLabel.TabIndex = 5; + DescriptionLabel.Text = resources.GetString("DescriptionLabel.Text"); + // + // VersionLabel + // + VersionLabel.AutoSize = true; + VersionLabel.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point, 204); + VersionLabel.Location = new Point(222, 17); + VersionLabel.Margin = new Padding(5, 0, 5, 0); + VersionLabel.Name = "VersionLabel"; + VersionLabel.Size = new Size(69, 29); + VersionLabel.TabIndex = 4; + VersionLabel.Text = "1.0.0"; + // + // NameLabel + // + NameLabel.AutoSize = true; + NameLabel.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point, 204); + NameLabel.Location = new Point(7, 17); + NameLabel.Margin = new Padding(5, 0, 5, 0); + NameLabel.Name = "NameLabel"; + NameLabel.Size = new Size(195, 29); + NameLabel.TabIndex = 3; + NameLabel.Text = "EVE-O-Preview"; + // + // DocumentationLink + // + DocumentationLink.Location = new Point(0, 340); + DocumentationLink.Margin = new Padding(50, 6, 5, 6); + DocumentationLink.Name = "DocumentationLink"; + DocumentationLink.Padding = new Padding(13, 6, 13, 6); + DocumentationLink.Size = new Size(437, 63); + DocumentationLink.TabIndex = 2; + DocumentationLink.TabStop = true; + DocumentationLink.Text = + "to be set from prresenter to be set from prresenter to be set from prresenter to be set from prresenter"; + DocumentationLink.LinkClicked += DocumentationLinkClicked_Handler; + // + // NotifyIcon + // + NotifyIcon.ContextMenuStrip = TrayMenu; + NotifyIcon.Icon = (Icon)resources.GetObject("NotifyIcon.Icon"); + NotifyIcon.Text = "EVE-O-Preview"; + NotifyIcon.Visible = true; + NotifyIcon.MouseDoubleClick += RestoreMainForm_Handler; + // + // TrayMenu + // + TrayMenu.ImageScalingSize = new Size(24, 24); + TrayMenu.Items.AddRange( + new ToolStripItem[] { TitleMenuItem, RestoreWindowMenuItem, SeparatorMenuItem, ExitMenuItem }); + TrayMenu.Name = "contextMenuStrip1"; + TrayMenu.Size = new Size(202, 106); + // + // MainForm + // + AutoScaleDimensions = new SizeF(10F, 25F); + AutoScaleMode = AutoScaleMode.Font; + BackColor = SystemColors.Control; + ClientSize = new Size(650, 419); + Controls.Add(ContentTabControl); + FormBorderStyle = FormBorderStyle.FixedSingle; + Icon = (Icon)resources.GetObject("$this.Icon"); + Margin = new Padding(0); + MaximizeBox = false; + Name = "MainForm"; + Text = "EVE-O-Preview"; + TopMost = true; + FormClosing += MainFormClosing_Handler; + Load += MainFormResize_Handler; + Resize += MainFormResize_Handler; + ContentTabControl.ResumeLayout(false); + GeneralTabPage.ResumeLayout(false); + GeneralSettingsPanel.ResumeLayout(false); + GeneralSettingsPanel.PerformLayout(); + ThumbnailTabPage.ResumeLayout(false); + ThumbnailSettingsPanel.ResumeLayout(false); + ThumbnailSettingsPanel.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)ThumbnailSnapToGridSizeYNumericEdit).EndInit(); + ((System.ComponentModel.ISupportInitialize)ThumbnailSnapToGridSizeXNumericEdit).EndInit(); + ((System.ComponentModel.ISupportInitialize)ThumbnailsWidthNumericEdit).EndInit(); + ((System.ComponentModel.ISupportInitialize)ThumbnailsHeightNumericEdit).EndInit(); + ((System.ComponentModel.ISupportInitialize)ThumbnailOpacityTrackBar).EndInit(); + ZoomTabPage.ResumeLayout(false); + ZoomSettingsPanel.ResumeLayout(false); + ZoomSettingsPanel.PerformLayout(); + ZoomAnchorPanel.ResumeLayout(false); + ZoomAnchorPanel.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)ThumbnailZoomFactorNumericEdit).EndInit(); + OverlayTabPage.ResumeLayout(false); + OverlaySettingsPanel.ResumeLayout(false); + OverlaySettingsPanel.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)OverlayLabelSizeNumericEdit).EndInit(); + panel1.ResumeLayout(false); + panel1.PerformLayout(); + ClientsTabPage.ResumeLayout(false); + ClientsPanel.ResumeLayout(false); + ClientsPanel.PerformLayout(); + AboutTabPage.ResumeLayout(false); + AboutPanel.ResumeLayout(false); + AboutPanel.PerformLayout(); + TrayMenu.ResumeLayout(false); + ResumeLayout(false); + } - } - - #endregion - private NotifyIcon NotifyIcon; - private ContextMenuStrip TrayMenu; - private TabPage ZoomTabPage; - private CheckBox EnableClientLayoutTrackingCheckBox; - private CheckBox HideActiveClientThumbnailCheckBox; - private CheckBox ShowThumbnailsAlwaysOnTopCheckBox; - private CheckBox HideThumbnailsOnLostFocusCheckBox; - private CheckBox EnablePerClientThumbnailsLayoutsCheckBox; - private CheckBox MinimizeToTrayCheckBox; - private NumericUpDown ThumbnailsWidthNumericEdit; - private NumericUpDown ThumbnailsHeightNumericEdit; - private TrackBar ThumbnailOpacityTrackBar; - private Panel ZoomAnchorPanel; - private RadioButton ZoomAanchorNWRadioButton; - private RadioButton ZoomAanchorNRadioButton; - private RadioButton ZoomAanchorNERadioButton; - private RadioButton ZoomAanchorWRadioButton; - private RadioButton ZoomAanchorSERadioButton; - private RadioButton ZoomAanchorCRadioButton; - private RadioButton ZoomAanchorSRadioButton; - private RadioButton ZoomAanchorERadioButton; - private RadioButton ZoomAanchorSWRadioButton; - private CheckBox EnableThumbnailZoomCheckBox; - private NumericUpDown ThumbnailZoomFactorNumericEdit; - private Label HighlightColorLabel; - private Panel ActiveClientHighlightColorButton; - private CheckBox EnableActiveClientHighlightCheckBox; - private CheckBox ShowThumbnailOverlaysCheckBox; - private CheckBox ShowThumbnailFramesCheckBox; - private CheckedListBox ThumbnailsList; - private LinkLabel DocumentationLink; - private Label VersionLabel; - private CheckBox MinimizeInactiveClientsCheckBox; +#endregion + private NotifyIcon NotifyIcon; + private ContextMenuStrip TrayMenu; + private TabPage ZoomTabPage; + private CheckBox EnableClientLayoutTrackingCheckBox; + private CheckBox HideActiveClientThumbnailCheckBox; + private CheckBox ShowThumbnailsAlwaysOnTopCheckBox; + private CheckBox HideThumbnailsOnLostFocusCheckBox; + private CheckBox EnablePerClientThumbnailsLayoutsCheckBox; + private CheckBox MinimizeToTrayCheckBox; + private NumericUpDown ThumbnailsWidthNumericEdit; + private NumericUpDown ThumbnailsHeightNumericEdit; + private TrackBar ThumbnailOpacityTrackBar; + private Panel ZoomAnchorPanel; + private RadioButton ZoomAanchorNWRadioButton; + private RadioButton ZoomAanchorNRadioButton; + private RadioButton ZoomAanchorNERadioButton; + private RadioButton ZoomAanchorWRadioButton; + private RadioButton ZoomAanchorSERadioButton; + private RadioButton ZoomAanchorCRadioButton; + private RadioButton ZoomAanchorSRadioButton; + private RadioButton ZoomAanchorERadioButton; + private RadioButton ZoomAanchorSWRadioButton; + private CheckBox EnableThumbnailZoomCheckBox; + private NumericUpDown ThumbnailZoomFactorNumericEdit; + private Label HighlightColorLabel; + private Panel ActiveClientHighlightColorButton; + private CheckBox EnableActiveClientHighlightCheckBox; + private CheckBox ShowThumbnailOverlaysCheckBox; + private CheckBox ShowThumbnailFramesCheckBox; + private CheckedListBox ThumbnailsList; + private LinkLabel DocumentationLink; + private Label VersionLabel; + private CheckBox MinimizeInactiveClientsCheckBox; private CheckBox LockThumbnailLocationCheckbox; private NumericUpDown ThumbnailSnapToGridSizeYNumericEdit; private Label SnapYLabel; private NumericUpDown ThumbnailSnapToGridSizeXNumericEdit; private Label SnapXLabel; private CheckBox ThumbnailSnapToGridCheckBox; + private CheckBox EnableThumbnailRegionSnippingCheckBox; + private NumericUpDown RegionLeftNumericEdit; + private NumericUpDown RegionTopNumericEdit; + private NumericUpDown RegionWidthNumericEdit; + private NumericUpDown RegionHeightNumericEdit; + private Label RegionLeftLabel; + private Label RegionTopLabel; + private Label RegionWidthLabel; + private Label RegionHeightLabel; + private Button PickRegionButton; + private ComboBox ProfileComboBox; + private Button SaveProfileButton; + private Button DeleteProfileButton; + private Label ProfileLabel; private Label label3; private Label label2; private Panel OverlayLabelColorButton; @@ -1288,6 +1488,6 @@ namespace EveOPreview.View private RadioButton OverlayLabelERadioButton; private RadioButton OverlayLabelSWRadioButton; private Label label1; - private ComboBox AnimationStyleCombo; - } + private ComboBox AnimationStyleCombo; + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/View/Implementation/MainForm.cs b/src/Eve-O-Preview/View/Implementation/MainForm.cs index a7c7238..4c45254 100644 --- a/src/Eve-O-Preview/View/Implementation/MainForm.cs +++ b/src/Eve-O-Preview/View/Implementation/MainForm.cs @@ -7,566 +7,546 @@ using System.IO; using System.Linq; using System.Windows.Forms; using static System.Windows.Forms.VisualStyles.VisualStyleElement; - -namespace EveOPreview.View -{ - public partial class MainForm : Form, IMainFormView - { - #region Private fields - private readonly ApplicationContext _context; - private readonly Dictionary _zoomAnchorMap; - private readonly Dictionary _overlayLabelMap; - private ViewZoomAnchor _cachedThumbnailZoomAnchor; - private ViewZoomAnchor _cachedOverlayLabelAnchor; - private bool _suppressEvents; - private Size _minimumSize; - private Size _maximumSize; - private string _iconName; - #endregion - - public MainForm(ApplicationContext context) - { - this._context = context; - this._zoomAnchorMap = new Dictionary(); - this._overlayLabelMap = new Dictionary(); - this._cachedThumbnailZoomAnchor = ViewZoomAnchor.NW; - this._suppressEvents = false; - this._minimumSize = new Size(20, 20); - this._maximumSize = new Size(20, 20); - - InitializeComponent(); - - this.ThumbnailsList.DisplayMember = "Title"; - - this.InitZoomAnchorMap(); - this.InitOverlayLabelMap(); - this.InitFormSize(); - - this.AnimationStyleCombo.DataSource = Enum.GetValues(typeof(AnimationStyle)); - } - - public bool MinimizeToTray - { - get => this.MinimizeToTrayCheckBox.Checked; - set => this.MinimizeToTrayCheckBox.Checked = value; - } - - public string IconName - { - get => this._iconName; - set { - - - this._iconName = value; - - // Set Icon - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); - if (this._iconName == null || ((resources.GetObject(this._iconName))) == null) - { - this._iconName = "IconOriginal"; - } - - // pull icon from resources - try - { - var iconBytes = (byte[])resources.GetObject(this._iconName); - using (MemoryStream ms = new MemoryStream(iconBytes)) - { - this.Icon = new Icon(ms); - this.NotifyIcon.Icon = this.Icon; - } - } - catch (Exception ex) - { - // Log ? - } - - if (value != "") - { - this.ApplicationSettingsChanged?.Invoke(); - } - } - } - - public double ThumbnailOpacity - { - get => Math.Min(this.ThumbnailOpacityTrackBar.Value / 100.00, 1.00); - set - { - int barValue = (int)(100.0 * value); - if (barValue > 100) - { - barValue = 100; - } - else if (barValue < 10) - { - barValue = 10; - } - - this.ThumbnailOpacityTrackBar.Value = barValue; - } - } - - public bool EnableClientLayoutTracking - { - get => this.EnableClientLayoutTrackingCheckBox.Checked; - set => this.EnableClientLayoutTrackingCheckBox.Checked = value; - } - - public bool HideActiveClientThumbnail - { - get => this.HideActiveClientThumbnailCheckBox.Checked; - set => this.HideActiveClientThumbnailCheckBox.Checked = value; - } - - public bool MinimizeInactiveClients - { - get => this.MinimizeInactiveClientsCheckBox.Checked; - set => this.MinimizeInactiveClientsCheckBox.Checked = value; - } - public ViewAnimationStyle WindowsAnimationStyle - { - get => (ViewAnimationStyle)this.AnimationStyleCombo.SelectedItem; - set => this.AnimationStyleCombo.SelectedIndex = (int)value; - } - - public bool ShowThumbnailsAlwaysOnTop - { - get => this.ShowThumbnailsAlwaysOnTopCheckBox.Checked; - set => this.ShowThumbnailsAlwaysOnTopCheckBox.Checked = value; - } - - public bool HideThumbnailsOnLostFocus - { - get => this.HideThumbnailsOnLostFocusCheckBox.Checked; - set => this.HideThumbnailsOnLostFocusCheckBox.Checked = value; - } - - public bool EnablePerClientThumbnailLayouts - { - get => this.EnablePerClientThumbnailsLayoutsCheckBox.Checked; - set => this.EnablePerClientThumbnailsLayoutsCheckBox.Checked = value; - } - - public Size ThumbnailSize - { - get => new Size((int)this.ThumbnailsWidthNumericEdit.Value, (int)this.ThumbnailsHeightNumericEdit.Value); - set - { - this.ThumbnailsWidthNumericEdit.Value = value.Width; - this.ThumbnailsHeightNumericEdit.Value = value.Height; - } - } - - public bool EnableThumbnailZoom - { - get => this.EnableThumbnailZoomCheckBox.Checked; - set - { - this.EnableThumbnailZoomCheckBox.Checked = value; - this.RefreshZoomSettings(); - } - } - - public int ThumbnailZoomFactor - { - get => (int)this.ThumbnailZoomFactorNumericEdit.Value; - set => this.ThumbnailZoomFactorNumericEdit.Value = value; - } - - public ViewZoomAnchor ThumbnailZoomAnchor - { - get - { - if (this._zoomAnchorMap[this._cachedThumbnailZoomAnchor].Checked) - { - return this._cachedThumbnailZoomAnchor; - } - - foreach (KeyValuePair valuePair in this._zoomAnchorMap) - { - if (!valuePair.Value.Checked) - { - continue; - } - - this._cachedThumbnailZoomAnchor = valuePair.Key; - return this._cachedThumbnailZoomAnchor; - } - - // Default value - return ViewZoomAnchor.NW; - } - set - { - this._cachedThumbnailZoomAnchor = value; - this._zoomAnchorMap[this._cachedThumbnailZoomAnchor].Checked = true; - } - } - - public ViewZoomAnchor OverlayLabelAnchor - { - get - { - if (this._overlayLabelMap[this._cachedOverlayLabelAnchor].Checked) - { - return this._cachedOverlayLabelAnchor; - } - - foreach (KeyValuePair valuePair in this._overlayLabelMap) - { - if (!valuePair.Value.Checked) - { - continue; - } - - this._cachedOverlayLabelAnchor = valuePair.Key; - return this._cachedOverlayLabelAnchor; - } - - // Default Value - return ViewZoomAnchor.NW; - } - set - { - this._cachedOverlayLabelAnchor = value; - this._overlayLabelMap[this._cachedOverlayLabelAnchor].Checked = true; - } - } - - public bool ShowThumbnailOverlays - { - get => this.ShowThumbnailOverlaysCheckBox.Checked; - set => this.ShowThumbnailOverlaysCheckBox.Checked = value; - } - - public bool ShowThumbnailFrames - { - get => this.ShowThumbnailFramesCheckBox.Checked; - set => this.ShowThumbnailFramesCheckBox.Checked = value; - } - public bool LockThumbnailLocation - { - get => this.LockThumbnailLocationCheckbox.Checked; - set => this.LockThumbnailLocationCheckbox.Checked = value; - } - public bool ThumbnailSnapToGrid - { - get => this.ThumbnailSnapToGridCheckBox.Checked; - set => this.ThumbnailSnapToGridCheckBox.Checked = value; - } - public int ThumbnailSnapToGridSizeX - { - get => (int)ThumbnailSnapToGridSizeXNumericEdit.Value; - set => ThumbnailSnapToGridSizeXNumericEdit.Value = value; - } - public int ThumbnailSnapToGridSizeY - { - get => (int)ThumbnailSnapToGridSizeYNumericEdit.Value; - set => ThumbnailSnapToGridSizeYNumericEdit.Value = value; - } - - public bool EnableActiveClientHighlight - { - get => this.EnableActiveClientHighlightCheckBox.Checked; - set => this.EnableActiveClientHighlightCheckBox.Checked = value; - } - - public Color ActiveClientHighlightColor - { - get => this._activeClientHighlightColor; - set - { - this._activeClientHighlightColor = value; - this.ActiveClientHighlightColorButton.BackColor = value; - } - } - private Color _activeClientHighlightColor; - - public Color OverlayLabelColor - { - get => this._OverlayLabelColor; - set - { - this._OverlayLabelColor = value; - this.OverlayLabelColorButton.BackColor = value; - } - } - private Color _OverlayLabelColor; - - public int OverlayLabelSize - { - get => (int)this.OverlayLabelSizeNumericEdit.Value; - set - { - this.OverlayLabelSizeNumericEdit.Value = value; - } - } - public new void Show() - { - // Registers the current instance as the application's Main Form - this._context.MainForm = this; - - this._suppressEvents = true; - this.FormActivated?.Invoke(); - this._suppressEvents = false; - - Application.Run(this._context); - } - - public void SetThumbnailSizeLimitations(Size minimumSize, Size maximumSize) - { - this._minimumSize = minimumSize; - this._maximumSize = maximumSize; - } - - public void Minimize() - { - this.WindowState = FormWindowState.Minimized; - } - - public void SetVersionInfo(string version) - { - this.VersionLabel.Text = version; - } - - public void SetDocumentationUrl(string url) - { - this.DocumentationLink.Text = url; - } - - public void AddThumbnails(IList thumbnails) - { - this.ThumbnailsList.BeginUpdate(); - - foreach (IThumbnailDescription view in thumbnails) - { - this.ThumbnailsList.SetItemChecked(this.ThumbnailsList.Items.Add(view), view.IsDisabled); - } - - this.ThumbnailsList.EndUpdate(); - } - - public void RemoveThumbnails(IList thumbnails) - { - this.ThumbnailsList.BeginUpdate(); - - foreach (IThumbnailDescription view in thumbnails) - { - this.ThumbnailsList.Items.Remove(view); - } - - this.ThumbnailsList.EndUpdate(); - } - - public void RefreshZoomSettings() - { - bool enableControls = this.EnableThumbnailZoom; - this.ThumbnailZoomFactorNumericEdit.Enabled = enableControls; - this.ZoomAnchorPanel.Enabled = enableControls; - } - - public Action ApplicationExitRequested { get; set; } - - public Action FormActivated { get; set; } - - public Action FormMinimized { get; set; } - - public Action FormCloseRequested { get; set; } - - public Action ApplicationSettingsChanged { get; set; } - - public Action ThumbnailsSizeChanged { get; set; } - - public Action ThumbnailStateChanged { get; set; } - - public Action DocumentationLinkActivated { get; set; } - - #region UI events - private void ContentTabControl_DrawItem(object sender, DrawItemEventArgs e) - { - TabControl control = (TabControl)sender; - TabPage page = control.TabPages[e.Index]; - Rectangle bounds = control.GetTabRect(e.Index); - - Graphics graphics = e.Graphics; - - Brush textBrush = new SolidBrush(SystemColors.ActiveCaptionText); - Brush backgroundBrush = (e.State == DrawItemState.Selected) - ? new SolidBrush(SystemColors.Control) - : new SolidBrush(SystemColors.ControlDark); - graphics.FillRectangle(backgroundBrush, e.Bounds); - - // Use our own font - Font font = new Font("Arial", this.Font.Size * 1.5f, FontStyle.Bold, GraphicsUnit.Pixel); - - // Draw string and center the text - StringFormat stringFlags = new StringFormat(); - stringFlags.Alignment = StringAlignment.Center; - stringFlags.LineAlignment = StringAlignment.Center; - - graphics.DrawString(page.Text, font, textBrush, bounds, stringFlags); - } - - private void OptionChanged_Handler(object sender, EventArgs e) - { - if (this._suppressEvents) - { - return; - } - - this.ApplicationSettingsChanged?.Invoke(); - } - - private void ThumbnailSizeChanged_Handler(object sender, EventArgs e) - { - if (this._suppressEvents) - { - return; - } - - // Perform some View work that is not properly done in the Control - this._suppressEvents = true; - Size thumbnailSize = this.ThumbnailSize; - thumbnailSize.Width = Math.Min(Math.Max(thumbnailSize.Width, this._minimumSize.Width), this._maximumSize.Width); - thumbnailSize.Height = Math.Min(Math.Max(thumbnailSize.Height, this._minimumSize.Height), this._maximumSize.Height); - this.ThumbnailSize = thumbnailSize; - this._suppressEvents = false; - - this.ThumbnailsSizeChanged?.Invoke(); - } - - private void ActiveClientHighlightColorButton_Click(object sender, EventArgs e) - { - using (ColorDialog dialog = new ColorDialog()) - { - dialog.Color = this.ActiveClientHighlightColor; - - if (dialog.ShowDialog() != DialogResult.OK) - { - return; - } - - this.ActiveClientHighlightColor = dialog.Color; - } - - this.OptionChanged_Handler(sender, e); - } - - private void OverlayLabelColorButton_Click(object sender, EventArgs e) - { - using (ColorDialog dialog = new ColorDialog()) - { - dialog.Color = this.OverlayLabelColor; - - if (dialog.ShowDialog() != DialogResult.OK) - { - return; - } - this.OverlayLabelColor = dialog.Color; - } - - this.OptionChanged_Handler(sender, e); - } - - private void ThumbnailsList_ItemCheck_Handler(object sender, ItemCheckEventArgs e) - { - if (!(this.ThumbnailsList.Items[e.Index] is IThumbnailDescription selectedItem)) - { - return; - } - - selectedItem.IsDisabled = (e.NewValue == CheckState.Checked); - - this.ThumbnailStateChanged?.Invoke(selectedItem.Title); - } - - private void DocumentationLinkClicked_Handler(object sender, LinkLabelLinkClickedEventArgs e) - { - this.DocumentationLinkActivated?.Invoke(); - } - - private void MainFormResize_Handler(object sender, EventArgs e) - { - if (this.WindowState != FormWindowState.Minimized) - { - return; - } - - this.FormMinimized?.Invoke(); - } - - private void MainFormClosing_Handler(object sender, FormClosingEventArgs e) - { - ViewCloseRequest request = new ViewCloseRequest(); - - this.FormCloseRequested?.Invoke(request); - - e.Cancel = !request.Allow; - } - - private void RestoreMainForm_Handler(object sender, EventArgs e) - { - // This is form's GUI lifecycle event that is invariant to the Form data - base.Show(); - this.WindowState = FormWindowState.Normal; - this.BringToFront(); - } - - private void ExitMenuItemClick_Handler(object sender, EventArgs e) - { - this.ApplicationExitRequested?.Invoke(); - } - #endregion - - private void InitZoomAnchorMap() - { - this._zoomAnchorMap[ViewZoomAnchor.NW] = this.ZoomAanchorNWRadioButton; - this._zoomAnchorMap[ViewZoomAnchor.N] = this.ZoomAanchorNRadioButton; - this._zoomAnchorMap[ViewZoomAnchor.NE] = this.ZoomAanchorNERadioButton; - this._zoomAnchorMap[ViewZoomAnchor.W] = this.ZoomAanchorWRadioButton; - this._zoomAnchorMap[ViewZoomAnchor.C] = this.ZoomAanchorCRadioButton; - this._zoomAnchorMap[ViewZoomAnchor.E] = this.ZoomAanchorERadioButton; - this._zoomAnchorMap[ViewZoomAnchor.SW] = this.ZoomAanchorSWRadioButton; - this._zoomAnchorMap[ViewZoomAnchor.S] = this.ZoomAanchorSRadioButton; - this._zoomAnchorMap[ViewZoomAnchor.SE] = this.ZoomAanchorSERadioButton; - } - private void InitOverlayLabelMap() - { - this._overlayLabelMap[ViewZoomAnchor.NW] = this.OverlayLabelNWRadioButton; - this._overlayLabelMap[ViewZoomAnchor.N] = this.OverlayLabelNRadioButton; - this._overlayLabelMap[ViewZoomAnchor.NE] = this.OverlayLabelNERadioButton; - this._overlayLabelMap[ViewZoomAnchor.W] = this.OverlayLabelWRadioButton; - this._overlayLabelMap[ViewZoomAnchor.C] = this.OverlayLabelCRadioButton; - this._overlayLabelMap[ViewZoomAnchor.E] = this.OverlayLabelERadioButton; - this._overlayLabelMap[ViewZoomAnchor.SW] = this.OverlayLabelSWRadioButton; - this._overlayLabelMap[ViewZoomAnchor.S] = this.OverlayLabelSRadioButton; - this._overlayLabelMap[ViewZoomAnchor.SE] = this.OverlayLabelSERadioButton; +using EveOPreview.View.Implementation; + +namespace EveOPreview.View { + public partial class MainForm : Form, IMainFormView { +#region Private fields + private readonly ApplicationContext _context; + private readonly Dictionary _zoomAnchorMap; + private readonly Dictionary _overlayLabelMap; + private ViewZoomAnchor _cachedThumbnailZoomAnchor; + private ViewZoomAnchor _cachedOverlayLabelAnchor; + private bool _suppressEvents; + private Size _minimumSize; + private Size _maximumSize; + private string _iconName; +#endregion + + public MainForm(ApplicationContext context) { + this._context = context; + this._zoomAnchorMap = new Dictionary(); + this._overlayLabelMap = new Dictionary(); + this._cachedThumbnailZoomAnchor = ViewZoomAnchor.NW; + this._suppressEvents = false; + this._minimumSize = new Size(20, 20); + this._maximumSize = new Size(20, 20); + + InitializeComponent(); + + this.ThumbnailsList.DisplayMember = "Title"; + + this.InitZoomAnchorMap(); + this.InitOverlayLabelMap(); + this.InitFormSize(); + + this.AnimationStyleCombo.DataSource = Enum.GetValues(typeof(AnimationStyle)); } - private void InitFormSize() - { - const int BUFFER_PIXEL_AMOUNT = 8; - // resize form height based on tabbed control item height - var tabControl = (System.Windows.Forms.TabControl)this.Controls.Find("ContentTabControl", false).First(); - if (tabControl != null) - { - var furnitureSize = this.Height - tabControl.Height; - var calculatedHeight = (tabControl.ItemSize.Width * tabControl.Controls.Count) + furnitureSize + BUFFER_PIXEL_AMOUNT; - if (this.Height < calculatedHeight) - { - this.Height = calculatedHeight; - } - } - } - private void AnimationStyleCombo_SelectedIndexChanged(object sender, EventArgs e) - { + public bool MinimizeToTray { + get => this.MinimizeToTrayCheckBox.Checked; + set => this.MinimizeToTrayCheckBox.Checked = value; + } - } + public string IconName { + get => this._iconName; + set { + this._iconName = value; - private void GeneralSettingsPanel_Paint(object sender, PaintEventArgs e) - { + // Set Icon + System.ComponentModel.ComponentResourceManager resources = + new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); + if (this._iconName == null || ((resources.GetObject(this._iconName))) == null) { + this._iconName = "IconOriginal"; + } - } - } + // pull icon from resources + try { + var iconBytes = (byte[])resources.GetObject(this._iconName); + using (MemoryStream ms = new MemoryStream(iconBytes)) { + this.Icon = new Icon(ms); + this.NotifyIcon.Icon = this.Icon; + } + } catch (Exception) { + // Log ? + } + + if (value != "") { + this.ApplicationSettingsChanged?.Invoke(); + } + } + } + + public double ThumbnailOpacity { + get => Math.Min(this.ThumbnailOpacityTrackBar.Value / 100.00, 1.00); + set { + int barValue = (int)(100.0 * value); + if (barValue > 100) { + barValue = 100; + } else if (barValue < 10) { + barValue = 10; + } + + this.ThumbnailOpacityTrackBar.Value = barValue; + } + } + + public bool EnableClientLayoutTracking { + get => this.EnableClientLayoutTrackingCheckBox.Checked; + set => this.EnableClientLayoutTrackingCheckBox.Checked = value; + } + + public bool HideActiveClientThumbnail { + get => this.HideActiveClientThumbnailCheckBox.Checked; + set => this.HideActiveClientThumbnailCheckBox.Checked = value; + } + + public bool MinimizeInactiveClients { + get => this.MinimizeInactiveClientsCheckBox.Checked; + set => this.MinimizeInactiveClientsCheckBox.Checked = value; + } + public ViewAnimationStyle WindowsAnimationStyle { + get => (ViewAnimationStyle)this.AnimationStyleCombo.SelectedItem; + set => this.AnimationStyleCombo.SelectedIndex = (int)value; + } + + public bool ShowThumbnailsAlwaysOnTop { + get => this.ShowThumbnailsAlwaysOnTopCheckBox.Checked; + set => this.ShowThumbnailsAlwaysOnTopCheckBox.Checked = value; + } + + public bool HideThumbnailsOnLostFocus { + get => this.HideThumbnailsOnLostFocusCheckBox.Checked; + set => this.HideThumbnailsOnLostFocusCheckBox.Checked = value; + } + + public bool EnablePerClientThumbnailLayouts { + get => this.EnablePerClientThumbnailsLayoutsCheckBox.Checked; + set => this.EnablePerClientThumbnailsLayoutsCheckBox.Checked = value; + } + + public Size ThumbnailSize { + get => new Size((int)this.ThumbnailsWidthNumericEdit.Value, (int)this.ThumbnailsHeightNumericEdit.Value); + set { + this.ThumbnailsWidthNumericEdit.Value = value.Width; + this.ThumbnailsHeightNumericEdit.Value = value.Height; + } + } + + public bool EnableThumbnailZoom { + get => this.EnableThumbnailZoomCheckBox.Checked; + set { + this.EnableThumbnailZoomCheckBox.Checked = value; + this.RefreshZoomSettings(); + } + } + + public int ThumbnailZoomFactor { + get => (int)this.ThumbnailZoomFactorNumericEdit.Value; + set => this.ThumbnailZoomFactorNumericEdit.Value = value; + } + + public ViewZoomAnchor ThumbnailZoomAnchor { + get { + if (this._zoomAnchorMap[this._cachedThumbnailZoomAnchor].Checked) { + return this._cachedThumbnailZoomAnchor; + } + + foreach (KeyValuePair valuePair in this._zoomAnchorMap) { + if (!valuePair.Value.Checked) { + continue; + } + + this._cachedThumbnailZoomAnchor = valuePair.Key; + return this._cachedThumbnailZoomAnchor; + } + + // Default value + return ViewZoomAnchor.NW; + } + set { + this._cachedThumbnailZoomAnchor = value; + this._zoomAnchorMap[this._cachedThumbnailZoomAnchor].Checked = true; + } + } + + public ViewZoomAnchor OverlayLabelAnchor { + get { + if (this._overlayLabelMap[this._cachedOverlayLabelAnchor].Checked) { + return this._cachedOverlayLabelAnchor; + } + + foreach (KeyValuePair valuePair in this._overlayLabelMap) { + if (!valuePair.Value.Checked) { + continue; + } + + this._cachedOverlayLabelAnchor = valuePair.Key; + return this._cachedOverlayLabelAnchor; + } + + // Default Value + return ViewZoomAnchor.NW; + } + set { + this._cachedOverlayLabelAnchor = value; + this._overlayLabelMap[this._cachedOverlayLabelAnchor].Checked = true; + } + } + + public bool ShowThumbnailOverlays { + get => this.ShowThumbnailOverlaysCheckBox.Checked; + set => this.ShowThumbnailOverlaysCheckBox.Checked = value; + } + + public bool ShowThumbnailFrames { + get => this.ShowThumbnailFramesCheckBox.Checked; + set => this.ShowThumbnailFramesCheckBox.Checked = value; + } + public bool LockThumbnailLocation { + get => this.LockThumbnailLocationCheckbox.Checked; + set => this.LockThumbnailLocationCheckbox.Checked = value; + } + public bool ThumbnailSnapToGrid { + get => this.ThumbnailSnapToGridCheckBox.Checked; + set => this.ThumbnailSnapToGridCheckBox.Checked = value; + } + public int ThumbnailSnapToGridSizeX { + get => (int)ThumbnailSnapToGridSizeXNumericEdit.Value; + set => ThumbnailSnapToGridSizeXNumericEdit.Value = value; + } + public int ThumbnailSnapToGridSizeY { + get => (int)ThumbnailSnapToGridSizeYNumericEdit.Value; + set => ThumbnailSnapToGridSizeYNumericEdit.Value = value; + } + + public bool EnableActiveClientHighlight { + get => this.EnableActiveClientHighlightCheckBox.Checked; + set => this.EnableActiveClientHighlightCheckBox.Checked = value; + } + + public Color ActiveClientHighlightColor { + get => this._activeClientHighlightColor; + set { + this._activeClientHighlightColor = value; + this.ActiveClientHighlightColorButton.BackColor = value; + } + } + private Color _activeClientHighlightColor; + + public Color OverlayLabelColor { + get => this._OverlayLabelColor; + set { + this._OverlayLabelColor = value; + this.OverlayLabelColorButton.BackColor = value; + } + } + private Color _OverlayLabelColor; + + public int OverlayLabelSize { + get => (int)this.OverlayLabelSizeNumericEdit.Value; + set => this.OverlayLabelSizeNumericEdit.Value = value; + } + + public bool EnableThumbnailRegionSnipping { + get => this.EnableThumbnailRegionSnippingCheckBox.Checked; + set => this.EnableThumbnailRegionSnippingCheckBox.Checked = value; + } + + public Rectangle DefaultThumbnailRegion { + get => new Rectangle((int)this.RegionLeftNumericEdit.Value, (int)this.RegionTopNumericEdit.Value, + (int)this.RegionWidthNumericEdit.Value, (int)this.RegionHeightNumericEdit.Value); + set { + this.RegionLeftNumericEdit.Value = value.Left; + this.RegionTopNumericEdit.Value = value.Top; + this.RegionWidthNumericEdit.Value = value.Width; + this.RegionHeightNumericEdit.Value = value.Height; + } + } + + private void PickRegionButton_Click(object sender, EventArgs e) { + using (var picker = new RegionPickerDialog()) { + if (picker.ShowDialog() == DialogResult.OK) { + var region = picker.SelectedRegion; + this.DefaultThumbnailRegion = region; + this.ApplicationSettingsChanged?.Invoke(); + } + } + } + + public string CurrentProfile { + get => this.ProfileComboBox.Text; + set { + if (this.ProfileComboBox.Items.Contains(value)) { + this.ProfileComboBox.SelectedItem = value; + } + } + } + + public List AvailableProfiles { + get => this.ProfileComboBox.Items.Cast().ToList(); + set { + this.ProfileComboBox.Items.Clear(); + foreach (var profile in value) { + this.ProfileComboBox.Items.Add(profile); + } + } + } + + private void ProfileComboBox_SelectedIndexChanged(object sender, EventArgs e) { + if (!this._suppressEvents) { + this.ApplicationSettingsChanged?.Invoke(); + } + } + + private void SaveProfileButton_Click(object sender, EventArgs e) { + using (var inputDialog = new InputDialog("Save Profile", "Enter profile name:")) { + if (inputDialog.ShowDialog() == DialogResult.OK) { + string profileName = inputDialog.InputText; + if (!string.IsNullOrWhiteSpace(profileName)) { + this.ProfileComboBox.Items.Add(profileName); + this.ProfileComboBox.SelectedItem = profileName; + this.ApplicationSettingsChanged?.Invoke(); + } + } + } + } + + private void DeleteProfileButton_Click(object sender, EventArgs e) { + if (this.ProfileComboBox.SelectedItem != null) { + string selectedProfile = this.ProfileComboBox.SelectedItem.ToString(); + if (selectedProfile != "Default") { + this.ProfileComboBox.Items.Remove(selectedProfile); + this.ApplicationSettingsChanged?.Invoke(); + } + } + } + + public new void Show() {// Registers the current instance as the application's Main Form + this._context.MainForm = this; + + this._suppressEvents = true; + this.FormActivated?.Invoke(); + this._suppressEvents = false; + + Application.Run(this._context); + } + + public void SetThumbnailSizeLimitations(Size minimumSize, Size maximumSize) { + this._minimumSize = minimumSize; + this._maximumSize = maximumSize; + } + + public void Minimize() { + this.WindowState = FormWindowState.Minimized; + } + + public void SetVersionInfo(string version) { + this.VersionLabel.Text = version; + } + + public void SetDocumentationUrl(string url) { + this.DocumentationLink.Text = url; + } + + public void AddThumbnails(IList thumbnails) { + this.ThumbnailsList.BeginUpdate(); + + foreach (IThumbnailDescription view in thumbnails) { + this.ThumbnailsList.SetItemChecked(this.ThumbnailsList.Items.Add(view), view.IsDisabled); + } + + this.ThumbnailsList.EndUpdate(); + } + + public void RemoveThumbnails(IList thumbnails) { + this.ThumbnailsList.BeginUpdate(); + + foreach (IThumbnailDescription view in thumbnails) { + this.ThumbnailsList.Items.Remove(view); + } + + this.ThumbnailsList.EndUpdate(); + } + + public void RefreshZoomSettings() { + bool enableControls = this.EnableThumbnailZoom; + this.ThumbnailZoomFactorNumericEdit.Enabled = enableControls; + this.ZoomAnchorPanel.Enabled = enableControls; + } + + public Action ApplicationExitRequested { get; set; } + + public Action FormActivated { get; set; } + + public Action FormMinimized { get; set; } + + public Action FormCloseRequested { get; set; } + + public Action ApplicationSettingsChanged { get; set; } + + public Action ThumbnailsSizeChanged { get; set; } + + public Action ThumbnailStateChanged { get; set; } + + public Action DocumentationLinkActivated { get; set; } + +#region UI events + private void ContentTabControl_DrawItem(object sender, DrawItemEventArgs e) { + TabControl control = (TabControl)sender; + TabPage page = control.TabPages[e.Index]; + Rectangle bounds = control.GetTabRect(e.Index); + + Graphics graphics = e.Graphics; + + Brush textBrush = new SolidBrush(SystemColors.ActiveCaptionText); + Brush backgroundBrush = (e.State == DrawItemState.Selected) ? new SolidBrush(SystemColors.Control) + : new SolidBrush(SystemColors.ControlDark); + graphics.FillRectangle(backgroundBrush, e.Bounds); + + // Use our own font + Font font = new Font("Arial", this.Font.Size * 1.5f, FontStyle.Bold, GraphicsUnit.Pixel); + + // Draw string and center the text + StringFormat stringFlags = new StringFormat(); + stringFlags.Alignment = StringAlignment.Center; + stringFlags.LineAlignment = StringAlignment.Center; + + graphics.DrawString(page.Text, font, textBrush, bounds, stringFlags); + } + + private void OptionChanged_Handler(object sender, EventArgs e) { + if (this._suppressEvents) { + return; + } + + this.ApplicationSettingsChanged?.Invoke(); + } + + private void ThumbnailSizeChanged_Handler(object sender, EventArgs e) { + if (this._suppressEvents) { + return; + } + + // Perform some View work that is not properly done in the Control + this._suppressEvents = true; + Size thumbnailSize = this.ThumbnailSize; + thumbnailSize.Width = Math.Min(Math.Max(thumbnailSize.Width, this._minimumSize.Width), this._maximumSize.Width); + thumbnailSize.Height = + Math.Min(Math.Max(thumbnailSize.Height, this._minimumSize.Height), this._maximumSize.Height); + this.ThumbnailSize = thumbnailSize; + this._suppressEvents = false; + + this.ThumbnailsSizeChanged?.Invoke(); + } + + private void ActiveClientHighlightColorButton_Click(object sender, EventArgs e) { + using (ColorDialog dialog = new ColorDialog()) { + dialog.Color = this.ActiveClientHighlightColor; + + if (dialog.ShowDialog() != DialogResult.OK) { + return; + } + + this.ActiveClientHighlightColor = dialog.Color; + } + + this.OptionChanged_Handler(sender, e); + } + + private void OverlayLabelColorButton_Click(object sender, EventArgs e) { + using (ColorDialog dialog = new ColorDialog()) { + dialog.Color = this.OverlayLabelColor; + + if (dialog.ShowDialog() != DialogResult.OK) { + return; + } + this.OverlayLabelColor = dialog.Color; + } + + this.OptionChanged_Handler(sender, e); + } + + private void ThumbnailsList_ItemCheck_Handler(object sender, ItemCheckEventArgs e) { + if (!(this.ThumbnailsList.Items[e.Index] is IThumbnailDescription selectedItem)) { + return; + } + + selectedItem.IsDisabled = (e.NewValue == CheckState.Checked); + + this.ThumbnailStateChanged?.Invoke(selectedItem.Title); + } + + private void DocumentationLinkClicked_Handler(object sender, LinkLabelLinkClickedEventArgs e) { + this.DocumentationLinkActivated?.Invoke(); + } + + private void MainFormResize_Handler(object sender, EventArgs e) { + if (this.WindowState != FormWindowState.Minimized) { + return; + } + + this.FormMinimized?.Invoke(); + } + + private void MainFormClosing_Handler(object sender, FormClosingEventArgs e) { + ViewCloseRequest request = new ViewCloseRequest(); + + this.FormCloseRequested?.Invoke(request); + + e.Cancel = !request.Allow; + } + + private void RestoreMainForm_Handler(object sender, EventArgs e) { + // This is form's GUI lifecycle event that is invariant to the Form data + base.Show(); + this.WindowState = FormWindowState.Normal; + this.BringToFront(); + } + + private void ExitMenuItemClick_Handler(object sender, EventArgs e) { + this.ApplicationExitRequested?.Invoke(); + } +#endregion + + private void InitZoomAnchorMap() { + this._zoomAnchorMap[ViewZoomAnchor.NW] = this.ZoomAanchorNWRadioButton; + this._zoomAnchorMap[ViewZoomAnchor.N] = this.ZoomAanchorNRadioButton; + this._zoomAnchorMap[ViewZoomAnchor.NE] = this.ZoomAanchorNERadioButton; + this._zoomAnchorMap[ViewZoomAnchor.W] = this.ZoomAanchorWRadioButton; + this._zoomAnchorMap[ViewZoomAnchor.C] = this.ZoomAanchorCRadioButton; + this._zoomAnchorMap[ViewZoomAnchor.E] = this.ZoomAanchorERadioButton; + this._zoomAnchorMap[ViewZoomAnchor.SW] = this.ZoomAanchorSWRadioButton; + this._zoomAnchorMap[ViewZoomAnchor.S] = this.ZoomAanchorSRadioButton; + this._zoomAnchorMap[ViewZoomAnchor.SE] = this.ZoomAanchorSERadioButton; + } + private void InitOverlayLabelMap() { + this._overlayLabelMap[ViewZoomAnchor.NW] = this.OverlayLabelNWRadioButton; + this._overlayLabelMap[ViewZoomAnchor.N] = this.OverlayLabelNRadioButton; + this._overlayLabelMap[ViewZoomAnchor.NE] = this.OverlayLabelNERadioButton; + this._overlayLabelMap[ViewZoomAnchor.W] = this.OverlayLabelWRadioButton; + this._overlayLabelMap[ViewZoomAnchor.C] = this.OverlayLabelCRadioButton; + this._overlayLabelMap[ViewZoomAnchor.E] = this.OverlayLabelERadioButton; + this._overlayLabelMap[ViewZoomAnchor.SW] = this.OverlayLabelSWRadioButton; + this._overlayLabelMap[ViewZoomAnchor.S] = this.OverlayLabelSRadioButton; + this._overlayLabelMap[ViewZoomAnchor.SE] = this.OverlayLabelSERadioButton; + } + private void InitFormSize() { + const int BUFFER_PIXEL_AMOUNT = 8; + // resize form height based on tabbed control item height + var tabControl = (System.Windows.Forms.TabControl)this.Controls.Find("ContentTabControl", false).First(); + if (tabControl != null) { + var furnitureSize = this.Height - tabControl.Height; + var calculatedHeight = + (tabControl.ItemSize.Width * tabControl.Controls.Count) + furnitureSize + BUFFER_PIXEL_AMOUNT; + if (this.Height < calculatedHeight) { + this.Height = calculatedHeight; + } + } + } + + private void AnimationStyleCombo_SelectedIndexChanged(object sender, EventArgs e) {} + + private void GeneralSettingsPanel_Paint(object sender, PaintEventArgs e) {} +} } \ No newline at end of file diff --git a/src/Eve-O-Preview/View/Implementation/RegionPickerDialog.Designer.cs b/src/Eve-O-Preview/View/Implementation/RegionPickerDialog.Designer.cs new file mode 100644 index 0000000..b1f6a82 --- /dev/null +++ b/src/Eve-O-Preview/View/Implementation/RegionPickerDialog.Designer.cs @@ -0,0 +1,40 @@ +namespace EveOPreview.View.Implementation { + partial class RegionPickerDialog { + /// + /// 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.SuspendLayout(); + // + // RegionPickerDialog + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Name = "RegionPickerDialog"; + this.Text = "Region Picker"; + this.ResumeLayout(false); + } + +#endregion + } +} \ No newline at end of file diff --git a/src/Eve-O-Preview/View/Implementation/RegionPickerDialog.cs b/src/Eve-O-Preview/View/Implementation/RegionPickerDialog.cs new file mode 100644 index 0000000..3d28634 --- /dev/null +++ b/src/Eve-O-Preview/View/Implementation/RegionPickerDialog.cs @@ -0,0 +1,136 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace EveOPreview.View.Implementation { + public partial class RegionPickerDialog : Form { + private Point _startPoint; + private Point _endPoint; + private bool _isDrawing; + private Rectangle _selectedRegion; + + public Rectangle SelectedRegion => _selectedRegion; + + public RegionPickerDialog() { + InitializeComponent(); + InitializeDialog(); + } + + private void InitializeDialog() { + // Make the form cover all screens + Rectangle totalBounds = GetTotalScreenBounds(); + this.Bounds = totalBounds; + this.StartPosition = FormStartPosition.Manual; + this.FormBorderStyle = FormBorderStyle.None; + this.WindowState = FormWindowState.Maximized; + this.TopMost = true; + this.ShowInTaskbar = false; + this.Cursor = Cursors.Cross; + + // Make the form semi-transparent but not fully transparent + this.BackColor = Color.Black; + this.Opacity = 0.3; + + // Add event handlers + this.MouseDown += RegionPickerDialog_MouseDown; + this.MouseMove += RegionPickerDialog_MouseMove; + this.MouseUp += RegionPickerDialog_MouseUp; + this.KeyDown += RegionPickerDialog_KeyDown; + this.Paint += RegionPickerDialog_Paint; + + // Add instructions label + var instructionsLabel = new Label { Text = "Click and drag to select a region. Press ESC to cancel.", + ForeColor = Color.White, + BackColor = Color.Black, + Font = new Font("Arial", 12, FontStyle.Bold), + AutoSize = true, + Location = new Point(10, 10) }; + this.Controls.Add(instructionsLabel); + } + + private Rectangle GetTotalScreenBounds() { + Rectangle bounds = Screen.PrimaryScreen.Bounds; + foreach (Screen screen in Screen.AllScreens) { + bounds = Rectangle.Union(bounds, screen.Bounds); + } + return bounds; + } + + private void RegionPickerDialog_MouseDown(object sender, MouseEventArgs e) { + if (e.Button == MouseButtons.Left) { + _startPoint = e.Location; + _isDrawing = true; + this.Capture = true; + this.Invalidate(); + } + } + + private void RegionPickerDialog_MouseMove(object sender, MouseEventArgs e) { + if (_isDrawing) { + _endPoint = e.Location; + this.Invalidate(); + } + } + + private void RegionPickerDialog_MouseUp(object sender, MouseEventArgs e) { + if (e.Button == MouseButtons.Left && _isDrawing) { + _isDrawing = false; + _endPoint = e.Location; + this.Capture = false; + + // Calculate the selected region + int x = Math.Min(_startPoint.X, _endPoint.X); + int y = Math.Min(_startPoint.Y, _endPoint.Y); + int width = Math.Abs(_endPoint.X - _startPoint.X); + int height = Math.Abs(_endPoint.Y - _startPoint.Y); + + if (width > 10 && height > 10) // Minimum size + { + _selectedRegion = new Rectangle(x, y, width, height); + this.DialogResult = DialogResult.OK; + this.Close(); + } else { + // Reset if region is too small + _startPoint = Point.Empty; + _endPoint = Point.Empty; + this.Invalidate(); + } + } + } + + private void RegionPickerDialog_KeyDown(object sender, KeyEventArgs e) { + if (e.KeyCode == Keys.Escape) { + this.DialogResult = DialogResult.Cancel; + this.Close(); + } + } + + private void RegionPickerDialog_Paint(object sender, PaintEventArgs e) { + if (_isDrawing) { + // Draw selection rectangle + using (Pen pen = new Pen(Color.Red, 2)) { + pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + + int x = Math.Min(_startPoint.X, _endPoint.X); + int y = Math.Min(_startPoint.Y, _endPoint.Y); + int width = Math.Abs(_endPoint.X - _startPoint.X); + int height = Math.Abs(_endPoint.Y - _startPoint.Y); + + e.Graphics.DrawRectangle(pen, x, y, width, height); + } + + // Draw size information + if (_startPoint != Point.Empty && _endPoint != Point.Empty) { + int width = Math.Abs(_endPoint.X - _startPoint.X); + int height = Math.Abs(_endPoint.Y - _startPoint.Y); + + string sizeText = $"{width} x {height}"; + using (Font font = new Font("Arial", 10, FontStyle.Bold)) using (Brush brush = + new SolidBrush(Color.White)) { + e.Graphics.DrawString(sizeText, font, brush, _endPoint.X + 5, _endPoint.Y + 5); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Eve-O-Preview/View/Implementation/StaticThumbnailImage.cs b/src/Eve-O-Preview/View/Implementation/StaticThumbnailImage.cs index f5ec500..8c10c68 100644 --- a/src/Eve-O-Preview/View/Implementation/StaticThumbnailImage.cs +++ b/src/Eve-O-Preview/View/Implementation/StaticThumbnailImage.cs @@ -1,23 +1,17 @@ using System; using System.Windows.Forms; -namespace EveOPreview.View -{ - sealed class StaticThumbnailImage : PictureBox - { - protected override void WndProc(ref Message m) - { - const int WM_NCHITTEST = 0x0084; - const int HTTRANSPARENT = (-1); +namespace EveOPreview.View { + sealed class StaticThumbnailImage : PictureBox { + protected override void WndProc(ref Message m) { + const int WM_NCHITTEST = 0x0084; + const int HTTRANSPARENT = (-1); - if (m.Msg == WM_NCHITTEST) - { - m.Result = (IntPtr)HTTRANSPARENT; - } - else - { - base.WndProc(ref m); - } - } - } + if (m.Msg == WM_NCHITTEST) { + m.Result = (IntPtr)HTTRANSPARENT; + } else { + base.WndProc(ref m); + } + } + } } diff --git a/src/Eve-O-Preview/View/Implementation/StaticThumbnailView.cs b/src/Eve-O-Preview/View/Implementation/StaticThumbnailView.cs index b00d4b3..fd40474 100644 --- a/src/Eve-O-Preview/View/Implementation/StaticThumbnailView.cs +++ b/src/Eve-O-Preview/View/Implementation/StaticThumbnailView.cs @@ -4,70 +4,93 @@ using System.Windows.Forms; using EveOPreview.Configuration; using EveOPreview.Services; -namespace EveOPreview.View -{ - sealed class StaticThumbnailView : ThumbnailView - { - #region Private fields - private readonly PictureBox _thumbnail; - private IThumbnailConfiguration _config; - #endregion +namespace EveOPreview.View { + sealed class StaticThumbnailView : ThumbnailView { +#region Private fields + private readonly PictureBox _thumbnail; + private IThumbnailConfiguration _config; +#endregion - public StaticThumbnailView(IWindowManager windowManager, IThumbnailConfiguration config, IThumbnailManager thumbnailManager) - : base(windowManager, config, thumbnailManager) - { - this._thumbnail = new StaticThumbnailImage - { - TabStop = false, - SizeMode = PictureBoxSizeMode.StretchImage, - Location = new Point(0, 0), - Size = new Size(this.ClientSize.Width, this.ClientSize.Height) - }; - this.Controls.Add(this._thumbnail); - this._config = config; - } + public StaticThumbnailView(IWindowManager windowManager, IThumbnailConfiguration config, + IThumbnailManager thumbnailManager) + : base(windowManager, config, thumbnailManager) { + this._thumbnail = + new StaticThumbnailImage { TabStop = false, SizeMode = PictureBoxSizeMode.StretchImage, + Location = new Point(0, 0), + Size = new Size(this.ClientSize.Width, this.ClientSize.Height) }; + this.Controls.Add(this._thumbnail); + this._config = config; + } - protected override void RefreshThumbnail(bool forceRefresh) - { - if (!forceRefresh) - { - return; - } + protected override void RefreshThumbnail(bool forceRefresh) { + if (!forceRefresh) { + return; + } - var thumbnail = this.WindowManager.GetStaticThumbnail(this.Id); - if (thumbnail != null) - { - var oldImage = this._thumbnail.Image; - this._thumbnail.Image = thumbnail; - oldImage?.Dispose(); - } - } + var thumbnail = this.WindowManager.GetStaticThumbnail(this.Id); + if (thumbnail != null) { + var oldImage = this._thumbnail.Image; + this._thumbnail.Image = thumbnail; + oldImage?.Dispose(); + } + } - protected override void ResizeThumbnail(int baseWidth, int baseHeight, int highlightWidthTop, int highlightWidthRight, int highlightWidthBottom, int highlightWidthLeft) - { - var left = 0 + highlightWidthLeft; - var top = 0 + highlightWidthTop; - if (this.IsLocationUpdateRequired(this._thumbnail.Location, left, top)) - { - this._thumbnail.Location = new Point(left, top); - } + protected override void ApplyRegionSettings() { + if (this._thumbnail.Image == null) + return; - var width = baseWidth - highlightWidthLeft - highlightWidthRight; - var height = baseHeight - highlightWidthTop - highlightWidthBottom; - if (this.IsSizeUpdateRequired(this._thumbnail.Size, width, height)) - { - this._thumbnail.Size = new Size(width, height); - } - } + if (this._config.EnableThumbnailRegionSnipping) { + var region = this._config.GetThumbnailRegion(this.Title, this._config.DefaultThumbnailRegion); + if (region.Width > 0 && region.Height > 0) { + // Crop the image to the specified region + var croppedImage = CropImage((Image)this._thumbnail.Image, region); + var oldImage = this._thumbnail.Image; + this._thumbnail.Image = croppedImage; + oldImage?.Dispose(); + } + } + } - private bool IsLocationUpdateRequired(Point currentLocation, int left, int top) - { - return (currentLocation.X != left) || (currentLocation.Y != top); - } + private Image CropImage(Image sourceImage, Rectangle region) { + // Ensure the region is within the image bounds + var imageRect = new Rectangle(0, 0, sourceImage.Width, sourceImage.Height); + var cropRect = Rectangle.Intersect(region, imageRect); - private bool IsSizeUpdateRequired(Size currentSize, int width, int height) - { - return (currentSize.Width != width) || (currentSize.Height != height); - } - } + if (cropRect.Width <= 0 || cropRect.Height <= 0) { + return sourceImage; // Return original if region is invalid + } + + var croppedImage = new Bitmap(cropRect.Width, cropRect.Height); + using (var graphics = Graphics.FromImage(croppedImage)) { + graphics.DrawImage(sourceImage, new Rectangle(0, 0, cropRect.Width, cropRect.Height), cropRect, + GraphicsUnit.Pixel); + } + + return croppedImage; + } + + protected override void ResizeThumbnail(int baseWidth, int baseHeight, int highlightWidthTop, + int highlightWidthRight, int highlightWidthBottom, + int highlightWidthLeft) { + var left = 0 + highlightWidthLeft; + var top = 0 + highlightWidthTop; + if (this.IsLocationUpdateRequired(this._thumbnail.Location, left, top)) { + this._thumbnail.Location = new Point(left, top); + } + + var width = baseWidth - highlightWidthLeft - highlightWidthRight; + var height = baseHeight - highlightWidthTop - highlightWidthBottom; + if (this.IsSizeUpdateRequired(this._thumbnail.Size, width, height)) { + this._thumbnail.Size = new Size(width, height); + } + } + + private bool IsLocationUpdateRequired(Point currentLocation, int left, int top) { + return (currentLocation.X != left) || (currentLocation.Y != top); + } + + private bool IsSizeUpdateRequired(Size currentSize, int width, int height) { + return (currentSize.Width != width) || (currentSize.Height != height); + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/View/Implementation/ThumbnailDescription.cs b/src/Eve-O-Preview/View/Implementation/ThumbnailDescription.cs index 61fbd6b..ce7be77 100644 --- a/src/Eve-O-Preview/View/Implementation/ThumbnailDescription.cs +++ b/src/Eve-O-Preview/View/Implementation/ThumbnailDescription.cs @@ -1,14 +1,11 @@ -namespace EveOPreview.View -{ - sealed class ThumbnailDescription : IThumbnailDescription - { - public ThumbnailDescription(string title, bool isDisabled) - { - this.Title = title; - this.IsDisabled = isDisabled; - } +namespace EveOPreview.View { + sealed class ThumbnailDescription : IThumbnailDescription { + public ThumbnailDescription(string title, bool isDisabled) { + this.Title = title; + this.IsDisabled = isDisabled; + } - public string Title { get; set; } - public bool IsDisabled { get; set; } - } + public string Title { get; set; } + public bool IsDisabled { get; set; } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/View/Implementation/ThumbnailOverlay.Designer.cs b/src/Eve-O-Preview/View/Implementation/ThumbnailOverlay.Designer.cs index e53f3e1..225afac 100644 --- a/src/Eve-O-Preview/View/Implementation/ThumbnailOverlay.Designer.cs +++ b/src/Eve-O-Preview/View/Implementation/ThumbnailOverlay.Designer.cs @@ -1,90 +1,85 @@ -namespace EveOPreview.View -{ - partial class ThumbnailOverlay - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; +namespace EveOPreview.View { + 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); - } + /// + /// 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 +#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.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(8, 8); - this.OverlayLabel.Name = "OverlayLabel"; - this.OverlayLabel.Size = new System.Drawing.Size(25, 13); - this.OverlayLabel.TabIndex = 1; - this.OverlayLabel.Text = "..."; - this.OverlayLabel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OverlayArea_Click); - // - // ThumbnailOverlay - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - 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(); + /// + /// 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.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(8, 8); + this.OverlayLabel.Name = "OverlayLabel"; + this.OverlayLabel.Size = new System.Drawing.Size(25, 13); + this.OverlayLabel.TabIndex = 1; + this.OverlayLabel.Text = "..."; + this.OverlayLabel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OverlayArea_Click); + // + // ThumbnailOverlay + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + 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 - #endregion - - private System.Windows.Forms.Label OverlayLabel; - } + private System.Windows.Forms.Label OverlayLabel; + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/View/Implementation/ThumbnailOverlay.cs b/src/Eve-O-Preview/View/Implementation/ThumbnailOverlay.cs index 2731e90..e97c1db 100644 --- a/src/Eve-O-Preview/View/Implementation/ThumbnailOverlay.cs +++ b/src/Eve-O-Preview/View/Implementation/ThumbnailOverlay.cs @@ -3,49 +3,41 @@ using System.Windows.Forms; using EveOPreview.Configuration; using EveOPreview.Services; -namespace EveOPreview.View -{ - public partial class ThumbnailOverlay : Form - { - #region Private fields - private readonly Action _areaClickAction; - #endregion +namespace EveOPreview.View { + public partial class ThumbnailOverlay : Form { +#region Private fields + private readonly Action _areaClickAction; +#endregion - public ThumbnailOverlay(Form owner, Action areaClickAction) - { - this.Owner = owner; - this._areaClickAction = areaClickAction; + public ThumbnailOverlay(Form owner, Action areaClickAction) { + this.Owner = owner; + this._areaClickAction = areaClickAction; - InitializeComponent(); - } + InitializeComponent(); + } - private void OverlayArea_Click(object sender, MouseEventArgs e) - { - this._areaClickAction(this, e); - } + private void OverlayArea_Click(object sender, MouseEventArgs e) { + this._areaClickAction(this, e); + } - public void SetOverlayLabel(string label) - { - this.OverlayLabel.Text = label; - } + public void SetOverlayLabel(string label) { + this.OverlayLabel.Text = label; + } - public void SetPropertiesOverlayLabel(int size, System.Drawing.Color c, ZoomAnchor anchor) - { - if (this.OverlayLabel.Font.Size != size) - { - this.OverlayLabel.Font = new System.Drawing.Font(this.OverlayLabel.Font.FontFamily, size); - } - this.OverlayLabel.ForeColor = c; + public void SetPropertiesOverlayLabel(int size, System.Drawing.Color c, ZoomAnchor anchor) { + if (this.OverlayLabel.Font.Size != size) { + this.OverlayLabel.Font = new System.Drawing.Font(this.OverlayLabel.Font.FontFamily, size); + } + this.OverlayLabel.ForeColor = c; - int margin = 5; + int margin = 5; - switch (anchor) - { - case ZoomAnchor.NW: - this.OverlayLabel.Left = margin; - this.OverlayLabel.Top = margin; - this.OverlayLabel.TextAlign = System.Drawing.ContentAlignment.TopLeft; - break; + switch (anchor) { + case ZoomAnchor.NW: + this.OverlayLabel.Left = margin; + this.OverlayLabel.Top = margin; + this.OverlayLabel.TextAlign = System.Drawing.ContentAlignment.TopLeft; + break; case ZoomAnchor.N: this.OverlayLabel.Left = (this.Width / 2) - (this.OverlayLabel.Width / 2); this.OverlayLabel.Top = margin; @@ -87,21 +79,18 @@ namespace EveOPreview.View this.OverlayLabel.TextAlign = System.Drawing.ContentAlignment.BottomRight; break; } - } + } - public void EnableOverlayLabel(bool enable) - { - this.OverlayLabel.Visible = enable; - } + public void EnableOverlayLabel(bool enable) { + this.OverlayLabel.Visible = enable; + } - protected override CreateParams CreateParams - { - get - { - var Params = base.CreateParams; - Params.ExStyle |= (int)InteropConstants.WS_EX_TOOLWINDOW; - return Params; - } - } - } + protected override CreateParams CreateParams { + get { + var Params = base.CreateParams; + Params.ExStyle |= (int)InteropConstants.WS_EX_TOOLWINDOW; + return Params; + } + } + } } diff --git a/src/Eve-O-Preview/View/Implementation/ThumbnailView.Designer.cs b/src/Eve-O-Preview/View/Implementation/ThumbnailView.Designer.cs index 575e5a1..bf69104 100644 --- a/src/Eve-O-Preview/View/Implementation/ThumbnailView.Designer.cs +++ b/src/Eve-O-Preview/View/Implementation/ThumbnailView.Designer.cs @@ -1,53 +1,47 @@ -namespace EveOPreview.View -{ - partial class ThumbnailView - { +namespace EveOPreview.View { + partial class ThumbnailView { /// /// Required designer variable. /// - #region Windows Form Designer generated code +#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.SuspendLayout(); - // - // ThumbnailView - // - this.AccessibleRole = System.Windows.Forms.AccessibleRole.None; - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - this.BackColor = System.Drawing.Color.Black; - this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.ClientSize = new System.Drawing.Size(153, 89); - this.ControlBox = false; - this.DoubleBuffered = true; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(20, 20); - this.Name = "ThumbnailView"; - this.Opacity = 0.1D; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.Text = "Preview"; - this.TopMost = true; - this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MouseDown_Handler); - this.MouseEnter += new System.EventHandler(this.MouseEnter_Handler); - this.MouseLeave += new System.EventHandler(this.MouseLeave_Handler); - this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MouseMove_Handler); - this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.MouseUp_Handler); - this.Move += new System.EventHandler(this.Move_Handler); - this.Resize += new System.EventHandler(this.Resize_Handler); - this.ResumeLayout(false); - + private void InitializeComponent() { + this.SuspendLayout(); + // + // ThumbnailView + // + this.AccessibleRole = System.Windows.Forms.AccessibleRole.None; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.BackColor = System.Drawing.Color.Black; + this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.ClientSize = new System.Drawing.Size(153, 89); + this.ControlBox = false; + this.DoubleBuffered = true; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(20, 20); + this.Name = "ThumbnailView"; + this.Opacity = 0.1D; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.Text = "Preview"; + this.TopMost = true; + this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MouseDown_Handler); + this.MouseEnter += new System.EventHandler(this.MouseEnter_Handler); + this.MouseLeave += new System.EventHandler(this.MouseLeave_Handler); + this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MouseMove_Handler); + this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.MouseUp_Handler); + this.Move += new System.EventHandler(this.Move_Handler); + this.Resize += new System.EventHandler(this.Resize_Handler); + this.ResumeLayout(false); } - #endregion - - +#endregion } } \ No newline at end of file diff --git a/src/Eve-O-Preview/View/Implementation/ThumbnailView.cs b/src/Eve-O-Preview/View/Implementation/ThumbnailView.cs index 6ee8a34..4431dcb 100644 --- a/src/Eve-O-Preview/View/Implementation/ThumbnailView.cs +++ b/src/Eve-O-Preview/View/Implementation/ThumbnailView.cs @@ -7,625 +7,557 @@ using EveOPreview.Configuration; using EveOPreview.Services; using EveOPreview.UI.Hotkeys; -namespace EveOPreview.View -{ - public abstract partial class ThumbnailView : Form, IThumbnailView - { - #region Private constants - private const double OPACITY_THRESHOLD = 0.9; - private const double OPACITY_EPSILON = 0.1; - #endregion +namespace EveOPreview.View { + public abstract partial class ThumbnailView : Form, IThumbnailView { +#region Private constants + private const double OPACITY_THRESHOLD = 0.9; + private const double OPACITY_EPSILON = 0.1; +#endregion - #region Private fields - private readonly ThumbnailOverlay _overlay; +#region Private fields + private readonly ThumbnailOverlay _overlay; - // Part of the logic (namely current size / position management) - // was moved to the view due to the performance reasons - private bool _isOverlayVisible; - private bool _isTopMost; - private bool _isHighlightEnabled; - private bool _isHighlightRequested; - private int _highlightWidth; + // Part of the logic (namely current size / position management) + // was moved to the view due to the performance reasons + private bool _isOverlayVisible; + private bool _isTopMost; + private bool _isHighlightEnabled; + private bool _isHighlightRequested; + private int _highlightWidth; - private bool _isLocationChanged; - private bool _isSizeChanged; + private bool _isLocationChanged; + private bool _isSizeChanged; - private bool _isCustomMouseModeActive; + private bool _isCustomMouseModeActive; - private double _opacity; - - private DateTime _suppressResizeEventsTimestamp; - private Size _baseZoomSize; - private Point _baseZoomLocation; - private Point _baseMousePosition; - private Size _baseZoomMaximumSize; + private double _opacity; - private HotkeyHandler _hotkeyHandler; + private DateTime _suppressResizeEventsTimestamp; + private Size _baseZoomSize; + private Point _baseZoomLocation; + private Point _baseMousePosition; + private Size _baseZoomMaximumSize; - private IThumbnailConfiguration _config; - private Lazy _myBorderColor; - private IThumbnailManager _thumbnailManager; - #endregion + private HotkeyHandler _hotkeyHandler; - protected ThumbnailView(IWindowManager windowManager, IThumbnailConfiguration config, IThumbnailManager thumbnailManager) - { - this._config = config; - this.SuppressResizeEvent(); + private IThumbnailConfiguration _config; + private Lazy _myBorderColor; + private IThumbnailManager _thumbnailManager; +#endregion - this.WindowManager = windowManager; + protected ThumbnailView(IWindowManager windowManager, IThumbnailConfiguration config, + IThumbnailManager thumbnailManager) { + this._config = config; + this.SuppressResizeEvent(); - this.IsActive = false; + this.WindowManager = windowManager; - this.IsOverlayEnabled = false; - this._isOverlayVisible = false; - this._isTopMost = false; - this._isHighlightEnabled = false; - this._isHighlightRequested = false; + this.IsActive = false; - this._isLocationChanged = true; - this._isSizeChanged = true; + this.IsOverlayEnabled = false; + this._isOverlayVisible = false; + this._isTopMost = false; + this._isHighlightEnabled = false; + this._isHighlightRequested = false; - this._isCustomMouseModeActive = false; + this._isLocationChanged = true; + this._isSizeChanged = true; - this._opacity = 0.1; + this._isCustomMouseModeActive = false; - InitializeComponent(); + this._opacity = 0.1; - this._overlay = new ThumbnailOverlay(this, this.MouseDown_Handler); + InitializeComponent(); - SetDefaultBorderColor(); - this._thumbnailManager = thumbnailManager; - } + this._overlay = new ThumbnailOverlay(this, this.MouseDown_Handler); - public IWindowManager WindowManager { get; } + SetDefaultBorderColor(); + this._thumbnailManager = thumbnailManager; + } - public IntPtr Id { get; set; } + public IWindowManager WindowManager { get; } - public string Title - { - get => this.Text; - set - { - this.Text = value; - this._overlay.SetOverlayLabel(value.Replace("EVE - ", "").Replace("EVE Frontier - ", "*")); - this._overlay.SetPropertiesOverlayLabel(_config.OverlayLabelSize, _config.OverlayLabelColor, _config.OverlayLabelAnchor); - SetDefaultBorderColor(); - } - } + public IntPtr Id { get; set; } - public bool IsActive { get; set; } - - public bool IsOverlayEnabled { get; set; } - public ZoomAnchor ClientZoomAnchor { get; set; } - - public Point ThumbnailLocation - { - get => this.Location; - set - { - this.StartPosition = FormStartPosition.Manual; - this.Location = value; - } - } - - public Size ThumbnailSize - { - get => this.ClientSize; - set => this.ClientSize = value; - } - - public Action ThumbnailResized { get; set; } - - public Action ThumbnailMoved { get; set; } - - public Action ThumbnailFocused { get; set; } - - public Action ThumbnailLostFocus { get; set; } - - public Action ThumbnailActivated { get; set; } - - public Action ThumbnailDeactivated { get; set; } - - private bool WindowMoved = false; - - public void SetDefaultBorderColor() - { - this._myBorderColor = new Lazy(() => - { - if (this._config.PerClientActiveClientHighlightColor.Any(x => x.Key == this.Title)) - { - return this._config.PerClientActiveClientHighlightColor[Title]; - } - else - { - return _config.ActiveClientHighlightColor; - } - }); - } - - public new void Show() - { - this.SuppressResizeEvent(); - - base.Show(); - - this._isLocationChanged = true; - this._isSizeChanged = true; - this._isOverlayVisible = false; - - this.Refresh(true); - - this.IsActive = true; - } - - public new void Hide() - { - this.SuppressResizeEvent(); - - this.IsActive = false; - - this._overlay.Hide(); - base.Hide(); - } - - public new virtual void Close() - { - this.SuppressResizeEvent(); - - this.IsActive = false; - this._overlay.Close(); - base.Close(); - } - - // This method is used to determine if the provided Handle is related to client or its thumbnail - public bool IsKnownHandle(IntPtr handle) - { - return (this.Id == handle) || (this.Handle == handle) || (this._overlay.Handle == handle); - } - - public void SetSizeLimitations(Size minimumSize, Size maximumSize) - { - this.MinimumSize = minimumSize; - this.MaximumSize = maximumSize; - } - - public void SetOpacity(double opacity) - { - if (opacity >= OPACITY_THRESHOLD) - { - opacity = 1.0; - } - - if (Math.Abs(opacity - this._opacity) < OPACITY_EPSILON) - { - return; - } - - try - { - this.Opacity = opacity; - - // Overlay opacity settings - // Of the thumbnail's opacity is almost full then set the overlay's one to - // full. Otherwise set it to half of the thumbnail opacity - // Opacity value is stored even if the overlay is not displayed atm - this._overlay.Opacity = opacity > 0.8 ? 1.0 : 1.0 - (1.0 - opacity) / 2; - - this._opacity = opacity; - } - catch (Win32Exception) - { - // Something went wrong in WinForms internals - // Opacity will be updated in the next cycle - } - } - - public void SetFrames(bool enable) - { - FormBorderStyle style = enable ? FormBorderStyle.SizableToolWindow : FormBorderStyle.None; - - // No need to change the borders style if it is ALREADY correct - if (this.FormBorderStyle == style) - { - return; - } - - this.SuppressResizeEvent(); - - this.FormBorderStyle = style; - } - public void SetOverlayLabel() - { - } - - public void SetTopMost(bool enableTopmost) - { - if (this._isTopMost == enableTopmost) - { - return; - } - - this._overlay.TopMost = enableTopmost; - this.TopMost = enableTopmost; - - this._isTopMost = enableTopmost; - } - - public void SetHighlight() - { - SetHighlight(_config.EnableActiveClientHighlight, _config.ActiveClientHighlightThickness); - } - - public void SetHighlight(bool enabled, int width) - { - if (this._isHighlightRequested == enabled) - { - return; - } - - if (enabled) - { - this._isHighlightRequested = true; - this._highlightWidth = width; - this.BackColor = _myBorderColor.Value; - } - else - { - this._isHighlightRequested = false; - this.BackColor = SystemColors.Control; - } - - this._isSizeChanged = true; - } - - public void ClearBorder() - { - this.SetHighlight(false, 0); - this.Refresh(true); - } - - public void ZoomIn(ViewZoomAnchor anchor, int zoomFactor) - { - int oldWidth = this._baseZoomSize.Width; - int oldHeight = this._baseZoomSize.Height; - - int locationX = this.Location.X; - int locationY = this.Location.Y; - - int clientSizeWidth = this.ClientSize.Width; - int clientSizeHeight = this.ClientSize.Height; - int newWidth = (zoomFactor * clientSizeWidth) + (this.Size.Width - clientSizeWidth); - int newHeight = (zoomFactor * clientSizeHeight) + (this.Size.Height - clientSizeHeight); - - // First change size, THEN move the window - // Otherwise there is a chance to fail in a loop - // Zoom required -> Moved the windows 1st -> Focus is lost -> Window is moved back -> Focus is back on -> Zoom required -> ... - this.MaximumSize = new Size(0, 0); - this.Size = new Size(newWidth, newHeight); - - switch (anchor) - { - case ViewZoomAnchor.NW: - break; - case ViewZoomAnchor.N: - this.Location = new Point(locationX - newWidth / 2 + oldWidth / 2, locationY); - break; - case ViewZoomAnchor.NE: - this.Location = new Point(locationX - newWidth + oldWidth, locationY); - break; - - case ViewZoomAnchor.W: - this.Location = new Point(locationX, locationY - newHeight / 2 + oldHeight / 2); - break; - case ViewZoomAnchor.C: - this.Location = new Point(locationX - newWidth / 2 + oldWidth / 2, locationY - newHeight / 2 + oldHeight / 2); - break; - case ViewZoomAnchor.E: - this.Location = new Point(locationX - newWidth + oldWidth, locationY - newHeight / 2 + oldHeight / 2); - break; - - case ViewZoomAnchor.SW: - this.Location = new Point(locationX, locationY - newHeight + this._baseZoomSize.Height); - break; - case ViewZoomAnchor.S: - this.Location = new Point(locationX - newWidth / 2 + oldWidth / 2, locationY - newHeight + oldHeight); - break; - case ViewZoomAnchor.SE: - this.Location = new Point(locationX - newWidth + oldWidth, locationY - newHeight + oldHeight); - break; - } - } - - public void ZoomOut() - { - this.RestoreWindowSizeAndLocation(); - } - - public void RegisterHotkey(Keys hotkey) - { - if (this._hotkeyHandler != null) - { - this.UnregisterHotkey(); - } - - if (hotkey == Keys.None) - { - return; - } - - this._hotkeyHandler = new HotkeyHandler(this.Handle, hotkey); - this._hotkeyHandler.Pressed += HotkeyPressed_Handler; - this._hotkeyHandler.Register(); - } - - public void UnregisterHotkey() - { - if (this._hotkeyHandler == null) - { - return; - } - - this._hotkeyHandler.Unregister(); - this._hotkeyHandler.Pressed -= HotkeyPressed_Handler; - this._hotkeyHandler.Dispose(); - this._hotkeyHandler = null; - } - - public void Refresh(bool forceRefresh) - { - this.RefreshThumbnail(forceRefresh); - this.HighlightThumbnail(forceRefresh || this._isSizeChanged); - this.RefreshOverlay(forceRefresh || this._isSizeChanged || this._isLocationChanged); - - this._isSizeChanged = false; - } - - protected abstract void RefreshThumbnail(bool forceRefresh); - - protected abstract void ResizeThumbnail(int baseWidth, int baseHeight, int highlightWidthTop, int highlightWidthRight, int highlightWidthBottom, int highlightWidthLeft); - - private void HighlightThumbnail(bool forceRefresh) - { - if (!forceRefresh && (this._isHighlightRequested == this._isHighlightEnabled)) - { - // Nothing to do here - return; - } - - this._isHighlightEnabled = this._isHighlightRequested; - - int baseWidth = this.ClientSize.Width; - int baseHeight = this.ClientSize.Height; - - if (!this._isHighlightRequested) - { - //No highlighting enabled, so no math required - this.ResizeThumbnail(baseWidth, baseHeight, 0, 0, 0, 0); - return; - } - - double baseAspectRatio = ((double)baseWidth) / baseHeight; - - int actualHeight = baseHeight - 2 * this._highlightWidth; - double desiredWidth = actualHeight * baseAspectRatio; - int actualWidth = (int)Math.Round(desiredWidth, MidpointRounding.AwayFromZero); - int highlightWidthLeft = (baseWidth - actualWidth) / 2; - int highlightWidthRight = baseWidth - actualWidth - highlightWidthLeft; - - this.ResizeThumbnail(this.ClientSize.Width, this.ClientSize.Height, this._highlightWidth, highlightWidthRight, this._highlightWidth, highlightWidthLeft); - } - - private void RefreshOverlay(bool forceRefresh) - { - if (this._isOverlayVisible && !forceRefresh) - { - // No need to update anything. Everything is already set up - return; - } - - // Only show overlay if enabled AND thumbnail is active/visible. - this._overlay.EnableOverlayLabel(this.IsOverlayEnabled && this.Visible); - - if (!this._isOverlayVisible) - { - // One-time action to show the Overlay before it is set up - // Otherwise its position won't be set - this._overlay.Show(); - this._isOverlayVisible = true; - } - - Size overlaySize = this.ClientSize; - Point overlayLocation = this.Location; - - int borderWidth = (this.Size.Width - this.ClientSize.Width) / 2; - overlayLocation.X += borderWidth; - overlayLocation.Y += (this.Size.Height - this.ClientSize.Height) - borderWidth; - - this._isLocationChanged = false; - this._overlay.Size = overlaySize; - - this._overlay.SetPropertiesOverlayLabel(_config.OverlayLabelSize, _config.OverlayLabelColor, _config.OverlayLabelAnchor); - - this._overlay.Location = overlayLocation; - this._overlay.Refresh(); - } - - private void SuppressResizeEvent() - { - // Workaround for WinForms issue with the Resize event being fired with inconsistent ClientSize value - // Any Resize events fired before this timestamp will be ignored - this._suppressResizeEventsTimestamp = DateTime.UtcNow.AddMilliseconds(_config.ThumbnailResizeTimeoutPeriod); - } - - #region GUI events - protected override CreateParams CreateParams - { - get - { - var Params = base.CreateParams; - Params.ExStyle |= (int)InteropConstants.WS_EX_TOOLWINDOW; - return Params; - } - } - - private void Move_Handler(object sender, EventArgs e) - { - this._isLocationChanged = true; - this.ThumbnailMoved?.Invoke(this.Id); - } - - private void Resize_Handler(object sender, EventArgs e) - { - if (DateTime.UtcNow < this._suppressResizeEventsTimestamp) - { - return; - } - - this._isSizeChanged = true; - - this.ThumbnailResized?.Invoke(this.Id); - } - - private void MouseEnter_Handler(object sender, EventArgs e) - { - this.ExitCustomMouseMode(); - this.SaveWindowSizeAndLocation(); - - this.ThumbnailFocused?.Invoke(this.Id); - } - - private void MouseLeave_Handler(object sender, EventArgs e) - { - this.ThumbnailLostFocus?.Invoke(this.Id); - } - - private void MouseDown_Handler(object sender, MouseEventArgs e) - { - this.MouseDownEventHandler(e.Button, Control.ModifierKeys); - } - - private void MouseMove_Handler(object sender, MouseEventArgs e) - { - if (this._isCustomMouseModeActive) - { - this.ProcessCustomMouseMode(e.Button.HasFlag(MouseButtons.Left), e.Button.HasFlag(MouseButtons.Right)); - } - } - - private void MouseUp_Handler(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Right) - { - this.ExitCustomMouseMode(); - - // Snap to Grid on release of mouse (if moved) - if (_config.ThumbnailSnapToGrid && this.WindowMoved) - { - var x = (int)Math.Round((double)this.Location.X / (double)_config.ThumbnailSnapToGridSizeX) * _config.ThumbnailSnapToGridSizeX; - var y = (int)Math.Round((double)this.Location.Y / (double)_config.ThumbnailSnapToGridSizeY) * _config.ThumbnailSnapToGridSizeY; - this.Location = new Point(x, y); - this._baseZoomLocation = this.Location; - - this.WindowMoved = false; - - } - } - } - - private void HotkeyPressed_Handler(object sender, HandledEventArgs e) - { - this.SetHighlight(); - this.ThumbnailActivated?.Invoke(this.Id); - - e.Handled = true; - } - #endregion - - #region Custom Mouse mode - // This pair of methods saves/restores certain window properties - // Methods are used to remove the 'Zoom' effect (if any) when the - // custom resize/move mode is activated - // Methods are kept on this level because moving to the presenter - // the code that responds to the mouse events like movement - // seems like a huge overkill - private void SaveWindowSizeAndLocation() - { - this._baseZoomSize = this.Size; - this._baseZoomLocation = this.Location; - this._baseZoomMaximumSize = this.MaximumSize; - } - - private void RestoreWindowSizeAndLocation() - { - this.Size = this._baseZoomSize; - this.MaximumSize = this._baseZoomMaximumSize; - this.Location = this._baseZoomLocation; - } - - private void EnterCustomMouseMode() - { - this.RestoreWindowSizeAndLocation(); - - this._isCustomMouseModeActive = true; - this._baseMousePosition = Control.MousePosition; - } - - private void ProcessCustomMouseMode(bool leftButton, bool rightButton) - { - Point mousePosition = Control.MousePosition; - int offsetX = mousePosition.X - this._baseMousePosition.X; - int offsetY = mousePosition.Y - this._baseMousePosition.Y; - this._baseMousePosition = mousePosition; - - if (!_config.LockThumbnailLocation) - { - // Left + Right buttons trigger thumbnail resize - // Right button only trigger thumbnail movement - if (leftButton && rightButton) - { - this.Size = new Size(this.Size.Width + offsetX, this.Size.Height + offsetY); - this._baseZoomSize = this.Size; - } - else - { - this.Location = new Point(this.Location.X + offsetX, this.Location.Y + offsetY); - this._baseZoomLocation = this.Location; - this.WindowMoved = true; - } + public string Title { + get => this.Text; + set { + this.Text = value; + this._overlay.SetOverlayLabel(value.Replace("EVE - ", "").Replace("EVE Frontier - ", "*")); + this._overlay.SetPropertiesOverlayLabel(_config.OverlayLabelSize, _config.OverlayLabelColor, + _config.OverlayLabelAnchor); + SetDefaultBorderColor(); } - } + } - private void ExitCustomMouseMode() - { - this._isCustomMouseModeActive = false; - } - #endregion + public bool IsActive { get; set; } - #region Custom GUI events - protected virtual void MouseDownEventHandler(MouseButtons mouseButtons, Keys modifierKeys) - { - switch (mouseButtons) - { - case MouseButtons.Left when modifierKeys == Keys.Control: - this.ThumbnailDeactivated?.Invoke(this.Id, false); - break; - case MouseButtons.Left when modifierKeys == (Keys.Control | Keys.Shift): - this.ThumbnailDeactivated?.Invoke(this.Id, true); - break; - case MouseButtons.Left: - var oldWindow = this._thumbnailManager.GetActiveClient(); - this.ThumbnailActivated?.Invoke(this.Id); - this.SetHighlight(); - this.Refresh(true); + public bool IsOverlayEnabled { get; set; } + public ZoomAnchor ClientZoomAnchor { get; set; } - oldWindow?.ClearBorder(); - break; - case MouseButtons.Right: - case MouseButtons.Left | MouseButtons.Right: - this.EnterCustomMouseMode(); - break; - } - } - #endregion - } + public Point ThumbnailLocation { + get => this.Location; + set { + this.StartPosition = FormStartPosition.Manual; + this.Location = value; + } + } + + public Size ThumbnailSize { + get => this.ClientSize; + set => this.ClientSize = value; + } + + public Action ThumbnailResized { get; set; } + + public Action ThumbnailMoved { get; set; } + + public Action ThumbnailFocused { get; set; } + + public Action ThumbnailLostFocus { get; set; } + + public Action ThumbnailActivated { get; set; } + + public Action ThumbnailDeactivated { get; set; } + + private bool WindowMoved = false; + + public void SetDefaultBorderColor() { + this._myBorderColor = new Lazy(() => { + if (this._config.PerClientActiveClientHighlightColor.Any(x => x.Key == this.Title)) { + return this._config.PerClientActiveClientHighlightColor[Title]; + } else { + return _config.ActiveClientHighlightColor; + } + }); + } + + public new void Show() { this.SuppressResizeEvent(); + + base.Show(); + + this._isLocationChanged = true; + this._isSizeChanged = true; + this._isOverlayVisible = false; + + this.Refresh(true); + + this.IsActive = true; + } + + public new void Hide() { this.SuppressResizeEvent(); + + this.IsActive = false; + + this._overlay.Hide(); + base.Hide(); +} + +public new virtual void Close() { this.SuppressResizeEvent(); + +this.IsActive = false; +this._overlay.Close(); +base.Close(); +} + +// This method is used to determine if the provided Handle is related to client or its thumbnail +public bool IsKnownHandle(IntPtr handle) { + return (this.Id == handle) || (this.Handle == handle) || (this._overlay.Handle == handle); +} + +public void SetSizeLimitations(Size minimumSize, Size maximumSize) { + this.MinimumSize = minimumSize; + this.MaximumSize = maximumSize; +} + +public void SetOpacity(double opacity) { + if (opacity >= OPACITY_THRESHOLD) { + opacity = 1.0; + } + + if (Math.Abs(opacity - this._opacity) < OPACITY_EPSILON) { + return; + } + + try { + this.Opacity = opacity; + + // Overlay opacity settings + // Of the thumbnail's opacity is almost full then set the overlay's one to + // full. Otherwise set it to half of the thumbnail opacity + // Opacity value is stored even if the overlay is not displayed atm + this._overlay.Opacity = opacity > 0.8 ? 1.0 : 1.0 - (1.0 - opacity) / 2; + + this._opacity = opacity; + } catch (Win32Exception) { + // Something went wrong in WinForms internals + // Opacity will be updated in the next cycle + } +} + +public void SetFrames(bool enable) { + FormBorderStyle style = enable ? FormBorderStyle.SizableToolWindow : FormBorderStyle.None; + + // No need to change the borders style if it is ALREADY correct + if (this.FormBorderStyle == style) { + return; + } + + this.SuppressResizeEvent(); + + this.FormBorderStyle = style; +} +public void SetOverlayLabel() {} + +public void SetTopMost(bool enableTopmost) { + if (this._isTopMost == enableTopmost) { + return; + } + + this._overlay.TopMost = enableTopmost; + this.TopMost = enableTopmost; + + this._isTopMost = enableTopmost; +} + +public void SetHighlight() { + SetHighlight(_config.EnableActiveClientHighlight, _config.ActiveClientHighlightThickness); +} + +public void SetHighlight(bool enabled, int width) { + if (this._isHighlightRequested == enabled) { + return; + } + + if (enabled) { + this._isHighlightRequested = true; + this._highlightWidth = width; + this.BackColor = _myBorderColor.Value; + } else { + this._isHighlightRequested = false; + this.BackColor = SystemColors.Control; + } + + this._isSizeChanged = true; +} + +public void ClearBorder() { + this.SetHighlight(false, 0); + this.Refresh(true); +} + +public void ZoomIn(ViewZoomAnchor anchor, int zoomFactor) { + int oldWidth = this._baseZoomSize.Width; + int oldHeight = this._baseZoomSize.Height; + + int locationX = this.Location.X; + int locationY = this.Location.Y; + + int clientSizeWidth = this.ClientSize.Width; + int clientSizeHeight = this.ClientSize.Height; + int newWidth = (zoomFactor * clientSizeWidth) + (this.Size.Width - clientSizeWidth); + int newHeight = (zoomFactor * clientSizeHeight) + (this.Size.Height - clientSizeHeight); + + // First change size, THEN move the window + // Otherwise there is a chance to fail in a loop + // Zoom required -> Moved the windows 1st -> Focus is lost -> Window is moved back -> Focus is back on -> Zoom + // required -> ... + this.MaximumSize = new Size(0, 0); + this.Size = new Size(newWidth, newHeight); + + switch (anchor) { + case ViewZoomAnchor.NW: + break; + case ViewZoomAnchor.N: + this.Location = new Point(locationX - newWidth / 2 + oldWidth / 2, locationY); + break; + case ViewZoomAnchor.NE: + this.Location = new Point(locationX - newWidth + oldWidth, locationY); + break; + + case ViewZoomAnchor.W: + this.Location = new Point(locationX, locationY - newHeight / 2 + oldHeight / 2); + break; + case ViewZoomAnchor.C: + this.Location = + new Point(locationX - newWidth / 2 + oldWidth / 2, locationY - newHeight / 2 + oldHeight / 2); + break; + case ViewZoomAnchor.E: + this.Location = new Point(locationX - newWidth + oldWidth, locationY - newHeight / 2 + oldHeight / 2); + break; + + case ViewZoomAnchor.SW: + this.Location = new Point(locationX, locationY - newHeight + this._baseZoomSize.Height); + break; + case ViewZoomAnchor.S: + this.Location = new Point(locationX - newWidth / 2 + oldWidth / 2, locationY - newHeight + oldHeight); + break; + case ViewZoomAnchor.SE: + this.Location = new Point(locationX - newWidth + oldWidth, locationY - newHeight + oldHeight); + break; + } +} + +public void ZoomOut() { + this.RestoreWindowSizeAndLocation(); +} + +public void RegisterHotkey(Keys hotkey) { + if (this._hotkeyHandler != null) { + this.UnregisterHotkey(); + } + + if (hotkey == Keys.None) { + return; + } + + this._hotkeyHandler = new HotkeyHandler(this.Handle, hotkey); + this._hotkeyHandler.Pressed += HotkeyPressed_Handler; + this._hotkeyHandler.Register(); +} + +public void UnregisterHotkey() { + if (this._hotkeyHandler == null) { + return; + } + + this._hotkeyHandler.Unregister(); + this._hotkeyHandler.Pressed -= HotkeyPressed_Handler; + this._hotkeyHandler.Dispose(); + this._hotkeyHandler = null; +} + +public void Refresh(bool forceRefresh) { + this.RefreshThumbnail(forceRefresh); + this.ApplyRegionSettings(); + this.HighlightThumbnail(forceRefresh || this._isSizeChanged); + this.RefreshOverlay(forceRefresh || this._isSizeChanged || this._isLocationChanged); + + this._isSizeChanged = false; +} + +protected abstract void RefreshThumbnail(bool forceRefresh); + +protected abstract void ResizeThumbnail(int baseWidth, int baseHeight, int highlightWidthTop, int highlightWidthRight, + int highlightWidthBottom, int highlightWidthLeft); + +protected virtual void ApplyRegionSettings() { + // Default implementation does nothing +} + +private void HighlightThumbnail(bool forceRefresh) { + if (!forceRefresh && (this._isHighlightRequested == this._isHighlightEnabled)) { + // Nothing to do here + return; + } + + this._isHighlightEnabled = this._isHighlightRequested; + + int baseWidth = this.ClientSize.Width; + int baseHeight = this.ClientSize.Height; + + if (!this._isHighlightRequested) { + // No highlighting enabled, so no math required + this.ResizeThumbnail(baseWidth, baseHeight, 0, 0, 0, 0); + return; + } + + double baseAspectRatio = ((double)baseWidth) / baseHeight; + + int actualHeight = baseHeight - 2 * this._highlightWidth; + double desiredWidth = actualHeight * baseAspectRatio; + int actualWidth = (int)Math.Round(desiredWidth, MidpointRounding.AwayFromZero); + int highlightWidthLeft = (baseWidth - actualWidth) / 2; + int highlightWidthRight = baseWidth - actualWidth - highlightWidthLeft; + + this.ResizeThumbnail(this.ClientSize.Width, this.ClientSize.Height, this._highlightWidth, highlightWidthRight, + this._highlightWidth, highlightWidthLeft); +} + +private void RefreshOverlay(bool forceRefresh) { + if (this._isOverlayVisible && !forceRefresh) { + // No need to update anything. Everything is already set up + return; + } + + // Only show overlay if enabled AND thumbnail is active/visible. + this._overlay.EnableOverlayLabel(this.IsOverlayEnabled && this.Visible); + + if (!this._isOverlayVisible) { + // One-time action to show the Overlay before it is set up + // Otherwise its position won't be set + this._overlay.Show(); + this._isOverlayVisible = true; + } + + Size overlaySize = this.ClientSize; + Point overlayLocation = this.Location; + + int borderWidth = (this.Size.Width - this.ClientSize.Width) / 2; + overlayLocation.X += borderWidth; + overlayLocation.Y += (this.Size.Height - this.ClientSize.Height) - borderWidth; + + this._isLocationChanged = false; + this._overlay.Size = overlaySize; + + this._overlay.SetPropertiesOverlayLabel(_config.OverlayLabelSize, _config.OverlayLabelColor, + _config.OverlayLabelAnchor); + + this._overlay.Location = overlayLocation; + this._overlay.Refresh(); +} + +private void SuppressResizeEvent() { + // Workaround for WinForms issue with the Resize event being fired with inconsistent ClientSize value + // Any Resize events fired before this timestamp will be ignored + this._suppressResizeEventsTimestamp = DateTime.UtcNow.AddMilliseconds(_config.ThumbnailResizeTimeoutPeriod); +} + +#region GUI events +protected override CreateParams CreateParams { + get { + var Params = base.CreateParams; + Params.ExStyle |= (int)InteropConstants.WS_EX_TOOLWINDOW; + return Params; + } +} + +private void Move_Handler(object sender, EventArgs e) { + this._isLocationChanged = true; + this.ThumbnailMoved?.Invoke(this.Id); +} + +private void Resize_Handler(object sender, EventArgs e) { + if (DateTime.UtcNow < this._suppressResizeEventsTimestamp) { + return; + } + + this._isSizeChanged = true; + + this.ThumbnailResized?.Invoke(this.Id); +} + +private void MouseEnter_Handler(object sender, EventArgs e) { + this.ExitCustomMouseMode(); + this.SaveWindowSizeAndLocation(); + + this.ThumbnailFocused?.Invoke(this.Id); +} + +private void MouseLeave_Handler(object sender, EventArgs e) { + this.ThumbnailLostFocus?.Invoke(this.Id); +} + +private void MouseDown_Handler(object sender, MouseEventArgs e) { + this.MouseDownEventHandler(e.Button, Control.ModifierKeys); +} + +private void MouseMove_Handler(object sender, MouseEventArgs e) { + if (this._isCustomMouseModeActive) { + this.ProcessCustomMouseMode(e.Button.HasFlag(MouseButtons.Left), e.Button.HasFlag(MouseButtons.Right)); + } +} + +private void MouseUp_Handler(object sender, MouseEventArgs e) { + if (e.Button == MouseButtons.Right) { + this.ExitCustomMouseMode(); + + // Snap to Grid on release of mouse (if moved) + if (_config.ThumbnailSnapToGrid && this.WindowMoved) { + var x = (int)Math.Round((double)this.Location.X / (double)_config.ThumbnailSnapToGridSizeX) * + _config.ThumbnailSnapToGridSizeX; + var y = (int)Math.Round((double)this.Location.Y / (double)_config.ThumbnailSnapToGridSizeY) * + _config.ThumbnailSnapToGridSizeY; + this.Location = new Point(x, y); + this._baseZoomLocation = this.Location; + + this.WindowMoved = false; + } + } +} + +private void HotkeyPressed_Handler(object sender, HandledEventArgs e) { + this.SetHighlight(); + this.ThumbnailActivated?.Invoke(this.Id); + + e.Handled = true; +} +#endregion + +#region Custom Mouse mode +// This pair of methods saves/restores certain window properties +// Methods are used to remove the 'Zoom' effect (if any) when the +// custom resize/move mode is activated +// Methods are kept on this level because moving to the presenter +// the code that responds to the mouse events like movement +// seems like a huge overkill +private void SaveWindowSizeAndLocation() { + this._baseZoomSize = this.Size; + this._baseZoomLocation = this.Location; + this._baseZoomMaximumSize = this.MaximumSize; +} + +private void RestoreWindowSizeAndLocation() { + this.Size = this._baseZoomSize; + this.MaximumSize = this._baseZoomMaximumSize; + this.Location = this._baseZoomLocation; +} + +private void EnterCustomMouseMode() { + this.RestoreWindowSizeAndLocation(); + + this._isCustomMouseModeActive = true; + this._baseMousePosition = Control.MousePosition; +} + +private void ProcessCustomMouseMode(bool leftButton, bool rightButton) { + Point mousePosition = Control.MousePosition; + int offsetX = mousePosition.X - this._baseMousePosition.X; + int offsetY = mousePosition.Y - this._baseMousePosition.Y; + this._baseMousePosition = mousePosition; + + if (!_config.LockThumbnailLocation) { + // Left + Right buttons trigger thumbnail resize + // Right button only trigger thumbnail movement + if (leftButton && rightButton) { + this.Size = new Size(this.Size.Width + offsetX, this.Size.Height + offsetY); + this._baseZoomSize = this.Size; + } else { + this.Location = new Point(this.Location.X + offsetX, this.Location.Y + offsetY); + this._baseZoomLocation = this.Location; + this.WindowMoved = true; + } + } +} + +private void ExitCustomMouseMode() { + this._isCustomMouseModeActive = false; +} +#endregion + +#region Custom GUI events +protected virtual void MouseDownEventHandler(MouseButtons mouseButtons, Keys modifierKeys) { + switch (mouseButtons) { + case MouseButtons.Left when modifierKeys == Keys.Control: + this.ThumbnailDeactivated?.Invoke(this.Id, false); + break; + case MouseButtons.Left when modifierKeys == (Keys.Control | Keys.Shift): + this.ThumbnailDeactivated?.Invoke(this.Id, true); + break; + case MouseButtons.Left: + var oldWindow = this._thumbnailManager.GetActiveClient(); + this.ThumbnailActivated?.Invoke(this.Id); + this.SetHighlight(); + this.Refresh(true); + + oldWindow?.ClearBorder(); + break; + case MouseButtons.Right: + case MouseButtons.Left | MouseButtons.Right: + this.EnterCustomMouseMode(); + break; + } +} +#endregion +} } \ No newline at end of file diff --git a/src/Eve-O-Preview/View/Implementation/ThumbnailViewFactory.cs b/src/Eve-O-Preview/View/Implementation/ThumbnailViewFactory.cs index a637646..f890f29 100644 --- a/src/Eve-O-Preview/View/Implementation/ThumbnailViewFactory.cs +++ b/src/Eve-O-Preview/View/Implementation/ThumbnailViewFactory.cs @@ -2,30 +2,26 @@ using System.Drawing; using EveOPreview.Configuration; -namespace EveOPreview.View -{ - sealed class ThumbnailViewFactory : IThumbnailViewFactory - { - private readonly IApplicationController _controller; - private readonly bool _enableWineCompatibilityMode; +namespace EveOPreview.View { + sealed class ThumbnailViewFactory : IThumbnailViewFactory { + private readonly IApplicationController _controller; + private readonly bool _enableWineCompatibilityMode; - public ThumbnailViewFactory(IApplicationController controller, IThumbnailConfiguration configuration) - { - this._controller = controller; - this._enableWineCompatibilityMode = configuration.EnableWineCompatibilityMode; - } + public ThumbnailViewFactory(IApplicationController controller, IThumbnailConfiguration configuration) { + this._controller = controller; + this._enableWineCompatibilityMode = configuration.EnableWineCompatibilityMode; + } - public IThumbnailView Create(IntPtr id, string title, Size size) - { - IThumbnailView view = this._enableWineCompatibilityMode - ? (IThumbnailView)this._controller.Create() - : (IThumbnailView)this._controller.Create(); + public IThumbnailView Create(IntPtr id, string title, Size size) { + IThumbnailView view = this._enableWineCompatibilityMode + ? (IThumbnailView)this._controller.Create() + : (IThumbnailView)this._controller.Create(); - view.Id = id; - view.Title = title; - view.ThumbnailSize = size; + view.Id = id; + view.Title = title; + view.ThumbnailSize = size; - return view; - } - } + return view; + } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/View/Interface/IMainFormView.cs b/src/Eve-O-Preview/View/Interface/IMainFormView.cs index 50cd720..addb5ad 100644 --- a/src/Eve-O-Preview/View/Interface/IMainFormView.cs +++ b/src/Eve-O-Preview/View/Interface/IMainFormView.cs @@ -2,65 +2,69 @@ using System.Collections.Generic; using System.Drawing; -namespace EveOPreview.View -{ - /// - /// Main view interface - /// Presenter uses it to access GUI properties - /// - public interface IMainFormView : IView - { - bool MinimizeToTray { get; set; } +namespace EveOPreview.View { + /// + /// Main view interface + /// Presenter uses it to access GUI properties + /// + public interface IMainFormView : IView { + bool MinimizeToTray { get; set; } - double ThumbnailOpacity { get; set; } + double ThumbnailOpacity { get; set; } - bool EnableClientLayoutTracking { get; set; } - bool HideActiveClientThumbnail { get; set; } - bool MinimizeInactiveClients { get; set; } + bool EnableClientLayoutTracking { get; set; } + bool HideActiveClientThumbnail { get; set; } + bool MinimizeInactiveClients { get; set; } ViewAnimationStyle WindowsAnimationStyle { get; set; } bool ShowThumbnailsAlwaysOnTop { get; set; } - bool HideThumbnailsOnLostFocus { get; set; } - bool EnablePerClientThumbnailLayouts { get; set; } + bool HideThumbnailsOnLostFocus { get; set; } + bool EnablePerClientThumbnailLayouts { get; set; } - Size ThumbnailSize { get; set; } + Size ThumbnailSize { get; set; } - bool EnableThumbnailZoom { get; set; } - int ThumbnailZoomFactor { get; set; } - ViewZoomAnchor ThumbnailZoomAnchor { get; set; } - ViewZoomAnchor OverlayLabelAnchor { get; set; } + bool EnableThumbnailZoom { get; set; } + int ThumbnailZoomFactor { get; set; } + ViewZoomAnchor ThumbnailZoomAnchor { get; set; } + ViewZoomAnchor OverlayLabelAnchor { get; set; } - bool ShowThumbnailOverlays { get; set; } - bool ShowThumbnailFrames { get; set; } + bool ShowThumbnailOverlays { get; set; } + bool ShowThumbnailFrames { get; set; } - bool LockThumbnailLocation { get; set; } - bool ThumbnailSnapToGrid { get; set; } - int ThumbnailSnapToGridSizeX { get; set; } - int ThumbnailSnapToGridSizeY { get; set; } + bool LockThumbnailLocation { get; set; } + bool ThumbnailSnapToGrid { get; set; } + int ThumbnailSnapToGridSizeX { get; set; } + int ThumbnailSnapToGridSizeY { get; set; } - bool EnableActiveClientHighlight { get; set; } - Color ActiveClientHighlightColor { get; set; } - Color OverlayLabelColor { get; set; } - int OverlayLabelSize { get; set; } + bool EnableActiveClientHighlight { get; set; } + Color ActiveClientHighlightColor { get; set; } + Color OverlayLabelColor { get; set; } + int OverlayLabelSize { get; set; } - string IconName { get; set; } + bool EnableThumbnailRegionSnipping { get; set; } + Rectangle DefaultThumbnailRegion { get; set; } - void SetDocumentationUrl(string url); - void SetVersionInfo(string version); - void SetThumbnailSizeLimitations(Size minimumSize, Size maximumSize); + string CurrentProfile { get; set; } + List AvailableProfiles { get; set; } - void Minimize(); + string IconName { get; set; } - void AddThumbnails(IList thumbnails); - void RemoveThumbnails(IList thumbnails); - void RefreshZoomSettings(); + void SetDocumentationUrl(string url); + void SetVersionInfo(string version); + void SetThumbnailSizeLimitations(Size minimumSize, Size maximumSize); - Action ApplicationExitRequested { get; set; } - Action FormActivated { get; set; } - Action FormMinimized { get; set; } - Action FormCloseRequested { get; set; } - Action ApplicationSettingsChanged { get; set; } - Action ThumbnailsSizeChanged { get; set; } - Action ThumbnailStateChanged { get; set; } - Action DocumentationLinkActivated { get; set; } - } + void Minimize(); + + void AddThumbnails(IList thumbnails); + void RemoveThumbnails(IList thumbnails); + void RefreshZoomSettings(); + + Action ApplicationExitRequested { get; set; } + Action FormActivated { get; set; } + Action FormMinimized { get; set; } + Action FormCloseRequested { get; set; } + Action ApplicationSettingsChanged { get; set; } + Action ThumbnailsSizeChanged { get; set; } + Action ThumbnailStateChanged { get; set; } + Action DocumentationLinkActivated { get; set; } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/View/Interface/IThumbnailDescription.cs b/src/Eve-O-Preview/View/Interface/IThumbnailDescription.cs index 5f08192..f30bc3e 100644 --- a/src/Eve-O-Preview/View/Interface/IThumbnailDescription.cs +++ b/src/Eve-O-Preview/View/Interface/IThumbnailDescription.cs @@ -1,8 +1,6 @@ -namespace EveOPreview.View -{ - public interface IThumbnailDescription - { - string Title { get; set; } - bool IsDisabled { get; set; } - } +namespace EveOPreview.View { + public interface IThumbnailDescription { + string Title { get; set; } + bool IsDisabled { get; set; } + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/View/Interface/IThumbnailView.cs b/src/Eve-O-Preview/View/Interface/IThumbnailView.cs index 38f7f1a..08dfeb4 100644 --- a/src/Eve-O-Preview/View/Interface/IThumbnailView.cs +++ b/src/Eve-O-Preview/View/Interface/IThumbnailView.cs @@ -4,46 +4,44 @@ using System.Windows.Forms; using EveOPreview.Configuration; using EveOPreview.Services; -namespace EveOPreview.View -{ - public interface IThumbnailView : IView - { - IntPtr Id { get; set; } - string Title { get; set; } +namespace EveOPreview.View { + public interface IThumbnailView : IView { + IntPtr Id { get; set; } + string Title { get; set; } - bool IsActive { get; set; } - Point ThumbnailLocation { get; set; } - Size ThumbnailSize { get; set; } - bool IsOverlayEnabled { get; set; } - ZoomAnchor ClientZoomAnchor { get; set; } - bool IsKnownHandle(IntPtr handle); + bool IsActive { get; set; } + Point ThumbnailLocation { get; set; } + Size ThumbnailSize { get; set; } + bool IsOverlayEnabled { get; set; } + ZoomAnchor ClientZoomAnchor { get; set; } + bool IsKnownHandle(IntPtr handle); - void SetSizeLimitations(Size minimumSize, Size maximumSize); - void SetOpacity(double opacity); - void SetFrames(bool enable); - void SetOverlayLabel(); - void SetTopMost(bool enableTopmost); - void SetHighlight(); - void SetHighlight(bool enabled, int width); + void SetSizeLimitations(Size minimumSize, Size maximumSize); + void SetOpacity(double opacity); + void SetFrames(bool enable); + void SetOverlayLabel(); + void SetTopMost(bool enableTopmost); + void SetHighlight(); + void SetHighlight(bool enabled, int width); - void ZoomIn(ViewZoomAnchor anchor, int zoomFactor); - void ZoomOut(); + void ZoomIn(ViewZoomAnchor anchor, int zoomFactor); + void ZoomOut(); - void RegisterHotkey(Keys hotkey); - void UnregisterHotkey(); + void RegisterHotkey(Keys hotkey); + void UnregisterHotkey(); - void Refresh(bool forceRefresh); + void Refresh(bool forceRefresh); - Action ThumbnailResized { get; set; } - Action ThumbnailMoved { get; set; } - Action ThumbnailFocused { get; set; } - Action ThumbnailLostFocus { get; set; } + Action ThumbnailResized { get; set; } + Action ThumbnailMoved { get; set; } + Action ThumbnailFocused { get; set; } + Action ThumbnailLostFocus { get; set; } - Action ThumbnailActivated { get; set; } - Action ThumbnailDeactivated { get; set; } + Action ThumbnailActivated { get; set; } + Action ThumbnailDeactivated { get; set; } - IWindowManager WindowManager { get; } - void SetDefaultBorderColor(); - void ClearBorder(); - } + IWindowManager WindowManager { get; } + void SetDefaultBorderColor(); + void ClearBorder(); + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/View/Interface/IThumbnailViewFactory.cs b/src/Eve-O-Preview/View/Interface/IThumbnailViewFactory.cs index 67bf001..c3cf753 100644 --- a/src/Eve-O-Preview/View/Interface/IThumbnailViewFactory.cs +++ b/src/Eve-O-Preview/View/Interface/IThumbnailViewFactory.cs @@ -1,10 +1,8 @@ using System; using System.Drawing; -namespace EveOPreview.View -{ - public interface IThumbnailViewFactory - { - IThumbnailView Create(IntPtr id, string title, Size size); - } +namespace EveOPreview.View { + public interface IThumbnailViewFactory { + IThumbnailView Create(IntPtr id, string title, Size size); + } } \ No newline at end of file diff --git a/src/Eve-O-Preview/View/Interface/ViewAnimationStyle.cs b/src/Eve-O-Preview/View/Interface/ViewAnimationStyle.cs index bdddcc7..d64f24f 100644 --- a/src/Eve-O-Preview/View/Interface/ViewAnimationStyle.cs +++ b/src/Eve-O-Preview/View/Interface/ViewAnimationStyle.cs @@ -1,8 +1,3 @@ -namespace EveOPreview.View -{ - public enum ViewAnimationStyle - { - OriginalAnimation, - NoAnimation - } +namespace EveOPreview.View { + public enum ViewAnimationStyle { OriginalAnimation, NoAnimation } } \ No newline at end of file diff --git a/src/Eve-O-Preview/View/Interface/ViewZoomAnchor.cs b/src/Eve-O-Preview/View/Interface/ViewZoomAnchor.cs index 564b134..2681ec8 100644 --- a/src/Eve-O-Preview/View/Interface/ViewZoomAnchor.cs +++ b/src/Eve-O-Preview/View/Interface/ViewZoomAnchor.cs @@ -1,15 +1,3 @@ -namespace EveOPreview.View -{ - public enum ViewZoomAnchor - { - NW, - N, - NE, - W, - C, - E, - SW, - S, - SE - } +namespace EveOPreview.View { + public enum ViewZoomAnchor { NW, N, NE, W, C, E, SW, S, SE } } \ No newline at end of file