Resizing thumbnail too big or too small results in an immediate program crash
This commit is contained in:
@@ -4,7 +4,6 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace EveOPreview.Configuration
|
||||
{
|
||||
// TODO Add Save and Load to this class
|
||||
public class ApplicationConfiguration : IApplicationConfiguration
|
||||
{
|
||||
public ApplicationConfiguration()
|
||||
@@ -22,8 +21,9 @@ namespace EveOPreview.Configuration
|
||||
this.EnablePerClientThumbnailLayouts = false;
|
||||
|
||||
this.SyncThumbnailsSize = true;
|
||||
this.ThumbnailsWidth = 250;
|
||||
this.ThumbnailsHeight = 150;
|
||||
this.ThumbnailSize = new Size(250, 150);
|
||||
this.ThumbnailMinimumSize = new Size(100, 80);
|
||||
this.ThumbnailMaximumSize = new Size(640, 400);
|
||||
|
||||
this.EnableThumbnailZoom = false;
|
||||
this.ThumbnailZoomFactor = 2;
|
||||
@@ -49,8 +49,9 @@ namespace EveOPreview.Configuration
|
||||
public bool EnablePerClientThumbnailLayouts { get; set; }
|
||||
|
||||
public bool SyncThumbnailsSize { get; set; }
|
||||
public int ThumbnailsWidth { get; set; }
|
||||
public int ThumbnailsHeight { get; set; }
|
||||
public Size ThumbnailSize { get; set; }
|
||||
public Size ThumbnailMaximumSize { get; set; }
|
||||
public Size ThumbnailMinimumSize { get; set; }
|
||||
|
||||
public bool EnableThumbnailZoom { get; set; }
|
||||
public int ThumbnailZoomFactor { get; set; }
|
||||
|
@@ -16,8 +16,9 @@ namespace EveOPreview.Configuration
|
||||
bool EnablePerClientThumbnailLayouts { get; set; }
|
||||
|
||||
bool SyncThumbnailsSize { get; set; }
|
||||
int ThumbnailsWidth { get; set; }
|
||||
int ThumbnailsHeight { get; set; }
|
||||
Size ThumbnailSize { get; set; }
|
||||
Size ThumbnailMinimumSize { get; set; }
|
||||
Size ThumbnailMaximumSize { get; set; }
|
||||
|
||||
bool EnableThumbnailZoom { get; set; }
|
||||
int ThumbnailZoomFactor { get; set; }
|
||||
|
@@ -90,7 +90,7 @@ namespace EveOPreview.UI
|
||||
|
||||
private void UpdateThumbnailsSize()
|
||||
{
|
||||
this._thumbnailManager.SetThumbnailsSize(new Size(this.View.ThumbnailsWidth, this.View.ThumbnailsHeight));
|
||||
this._thumbnailManager.SetThumbnailsSize(this.View.ThumbnailSize);
|
||||
this.SaveApplicationSettings();
|
||||
}
|
||||
|
||||
@@ -109,8 +109,7 @@ namespace EveOPreview.UI
|
||||
this.View.EnablePerClientThumbnailsLayouts = this._configuration.EnablePerClientThumbnailLayouts;
|
||||
|
||||
this.View.SyncThumbnailsSize = this._configuration.SyncThumbnailsSize;
|
||||
this.View.ThumbnailsWidth = this._configuration.ThumbnailsWidth;
|
||||
this.View.ThumbnailsHeight = this._configuration.ThumbnailsHeight;
|
||||
this.View.ThumbnailSize = this._configuration.ThumbnailSize;
|
||||
|
||||
this.View.EnableThumbnailZoom = this._configuration.EnableThumbnailZoom;
|
||||
this.View.ThumbnailZoomFactor = this._configuration.ThumbnailZoomFactor;
|
||||
@@ -118,6 +117,8 @@ namespace EveOPreview.UI
|
||||
|
||||
this.View.ShowThumbnailOverlays = this._configuration.ShowThumbnailOverlays;
|
||||
this.View.ShowThumbnailFrames = this._configuration.ShowThumbnailFrames;
|
||||
|
||||
this.View.SetThumbnailSizeLimitations(this._configuration.ThumbnailMinimumSize, this._configuration.ThumbnailMaximumSize);
|
||||
}
|
||||
|
||||
private void SaveApplicationSettings()
|
||||
@@ -133,8 +134,7 @@ namespace EveOPreview.UI
|
||||
this._configuration.EnablePerClientThumbnailLayouts = this.View.EnablePerClientThumbnailsLayouts;
|
||||
|
||||
this._configuration.SyncThumbnailsSize = this.View.SyncThumbnailsSize;
|
||||
this._configuration.ThumbnailsWidth = this.View.ThumbnailsWidth;
|
||||
this._configuration.ThumbnailsHeight = this.View.ThumbnailsHeight;
|
||||
this._configuration.ThumbnailSize = this.View.ThumbnailSize;
|
||||
|
||||
this._configuration.EnableThumbnailZoom = this.View.EnableThumbnailZoom;
|
||||
this._configuration.ThumbnailZoomFactor = this.View.ThumbnailZoomFactor;
|
||||
@@ -145,7 +145,7 @@ namespace EveOPreview.UI
|
||||
|
||||
this._configurationStorage.Save();
|
||||
|
||||
this.View.UpdateZoomSettingsView();
|
||||
this.View.RefreshZoomSettings();
|
||||
|
||||
this._thumbnailManager.SetupThumbnailFrames();
|
||||
this._thumbnailManager.RefreshThumbnails();
|
||||
@@ -210,7 +210,7 @@ namespace EveOPreview.UI
|
||||
|
||||
private void ThumbnailSizeChanged(Size size)
|
||||
{
|
||||
this.View.UpdateThumbnailsSizeView(size);
|
||||
this.View.ThumbnailSize = size;
|
||||
}
|
||||
|
||||
private void UpdateThumbnailState(IntPtr thumbnailId)
|
||||
|
@@ -194,13 +194,10 @@ namespace EveOPreview.UI
|
||||
|
||||
if ((view == null) && (processTitle != ""))
|
||||
{
|
||||
Size thumbnailSize = new Size();
|
||||
thumbnailSize.Width = this._configuration.ThumbnailsWidth;
|
||||
thumbnailSize.Height = this._configuration.ThumbnailsHeight;
|
||||
|
||||
view = this._thumbnailViewFactory.Create(processHandle, ThumbnailManager.DefaultThumbnailTitle, thumbnailSize);
|
||||
view = this._thumbnailViewFactory.Create(processHandle, ThumbnailManager.DefaultThumbnailTitle, this._configuration.ThumbnailSize);
|
||||
view.IsEnabled = true;
|
||||
view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays;
|
||||
view.SetSizeLimitations(this._configuration.ThumbnailMinimumSize, this._configuration.ThumbnailMaximumSize);
|
||||
view.SetTopMost(this._configuration.ShowThumbnailsAlwaysOnTop);
|
||||
view.SetWindowFrames(this._configuration.ShowThumbnailFrames);
|
||||
|
||||
@@ -242,7 +239,7 @@ namespace EveOPreview.UI
|
||||
// Cleanup
|
||||
IList<IntPtr> obsoleteThumbnails = new List<IntPtr>();
|
||||
|
||||
foreach (IntPtr processHandle in _thumbnailViews.Keys)
|
||||
foreach (IntPtr processHandle in this._thumbnailViews.Keys)
|
||||
{
|
||||
if (!processHandles.Contains(processHandle))
|
||||
{
|
||||
@@ -254,7 +251,7 @@ namespace EveOPreview.UI
|
||||
{
|
||||
IThumbnailView view = this._thumbnailViews[processHandle];
|
||||
|
||||
_thumbnailViews.Remove(processHandle);
|
||||
this._thumbnailViews.Remove(processHandle);
|
||||
|
||||
// TODO Remove hotkey here
|
||||
view.ThumbnailResized -= ThumbnailViewResized;
|
||||
|
@@ -122,27 +122,16 @@ namespace EveOPreview.UI
|
||||
}
|
||||
}
|
||||
|
||||
public int ThumbnailsWidth
|
||||
public Size ThumbnailSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)this.ThumbnailsWidthNumericEdit.Value;
|
||||
return new Size((int)this.ThumbnailsWidthNumericEdit.Value, (int)this.ThumbnailsHeightNumericEdit.Value);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.ThumbnailsWidthNumericEdit.Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int ThumbnailsHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)this.ThumbnailsHeightNumericEdit.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.ThumbnailsHeightNumericEdit.Value = value;
|
||||
this.ThumbnailsWidthNumericEdit.Value = value.Width;
|
||||
this.ThumbnailsHeightNumericEdit.Value = value.Height;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +144,7 @@ namespace EveOPreview.UI
|
||||
set
|
||||
{
|
||||
this.EnableThumbnailZoomCheckBox.Checked = value;
|
||||
this.UpdateZoomSettingsView();
|
||||
this.RefreshZoomSettings();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,6 +226,15 @@ namespace EveOPreview.UI
|
||||
Application.Run(this._context);
|
||||
}
|
||||
|
||||
public void SetThumbnailSizeLimitations(Size minimumSize, Size maximumSize)
|
||||
{
|
||||
this.ThumbnailsWidthNumericEdit.Minimum = minimumSize.Width;
|
||||
this.ThumbnailsWidthNumericEdit.Maximum = maximumSize.Width;
|
||||
|
||||
this.ThumbnailsHeightNumericEdit.Minimum = minimumSize.Height;
|
||||
this.ThumbnailsHeightNumericEdit.Maximum = maximumSize.Height;
|
||||
}
|
||||
|
||||
public void Minimize()
|
||||
{
|
||||
this.WindowState = FormWindowState.Minimized;
|
||||
@@ -290,13 +288,7 @@ namespace EveOPreview.UI
|
||||
this.ThumbnailsList.EndUpdate();
|
||||
}
|
||||
|
||||
public void UpdateThumbnailsSizeView(Size size)
|
||||
{
|
||||
this.ThumbnailsWidth = size.Width;
|
||||
this.ThumbnailsHeight = size.Height;
|
||||
}
|
||||
|
||||
public void UpdateZoomSettingsView()
|
||||
public void RefreshZoomSettings()
|
||||
{
|
||||
bool enableControls = this.EnableThumbnailZoom;
|
||||
this.ThumbnailZoomFactorNumericEdit.Enabled = enableControls;
|
||||
|
@@ -115,6 +115,12 @@ namespace EveOPreview.UI
|
||||
return (this.Id == handle) || (this.Handle == handle) || (this._overlay.Handle == handle);
|
||||
}
|
||||
|
||||
public void SetSizeLimitations(Size minimumSize, Size maximumSize)
|
||||
{
|
||||
this.MinimumSize = minimumSize;
|
||||
this.MaximumSize = maximumSize;
|
||||
}
|
||||
|
||||
public void SetOpacity(double opacity)
|
||||
{
|
||||
this.Opacity = opacity;
|
||||
|
@@ -21,8 +21,7 @@ namespace EveOPreview.UI
|
||||
bool EnablePerClientThumbnailsLayouts { get; set; }
|
||||
|
||||
bool SyncThumbnailsSize { get; set; }
|
||||
int ThumbnailsWidth { get; set; }
|
||||
int ThumbnailsHeight { get; set; }
|
||||
Size ThumbnailSize { get; set; }
|
||||
|
||||
bool EnableThumbnailZoom { get; set; }
|
||||
int ThumbnailZoomFactor { get; set; }
|
||||
@@ -32,14 +31,14 @@ namespace EveOPreview.UI
|
||||
bool ShowThumbnailFrames { get; set; }
|
||||
|
||||
void SetForumUrl(string url);
|
||||
void SetThumbnailSizeLimitations(Size minimumSize, Size maximumSize);
|
||||
|
||||
void Minimize();
|
||||
|
||||
void AddThumbnails(IList<IThumbnailDescriptionView> thumbnails);
|
||||
void UpdateThumbnails(IList<IThumbnailDescriptionView> thumbnails);
|
||||
void RemoveThumbnails(IList<IThumbnailDescriptionView> thumbnails);
|
||||
void UpdateThumbnailsSizeView(Size size);
|
||||
void UpdateZoomSettingsView();
|
||||
void RefreshZoomSettings();
|
||||
|
||||
event Action ApplicationExitRequested;
|
||||
event Action FormActivated;
|
||||
|
@@ -16,6 +16,7 @@ namespace EveOPreview.UI
|
||||
|
||||
bool IsKnownHandle(IntPtr handle);
|
||||
|
||||
void SetSizeLimitations(Size minimumSize, Size maximumSize);
|
||||
void SetOpacity(double opacity);
|
||||
void SetWindowFrames(bool enable);
|
||||
void SetTopMost(bool enableTopmost);
|
||||
|
Reference in New Issue
Block a user