From a30834db6cd3fc47ab1af1738f9d2a0d38e87b71 Mon Sep 17 00:00:00 2001 From: Anton Kasyanov Date: Thu, 2 Jun 2016 22:48:51 +0300 Subject: [PATCH] Update configuration system to use JSON --- .../Configuration/ApplicationConfiguration.cs | 53 ++++ Eve-O-Preview/Configuration/Configuration.cs | 7 - .../Configuration/ConfigurationStorage.cs | 35 ++- .../IApplicationConfiguration.cs | 27 ++ .../Configuration/IConfigurationStorage.cs | 8 + Eve-O-Preview/Configuration/ZoomAnchor.cs | 15 ++ Eve-O-Preview/Eve-O-Preview.csproj | 17 +- .../Eve-O-Preview.csproj.DotSettings | 3 + Eve-O-Preview/Presentation/MainPresenter.cs | 116 +++++---- .../Presentation/ThumbnailManager.cs | 91 +++---- .../Presentation/ViewZoomAnchorConverter.cs | 19 ++ Eve-O-Preview/Program.cs | 3 +- Eve-O-Preview/Properties/Settings.Designer.cs | 230 ------------------ Eve-O-Preview/Properties/Settings.settings | 57 ----- .../UI/Implementation/MainForm.Designer.cs | 84 +++---- Eve-O-Preview/UI/Implementation/MainForm.cs | 40 +-- Eve-O-Preview/UI/Implementation/MainForm.resx | 6 +- Eve-O-Preview/UI/Interface/IMainView.cs | 8 +- Eve-O-Preview/packages.config | 1 + 19 files changed, 348 insertions(+), 472 deletions(-) create mode 100644 Eve-O-Preview/Configuration/ApplicationConfiguration.cs delete mode 100644 Eve-O-Preview/Configuration/Configuration.cs create mode 100644 Eve-O-Preview/Configuration/IApplicationConfiguration.cs create mode 100644 Eve-O-Preview/Configuration/IConfigurationStorage.cs create mode 100644 Eve-O-Preview/Configuration/ZoomAnchor.cs create mode 100644 Eve-O-Preview/Presentation/ViewZoomAnchorConverter.cs delete mode 100644 Eve-O-Preview/Properties/Settings.Designer.cs delete mode 100644 Eve-O-Preview/Properties/Settings.settings diff --git a/Eve-O-Preview/Configuration/ApplicationConfiguration.cs b/Eve-O-Preview/Configuration/ApplicationConfiguration.cs new file mode 100644 index 0000000..a5dbeca --- /dev/null +++ b/Eve-O-Preview/Configuration/ApplicationConfiguration.cs @@ -0,0 +1,53 @@ +namespace EveOPreview.Configuration +{ + public class ApplicationConfiguration : IApplicationConfiguration + { + public ApplicationConfiguration() + { + // Default values + this.MinimizeToTray = true; + this.ThumbnailRefreshPeriod = 500; + + this.ThumbnailsOpacity = 0.5; + + this.EnableClientsLocationTracking = false; + this.HideActiveClientThumbnail = false; + this.ShowThumbnailsAlwaysOnTop = true; + this.HideThumbnailsOnLostFocus = false; + this.EnablePerClientThumbnailsLayouts = false; + + this.SyncThumbnailsSize = true; + this.ThumbnailsWidth = 250; + this.ThumbnailsHeight = 150; + + this.EnableThumbnailZoom = false; + this.ThumbnailZoomFactor = 2; + this.ThumbnailZoomAnchor = ZoomAnchor.NW; + + this.ShowThumbnailOverlays = true; + this.ShowThumbnailFrames = true; + } + + public bool MinimizeToTray { get; set; } + public int ThumbnailRefreshPeriod { get; set; } + + public double ThumbnailsOpacity { get; set; } + + public bool EnableClientsLocationTracking { get; set; } + public bool HideActiveClientThumbnail { get; set; } + public bool ShowThumbnailsAlwaysOnTop { get; set; } + public bool HideThumbnailsOnLostFocus { get; set; } + public bool EnablePerClientThumbnailsLayouts { get; set; } + + public bool SyncThumbnailsSize { get; set; } + public int ThumbnailsWidth { get; set; } + public int ThumbnailsHeight { get; set; } + + public bool EnableThumbnailZoom { get; set; } + public int ThumbnailZoomFactor { get; set; } + public ZoomAnchor ThumbnailZoomAnchor { get; set; } + + public bool ShowThumbnailOverlays { get; set; } + public bool ShowThumbnailFrames { get; set; } + } +} \ No newline at end of file diff --git a/Eve-O-Preview/Configuration/Configuration.cs b/Eve-O-Preview/Configuration/Configuration.cs deleted file mode 100644 index a7fe428..0000000 --- a/Eve-O-Preview/Configuration/Configuration.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace EveOPreview.Configuration -{ - public class Configuration - { - - } -} \ No newline at end of file diff --git a/Eve-O-Preview/Configuration/ConfigurationStorage.cs b/Eve-O-Preview/Configuration/ConfigurationStorage.cs index e2bf967..e60dbf6 100644 --- a/Eve-O-Preview/Configuration/ConfigurationStorage.cs +++ b/Eve-O-Preview/Configuration/ConfigurationStorage.cs @@ -1,7 +1,36 @@ -namespace EveOPreview.Configuration +using System.IO; +using Newtonsoft.Json; + +namespace EveOPreview.Configuration { - public class ConfigurationStorage + public class ConfigurationStorage : IConfigurationStorage { - + private const string ConfigurationFileName = "EVE-O Preview.json"; + + private readonly IApplicationConfiguration _configuration; + + public ConfigurationStorage(IApplicationConfiguration configuration) + { + this._configuration = configuration; + } + + public void Load() + { + if (!File.Exists(ConfigurationStorage.ConfigurationFileName)) + { + return; + } + + string rawData = File.ReadAllText(ConfigurationStorage.ConfigurationFileName); + + JsonConvert.PopulateObject(rawData, this._configuration); + } + + public void Save() + { + string rawData = JsonConvert.SerializeObject(this._configuration, Formatting.Indented); + + File.WriteAllText(ConfigurationStorage.ConfigurationFileName, rawData); + } } } \ No newline at end of file diff --git a/Eve-O-Preview/Configuration/IApplicationConfiguration.cs b/Eve-O-Preview/Configuration/IApplicationConfiguration.cs new file mode 100644 index 0000000..759990b --- /dev/null +++ b/Eve-O-Preview/Configuration/IApplicationConfiguration.cs @@ -0,0 +1,27 @@ +namespace EveOPreview.Configuration +{ + public interface IApplicationConfiguration + { + bool MinimizeToTray { get; set; } + int ThumbnailRefreshPeriod { get; set; } + + double ThumbnailsOpacity { get; set; } + + bool EnableClientsLocationTracking { get; set; } + bool HideActiveClientThumbnail { get; set; } + bool ShowThumbnailsAlwaysOnTop { get; set; } + bool HideThumbnailsOnLostFocus { get; set; } + bool EnablePerClientThumbnailsLayouts { get; set; } + + bool SyncThumbnailsSize { get; set; } + int ThumbnailsWidth { get; set; } + int ThumbnailsHeight { get; set; } + + bool EnableThumbnailZoom { get; set; } + int ThumbnailZoomFactor { get; set; } + ZoomAnchor ThumbnailZoomAnchor { get; set; } + + bool ShowThumbnailOverlays { get; set; } + bool ShowThumbnailFrames { get; set; } + } +} \ No newline at end of file diff --git a/Eve-O-Preview/Configuration/IConfigurationStorage.cs b/Eve-O-Preview/Configuration/IConfigurationStorage.cs new file mode 100644 index 0000000..5cc3e11 --- /dev/null +++ b/Eve-O-Preview/Configuration/IConfigurationStorage.cs @@ -0,0 +1,8 @@ +namespace EveOPreview.Configuration +{ + public interface IConfigurationStorage + { + void Load(); + void Save(); + } +} \ No newline at end of file diff --git a/Eve-O-Preview/Configuration/ZoomAnchor.cs b/Eve-O-Preview/Configuration/ZoomAnchor.cs new file mode 100644 index 0000000..d344b7e --- /dev/null +++ b/Eve-O-Preview/Configuration/ZoomAnchor.cs @@ -0,0 +1,15 @@ +namespace EveOPreview.Configuration +{ + public enum ZoomAnchor + { + NW, + N, + NE, + W, + C, + E, + SW, + S, + SE + } +} \ No newline at end of file diff --git a/Eve-O-Preview/Eve-O-Preview.csproj b/Eve-O-Preview/Eve-O-Preview.csproj index f944e60..c4afe66 100644 --- a/Eve-O-Preview/Eve-O-Preview.csproj +++ b/Eve-O-Preview/Eve-O-Preview.csproj @@ -94,6 +94,10 @@ ..\packages\LightInject.4.0.9\lib\net45\LightInject.dll True + + ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll + True + @@ -111,6 +115,7 @@ + @@ -122,6 +127,7 @@ + @@ -140,7 +146,7 @@ MainForm.cs - + @@ -177,15 +183,6 @@ Designer - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - Form diff --git a/Eve-O-Preview/Eve-O-Preview.csproj.DotSettings b/Eve-O-Preview/Eve-O-Preview.csproj.DotSettings index 662dc1c..7a1090f 100644 --- a/Eve-O-Preview/Eve-O-Preview.csproj.DotSettings +++ b/Eve-O-Preview/Eve-O-Preview.csproj.DotSettings @@ -1,4 +1,7 @@  + True + True + True True True True diff --git a/Eve-O-Preview/Presentation/MainPresenter.cs b/Eve-O-Preview/Presentation/MainPresenter.cs index 379f2b7..5004e3c 100644 --- a/Eve-O-Preview/Presentation/MainPresenter.cs +++ b/Eve-O-Preview/Presentation/MainPresenter.cs @@ -2,26 +2,37 @@ using System.Collections.Generic; using System.Diagnostics; using System.Drawing; +using EveOPreview.Configuration; namespace EveOPreview.UI { public class MainPresenter : Presenter { + #region Private constants private const string ForumUrl = @"https://forums.eveonline.com/default.aspx?g=posts&t=389086"; + #endregion + #region Private fields + private readonly IApplicationConfiguration _configuration; + private readonly IConfigurationStorage _configurationStorage; private readonly IThumbnailDescriptionViewFactory _thumbnailDescriptionViewFactory; - private readonly IThumbnailManager _manager; - private readonly IDictionary _thumbnailViews; + private readonly IDictionary _thumbnailDescriptionViews; + private readonly IThumbnailManager _thumbnailManager; private bool _exitApplication; + #endregion - public MainPresenter(IApplicationController controller, IMainView view, IThumbnailDescriptionViewFactory thumbnailDescriptionViewFactory, IThumbnailManager manager) + public MainPresenter(IApplicationController controller, IMainView view, IApplicationConfiguration configuration, IConfigurationStorage configurationStorage, + IThumbnailDescriptionViewFactory thumbnailDescriptionViewFactory, IThumbnailManager thumbnailManager) : base(controller, view) { - this._thumbnailDescriptionViewFactory = thumbnailDescriptionViewFactory; - this._manager = manager; + this._configuration = configuration; + this._configurationStorage = configurationStorage; - this._thumbnailViews = new Dictionary(); + this._thumbnailDescriptionViewFactory = thumbnailDescriptionViewFactory; + this._thumbnailManager = thumbnailManager; + + this._thumbnailDescriptionViews = new Dictionary(); this._exitApplication = false; this.View.ApplicationExitRequested += ExitApplication; @@ -33,10 +44,10 @@ namespace EveOPreview.UI this.View.ThumbnailStateChanged += UpdateThumbnailState; this.View.ForumUrlLinkActivated += OpenForumUrlLink; - this._manager.ThumbnailsAdded += ThumbnailsAdded; - this._manager.ThumbnailsUpdated += ThumbnailsUpdated; - this._manager.ThumbnailsRemoved += ThumbnailsRemoved; - this._manager.ThumbnailSizeChanged += ThumbnailSizeChanged; + this._thumbnailManager.ThumbnailsAdded += ThumbnailsAdded; + this._thumbnailManager.ThumbnailsUpdated += ThumbnailsUpdated; + this._thumbnailManager.ThumbnailsRemoved += ThumbnailsRemoved; + this._thumbnailManager.ThumbnailSizeChanged += ThumbnailSizeChanged; } private void ExitApplication() @@ -50,7 +61,7 @@ namespace EveOPreview.UI this.LoadApplicationSettings(); this.View.SetForumUrl(MainPresenter.ForumUrl); - this._manager.Activate(); + this._thumbnailManager.Activate(); } private void Minimize() @@ -77,60 +88,65 @@ namespace EveOPreview.UI private void UpdateThumbnailsSize() { - this._manager.SetThumbnailsSize(new Size(this.View.ThumbnailsWidth, this.View.ThumbnailsHeight)); + this._thumbnailManager.SetThumbnailsSize(new Size(this.View.ThumbnailsWidth, this.View.ThumbnailsHeight)); this.SaveApplicationSettings(); } private void LoadApplicationSettings() { - this.View.MinimizeToTray = Properties.Settings.Default.minimizeToTray; - this.View.ThumbnailsOpacity = Properties.Settings.Default.opacity; - this.View.EnableClientsLocationTracking = Properties.Settings.Default.track_client_windows; - this.View.HideActiveClientThumbnail = Properties.Settings.Default.hide_active; - this.View.ShowThumbnailsAlwaysOnTop = Properties.Settings.Default.always_on_top; - this.View.HideThumbnailsOnLostFocus = Properties.Settings.Default.hide_all; - this.View.EnableUniqueThumbnailsLayouts = Properties.Settings.Default.unique_layout; + this._configurationStorage.Load(); - this.View.SyncThumbnailsSize = Properties.Settings.Default.sync_resize; - this.View.ThumbnailsWidth = (int)Properties.Settings.Default.sync_resize_x; - this.View.ThumbnailsHeight = (int)Properties.Settings.Default.sync_resize_y; + this.View.MinimizeToTray = this._configuration.MinimizeToTray; - this.View.EnableZoomOnHover = Properties.Settings.Default.zoom_on_hover; - this.View.ZoomFactor = (int)Properties.Settings.Default.zoom_amount; - this.View.ZoomAnchor = (ViewZoomAnchor)Properties.Settings.Default.zoom_anchor; + this.View.ThumbnailsOpacity = this._configuration.ThumbnailsOpacity; - this.View.ShowThumbnailFrames = Properties.Settings.Default.show_thumb_frames; - this.View.ShowThumbnailOverlays = Properties.Settings.Default.show_overlay; + this.View.EnableClientsLocationTracking = this._configuration.EnableClientsLocationTracking; + this.View.HideActiveClientThumbnail = this._configuration.HideActiveClientThumbnail; + this.View.ShowThumbnailsAlwaysOnTop = this._configuration.ShowThumbnailsAlwaysOnTop; + this.View.HideThumbnailsOnLostFocus = this._configuration.HideThumbnailsOnLostFocus; + this.View.EnablePerClientThumbnailsLayouts = this._configuration.EnablePerClientThumbnailsLayouts; + + this.View.SyncThumbnailsSize = this._configuration.SyncThumbnailsSize; + this.View.ThumbnailsWidth = this._configuration.ThumbnailsWidth; + this.View.ThumbnailsHeight = this._configuration.ThumbnailsHeight; + + this.View.EnableThumbnailZoom = this._configuration.EnableThumbnailZoom; + this.View.ThumbnailZoomFactor = this._configuration.ThumbnailZoomFactor; + this.View.ThumbnailZoomAnchor = ViewZoomAnchorConverter.Convert(this._configuration.ThumbnailZoomAnchor); + + this.View.ShowThumbnailOverlays = this._configuration.ShowThumbnailOverlays; + this.View.ShowThumbnailFrames = this._configuration.ShowThumbnailFrames; } private void SaveApplicationSettings() { - Properties.Settings.Default.minimizeToTray = this.View.MinimizeToTray; + this._configuration.MinimizeToTray = this.View.MinimizeToTray; - Properties.Settings.Default.opacity = (float)this.View.ThumbnailsOpacity; - Properties.Settings.Default.track_client_windows = this.View.EnableClientsLocationTracking; - Properties.Settings.Default.hide_active = this.View.HideActiveClientThumbnail; - Properties.Settings.Default.always_on_top = this.View.ShowThumbnailsAlwaysOnTop; - Properties.Settings.Default.hide_all = this.View.HideThumbnailsOnLostFocus; - Properties.Settings.Default.unique_layout = this.View.EnableUniqueThumbnailsLayouts; + this._configuration.ThumbnailsOpacity = (float)this.View.ThumbnailsOpacity; - Properties.Settings.Default.sync_resize = this.View.SyncThumbnailsSize; - Properties.Settings.Default.sync_resize_x = (uint)this.View.ThumbnailsWidth; - Properties.Settings.Default.sync_resize_y = (uint)this.View.ThumbnailsHeight; + this._configuration.EnableClientsLocationTracking = this.View.EnableClientsLocationTracking; + this._configuration.HideActiveClientThumbnail = this.View.HideActiveClientThumbnail; + this._configuration.ShowThumbnailsAlwaysOnTop = this.View.ShowThumbnailsAlwaysOnTop; + this._configuration.HideThumbnailsOnLostFocus = this.View.HideThumbnailsOnLostFocus; + this._configuration.EnablePerClientThumbnailsLayouts = this.View.EnablePerClientThumbnailsLayouts; - Properties.Settings.Default.zoom_on_hover = this.View.EnableZoomOnHover; - Properties.Settings.Default.zoom_amount = this.View.ZoomFactor; - Properties.Settings.Default.zoom_anchor = (byte)this.View.ZoomAnchor; + this._configuration.SyncThumbnailsSize = this.View.SyncThumbnailsSize; + this._configuration.ThumbnailsWidth = this.View.ThumbnailsWidth; + this._configuration.ThumbnailsHeight = this.View.ThumbnailsHeight; - Properties.Settings.Default.show_overlay = this.View.ShowThumbnailOverlays; - Properties.Settings.Default.show_thumb_frames = this.View.ShowThumbnailFrames; + this._configuration.EnableThumbnailZoom = this.View.EnableThumbnailZoom; + this._configuration.ThumbnailZoomFactor = this.View.ThumbnailZoomFactor; + this._configuration.ThumbnailZoomAnchor = ViewZoomAnchorConverter.Convert(this.View.ThumbnailZoomAnchor); - Properties.Settings.Default.Save(); + this._configuration.ShowThumbnailOverlays = this.View.ShowThumbnailOverlays; + this._configuration.ShowThumbnailFrames = this.View.ShowThumbnailFrames; + + this._configurationStorage.Save(); this.View.UpdateZoomSettingsView(); - this._manager.SetupThumbnailFrames(); - this._manager.RefreshThumbnails(); + this._thumbnailManager.SetupThumbnailFrames(); + this._thumbnailManager.RefreshThumbnails(); } private void ThumbnailsAdded(IList thumbnails) @@ -153,12 +169,12 @@ namespace EveOPreview.UI IList thumbnailViews = new List(thumbnails.Count); // Time for some thread safety - lock (this._thumbnailViews) + lock (this._thumbnailDescriptionViews) { foreach (IThumbnailView thumbnail in thumbnails) { IThumbnailDescriptionView thumbnailView; - bool foundInCache = this._thumbnailViews.TryGetValue(thumbnail.Id, out thumbnailView); + bool foundInCache = this._thumbnailDescriptionViews.TryGetValue(thumbnail.Id, out thumbnailView); if (!foundInCache) { @@ -169,13 +185,13 @@ namespace EveOPreview.UI } thumbnailView = this._thumbnailDescriptionViewFactory.Create(thumbnail.Id, thumbnail.Title, !thumbnail.IsEnabled); - this._thumbnailViews.Add(thumbnail.Id, thumbnailView); + this._thumbnailDescriptionViews.Add(thumbnail.Id, thumbnailView); } else { if (removeFromCache) { - this._thumbnailViews.Remove(thumbnail.Id); + this._thumbnailDescriptionViews.Remove(thumbnail.Id); } else { @@ -197,7 +213,7 @@ namespace EveOPreview.UI private void UpdateThumbnailState(IntPtr thumbnailId) { - this._manager.SetThumbnailState(thumbnailId, this._thumbnailViews[thumbnailId].IsDisabled); + this._thumbnailManager.SetThumbnailState(thumbnailId, this._thumbnailDescriptionViews[thumbnailId].IsDisabled); } private void OpenForumUrlLink() diff --git a/Eve-O-Preview/Presentation/ThumbnailManager.cs b/Eve-O-Preview/Presentation/ThumbnailManager.cs index 97c8709..c8754f3 100644 --- a/Eve-O-Preview/Presentation/ThumbnailManager.cs +++ b/Eve-O-Preview/Presentation/ThumbnailManager.cs @@ -11,9 +11,13 @@ namespace EveOPreview.UI { public class ThumbnailManager : IThumbnailManager { + #region Private constants private const string ClientProcessName = "ExeFile"; private const string DefaultThumbnailTitle = "..."; + #endregion + #region Private fields + private readonly IApplicationConfiguration _configuration; private readonly DispatcherTimer _thumbnailUpdateTimer; private readonly IThumbnailViewFactory _thumbnailViewFactory; private readonly Dictionary _thumbnailViews; @@ -34,10 +38,11 @@ namespace EveOPreview.UI // TODO To be removed private readonly Dictionary _xmlBadToOkChars; + #endregion - // TODO Drop dependency on the configuration object - public ThumbnailManager(IThumbnailViewFactory factory) + public ThumbnailManager(IApplicationConfiguration configuration, IThumbnailViewFactory factory) { + this._configuration = configuration; this._thumbnailViewFactory = factory; this._activeClientHandle = (IntPtr)0; @@ -115,11 +120,10 @@ namespace EveOPreview.UI this.EnableViewEvents(); } - // TODO Drop dependency on the configuration object public void RefreshThumbnails() { IntPtr foregroundWindowHandle = DwmApiNativeMethods.GetForegroundWindow(); - Boolean hideAllThumbnails = (Properties.Settings.Default.hide_all && !this.IsClientWindowActive(foregroundWindowHandle)) || !DwmApiNativeMethods.DwmIsCompositionEnabled(); + Boolean hideAllThumbnails = (this._configuration.HideThumbnailsOnLostFocus && !this.IsClientWindowActive(foregroundWindowHandle)) || !DwmApiNativeMethods.DwmIsCompositionEnabled(); this.DisableViewEvents(); @@ -137,7 +141,7 @@ namespace EveOPreview.UI continue; } - if (view.Id == this._activeClientHandle && Properties.Settings.Default.hide_active) + if (this._configuration.HideActiveClientThumbnail && (view.Id == this._activeClientHandle)) { if (view.IsActive) { @@ -146,7 +150,7 @@ namespace EveOPreview.UI continue; } - if (Properties.Settings.Default.unique_layout) + if (this._configuration.EnablePerClientThumbnailsLayouts) { this.ApplyPerClientLayout(view, this._activeClientTitle); } @@ -155,10 +159,10 @@ namespace EveOPreview.UI this.ApplyFlatLayout(view); } - view.IsOverlayEnabled = Properties.Settings.Default.show_overlay; + view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays; if (!this._isHoverEffectActive) { - view.SetOpacity(Properties.Settings.Default.opacity); + view.SetOpacity(this._configuration.ThumbnailsOpacity); } if (!view.IsActive) @@ -177,7 +181,7 @@ namespace EveOPreview.UI foreach (KeyValuePair entry in this._thumbnailViews) { - entry.Value.SetWindowFrames(Properties.Settings.Default.show_thumb_frames); + entry.Value.SetWindowFrames(this._configuration.ShowThumbnailFrames); } this.EnableViewEvents(); @@ -227,14 +231,14 @@ namespace EveOPreview.UI if ((view == null) && (processTitle != "")) { Size thumbnailSize = new Size(); - thumbnailSize.Width = (int)Properties.Settings.Default.sync_resize_x; - thumbnailSize.Height = (int)Properties.Settings.Default.sync_resize_y; + thumbnailSize.Width = this._configuration.ThumbnailsWidth; + thumbnailSize.Height = this._configuration.ThumbnailsHeight; view = this._thumbnailViewFactory.Create(processHandle, ThumbnailManager.DefaultThumbnailTitle, thumbnailSize); view.IsEnabled = true; - view.IsOverlayEnabled = Properties.Settings.Default.show_overlay; - view.SetTopMost(Properties.Settings.Default.always_on_top); - view.SetWindowFrames(Properties.Settings.Default.show_thumb_frames); + view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays; + view.SetTopMost(this._configuration.ShowThumbnailsAlwaysOnTop); + view.SetWindowFrames(this._configuration.ShowThumbnailFrames); view.ThumbnailResized += ThumbnailViewResized; view.ThumbnailMoved += ThumbnailViewMoved; @@ -333,7 +337,7 @@ namespace EveOPreview.UI this.ThumbnailZoomOut(view); - view.SetOpacity(Properties.Settings.Default.opacity); + view.SetOpacity(this._configuration.ThumbnailsOpacity); this._isHoverEffectActive = false; } @@ -355,7 +359,7 @@ namespace EveOPreview.UI foreach (KeyValuePair entry in this._thumbnailViews) { IThumbnailView view = entry.Value; - view.SetTopMost(Properties.Settings.Default.always_on_top); + view.SetTopMost(this._configuration.ShowThumbnailsAlwaysOnTop); } } @@ -389,7 +393,7 @@ namespace EveOPreview.UI private void SetupClientWindow(IntPtr clientHandle, string clientTitle) { - if (!Properties.Settings.Default.track_client_windows) + if (!this._configuration.EnableClientsLocationTracking) { return; } @@ -418,29 +422,27 @@ namespace EveOPreview.UI private void UpdateThumbnailPosition(string title, Point position) { - if (Properties.Settings.Default.unique_layout) - { - Dictionary layout; - if (_uniqueLayouts.TryGetValue(_activeClientTitle, out layout)) - { - layout[title] = position; - } - else if (_activeClientTitle == "") - { - _uniqueLayouts[_activeClientTitle] = new Dictionary(); - _uniqueLayouts[_activeClientTitle][title] = position; - } - } - else + if (!this._configuration.EnablePerClientThumbnailsLayouts) { _flatLayout[title] = position; + return; + } + + Dictionary layout; + if (_uniqueLayouts.TryGetValue(_activeClientTitle, out layout)) + { + layout[title] = position; + } + else if (_activeClientTitle == "") + { + _uniqueLayouts[_activeClientTitle] = new Dictionary(); + _uniqueLayouts[_activeClientTitle][title] = position; } } private void ThumbnailZoomIn(IThumbnailView view) { - // TODO Use global settings object - float zoomFactor = Properties.Settings.Default.zoom_amount; + int zoomFactor = this._configuration.ThumbnailZoomFactor; this._thumbnailBaseSize = view.Size; this._thumbnailBaseLocation = view.Location; @@ -458,35 +460,34 @@ namespace EveOPreview.UI int oldWidth = this._thumbnailBaseSize.Width; int oldHeight = this._thumbnailBaseSize.Height; - // TODO Use global settings object - switch ((ViewZoomAnchor)Properties.Settings.Default.zoom_anchor) + switch (this._configuration.ThumbnailZoomAnchor) { - case ViewZoomAnchor.NW: + case ZoomAnchor.NW: break; - case ViewZoomAnchor.N: + case ZoomAnchor.N: view.Location = new Point(locationX - newWidth / 2 + oldWidth / 2, locationY); break; - case ViewZoomAnchor.NE: + case ZoomAnchor.NE: view.Location = new Point(locationX - newWidth + oldWidth, locationY); break; - case ViewZoomAnchor.W: + case ZoomAnchor.W: view.Location = new Point(locationX, locationY - newHeight / 2 + oldHeight / 2); break; - case ViewZoomAnchor.C: + case ZoomAnchor.C: view.Location = new Point(locationX - newWidth / 2 + oldWidth / 2, locationY - newHeight / 2 + oldHeight / 2); break; - case ViewZoomAnchor.E: + case ZoomAnchor.E: view.Location = new Point(locationX - newWidth + oldWidth, locationY - newHeight / 2 + oldHeight / 2); break; - case ViewZoomAnchor.SW: + case ZoomAnchor.SW: view.Location = new Point(locationX, locationY - newHeight + this._thumbnailBaseSize.Height); break; - case ViewZoomAnchor.S: + case ZoomAnchor.S: view.Location = new Point(locationX - newWidth / 2 + oldWidth / 2, locationY - newHeight + oldHeight); break; - case ViewZoomAnchor.SE: + case ZoomAnchor.SE: view.Location = new Point(locationX - newWidth + oldWidth, locationY - newHeight + oldHeight); break; } @@ -724,7 +725,7 @@ namespace EveOPreview.UI if (_uniqueLayouts.TryGetValue(last_known_active_window, out layout)) { Point new_loc; - if (Properties.Settings.Default.unique_layout && layout.TryGetValue(thumbnailWindow.Title, out new_loc)) + if (this._configuration.EnablePerClientThumbnailsLayouts && layout.TryGetValue(thumbnailWindow.Title, out new_loc)) { thumbnailWindow.Location = new_loc; } diff --git a/Eve-O-Preview/Presentation/ViewZoomAnchorConverter.cs b/Eve-O-Preview/Presentation/ViewZoomAnchorConverter.cs new file mode 100644 index 0000000..04027cc --- /dev/null +++ b/Eve-O-Preview/Presentation/ViewZoomAnchorConverter.cs @@ -0,0 +1,19 @@ +using EveOPreview.Configuration; + +namespace EveOPreview.UI +{ + 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); + } + } +} \ No newline at end of file diff --git a/Eve-O-Preview/Program.cs b/Eve-O-Preview/Program.cs index 0788efb..c36b116 100644 --- a/Eve-O-Preview/Program.cs +++ b/Eve-O-Preview/Program.cs @@ -28,7 +28,8 @@ namespace EveOPreview controller.RegisterService() .RegisterService() .RegisterService() - .RegisterService(); + .RegisterService() + .RegisterInstance(new ApplicationConfiguration()); controller.Run(); } diff --git a/Eve-O-Preview/Properties/Settings.Designer.cs b/Eve-O-Preview/Properties/Settings.Designer.cs deleted file mode 100644 index 7effa90..0000000 --- a/Eve-O-Preview/Properties/Settings.Designer.cs +++ /dev/null @@ -1,230 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace EveOPreview.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool hide_active { - get { - return ((bool)(this["hide_active"])); - } - set { - this["hide_active"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool hide_all { - get { - return ((bool)(this["hide_all"])); - } - set { - this["hide_all"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool always_on_top { - get { - return ((bool)(this["always_on_top"])); - } - set { - this["always_on_top"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool unique_layout { - get { - return ((bool)(this["unique_layout"])); - } - set { - this["unique_layout"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool sync_resize { - get { - return ((bool)(this["sync_resize"])); - } - set { - this["sync_resize"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool show_thumb_frames { - get { - return ((bool)(this["show_thumb_frames"])); - } - set { - this["show_thumb_frames"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool show_client_frames { - get { - return ((bool)(this["show_client_frames"])); - } - set { - this["show_client_frames"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("128")] - public uint sync_resize_x { - get { - return ((uint)(this["sync_resize_x"])); - } - set { - this["sync_resize_x"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("128")] - public uint sync_resize_y { - get { - return ((uint)(this["sync_resize_y"])); - } - set { - this["sync_resize_y"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool show_overlay { - get { - return ((bool)(this["show_overlay"])); - } - set { - this["show_overlay"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool zoom_on_hover { - get { - return ((bool)(this["zoom_on_hover"])); - } - set { - this["zoom_on_hover"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("3")] - public float zoom_amount { - get { - return ((float)(this["zoom_amount"])); - } - set { - this["zoom_amount"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool previews_dock { - get { - return ((bool)(this["previews_dock"])); - } - set { - this["previews_dock"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("0")] - public byte zoom_anchor { - get { - return ((byte)(this["zoom_anchor"])); - } - set { - this["zoom_anchor"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool track_client_windows { - get { - return ((bool)(this["track_client_windows"])); - } - set { - this["track_client_windows"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("0.9")] - public float opacity { - get { - return ((float)(this["opacity"])); - } - set { - this["opacity"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool minimizeToTray { - get { - return ((bool)(this["minimizeToTray"])); - } - set { - this["minimizeToTray"] = value; - } - } - } -} diff --git a/Eve-O-Preview/Properties/Settings.settings b/Eve-O-Preview/Properties/Settings.settings deleted file mode 100644 index 71f2b64..0000000 --- a/Eve-O-Preview/Properties/Settings.settings +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - False - - - False - - - False - - - False - - - True - - - True - - - True - - - 128 - - - 128 - - - False - - - False - - - 3 - - - False - - - 0 - - - False - - - 0.9 - - - False - - - \ No newline at end of file diff --git a/Eve-O-Preview/UI/Implementation/MainForm.Designer.cs b/Eve-O-Preview/UI/Implementation/MainForm.Designer.cs index c60ac2a..5df2275 100644 --- a/Eve-O-Preview/UI/Implementation/MainForm.Designer.cs +++ b/Eve-O-Preview/UI/Implementation/MainForm.Designer.cs @@ -49,7 +49,7 @@ namespace EveOPreview.UI this.HideActiveClientThumbnailCheckBox = new System.Windows.Forms.CheckBox(); this.ShowThumbnailsAlwaysOnTopCheckBox = new System.Windows.Forms.CheckBox(); this.HideThumbnailsOnLostFocusCheckBox = new System.Windows.Forms.CheckBox(); - this.EnableUniqueThumbnailsLayoutsCheckBox = new System.Windows.Forms.CheckBox(); + this.EnablePerClientThumbnailsLayoutsCheckBox = new System.Windows.Forms.CheckBox(); this.SyncThumbnailsSizeCheckBox = new System.Windows.Forms.CheckBox(); this.ThumbnailsWidthNumericEdit = new System.Windows.Forms.NumericUpDown(); this.ThumbnailsHeightNumericEdit = new System.Windows.Forms.NumericUpDown(); @@ -63,8 +63,8 @@ namespace EveOPreview.UI this.ZoomAanchorSRadioButton = new System.Windows.Forms.RadioButton(); this.ZoomAanchorERadioButton = new System.Windows.Forms.RadioButton(); this.ZoomAanchorSWRadioButton = new System.Windows.Forms.RadioButton(); - this.EnableZoomOnHoverCheckBox = new System.Windows.Forms.CheckBox(); - this.ZoomFactorNumericEdit = new System.Windows.Forms.NumericUpDown(); + this.EnableThumbnailZoomCheckBox = new System.Windows.Forms.CheckBox(); + this.ThumbnailZoomFactorNumericEdit = new System.Windows.Forms.NumericUpDown(); this.ShowThumbnailOverlaysCheckBox = new System.Windows.Forms.CheckBox(); this.ShowThumbnailFramesCheckBox = new System.Windows.Forms.CheckBox(); this.ThumbnailsList = new System.Windows.Forms.CheckedListBox(); @@ -89,7 +89,7 @@ namespace EveOPreview.UI ((System.ComponentModel.ISupportInitialize)(this.ThumbnailsHeightNumericEdit)).BeginInit(); ZoomOptionsPanel.SuspendLayout(); this.ZoomAnchorPanel.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.ZoomFactorNumericEdit)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.ThumbnailZoomFactorNumericEdit)).BeginInit(); ThumbnailsListPanel.SuspendLayout(); this.TrayMenu.SuspendLayout(); this.SuspendLayout(); @@ -126,7 +126,7 @@ namespace EveOPreview.UI ContentFlowLayoutPanel.Controls.Add(this.HideActiveClientThumbnailCheckBox); ContentFlowLayoutPanel.Controls.Add(this.ShowThumbnailsAlwaysOnTopCheckBox); ContentFlowLayoutPanel.Controls.Add(this.HideThumbnailsOnLostFocusCheckBox); - ContentFlowLayoutPanel.Controls.Add(this.EnableUniqueThumbnailsLayoutsCheckBox); + ContentFlowLayoutPanel.Controls.Add(this.EnablePerClientThumbnailsLayoutsCheckBox); ContentFlowLayoutPanel.Controls.Add(ResizeOptionsPanel); ContentFlowLayoutPanel.Controls.Add(ZoomOptionsPanel); ContentFlowLayoutPanel.Controls.Add(this.ShowThumbnailOverlaysCheckBox); @@ -222,16 +222,16 @@ namespace EveOPreview.UI // // EnableUniqueThumbnailsLayoutsCheckBox // - this.EnableUniqueThumbnailsLayoutsCheckBox.AutoSize = true; - this.EnableUniqueThumbnailsLayoutsCheckBox.Checked = true; - this.EnableUniqueThumbnailsLayoutsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; - this.EnableUniqueThumbnailsLayoutsCheckBox.Location = new System.Drawing.Point(3, 150); - this.EnableUniqueThumbnailsLayoutsCheckBox.Name = "EnableUniqueThumbnailsLayoutsCheckBox"; - this.EnableUniqueThumbnailsLayoutsCheckBox.Size = new System.Drawing.Size(185, 17); - this.EnableUniqueThumbnailsLayoutsCheckBox.TabIndex = 3; - this.EnableUniqueThumbnailsLayoutsCheckBox.Text = "Unique layout for each EVE client"; - this.EnableUniqueThumbnailsLayoutsCheckBox.UseVisualStyleBackColor = true; - this.EnableUniqueThumbnailsLayoutsCheckBox.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler); + this.EnablePerClientThumbnailsLayoutsCheckBox.AutoSize = true; + this.EnablePerClientThumbnailsLayoutsCheckBox.Checked = true; + this.EnablePerClientThumbnailsLayoutsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.EnablePerClientThumbnailsLayoutsCheckBox.Location = new System.Drawing.Point(3, 150); + this.EnablePerClientThumbnailsLayoutsCheckBox.Name = "EnablePerClientThumbnailsLayoutsCheckBox"; + this.EnablePerClientThumbnailsLayoutsCheckBox.Size = new System.Drawing.Size(185, 17); + this.EnablePerClientThumbnailsLayoutsCheckBox.TabIndex = 3; + this.EnablePerClientThumbnailsLayoutsCheckBox.Text = "Unique layout for each EVE client"; + this.EnablePerClientThumbnailsLayoutsCheckBox.UseVisualStyleBackColor = true; + this.EnablePerClientThumbnailsLayoutsCheckBox.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler); // // ResizeOptionsPanel // @@ -327,8 +327,8 @@ namespace EveOPreview.UI ZoomOptionsPanel.Controls.Add(ZoomFactorLabel); ZoomOptionsPanel.Controls.Add(this.ZoomAnchorPanel); ZoomOptionsPanel.Controls.Add(ZoomAnchorLabel); - ZoomOptionsPanel.Controls.Add(this.EnableZoomOnHoverCheckBox); - ZoomOptionsPanel.Controls.Add(this.ZoomFactorNumericEdit); + ZoomOptionsPanel.Controls.Add(this.EnableThumbnailZoomCheckBox); + ZoomOptionsPanel.Controls.Add(this.ThumbnailZoomFactorNumericEdit); ZoomOptionsPanel.Location = new System.Drawing.Point(3, 209); ZoomOptionsPanel.Name = "ZoomOptionsPanel"; ZoomOptionsPanel.Size = new System.Drawing.Size(246, 82); @@ -469,42 +469,42 @@ namespace EveOPreview.UI // // EnableZoomOnHoverCheckBox // - this.EnableZoomOnHoverCheckBox.AutoSize = true; - this.EnableZoomOnHoverCheckBox.Checked = true; - this.EnableZoomOnHoverCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; - this.EnableZoomOnHoverCheckBox.Location = new System.Drawing.Point(1, 5); - this.EnableZoomOnHoverCheckBox.Name = "EnableZoomOnHoverCheckBox"; - this.EnableZoomOnHoverCheckBox.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.EnableZoomOnHoverCheckBox.Size = new System.Drawing.Size(98, 17); - this.EnableZoomOnHoverCheckBox.TabIndex = 13; - this.EnableZoomOnHoverCheckBox.Text = "Zoom on hover"; - this.EnableZoomOnHoverCheckBox.UseVisualStyleBackColor = true; - this.EnableZoomOnHoverCheckBox.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler); + this.EnableThumbnailZoomCheckBox.AutoSize = true; + this.EnableThumbnailZoomCheckBox.Checked = true; + this.EnableThumbnailZoomCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.EnableThumbnailZoomCheckBox.Location = new System.Drawing.Point(1, 5); + this.EnableThumbnailZoomCheckBox.Name = "EnableThumbnailZoomCheckBox"; + this.EnableThumbnailZoomCheckBox.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.EnableThumbnailZoomCheckBox.Size = new System.Drawing.Size(98, 17); + this.EnableThumbnailZoomCheckBox.TabIndex = 13; + this.EnableThumbnailZoomCheckBox.Text = "Zoom on hover"; + this.EnableThumbnailZoomCheckBox.UseVisualStyleBackColor = true; + this.EnableThumbnailZoomCheckBox.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler); // // ZoomFactorNumericEdit // - this.ZoomFactorNumericEdit.BackColor = System.Drawing.SystemColors.Window; - this.ZoomFactorNumericEdit.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.ZoomFactorNumericEdit.Location = new System.Drawing.Point(9, 40); - this.ZoomFactorNumericEdit.Maximum = new decimal(new int[] { + this.ThumbnailZoomFactorNumericEdit.BackColor = System.Drawing.SystemColors.Window; + this.ThumbnailZoomFactorNumericEdit.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.ThumbnailZoomFactorNumericEdit.Location = new System.Drawing.Point(9, 40); + this.ThumbnailZoomFactorNumericEdit.Maximum = new decimal(new int[] { 10, 0, 0, 0}); - this.ZoomFactorNumericEdit.Minimum = new decimal(new int[] { + this.ThumbnailZoomFactorNumericEdit.Minimum = new decimal(new int[] { 1, 0, 0, 0}); - this.ZoomFactorNumericEdit.Name = "ZoomFactorNumericEdit"; - this.ZoomFactorNumericEdit.Size = new System.Drawing.Size(34, 20); - this.ZoomFactorNumericEdit.TabIndex = 24; - this.ZoomFactorNumericEdit.Value = new decimal(new int[] { + this.ThumbnailZoomFactorNumericEdit.Name = "ThumbnailZoomFactorNumericEdit"; + this.ThumbnailZoomFactorNumericEdit.Size = new System.Drawing.Size(34, 20); + this.ThumbnailZoomFactorNumericEdit.TabIndex = 24; + this.ThumbnailZoomFactorNumericEdit.Value = new decimal(new int[] { 1, 0, 0, 0}); - this.ZoomFactorNumericEdit.ValueChanged += new System.EventHandler(this.OptionChanged_Handler); + this.ThumbnailZoomFactorNumericEdit.ValueChanged += new System.EventHandler(this.OptionChanged_Handler); // // ShowThumbnailOverlaysCheckBox // @@ -622,7 +622,7 @@ namespace EveOPreview.UI ZoomOptionsPanel.PerformLayout(); this.ZoomAnchorPanel.ResumeLayout(false); this.ZoomAnchorPanel.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.ZoomFactorNumericEdit)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.ThumbnailZoomFactorNumericEdit)).EndInit(); ThumbnailsListPanel.ResumeLayout(false); ThumbnailsListPanel.PerformLayout(); this.TrayMenu.ResumeLayout(false); @@ -634,14 +634,14 @@ namespace EveOPreview.UI private CheckBox HideActiveClientThumbnailCheckBox; private CheckBox HideThumbnailsOnLostFocusCheckBox; - private CheckBox EnableUniqueThumbnailsLayoutsCheckBox; + private CheckBox EnablePerClientThumbnailsLayoutsCheckBox; private CheckBox SyncThumbnailsSizeCheckBox; private CheckBox ShowThumbnailsAlwaysOnTopCheckBox; private CheckBox ShowThumbnailFramesCheckBox; private LinkLabel ForumLinkLabel; private NumericUpDown ThumbnailsWidthNumericEdit; private NumericUpDown ThumbnailsHeightNumericEdit; - private CheckBox EnableZoomOnHoverCheckBox; + private CheckBox EnableThumbnailZoomCheckBox; private CheckBox ShowThumbnailOverlaysCheckBox; private RadioButton ZoomAanchorNWRadioButton; private RadioButton ZoomAanchorNRadioButton; @@ -652,7 +652,7 @@ namespace EveOPreview.UI private RadioButton ZoomAanchorSWRadioButton; private RadioButton ZoomAanchorSRadioButton; private RadioButton ZoomAanchorSERadioButton; - private NumericUpDown ZoomFactorNumericEdit; + private NumericUpDown ThumbnailZoomFactorNumericEdit; private Panel ZoomAnchorPanel; private CheckedListBox ThumbnailsList; private CheckBox EnableClientsLocationTrackingCheckBox; diff --git a/Eve-O-Preview/UI/Implementation/MainForm.cs b/Eve-O-Preview/UI/Implementation/MainForm.cs index ed231ad..de58336 100644 --- a/Eve-O-Preview/UI/Implementation/MainForm.cs +++ b/Eve-O-Preview/UI/Implementation/MainForm.cs @@ -9,14 +9,14 @@ namespace EveOPreview.UI { private readonly ApplicationContext _context; private readonly Dictionary _zoomAnchorMap; - private ViewZoomAnchor _cachedZoomAnchor; + private ViewZoomAnchor _cachedThumbnailZoomAnchor; private bool _suppressEvents; public MainForm(ApplicationContext context) { this._context = context; this._zoomAnchorMap = new Dictionary(); - this._cachedZoomAnchor = ViewZoomAnchor.NW; + this._cachedThumbnailZoomAnchor = ViewZoomAnchor.NW; this._suppressEvents = false; InitializeComponent(); @@ -98,15 +98,15 @@ namespace EveOPreview.UI } } - public bool EnableUniqueThumbnailsLayouts + public bool EnablePerClientThumbnailsLayouts { get { - return this.EnableUniqueThumbnailsLayoutsCheckBox.Checked; + return this.EnablePerClientThumbnailsLayoutsCheckBox.Checked; } set { - this.EnableUniqueThumbnailsLayoutsCheckBox.Checked = value; + this.EnablePerClientThumbnailsLayoutsCheckBox.Checked = value; } } @@ -146,38 +146,38 @@ namespace EveOPreview.UI } } - public bool EnableZoomOnHover + public bool EnableThumbnailZoom { get { - return this.EnableZoomOnHoverCheckBox.Checked; + return this.EnableThumbnailZoomCheckBox.Checked; } set { - this.EnableZoomOnHoverCheckBox.Checked = value; + this.EnableThumbnailZoomCheckBox.Checked = value; this.UpdateZoomSettingsView(); } } - public int ZoomFactor + public int ThumbnailZoomFactor { get { - return (int)this.ZoomFactorNumericEdit.Value; + return (int)this.ThumbnailZoomFactorNumericEdit.Value; } set { - this.ZoomFactorNumericEdit.Value = value; + this.ThumbnailZoomFactorNumericEdit.Value = value; } } - public ViewZoomAnchor ZoomAnchor + public ViewZoomAnchor ThumbnailZoomAnchor { get { - if (this._zoomAnchorMap[this._cachedZoomAnchor].Checked) + if (this._zoomAnchorMap[this._cachedThumbnailZoomAnchor].Checked) { - return this._cachedZoomAnchor; + return this._cachedThumbnailZoomAnchor; } foreach (KeyValuePair valuePair in this._zoomAnchorMap) @@ -187,8 +187,8 @@ namespace EveOPreview.UI continue; } - this._cachedZoomAnchor = valuePair.Key; - return this._cachedZoomAnchor; + this._cachedThumbnailZoomAnchor = valuePair.Key; + return this._cachedThumbnailZoomAnchor; } // Default value @@ -196,8 +196,8 @@ namespace EveOPreview.UI } set { - this._cachedZoomAnchor = value; - this._zoomAnchorMap[this._cachedZoomAnchor].Checked = true; + this._cachedThumbnailZoomAnchor = value; + this._zoomAnchorMap[this._cachedThumbnailZoomAnchor].Checked = true; } } @@ -298,8 +298,8 @@ namespace EveOPreview.UI public void UpdateZoomSettingsView() { - bool enableControls = this.EnableZoomOnHover; - this.ZoomFactorNumericEdit.Enabled = enableControls; + bool enableControls = this.EnableThumbnailZoom; + this.ThumbnailZoomFactorNumericEdit.Enabled = enableControls; this.ZoomAnchorPanel.Enabled = enableControls; } diff --git a/Eve-O-Preview/UI/Implementation/MainForm.resx b/Eve-O-Preview/UI/Implementation/MainForm.resx index 735b71b..1e3ba63 100644 --- a/Eve-O-Preview/UI/Implementation/MainForm.resx +++ b/Eve-O-Preview/UI/Implementation/MainForm.resx @@ -159,7 +159,7 @@ True - + True @@ -225,10 +225,10 @@ True - + True - + True diff --git a/Eve-O-Preview/UI/Interface/IMainView.cs b/Eve-O-Preview/UI/Interface/IMainView.cs index 108c57d..471aa37 100644 --- a/Eve-O-Preview/UI/Interface/IMainView.cs +++ b/Eve-O-Preview/UI/Interface/IMainView.cs @@ -18,15 +18,15 @@ namespace EveOPreview.UI bool HideActiveClientThumbnail { get; set; } bool ShowThumbnailsAlwaysOnTop { get; set; } bool HideThumbnailsOnLostFocus { get; set; } - bool EnableUniqueThumbnailsLayouts { get; set; } + bool EnablePerClientThumbnailsLayouts { get; set; } bool SyncThumbnailsSize { get; set; } int ThumbnailsWidth { get; set; } int ThumbnailsHeight { get; set; } - bool EnableZoomOnHover { get; set; } - int ZoomFactor { get; set; } - ViewZoomAnchor ZoomAnchor { get; set; } + bool EnableThumbnailZoom { get; set; } + int ThumbnailZoomFactor { get; set; } + ViewZoomAnchor ThumbnailZoomAnchor { get; set; } bool ShowThumbnailOverlays { get; set; } bool ShowThumbnailFrames { get; set; } diff --git a/Eve-O-Preview/packages.config b/Eve-O-Preview/packages.config index 6202f14..abef4b0 100644 --- a/Eve-O-Preview/packages.config +++ b/Eve-O-Preview/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file