Update configuration system to use JSON

This commit is contained in:
Anton Kasyanov
2016-06-02 22:48:51 +03:00
parent 08e39ab4ea
commit a30834db6c
19 changed files with 348 additions and 472 deletions

View File

@@ -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; }
}
}

View File

@@ -1,7 +0,0 @@
namespace EveOPreview.Configuration
{
public class Configuration
{
}
}

View File

@@ -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);
}
}
}

View File

@@ -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; }
}
}

View File

@@ -0,0 +1,8 @@
namespace EveOPreview.Configuration
{
public interface IConfigurationStorage
{
void Load();
void Save();
}
}

View File

@@ -0,0 +1,15 @@
namespace EveOPreview.Configuration
{
public enum ZoomAnchor
{
NW,
N,
NE,
W,
C,
E,
SW,
S,
SE
}
}

View File

@@ -94,6 +94,10 @@
<HintPath>..\packages\LightInject.4.0.9\lib\net45\LightInject.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
@@ -111,6 +115,7 @@
<Compile Include="ApplicationBase\LightInjectContainer.cs" />
<Compile Include="ApplicationBase\Presenter.cs" />
<Compile Include="ApplicationBase\PresenterGeneric.cs" />
<Compile Include="Configuration\ConfigurationStorage.cs" />
<Compile Include="Configuration\IApplicationConfiguration.cs" />
<Compile Include="Configuration\ZoomAnchor.cs" />
<Compile Include="DwmAPI\DWM_BLURBEHIND.cs" />
@@ -122,6 +127,7 @@
<Compile Include="ApplicationBase\IPresenter.cs" />
<Compile Include="Presentation\MainPresenter.cs" />
<Compile Include="Presentation\ViewCloseRequest.cs" />
<Compile Include="Presentation\ViewZoomAnchorConverter.cs" />
<Compile Include="UI\Interface\IThumbnailViewFactory.cs" />
<Compile Include="Presentation\IThumbnailManager.cs" />
<Compile Include="UI\Implementation\ThumbnailDescriptionView.cs" />
@@ -140,7 +146,7 @@
<Compile Include="UI\Implementation\MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Configuration\ConfigurationStorage.cs" />
<Compile Include="Configuration\IConfigurationStorage.cs" />
<Compile Include="UI\Interface\IThumbnailView.cs" />
<Compile Include="UI\Factory\ThumbnailViewFactory.cs" />
<Compile Include="Presentation\ThumbnailManager.cs" />
@@ -177,15 +183,6 @@
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="UI\Implementation\ThumbnailView.cs">
<SubType>Form</SubType>
</Compile>

View File

@@ -1,4 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=configuration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=configuration_005Cimplementation/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=configuration_005Cinterface/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=gui/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=gui_005Cpresenter_005Cinterface/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=gui_005Cview/@EntryIndexedValue">True</s:Boolean>

View File

@@ -2,26 +2,37 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using EveOPreview.Configuration;
namespace EveOPreview.UI
{
public class MainPresenter : Presenter<IMainView>
{
#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<IntPtr, IThumbnailDescriptionView> _thumbnailViews;
private readonly IDictionary<IntPtr, IThumbnailDescriptionView> _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<IntPtr, IThumbnailDescriptionView>();
this._thumbnailDescriptionViewFactory = thumbnailDescriptionViewFactory;
this._thumbnailManager = thumbnailManager;
this._thumbnailDescriptionViews = new Dictionary<IntPtr, IThumbnailDescriptionView>();
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<IThumbnailView> thumbnails)
@@ -153,12 +169,12 @@ namespace EveOPreview.UI
IList<IThumbnailDescriptionView> thumbnailViews = new List<IThumbnailDescriptionView>(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()

View File

@@ -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<IntPtr, IThumbnailView> _thumbnailViews;
@@ -34,10 +38,11 @@ namespace EveOPreview.UI
// TODO To be removed
private readonly Dictionary<string, string> _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<IntPtr, IThumbnailView> 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<IntPtr, IThumbnailView> 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<string, Point> layout;
if (_uniqueLayouts.TryGetValue(_activeClientTitle, out layout))
{
layout[title] = position;
}
else if (_activeClientTitle == "")
{
_uniqueLayouts[_activeClientTitle] = new Dictionary<string, Point>();
_uniqueLayouts[_activeClientTitle][title] = position;
}
}
else
if (!this._configuration.EnablePerClientThumbnailsLayouts)
{
_flatLayout[title] = position;
return;
}
Dictionary<string, Point> layout;
if (_uniqueLayouts.TryGetValue(_activeClientTitle, out layout))
{
layout[title] = position;
}
else if (_activeClientTitle == "")
{
_uniqueLayouts[_activeClientTitle] = new Dictionary<string, Point>();
_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;
}

View File

@@ -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);
}
}
}

View File

@@ -28,7 +28,8 @@ namespace EveOPreview
controller.RegisterService<IThumbnailManager, ThumbnailManager>()
.RegisterService<IThumbnailViewFactory, ThumbnailViewFactory>()
.RegisterService<IThumbnailDescriptionViewFactory, ThumbnailDescriptionViewFactory>()
.RegisterService<IApplicationConfiguration, ApplicationConfiguration>();
.RegisterService<IConfigurationStorage, ConfigurationStorage>()
.RegisterInstance<IApplicationConfiguration>(new ApplicationConfiguration());
controller.Run<EveOPreview.UI.MainPresenter>();
}

View File

@@ -1,230 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
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;
}
}
}
}

View File

@@ -1,57 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="PreviewToy.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="hide_active" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="hide_all" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="always_on_top" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="unique_layout" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="sync_resize" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="show_thumb_frames" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="show_client_frames" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="sync_resize_x" Type="System.UInt32" Scope="User">
<Value Profile="(Default)">128</Value>
</Setting>
<Setting Name="sync_resize_y" Type="System.UInt32" Scope="User">
<Value Profile="(Default)">128</Value>
</Setting>
<Setting Name="show_overlay" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="zoom_on_hover" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="zoom_amount" Type="System.Single" Scope="User">
<Value Profile="(Default)">3</Value>
</Setting>
<Setting Name="previews_dock" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="zoom_anchor" Type="System.Byte" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="track_client_windows" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="opacity" Type="System.Single" Scope="User">
<Value Profile="(Default)">0.9</Value>
</Setting>
<Setting Name="minimizeToTray" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@@ -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;

View File

@@ -9,14 +9,14 @@ namespace EveOPreview.UI
{
private readonly ApplicationContext _context;
private readonly Dictionary<ViewZoomAnchor, RadioButton> _zoomAnchorMap;
private ViewZoomAnchor _cachedZoomAnchor;
private ViewZoomAnchor _cachedThumbnailZoomAnchor;
private bool _suppressEvents;
public MainForm(ApplicationContext context)
{
this._context = context;
this._zoomAnchorMap = new Dictionary<ViewZoomAnchor, RadioButton>();
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<ViewZoomAnchor, RadioButton> 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;
}

View File

@@ -159,7 +159,7 @@
<metadata name="HideThumbnailsOnLostFocusCheckBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="EnableUniqueThumbnailsLayoutsCheckBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="EnablePerClientThumbnailsLayoutsCheckBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ResizeOptionsPanel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@@ -225,10 +225,10 @@
<metadata name="ZoomAnchorLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="EnableZoomOnHoverCheckBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="EnableThumbnailZoomCheckBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ZoomFactorNumericEdit.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="ThumbnailZoomFactorNumericEdit.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ShowThumbnailOverlaysCheckBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

View File

@@ -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; }

View File

@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LightInject" version="4.0.9" targetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
</packages>