Thumbnail management code cleanup
This commit is contained in:
@@ -2,9 +2,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Globalization;
|
||||
using EveOPreview.Configuration;
|
||||
using EveOPreview.Thumbnails;
|
||||
|
||||
namespace EveOPreview.UI
|
||||
{
|
||||
@@ -312,7 +309,7 @@ namespace EveOPreview.UI
|
||||
public event Action<ViewCloseRequest> FormCloseRequested;
|
||||
public event Action ApplicationSettingsChanged;
|
||||
public event Action ThumbnailsSizeChanged;
|
||||
public event Action<IntPtr, Boolean> ThumbnailStateChanged;
|
||||
public event Action<IntPtr> ThumbnailStateChanged;
|
||||
public event Action ForumUrlLinkActivated;
|
||||
|
||||
#region UI events
|
||||
@@ -343,8 +340,9 @@ namespace EveOPreview.UI
|
||||
{
|
||||
return;
|
||||
}
|
||||
selectedItem.IsDisabled = (e.NewValue == CheckState.Checked);
|
||||
|
||||
this.ThumbnailStateChanged?.Invoke(selectedItem.Id, e.NewValue == CheckState.Checked);
|
||||
this.ThumbnailStateChanged?.Invoke(selectedItem.Id);
|
||||
}
|
||||
|
||||
private void ForumLinkLabelClicked_Handler(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace EveOPreview.UI
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
public bool IsDisabled { get; set; }
|
||||
|
||||
public void Show()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace EveOPreview.UI
|
||||
{
|
||||
public class ThumbnailDescriptionViewFactory : IThumbnailDescriptionViewFactory
|
||||
{
|
||||
private readonly IApplicationController _controller;
|
||||
|
||||
public ThumbnailDescriptionViewFactory(IApplicationController controller)
|
||||
{
|
||||
this._controller = controller;
|
||||
}
|
||||
|
||||
public IThumbnailDescriptionView Create(IntPtr id, string title)
|
||||
{
|
||||
IThumbnailDescriptionView view = this._controller.Create<IThumbnailDescriptionView>();
|
||||
|
||||
view.Id = id;
|
||||
view.Title = title;
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
||||
90
Eve-O-Preview/UI/Implementation/ThumbnailOverlay.Designer.cs
generated
Normal file
90
Eve-O-Preview/UI/Implementation/ThumbnailOverlay.Designer.cs
generated
Normal file
@@ -0,0 +1,90 @@
|
||||
namespace EveOPreview.UI
|
||||
{
|
||||
partial class ThumbnailOverlay
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.PictureBox OverlayAreaPictureBox;
|
||||
this.OverlayLabel = new System.Windows.Forms.Label();
|
||||
OverlayAreaPictureBox = new System.Windows.Forms.PictureBox();
|
||||
((System.ComponentModel.ISupportInitialize)(OverlayAreaPictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// OverlayAreaPictureBox
|
||||
//
|
||||
OverlayAreaPictureBox.BackColor = System.Drawing.Color.Transparent;
|
||||
OverlayAreaPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
OverlayAreaPictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
OverlayAreaPictureBox.Location = new System.Drawing.Point(0, 0);
|
||||
OverlayAreaPictureBox.Name = "OverlayAreaPictureBox";
|
||||
OverlayAreaPictureBox.Size = new System.Drawing.Size(284, 262);
|
||||
OverlayAreaPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||
OverlayAreaPictureBox.TabIndex = 0;
|
||||
OverlayAreaPictureBox.TabStop = false;
|
||||
OverlayAreaPictureBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OverlayArea_Click);
|
||||
//
|
||||
// OverlayLabel
|
||||
//
|
||||
this.OverlayLabel.AutoSize = true;
|
||||
this.OverlayLabel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.OverlayLabel.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.OverlayLabel.ForeColor = System.Drawing.Color.DarkGray;
|
||||
this.OverlayLabel.Location = new System.Drawing.Point(0, 0);
|
||||
this.OverlayLabel.Name = "OverlayLabel";
|
||||
this.OverlayLabel.Size = new System.Drawing.Size(25, 13);
|
||||
this.OverlayLabel.TabIndex = 1;
|
||||
this.OverlayLabel.Text = "...";
|
||||
//
|
||||
// PreviewOverlay
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.Black;
|
||||
this.ClientSize = new System.Drawing.Size(284, 262);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.OverlayLabel);
|
||||
this.Controls.Add(OverlayAreaPictureBox);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "ThumbnailOverlay";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.Text = "PreviewOverlay";
|
||||
this.TransparencyKey = System.Drawing.Color.Black;
|
||||
((System.ComponentModel.ISupportInitialize)(OverlayAreaPictureBox)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label OverlayLabel;
|
||||
}
|
||||
}
|
||||
36
Eve-O-Preview/UI/Implementation/ThumbnailOverlay.cs
Normal file
36
Eve-O-Preview/UI/Implementation/ThumbnailOverlay.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace EveOPreview.UI
|
||||
{
|
||||
public partial class ThumbnailOverlay : Form
|
||||
{
|
||||
private readonly Action<object, MouseEventArgs> _areaClickAction;
|
||||
|
||||
public ThumbnailOverlay(Action<object, MouseEventArgs> areaClickAction)
|
||||
{
|
||||
this._areaClickAction = areaClickAction;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OverlayArea_Click(object sender, MouseEventArgs e)
|
||||
{
|
||||
this._areaClickAction(sender, e);
|
||||
}
|
||||
|
||||
public void SetOverlayLabel(string label)
|
||||
{
|
||||
this.OverlayLabel.Text = label;
|
||||
}
|
||||
|
||||
protected override CreateParams CreateParams
|
||||
{
|
||||
get
|
||||
{
|
||||
var Params = base.CreateParams;
|
||||
Params.ExStyle |= (int)DwmApiNativeMethods.WS_EX_TOOLWINDOW;
|
||||
return Params;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
123
Eve-O-Preview/UI/Implementation/ThumbnailOverlay.resx
Normal file
123
Eve-O-Preview/UI/Implementation/ThumbnailOverlay.resx
Normal file
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="OverlayAreaPictureBox.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
||||
70
Eve-O-Preview/UI/Implementation/ThumbnailView.Designer.cs
generated
Normal file
70
Eve-O-Preview/UI/Implementation/ThumbnailView.Designer.cs
generated
Normal file
@@ -0,0 +1,70 @@
|
||||
namespace EveOPreview.UI
|
||||
{
|
||||
partial class ThumbnailView
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </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;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
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;
|
||||
this.MinimumSize = new System.Drawing.Size(64, 64);
|
||||
this.Name = "ThumbnailView";
|
||||
this.Opacity = 0.1D;
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "Preview";
|
||||
this.TopMost = true;
|
||||
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;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
282
Eve-O-Preview/UI/Implementation/ThumbnailView.cs
Normal file
282
Eve-O-Preview/UI/Implementation/ThumbnailView.cs
Normal file
@@ -0,0 +1,282 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace EveOPreview.UI
|
||||
{
|
||||
public partial class ThumbnailView : Form, IThumbnailView
|
||||
{
|
||||
#region Private fields
|
||||
|
||||
//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 DWM_THUMBNAIL_PROPERTIES _Thumbnail;
|
||||
private IntPtr _ThumbnailHandle;
|
||||
private int _currentWidth;
|
||||
private int _currentHeight;
|
||||
private int _currentTop;
|
||||
private int _currentLeft;
|
||||
#endregion
|
||||
|
||||
public ThumbnailView()
|
||||
{
|
||||
this.IsEnabled = true;
|
||||
this.IsActive = false;
|
||||
|
||||
this.IsOverlayEnabled = false;
|
||||
this._isThumbnailSetUp = false;
|
||||
|
||||
this._currentWidth = -1;
|
||||
this._currentHeight = -1;
|
||||
this._currentTop = -1;
|
||||
this._currentLeft = -1;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
this._overlay = new ThumbnailOverlay(this.ThumbnailActivated_Handler);
|
||||
}
|
||||
|
||||
public IntPtr Id { get; set; }
|
||||
|
||||
public string Title
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.Text = value;
|
||||
this._overlay.SetOverlayLabel(value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsEnabled { get; set; }
|
||||
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
public bool IsOverlayEnabled { get; set; }
|
||||
|
||||
public event Action<IntPtr> ThumbnailResized;
|
||||
|
||||
public event Action<IntPtr> ThumbnailMoved;
|
||||
|
||||
public event Action<IntPtr> ThumbnailFocused;
|
||||
|
||||
public event Action<IntPtr> ThumbnailLostFocus;
|
||||
|
||||
public event Action<IntPtr> ThumbnailActivated;
|
||||
|
||||
public new void Show()
|
||||
{
|
||||
base.Show();
|
||||
|
||||
if (this.IsOverlayEnabled)
|
||||
{
|
||||
this._overlay.Show();
|
||||
this._overlay.TopMost = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._overlay.Hide();
|
||||
}
|
||||
|
||||
this.Refresh();
|
||||
|
||||
this.IsActive = true;
|
||||
}
|
||||
|
||||
public new void Hide()
|
||||
{
|
||||
this.IsActive = false;
|
||||
|
||||
this._overlay.Hide();
|
||||
base.Hide();
|
||||
}
|
||||
|
||||
public new void Close()
|
||||
{
|
||||
this.IsActive = false;
|
||||
|
||||
this._overlay.Close();
|
||||
base.Close();
|
||||
}
|
||||
|
||||
// This method is used to determine if the provided Handle is related to client or its thumbnail
|
||||
public bool IsKnownHandle(IntPtr handle)
|
||||
{
|
||||
return (this.Id == handle) || (this.Handle == handle) || (this._overlay.Handle == handle);
|
||||
}
|
||||
|
||||
public void SetOpacity(double opacity)
|
||||
{
|
||||
this.Opacity = opacity;
|
||||
}
|
||||
|
||||
public void SetWindowFrames(bool enable)
|
||||
{
|
||||
this.FormBorderStyle = enable ? FormBorderStyle.SizableToolWindow : FormBorderStyle.None;
|
||||
}
|
||||
|
||||
public void SetTopMost(bool enableTopmost)
|
||||
{
|
||||
this.TopMost = enableTopmost;
|
||||
this._overlay.TopMost = true;
|
||||
}
|
||||
|
||||
public new void Refresh()
|
||||
{
|
||||
if (this._isThumbnailSetUp == false)
|
||||
{
|
||||
this.InitializeThumbnail();
|
||||
}
|
||||
|
||||
bool sizeChanged = (this._currentWidth != this.ClientRectangle.Right) || (this._currentHeight != this.ClientRectangle.Bottom);
|
||||
bool locationChanged = (this._currentLeft != this.Location.X) || (this._currentTop != this.Location.Y);
|
||||
|
||||
if (sizeChanged)
|
||||
{
|
||||
this._currentWidth = this.ClientRectangle.Right;
|
||||
this._currentHeight = this.ClientRectangle.Bottom;
|
||||
|
||||
this._Thumbnail.rcDestination = new RECT(0, 0, this._currentWidth, this._currentHeight);
|
||||
DwmApiNativeMethods.DwmUpdateThumbnailProperties(this._ThumbnailHandle, this._Thumbnail);
|
||||
}
|
||||
|
||||
if (!(this.IsOverlayEnabled && (sizeChanged || locationChanged)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Size overlaySize = this.RenderAreaPictureBox.Size;
|
||||
overlaySize.Width -= 2 * 5;
|
||||
overlaySize.Height -= 2 * 5;
|
||||
|
||||
Point overlayLocation = this.Location;
|
||||
|
||||
this._currentLeft = overlayLocation.X;
|
||||
this._currentTop = overlayLocation.Y;
|
||||
|
||||
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;
|
||||
|
||||
this._overlay.Size = overlaySize;
|
||||
this._overlay.Location = overlayLocation;
|
||||
}
|
||||
|
||||
#region GUI events
|
||||
protected override CreateParams CreateParams
|
||||
{
|
||||
get
|
||||
{
|
||||
var Params = base.CreateParams;
|
||||
Params.ExStyle |= (int)DwmApiNativeMethods.WS_EX_TOOLWINDOW;
|
||||
return Params;
|
||||
}
|
||||
}
|
||||
|
||||
private void Move_Handler(object sender, EventArgs e)
|
||||
{
|
||||
this.ThumbnailMoved?.Invoke(this.Id);
|
||||
}
|
||||
|
||||
private void Resize_Handler(object sender, EventArgs e)
|
||||
{
|
||||
this.ThumbnailResized?.Invoke(this.Id);
|
||||
}
|
||||
|
||||
private void Focused_Handler(object sender, EventArgs e)
|
||||
{
|
||||
this.ThumbnailFocused?.Invoke(this.Id);
|
||||
}
|
||||
|
||||
private void LostFocus_Handler(object sender, EventArgs e)
|
||||
{
|
||||
this.ThumbnailLostFocus?.Invoke(this.Id);
|
||||
}
|
||||
|
||||
private void ThumbnailActivated_Handler(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
this.ThumbnailActivated?.Invoke(this.Id);
|
||||
}
|
||||
|
||||
//if (e.Button == MouseButtons.Right)
|
||||
//{
|
||||
// // do smth cool?
|
||||
//}
|
||||
|
||||
//if (e.Button == MouseButtons.Middle)
|
||||
//{
|
||||
// // do smth cool?
|
||||
//}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void InitializeThumbnail()
|
||||
{
|
||||
this._ThumbnailHandle = DwmApiNativeMethods.DwmRegisterThumbnail(this.Handle, this.Id);
|
||||
|
||||
this._Thumbnail = new DWM_THUMBNAIL_PROPERTIES();
|
||||
this._Thumbnail.dwFlags = DWM_TNP_CONSTANTS.DWM_TNP_VISIBLE
|
||||
+ DWM_TNP_CONSTANTS.DWM_TNP_OPACITY
|
||||
+ DWM_TNP_CONSTANTS.DWM_TNP_RECTDESTINATION
|
||||
+ DWM_TNP_CONSTANTS.DWM_TNP_SOURCECLIENTAREAONLY;
|
||||
this._Thumbnail.opacity = 255;
|
||||
this._Thumbnail.fVisible = true;
|
||||
this._Thumbnail.fSourceClientAreaOnly = true;
|
||||
|
||||
this._isThumbnailSetUp = true;
|
||||
}
|
||||
|
||||
//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;
|
||||
//}
|
||||
}
|
||||
}
|
||||
120
Eve-O-Preview/UI/Implementation/ThumbnailView.resx
Normal file
120
Eve-O-Preview/UI/Implementation/ThumbnailView.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Reference in New Issue
Block a user