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