PerClientZoomAnchor option

This commit is contained in:
Izakbar
2024-11-27 00:23:13 +00:00
parent 1a98888bbd
commit b7f9c71f5b
7 changed files with 47 additions and 8 deletions

View File

@@ -47,6 +47,12 @@ namespace EveOPreview.Configuration.Implementation
{"EVE - Example Toon 2", new Size(200, 200)}
};
this.PerClientZoomAnchor = new Dictionary<string, ZoomAnchor>
{
{"EVE - Example Toon 1", ZoomAnchor.N },
{"EVE - Example Toon 2", ZoomAnchor.S}
};
this.PerClientLayout = new Dictionary<string, Dictionary<string, Point>>();
this.FlatLayout = new Dictionary<string, Point>();
this.ClientLayout = new Dictionary<string, ClientLayout>();
@@ -129,6 +135,8 @@ namespace EveOPreview.Configuration.Implementation
[JsonProperty("PerClientThumbnailSize")]
public Dictionary<string, Size> PerClientThumbnailSize { get; set; }
[JsonProperty("PerClientZoomAnchor")]
public Dictionary<string, ZoomAnchor> PerClientZoomAnchor{ get; set; }
public bool MinimizeToTray { get; set; }
public int ThumbnailRefreshPeriod { get; set; }
public int ThumbnailResizeTimeoutPeriod { get; set; }
@@ -246,6 +254,11 @@ namespace EveOPreview.Configuration.Implementation
Size sizeOfThumbnail;
return this.PerClientThumbnailSize.TryGetValue(currentClient, out sizeOfThumbnail) ? sizeOfThumbnail : defaultSize;
}
public ZoomAnchor GetZoomAnchor(string currentClient, ZoomAnchor defaultZoomAnchor)
{
ZoomAnchor zoomAnchor;
return this.PerClientZoomAnchor.TryGetValue(currentClient, out zoomAnchor) ? zoomAnchor : defaultZoomAnchor;
}
public void SetThumbnailLocation(string currentClient, string activeClient, Point location)
{

View File

@@ -62,6 +62,7 @@ namespace EveOPreview.Configuration
Point GetThumbnailLocation(string currentClient, string activeClient, Point defaultLocation);
Size GetThumbnailSize(string currentClient, string activeClient, Size defaultSize);
ZoomAnchor GetZoomAnchor(string currentClient, ZoomAnchor defaultZoomAnchor);
void SetThumbnailLocation(string currentClient, string activeClient, Point location);
ClientLayout GetClientLayout(string currentClient);

View File

@@ -12,7 +12,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")]
[assembly: AssemblyVersion("8.0.1.3")]
[assembly: AssemblyFileVersion("8.0.1.3")]
[assembly: AssemblyVersion("8.0.1.4")]
[assembly: AssemblyFileVersion("8.0.1.4")]
[assembly: CLSCompliant(false)]

View File

@@ -236,7 +236,7 @@ namespace EveOPreview.Services
view.RegisterHotkey(this._configuration.GetClientHotkey(view.Title));
this.ApplyClientLayout(view.Id, view.Title);
this.ApplyClientLayout(view);
// TODO Add extension filter here later
if (view.Title != ThumbnailManager.DEFAULT_CLIENT_TITLE)
@@ -263,7 +263,7 @@ namespace EveOPreview.Services
view.RegisterHotkey(this._configuration.GetClientHotkey(process.Title));
this.ApplyClientLayout(view.Id, view.Title);
this.ApplyClientLayout(view);
}
}
@@ -629,7 +629,7 @@ namespace EveOPreview.Services
{
this.DisableViewEvents();
view.ZoomIn(ViewZoomAnchorConverter.Convert(this._configuration.ThumbnailZoomAnchor), this._configuration.ThumbnailZoomFactor);
view.ZoomIn(ViewZoomAnchorConverter.Convert(view.ClientZoomAnchor), this._configuration.ThumbnailZoomFactor);
view.Refresh(false);
this.EnableViewEvents();
@@ -725,8 +725,11 @@ namespace EveOPreview.Services
return (0, 0);
}
private void ApplyClientLayout(IntPtr clientHandle, string clientTitle)
private void ApplyClientLayout(IThumbnailView view)
{
IntPtr clientHandle = view.Id;
string clientTitle = view.Title;
if (!this._configuration.EnableClientLayoutTracking)
{
return;
@@ -753,6 +756,8 @@ namespace EveOPreview.Services
{
this._windowManager.MoveWindow(clientHandle, clientLayout.X, clientLayout.Y, clientLayout.Width, clientLayout.Height);
}
view.ClientZoomAnchor = this._configuration.GetZoomAnchor(clientTitle, this._configuration.ThumbnailZoomAnchor);
}
private void UpdateClientLayouts()

View File

@@ -96,7 +96,8 @@ namespace EveOPreview.View
public bool IsActive { get; set; }
public bool IsOverlayEnabled { get; set; }
public ZoomAnchor ClientZoomAnchor { get; set; }
public Point ThumbnailLocation
{
get => this.Location;

View File

@@ -1,6 +1,7 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using EveOPreview.Configuration;
using EveOPreview.Services;
namespace EveOPreview.View
@@ -14,7 +15,7 @@ namespace EveOPreview.View
Point ThumbnailLocation { get; set; }
Size ThumbnailSize { get; set; }
bool IsOverlayEnabled { get; set; }
ZoomAnchor ClientZoomAnchor { get; set; }
bool IsKnownHandle(IntPtr handle);
void SetSizeLimitations(Size minimumSize, Size maximumSize);