Allow to setup the highlight border thickness

This commit is contained in:
Anton Kasyanov
2016-10-20 21:47:20 +03:00
parent c56e173738
commit b4a0e7d31d
4 changed files with 11 additions and 5 deletions

View File

@@ -32,6 +32,7 @@ namespace EveOPreview.Configuration
bool EnableActiveClientHighlight { get; set; } bool EnableActiveClientHighlight { get; set; }
Color ActiveClientHighlightColor { get; set; } Color ActiveClientHighlightColor { get; set; }
int ActiveClientHighlightThickness { get; set; }
Point GetThumbnailLocation(string currentClient, string activeClient, Point defaultLocation); Point GetThumbnailLocation(string currentClient, string activeClient, Point defaultLocation);
void SetThumbnailLocation(string currentClient, string activeClient, Point location); void SetThumbnailLocation(string currentClient, string activeClient, Point location);

View File

@@ -32,7 +32,8 @@ namespace EveOPreview.Configuration
this.ShowThumbnailFrames = true; this.ShowThumbnailFrames = true;
this.EnableActiveClientHighlight = false; this.EnableActiveClientHighlight = false;
this.ActiveClientHighlightColor = Color.Yellow; this.ActiveClientHighlightColor = Color.GreenYellow;
this.ActiveClientHighlightThickness = 3;
this.PerClientLayout = new Dictionary<string, Dictionary<string, Point>>(); this.PerClientLayout = new Dictionary<string, Dictionary<string, Point>>();
this.FlatLayout = new Dictionary<string, Point>(); this.FlatLayout = new Dictionary<string, Point>();
@@ -82,6 +83,8 @@ namespace EveOPreview.Configuration
} }
private Color _activeClientHighlightColor; private Color _activeClientHighlightColor;
public int ActiveClientHighlightThickness { get; set; }
[JsonProperty] [JsonProperty]
private Dictionary<string, Dictionary<string, Point>> PerClientLayout { get; set; } private Dictionary<string, Dictionary<string, Point>> PerClientLayout { get; set; }
[JsonProperty] [JsonProperty]
@@ -181,6 +184,7 @@ namespace EveOPreview.Configuration
ThumbnailConfig.ApplyRestrictions(this.ThumbnailSize.Height, this.ThumbnailMinimumSize.Height, this.ThumbnailMaximumSize.Height)); ThumbnailConfig.ApplyRestrictions(this.ThumbnailSize.Height, this.ThumbnailMinimumSize.Height, this.ThumbnailMaximumSize.Height));
this.ThumbnailOpacity = ThumbnailConfig.ApplyRestrictions((int)(this.ThumbnailOpacity * 100.00), 20, 100) / 100.00; this.ThumbnailOpacity = ThumbnailConfig.ApplyRestrictions((int)(this.ThumbnailOpacity * 100.00), 20, 100) / 100.00;
this.ThumbnailZoomFactor = ThumbnailConfig.ApplyRestrictions(this.ThumbnailZoomFactor, 2, 10); this.ThumbnailZoomFactor = ThumbnailConfig.ApplyRestrictions(this.ThumbnailZoomFactor, 2, 10);
this.ActiveClientHighlightThickness = ThumbnailConfig.ApplyRestrictions(this.ActiveClientHighlightThickness, 1, 3);
} }
private static int ApplyRestrictions(int value, int minimum, int maximum) private static int ApplyRestrictions(int value, int minimum, int maximum)

View File

@@ -137,7 +137,8 @@ namespace EveOPreview.UI
view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays; view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays;
view.SetHighlight(this._configuration.EnableActiveClientHighlight && (view.Id == this._activeClientHandle), this._configuration.ActiveClientHighlightColor, 3); view.SetHighlight(this._configuration.EnableActiveClientHighlight && (view.Id == this._activeClientHandle),
this._configuration.ActiveClientHighlightColor, this._configuration.ActiveClientHighlightThickness);
if (!view.IsActive) if (!view.IsActive)
{ {

View File

@@ -329,9 +329,9 @@ namespace EveOPreview.UI
int actualHeight = baseHeight - 2 * this._highlightWidth; int actualHeight = baseHeight - 2 * this._highlightWidth;
double desiredWidth = actualHeight * baseAspectRatio; double desiredWidth = actualHeight * baseAspectRatio;
int actualWidth = (int)Math.Round(desiredWidth); int actualWidth = (int)Math.Round(desiredWidth, MidpointRounding.AwayFromZero);
int highlightWidthLeft = Math.Min(5, (baseWidth - actualWidth) / 2); int highlightWidthLeft = Math.Min(4, (baseWidth - actualWidth) / 2);
int highlightWidthRight = Math.Min(5, baseWidth - actualWidth - highlightWidthLeft); int highlightWidthRight = Math.Min(4, baseWidth - actualWidth - highlightWidthLeft);
this._overlay.SetHighlightWidth(highlightWidthLeft, this._highlightWidth, highlightWidthRight, this._highlightWidth); this._overlay.SetHighlightWidth(highlightWidthLeft, this._highlightWidth, highlightWidthRight, this._highlightWidth);
this._thumbnail.rcDestination = new RECT(0 + highlightWidthLeft, 0 + this._highlightWidth, actualWidth + highlightWidthLeft, actualHeight + this._highlightWidth); this._thumbnail.rcDestination = new RECT(0 + highlightWidthLeft, 0 + this._highlightWidth, actualWidth + highlightWidthLeft, actualHeight + this._highlightWidth);