Merge branch 'develop'

This commit is contained in:
Anton Kasyanov
2016-06-20 14:33:03 +03:00
12 changed files with 159 additions and 205 deletions

View File

@@ -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; }

View File

@@ -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; }

View File

@@ -9,7 +9,7 @@ namespace EveOPreview.UI
public class MainPresenter : Presenter<IMainView>
{
#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;

View File

@@ -84,7 +84,7 @@ namespace EveOPreview.UI
foreach (KeyValuePair<IntPtr, IThumbnailView> 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<IntPtr, IThumbnailView> 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);
}

View File

@@ -18,7 +18,7 @@ namespace EveOPreview.UI
view.Id = id;
view.Title = title;
view.Size = size;
view.ThumbnailSize = size;
return view;
}

View File

@@ -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,45 +243,46 @@ 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);
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,
999999,
0,
0,
0});
@@ -290,13 +294,13 @@ namespace EveOPreview.UI
0,
0,
0});
this.ThumbnailsWidthNumericEdit.TextChanged += new System.EventHandler(this.ThumbnailSizeChanged_Handler);
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,
@@ -304,12 +308,7 @@ namespace EveOPreview.UI
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,
99999999,
0,
0,
0});
@@ -321,7 +320,6 @@ namespace EveOPreview.UI
0,
0,
0});
this.ThumbnailsHeightNumericEdit.TextChanged += new System.EventHandler(this.ThumbnailSizeChanged_Handler);
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,7 +487,7 @@ 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,
@@ -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,7 +570,7 @@ 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;
@@ -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;

View File

@@ -7,10 +7,14 @@ namespace EveOPreview.UI
{
public partial class MainForm : Form, IMainView
{
#region Private fields
private readonly ApplicationContext _context;
private readonly Dictionary<ViewZoomAnchor, RadioButton> _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<ViewZoomAnchor, RadioButton>();
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();
}

View File

@@ -168,7 +168,16 @@
<metadata name="ResizeOptionsPanel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SyncThumbnailsSizeCheckBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="HeigthLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="HeigthLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="WidthLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="WidthLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ThumbnailsWidthNumericEdit.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

View File

@@ -14,27 +14,8 @@ namespace EveOPreview.UI
/// </summary>
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;
}
}

View File

@@ -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)
{
//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;
//}
}
}

View File

@@ -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; }

View File

@@ -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);