diff --git a/Eve-O-Preview/Configuration/ApplicationConfiguration.cs b/Eve-O-Preview/Configuration/ApplicationConfiguration.cs index 8f156bb..7060fc2 100644 --- a/Eve-O-Preview/Configuration/ApplicationConfiguration.cs +++ b/Eve-O-Preview/Configuration/ApplicationConfiguration.cs @@ -21,7 +21,6 @@ namespace EveOPreview.Configuration this.HideThumbnailsOnLostFocus = false; this.EnablePerClientThumbnailLayouts = false; - this.SyncThumbnailsSize = true; this.ThumbnailSize = new Size(250, 150); this.ThumbnailMinimumSize = new Size(100, 80); this.ThumbnailMaximumSize = new Size(640, 400); @@ -50,7 +49,6 @@ namespace EveOPreview.Configuration public bool HideThumbnailsOnLostFocus { get; set; } public bool EnablePerClientThumbnailLayouts { get; set; } - public bool SyncThumbnailsSize { get; set; } public Size ThumbnailSize { get; set; } public Size ThumbnailMaximumSize { get; set; } public Size ThumbnailMinimumSize { get; set; } diff --git a/Eve-O-Preview/Configuration/IApplicationConfiguration.cs b/Eve-O-Preview/Configuration/IApplicationConfiguration.cs index 9460a82..47c75cc 100644 --- a/Eve-O-Preview/Configuration/IApplicationConfiguration.cs +++ b/Eve-O-Preview/Configuration/IApplicationConfiguration.cs @@ -16,7 +16,6 @@ namespace EveOPreview.Configuration bool HideThumbnailsOnLostFocus { get; set; } bool EnablePerClientThumbnailLayouts { get; set; } - bool SyncThumbnailsSize { get; set; } Size ThumbnailSize { get; set; } Size ThumbnailMinimumSize { get; set; } Size ThumbnailMaximumSize { get; set; } diff --git a/Eve-O-Preview/Presentation/MainPresenter.cs b/Eve-O-Preview/Presentation/MainPresenter.cs index cfac9ef..d9e4a9e 100644 --- a/Eve-O-Preview/Presentation/MainPresenter.cs +++ b/Eve-O-Preview/Presentation/MainPresenter.cs @@ -9,7 +9,7 @@ namespace EveOPreview.UI public class MainPresenter : Presenter { #region Private constants - private const string ForumUrl = @"https://forums.eveonline.com/default.aspx?g=posts&t=389086"; + private const string ForumUrl = @"https://forums.eveonline.com/default.aspx?g=posts&t=484927"; #endregion #region Private fields @@ -106,7 +106,7 @@ namespace EveOPreview.UI this.View.HideThumbnailsOnLostFocus = this._configuration.HideThumbnailsOnLostFocus; this.View.EnablePerClientThumbnailsLayouts = this._configuration.EnablePerClientThumbnailLayouts; - this.View.SyncThumbnailsSize = this._configuration.SyncThumbnailsSize; + this.View.SetThumbnailSizeLimitations(this._configuration.ThumbnailMinimumSize, this._configuration.ThumbnailMaximumSize); this.View.ThumbnailSize = this._configuration.ThumbnailSize; this.View.EnableThumbnailZoom = this._configuration.EnableThumbnailZoom; @@ -115,8 +115,6 @@ 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() @@ -131,7 +129,6 @@ namespace EveOPreview.UI this._configuration.HideThumbnailsOnLostFocus = this.View.HideThumbnailsOnLostFocus; this._configuration.EnablePerClientThumbnailLayouts = this.View.EnablePerClientThumbnailsLayouts; - this._configuration.SyncThumbnailsSize = this.View.SyncThumbnailsSize; this._configuration.ThumbnailSize = this.View.ThumbnailSize; this._configuration.EnableThumbnailZoom = this.View.EnableThumbnailZoom; diff --git a/Eve-O-Preview/Presentation/ThumbnailManager.cs b/Eve-O-Preview/Presentation/ThumbnailManager.cs index 667d931..414bb03 100644 --- a/Eve-O-Preview/Presentation/ThumbnailManager.cs +++ b/Eve-O-Preview/Presentation/ThumbnailManager.cs @@ -84,7 +84,7 @@ namespace EveOPreview.UI foreach (KeyValuePair entry in this._thumbnailViews) { - entry.Value.Size = size; + entry.Value.ThumbnailSize = size; entry.Value.Refresh(false); } @@ -126,7 +126,7 @@ namespace EveOPreview.UI if (!this._isHoverEffectActive) { // No need to move Thumbnails while one of them is highlighted - view.Location = this._configuration.GetThumbnailLocation(view.Title, this._activeClientTitle, view.Location); + view.ThumbnailLocation = this._configuration.GetThumbnailLocation(view.Title, this._activeClientTitle, view.ThumbnailLocation); view.SetOpacity(this._configuration.ThumbnailsOpacity); view.SetTopMost(this._configuration.ShowThumbnailsAlwaysOnTop); } @@ -152,7 +152,7 @@ namespace EveOPreview.UI foreach (KeyValuePair entry in this._thumbnailViews) { - entry.Value.SetWindowFrames(this._configuration.ShowThumbnailFrames); + entry.Value.SetFrames(this._configuration.ShowThumbnailFrames); } this.EnableViewEvents(); @@ -206,8 +206,8 @@ namespace EveOPreview.UI view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays; view.SetSizeLimitations(this._configuration.ThumbnailMinimumSize, this._configuration.ThumbnailMaximumSize); view.SetTopMost(this._configuration.ShowThumbnailsAlwaysOnTop); - view.SetWindowFrames(this._configuration.ShowThumbnailFrames); - view.Location = this._configuration.GetThumbnailLocation(processTitle, this._activeClientTitle, view.Location); + view.SetFrames(this._configuration.ShowThumbnailFrames); + view.ThumbnailLocation = this._configuration.GetThumbnailLocation(processTitle, this._activeClientTitle, view.ThumbnailLocation); view.ThumbnailResized = this.ThumbnailViewResized; view.ThumbnailMoved = this.ThumbnailViewMoved; @@ -349,7 +349,7 @@ namespace EveOPreview.UI IThumbnailView view = this._thumbnailViews[id]; - this.SetThumbnailsSize(view.Size); + this.SetThumbnailsSize(view.ThumbnailSize); view.Refresh(false); } @@ -363,7 +363,7 @@ namespace EveOPreview.UI IThumbnailView view = this._thumbnailViews[id]; - this._configuration.SetThumbnailLocation(view.Title, this._activeClientTitle, view.Location); + this._configuration.SetThumbnailLocation(view.Title, this._activeClientTitle, view.ThumbnailLocation); view.Refresh(false); } diff --git a/Eve-O-Preview/UI/Factory/ThumbnailViewFactory.cs b/Eve-O-Preview/UI/Factory/ThumbnailViewFactory.cs index 0163555..986e3d2 100644 --- a/Eve-O-Preview/UI/Factory/ThumbnailViewFactory.cs +++ b/Eve-O-Preview/UI/Factory/ThumbnailViewFactory.cs @@ -18,7 +18,7 @@ namespace EveOPreview.UI view.Id = id; view.Title = title; - view.Size = size; + view.ThumbnailSize = size; return view; } diff --git a/Eve-O-Preview/UI/Implementation/MainForm.Designer.cs b/Eve-O-Preview/UI/Implementation/MainForm.Designer.cs index af24627..179deda 100644 --- a/Eve-O-Preview/UI/Implementation/MainForm.Designer.cs +++ b/Eve-O-Preview/UI/Implementation/MainForm.Designer.cs @@ -37,6 +37,8 @@ namespace EveOPreview.UI System.Windows.Forms.FlowLayoutPanel ContentFlowLayoutPanel; System.Windows.Forms.Panel OpacityPanel; System.Windows.Forms.Panel ResizeOptionsPanel; + System.Windows.Forms.Label HeigthLabel; + System.Windows.Forms.Label WidthLabel; System.Windows.Forms.Panel ZoomOptionsPanel; System.Windows.Forms.Label ZoomFactorLabel; System.Windows.Forms.Label ZoomAnchorLabel; @@ -52,7 +54,6 @@ namespace EveOPreview.UI this.ShowThumbnailsAlwaysOnTopCheckBox = new System.Windows.Forms.CheckBox(); this.HideThumbnailsOnLostFocusCheckBox = 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(); this.ZoomAnchorPanel = new System.Windows.Forms.Panel(); @@ -79,6 +80,8 @@ namespace EveOPreview.UI ContentFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); OpacityPanel = new System.Windows.Forms.Panel(); ResizeOptionsPanel = new System.Windows.Forms.Panel(); + HeigthLabel = new System.Windows.Forms.Label(); + WidthLabel = new System.Windows.Forms.Label(); ZoomOptionsPanel = new System.Windows.Forms.Panel(); ZoomFactorLabel = new System.Windows.Forms.Label(); ZoomAnchorLabel = new System.Windows.Forms.Label(); @@ -140,7 +143,7 @@ namespace EveOPreview.UI ContentFlowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; ContentFlowLayoutPanel.Location = new System.Drawing.Point(0, 0); ContentFlowLayoutPanel.Name = "ContentFlowLayoutPanel"; - ContentFlowLayoutPanel.Size = new System.Drawing.Size(252, 487); + ContentFlowLayoutPanel.Size = new System.Drawing.Size(252, 481); ContentFlowLayoutPanel.TabIndex = 25; // // MinimizeToTrayCheckBox @@ -240,88 +243,83 @@ namespace EveOPreview.UI // ResizeOptionsPanel // ResizeOptionsPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - ResizeOptionsPanel.Controls.Add(this.SyncThumbnailsSizeCheckBox); + ResizeOptionsPanel.Controls.Add(HeigthLabel); + ResizeOptionsPanel.Controls.Add(WidthLabel); ResizeOptionsPanel.Controls.Add(this.ThumbnailsWidthNumericEdit); ResizeOptionsPanel.Controls.Add(this.ThumbnailsHeightNumericEdit); ResizeOptionsPanel.Location = new System.Drawing.Point(3, 173); ResizeOptionsPanel.Name = "ResizeOptionsPanel"; - ResizeOptionsPanel.Size = new System.Drawing.Size(246, 30); + ResizeOptionsPanel.Size = new System.Drawing.Size(246, 28); ResizeOptionsPanel.TabIndex = 26; // - // SyncThumbnailsSizeCheckBox + // HeigthLabel // - this.SyncThumbnailsSizeCheckBox.AutoSize = true; - this.SyncThumbnailsSizeCheckBox.Checked = true; - this.SyncThumbnailsSizeCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; - this.SyncThumbnailsSizeCheckBox.Location = new System.Drawing.Point(1, 3); - this.SyncThumbnailsSizeCheckBox.Name = "SyncThumbnailsSizeCheckBox"; - this.SyncThumbnailsSizeCheckBox.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.SyncThumbnailsSizeCheckBox.Size = new System.Drawing.Size(108, 17); - this.SyncThumbnailsSizeCheckBox.TabIndex = 4; - this.SyncThumbnailsSizeCheckBox.Text = "Syncronize resize"; - this.SyncThumbnailsSizeCheckBox.UseVisualStyleBackColor = true; - this.SyncThumbnailsSizeCheckBox.CheckedChanged += new System.EventHandler(this.OptionChanged_Handler); + HeigthLabel.AutoSize = true; + HeigthLabel.Location = new System.Drawing.Point(152, 5); + HeigthLabel.Name = "HeigthLabel"; + HeigthLabel.Size = new System.Drawing.Size(38, 13); + HeigthLabel.TabIndex = 14; + HeigthLabel.Text = "Heigth"; + // + // WidthLabel + // + WidthLabel.AutoSize = true; + WidthLabel.Location = new System.Drawing.Point(2, 5); + WidthLabel.Name = "WidthLabel"; + WidthLabel.Size = new System.Drawing.Size(87, 13); + WidthLabel.TabIndex = 13; + WidthLabel.Text = "Thumbnail Width"; // // ThumbnailsWidthNumericEdit // this.ThumbnailsWidthNumericEdit.BackColor = System.Drawing.SystemColors.Window; this.ThumbnailsWidthNumericEdit.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.ThumbnailsWidthNumericEdit.CausesValidation = false; this.ThumbnailsWidthNumericEdit.Increment = new decimal(new int[] { - 10, - 0, - 0, - 0}); - this.ThumbnailsWidthNumericEdit.Location = new System.Drawing.Point(137, 3); + 10, + 0, + 0, + 0}); + this.ThumbnailsWidthNumericEdit.Location = new System.Drawing.Point(95, 3); this.ThumbnailsWidthNumericEdit.Maximum = new decimal(new int[] { - 640, - 0, - 0, - 0}); - this.ThumbnailsWidthNumericEdit.Minimum = new decimal(new int[] { - 80, - 0, - 0, - 0}); + 999999, + 0, + 0, + 0}); this.ThumbnailsWidthNumericEdit.Name = "ThumbnailsWidthNumericEdit"; this.ThumbnailsWidthNumericEdit.Size = new System.Drawing.Size(48, 20); this.ThumbnailsWidthNumericEdit.TabIndex = 11; this.ThumbnailsWidthNumericEdit.Value = new decimal(new int[] { - 100, - 0, - 0, - 0}); - this.ThumbnailsWidthNumericEdit.TextChanged += new System.EventHandler(this.ThumbnailSizeChanged_Handler); + 100, + 0, + 0, + 0}); this.ThumbnailsWidthNumericEdit.ValueChanged += new System.EventHandler(this.ThumbnailSizeChanged_Handler); // // ThumbnailsHeightNumericEdit // this.ThumbnailsHeightNumericEdit.BackColor = System.Drawing.SystemColors.Window; this.ThumbnailsHeightNumericEdit.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.ThumbnailsHeightNumericEdit.CausesValidation = false; this.ThumbnailsHeightNumericEdit.Increment = new decimal(new int[] { - 10, - 0, - 0, - 0}); + 10, + 0, + 0, + 0}); this.ThumbnailsHeightNumericEdit.Location = new System.Drawing.Point(196, 3); this.ThumbnailsHeightNumericEdit.Maximum = new decimal(new int[] { - 480, - 0, - 0, - 0}); - this.ThumbnailsHeightNumericEdit.Minimum = new decimal(new int[] { - 60, - 0, - 0, - 0}); + 99999999, + 0, + 0, + 0}); this.ThumbnailsHeightNumericEdit.Name = "ThumbnailsHeightNumericEdit"; this.ThumbnailsHeightNumericEdit.Size = new System.Drawing.Size(42, 20); this.ThumbnailsHeightNumericEdit.TabIndex = 12; this.ThumbnailsHeightNumericEdit.Value = new decimal(new int[] { - 70, - 0, - 0, - 0}); - this.ThumbnailsHeightNumericEdit.TextChanged += new System.EventHandler(this.ThumbnailSizeChanged_Handler); + 70, + 0, + 0, + 0}); this.ThumbnailsHeightNumericEdit.ValueChanged += new System.EventHandler(this.ThumbnailSizeChanged_Handler); // // ZoomOptionsPanel @@ -333,7 +331,7 @@ namespace EveOPreview.UI ZoomOptionsPanel.Controls.Add(ZoomAnchorLabel); ZoomOptionsPanel.Controls.Add(this.EnableThumbnailZoomCheckBox); ZoomOptionsPanel.Controls.Add(this.ThumbnailZoomFactorNumericEdit); - ZoomOptionsPanel.Location = new System.Drawing.Point(3, 209); + ZoomOptionsPanel.Location = new System.Drawing.Point(3, 207); ZoomOptionsPanel.Name = "ZoomOptionsPanel"; ZoomOptionsPanel.Size = new System.Drawing.Size(246, 82); ZoomOptionsPanel.TabIndex = 27; @@ -341,11 +339,11 @@ namespace EveOPreview.UI // ZoomFactorLabel // ZoomFactorLabel.AutoSize = true; - ZoomFactorLabel.Location = new System.Drawing.Point(49, 43); + ZoomFactorLabel.Location = new System.Drawing.Point(8, 43); ZoomFactorLabel.Name = "ZoomFactorLabel"; - ZoomFactorLabel.Size = new System.Drawing.Size(37, 13); + ZoomFactorLabel.Size = new System.Drawing.Size(67, 13); ZoomFactorLabel.TabIndex = 29; - ZoomFactorLabel.Text = "Factor"; + ZoomFactorLabel.Text = "Zoom Factor"; // // ZoomAnchorPanel // @@ -489,25 +487,25 @@ namespace EveOPreview.UI // 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.Location = new System.Drawing.Point(81, 41); this.ThumbnailZoomFactorNumericEdit.Maximum = new decimal(new int[] { - 10, - 0, - 0, - 0}); + 10, + 0, + 0, + 0}); this.ThumbnailZoomFactorNumericEdit.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); + 1, + 0, + 0, + 0}); 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}); + 1, + 0, + 0, + 0}); this.ThumbnailZoomFactorNumericEdit.ValueChanged += new System.EventHandler(this.OptionChanged_Handler); // // ShowThumbnailOverlaysCheckBox @@ -515,7 +513,7 @@ namespace EveOPreview.UI this.ShowThumbnailOverlaysCheckBox.AutoSize = true; this.ShowThumbnailOverlaysCheckBox.Checked = true; this.ShowThumbnailOverlaysCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; - this.ShowThumbnailOverlaysCheckBox.Location = new System.Drawing.Point(3, 297); + this.ShowThumbnailOverlaysCheckBox.Location = new System.Drawing.Point(3, 295); this.ShowThumbnailOverlaysCheckBox.Name = "ShowThumbnailOverlaysCheckBox"; this.ShowThumbnailOverlaysCheckBox.RightToLeft = System.Windows.Forms.RightToLeft.No; this.ShowThumbnailOverlaysCheckBox.Size = new System.Drawing.Size(90, 17); @@ -529,7 +527,7 @@ namespace EveOPreview.UI this.ShowThumbnailFramesCheckBox.AutoSize = true; this.ShowThumbnailFramesCheckBox.Checked = true; this.ShowThumbnailFramesCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; - this.ShowThumbnailFramesCheckBox.Location = new System.Drawing.Point(99, 297); + this.ShowThumbnailFramesCheckBox.Location = new System.Drawing.Point(99, 295); this.ShowThumbnailFramesCheckBox.Name = "ShowThumbnailFramesCheckBox"; this.ShowThumbnailFramesCheckBox.RightToLeft = System.Windows.Forms.RightToLeft.No; this.ShowThumbnailFramesCheckBox.Size = new System.Drawing.Size(127, 17); @@ -543,7 +541,7 @@ namespace EveOPreview.UI ThumbnailsListPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; ThumbnailsListPanel.Controls.Add(this.ThumbnailsList); ThumbnailsListPanel.Controls.Add(ThumbnailsListLabel); - ThumbnailsListPanel.Location = new System.Drawing.Point(3, 320); + ThumbnailsListPanel.Location = new System.Drawing.Point(3, 318); ThumbnailsListPanel.Name = "ThumbnailsListPanel"; ThumbnailsListPanel.Size = new System.Drawing.Size(246, 125); ThumbnailsListPanel.TabIndex = 31; @@ -572,13 +570,13 @@ namespace EveOPreview.UI // ForumLinkLabel // this.ForumLinkLabel.AutoSize = true; - this.ForumLinkLabel.Location = new System.Drawing.Point(3, 448); + this.ForumLinkLabel.Location = new System.Drawing.Point(3, 446); this.ForumLinkLabel.Name = "ForumLinkLabel"; this.ForumLinkLabel.Size = new System.Drawing.Size(241, 26); this.ForumLinkLabel.TabIndex = 10; this.ForumLinkLabel.TabStop = true; this.ForumLinkLabel.Text = "to be set from prresenter to be set from prresenter to be set from prresenter to " + - "be set from prresenter"; + "be set from prresenter"; this.ForumLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.ForumLinkLabelClicked_Handler); // // TitleMenuItem @@ -604,10 +602,10 @@ namespace EveOPreview.UI // TrayMenu // this.TrayMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - TitleMenuItem, - RestoreWindowMenuItem, - SeparatorMenuItem, - ExitMenuItem}); + TitleMenuItem, + RestoreWindowMenuItem, + SeparatorMenuItem, + ExitMenuItem}); this.TrayMenu.Name = "contextMenuStrip1"; this.TrayMenu.Size = new System.Drawing.Size(152, 76); // @@ -616,7 +614,7 @@ namespace EveOPreview.UI this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.ControlDarkDark; - this.ClientSize = new System.Drawing.Size(252, 487); + this.ClientSize = new System.Drawing.Size(252, 481); this.Controls.Add(ContentFlowLayoutPanel); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -653,7 +651,6 @@ namespace EveOPreview.UI private CheckBox HideActiveClientThumbnailCheckBox; private CheckBox HideThumbnailsOnLostFocusCheckBox; private CheckBox EnablePerClientThumbnailsLayoutsCheckBox; - private CheckBox SyncThumbnailsSizeCheckBox; private CheckBox ShowThumbnailsAlwaysOnTopCheckBox; private CheckBox ShowThumbnailFramesCheckBox; private LinkLabel ForumLinkLabel; diff --git a/Eve-O-Preview/UI/Implementation/MainForm.cs b/Eve-O-Preview/UI/Implementation/MainForm.cs index 7476960..85c793f 100644 --- a/Eve-O-Preview/UI/Implementation/MainForm.cs +++ b/Eve-O-Preview/UI/Implementation/MainForm.cs @@ -7,10 +7,14 @@ namespace EveOPreview.UI { public partial class MainForm : Form, IMainView { + #region Private fields private readonly ApplicationContext _context; private readonly Dictionary _zoomAnchorMap; private ViewZoomAnchor _cachedThumbnailZoomAnchor; private bool _suppressEvents; + private Size _minimumSize; + private Size _maximumSize; + #endregion public MainForm(ApplicationContext context) { @@ -18,6 +22,8 @@ namespace EveOPreview.UI this._zoomAnchorMap = new Dictionary(); this._cachedThumbnailZoomAnchor = ViewZoomAnchor.NW; this._suppressEvents = false; + this._minimumSize = new Size(80, 60); + this._maximumSize = new Size(80, 60); InitializeComponent(); @@ -110,18 +116,6 @@ namespace EveOPreview.UI } } - public bool SyncThumbnailsSize - { - get - { - return this.SyncThumbnailsSizeCheckBox.Checked; - } - set - { - this.SyncThumbnailsSizeCheckBox.Checked = value; - } - } - public Size ThumbnailSize { get @@ -228,11 +222,8 @@ namespace EveOPreview.UI 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; + this._minimumSize = minimumSize; + this._maximumSize = maximumSize; } public void Minimize() @@ -329,6 +320,14 @@ namespace EveOPreview.UI return; } + // Perform some View work that is not properly done in the Control + this._suppressEvents = true; + Size thumbnailSize = this.ThumbnailSize; + thumbnailSize.Width = Math.Min(Math.Max(thumbnailSize.Width, this._minimumSize.Width), this._maximumSize.Width); + thumbnailSize.Height = Math.Min(Math.Max(thumbnailSize.Height, this._minimumSize.Height), this._maximumSize.Height); + this.ThumbnailSize = thumbnailSize; + this._suppressEvents = false; + this.ThumbnailsSizeChanged?.Invoke(); } diff --git a/Eve-O-Preview/UI/Implementation/MainForm.resx b/Eve-O-Preview/UI/Implementation/MainForm.resx index 78e5597..4f505d6 100644 --- a/Eve-O-Preview/UI/Implementation/MainForm.resx +++ b/Eve-O-Preview/UI/Implementation/MainForm.resx @@ -168,7 +168,16 @@ True - + + False + + + True + + + False + + True diff --git a/Eve-O-Preview/UI/Implementation/ThumbnailView.Designer.cs b/Eve-O-Preview/UI/Implementation/ThumbnailView.Designer.cs index d0de14f..c8680f3 100644 --- a/Eve-O-Preview/UI/Implementation/ThumbnailView.Designer.cs +++ b/Eve-O-Preview/UI/Implementation/ThumbnailView.Designer.cs @@ -14,27 +14,8 @@ namespace EveOPreview.UI /// private void InitializeComponent() { - this.RenderAreaPictureBox = new System.Windows.Forms.PictureBox(); - ((System.ComponentModel.ISupportInitialize)(this.RenderAreaPictureBox)).BeginInit(); this.SuspendLayout(); // - // RenderAreaPictureBox - // - this.RenderAreaPictureBox.BackColor = System.Drawing.Color.Transparent; - this.RenderAreaPictureBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.RenderAreaPictureBox.Cursor = System.Windows.Forms.Cursors.Hand; - this.RenderAreaPictureBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.RenderAreaPictureBox.Location = new System.Drawing.Point(0, 0); - this.RenderAreaPictureBox.Margin = new System.Windows.Forms.Padding(0); - this.RenderAreaPictureBox.Name = "RenderAreaPictureBox"; - this.RenderAreaPictureBox.Size = new System.Drawing.Size(153, 89); - this.RenderAreaPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.RenderAreaPictureBox.TabIndex = 0; - this.RenderAreaPictureBox.TabStop = false; - this.RenderAreaPictureBox.MouseLeave += new System.EventHandler(this.LostFocus_Handler); - this.RenderAreaPictureBox.MouseHover += new System.EventHandler(this.Focused_Handler); - this.RenderAreaPictureBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ThumbnailActivated_Handler); - // // ThumbnailView // this.AccessibleRole = System.Windows.Forms.AccessibleRole.None; @@ -42,7 +23,6 @@ namespace EveOPreview.UI this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(153, 89); this.ControlBox = false; - this.Controls.Add(this.RenderAreaPictureBox); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; this.MaximizeBox = false; this.MinimizeBox = false; @@ -53,18 +33,17 @@ namespace EveOPreview.UI this.ShowInTaskbar = false; this.Text = "Preview"; this.TopMost = true; + this.MouseLeave += new System.EventHandler(this.LostFocus_Handler); + this.MouseHover += new System.EventHandler(this.Focused_Handler); + this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ThumbnailActivated_Handler); this.Move += new System.EventHandler(this.Move_Handler); this.Resize += new System.EventHandler(this.Resize_Handler); - ((System.ComponentModel.ISupportInitialize)(this.RenderAreaPictureBox)).EndInit(); this.ResumeLayout(false); - this.PerformLayout(); } #endregion - private System.Windows.Forms.PictureBox RenderAreaPictureBox; - } } \ No newline at end of file diff --git a/Eve-O-Preview/UI/Implementation/ThumbnailView.cs b/Eve-O-Preview/UI/Implementation/ThumbnailView.cs index f40048a..5a99a01 100644 --- a/Eve-O-Preview/UI/Implementation/ThumbnailView.cs +++ b/Eve-O-Preview/UI/Implementation/ThumbnailView.cs @@ -12,15 +12,13 @@ namespace EveOPreview.UI //private readonly IThumbnailManager _manager; private readonly ThumbnailOverlay _overlay; - //private Size _baseSize; - //private Point _basePosition; - // This is pure brainless View // Just somewhat more complex than usual private bool _isThumbnailSetUp; private bool _isOverlayVisible; private bool _isPositionChanged; private bool _isSizeChanged; + private DateTime _suppressResizeEventsTimestamp; private DWM_THUMBNAIL_PROPERTIES _thumbnail; private IntPtr _thumbnailHandle; private Size _baseSize; @@ -40,6 +38,8 @@ namespace EveOPreview.UI this._isPositionChanged = true; this._isSizeChanged = true; + this._suppressResizeEventsTimestamp = DateTime.UtcNow; + InitializeComponent(); this._overlay = new ThumbnailOverlay(this, this.ThumbnailActivated_Handler); @@ -66,11 +66,11 @@ namespace EveOPreview.UI public bool IsOverlayEnabled { get; set; } - public new Point Location + public Point ThumbnailLocation { get { - return base.Location; + return this.Location; } set { @@ -78,7 +78,19 @@ namespace EveOPreview.UI { this.StartPosition = FormStartPosition.Manual; } - base.Location = value; + this.Location = value; + } + } + + public Size ThumbnailSize + { + get + { + return this.ClientSize; + } + set + { + this.ClientSize = value; } } @@ -137,11 +149,14 @@ namespace EveOPreview.UI this.Opacity = opacity; } - public void SetWindowFrames(bool enable) + public void SetFrames(bool enable) { + // Fix for WinForms issue with the Resize event being fired with inconsistent ClientSize value + // Any Resize events fired before this timestamp will be ignored + this._suppressResizeEventsTimestamp = DateTime.UtcNow.AddMilliseconds(450); this.FormBorderStyle = enable ? FormBorderStyle.SizableToolWindow : FormBorderStyle.None; - // Notify about windo contents position change + // Notify about possible contents position change this._isSizeChanged = true; } @@ -226,11 +241,9 @@ namespace EveOPreview.UI try { this._hotkeyHandler.Register(); - System.Diagnostics.Debug.WriteLine("Registered shortcut for " + this.Title); } catch (Exception) { - System.Diagnostics.Debug.WriteLine("Failed to register shortcut for " + this.Title); // There can be a lot of possible exception reasons here // In case of any of them the hotkey setting is silently ignored } @@ -265,7 +278,7 @@ namespace EveOPreview.UI if (sizeChanged) { - this._thumbnail.rcDestination = new RECT(0, 0, this.ClientRectangle.Right, this.ClientRectangle.Bottom); + this._thumbnail.rcDestination = new RECT(0, 0, this.ClientSize.Width, this.ClientSize.Height); try { DwmApiNativeMethods.DwmUpdateThumbnailProperties(this._thumbnailHandle, this._thumbnail); @@ -304,14 +317,14 @@ namespace EveOPreview.UI return; } - Size overlaySize = this.RenderAreaPictureBox.Size; + Size overlaySize = this.ClientSize; overlaySize.Width -= 2 * 5; overlaySize.Height -= 2 * 5; Point overlayLocation = this.Location; - overlayLocation.X += 5 + (this.Size.Width - this.RenderAreaPictureBox.Size.Width) / 2; - overlayLocation.Y += 5 + (this.Size.Height - this.RenderAreaPictureBox.Size.Height) - (this.Size.Width - this.RenderAreaPictureBox.Size.Width) / 2; + overlayLocation.X += 5 + (this.Size.Width - this.ClientSize.Width) / 2; + overlayLocation.Y += 5 + (this.Size.Height - this.ClientSize.Height) - (this.Size.Width - this.ClientSize.Width) / 2; this._isPositionChanged = false; this._overlay.Size = overlaySize; @@ -337,7 +350,13 @@ namespace EveOPreview.UI private void Resize_Handler(object sender, EventArgs e) { + if (DateTime.UtcNow < this._suppressResizeEventsTimestamp) + { + return; + } + this._isSizeChanged = true; + this.ThumbnailResized?.Invoke(this.Id); } @@ -363,12 +382,12 @@ namespace EveOPreview.UI // // do smth cool? //} - if (e.Button == MouseButtons.Middle) - { - //// Trigger full thumbnail refresh - //this.UnregisterThumbnail(); - //this.Refresh(); - } + //if (e.Button == MouseButtons.Middle) + //{ + //// Trigger full thumbnail refresh + //this.UnregisterThumbnail(); + //this.Refresh(); + //} } private void HotkeyPressed_Handler(object sender, HandledEventArgs e) @@ -405,47 +424,5 @@ namespace EveOPreview.UI { } } - - //private Hotkey _hotkey; // This field stores the hotkey reference - //public void RegisterShortcut(string shortcut) - //{ - //if (String.IsNullOrEmpty(shortcut)) - //{ - // return; - //} - - //KeysConverter converter = new KeysConverter(); - //object keysObject = converter.ConvertFrom(shortcut); - //if (keysObject == null) - //{ - // return; - //} - - //Keys key = (Keys)keysObject; - - //Hotkey hotkey = new Hotkey(); - - //if ((key & Keys.Shift) == Keys.Shift) - //{ - // hotkey.Shift = true; - //} - - //if ((key & Keys.Alt) == Keys.Alt) - //{ - // hotkey.Alt = true; - //} - - //if ((key & Keys.Control) == Keys.Control) - //{ - // hotkey.Control = true; - //} - - //key = key & ~Keys.Shift & ~Keys.Alt & ~Keys.Control; - //hotkey.KeyCode = key; - //hotkey.Pressed += Hotkey_Pressed; - //hotkey.Register(this); - - //this._hotkey = hotkey; - //} } } \ No newline at end of file diff --git a/Eve-O-Preview/UI/Interface/IMainView.cs b/Eve-O-Preview/UI/Interface/IMainView.cs index 27dca96..3a2b7b1 100644 --- a/Eve-O-Preview/UI/Interface/IMainView.cs +++ b/Eve-O-Preview/UI/Interface/IMainView.cs @@ -20,7 +20,6 @@ namespace EveOPreview.UI bool HideThumbnailsOnLostFocus { get; set; } bool EnablePerClientThumbnailsLayouts { get; set; } - bool SyncThumbnailsSize { get; set; } Size ThumbnailSize { get; set; } bool EnableThumbnailZoom { get; set; } diff --git a/Eve-O-Preview/UI/Interface/IThumbnailView.cs b/Eve-O-Preview/UI/Interface/IThumbnailView.cs index b371fc7..1034160 100644 --- a/Eve-O-Preview/UI/Interface/IThumbnailView.cs +++ b/Eve-O-Preview/UI/Interface/IThumbnailView.cs @@ -11,15 +11,15 @@ namespace EveOPreview.UI bool IsEnabled { get; set; } bool IsActive { get; set; } - Point Location { get; set; } - Size Size { get; set; } + Point ThumbnailLocation { get; set; } + Size ThumbnailSize { get; set; } bool IsOverlayEnabled { get; set; } bool IsKnownHandle(IntPtr handle); void SetSizeLimitations(Size minimumSize, Size maximumSize); void SetOpacity(double opacity); - void SetWindowFrames(bool enable); + void SetFrames(bool enable); void SetTopMost(bool enableTopmost); void ZoomIn(ViewZoomAnchor anchor, int zoomFactor);