diff --git a/.gitignore b/.gitignore index 8c38cb8..ae2b6c6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ Installer/OnTopReplica-Setup.exe *.user *.suo +packages/ diff --git a/OnTopReplica.sln b/OnTopReplica.sln index 1c732a8..2db74a9 100644 --- a/OnTopReplica.sln +++ b/OnTopReplica.sln @@ -1,20 +1,55 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C# Express 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27004.2008 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnTopReplica", "OnTopReplica\OnTopReplica.csproj", "{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Debug|x64.ActiveCfg = Debug|Any CPU + {E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Debug|x64.Build.0 = Debug|Any CPU + {E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Debug|x86.ActiveCfg = Debug|Any CPU + {E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Debug|x86.Build.0 = Debug|Any CPU {E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Release|Any CPU.ActiveCfg = Release|Any CPU {E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Release|Any CPU.Build.0 = Release|Any CPU + {E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Release|x64.ActiveCfg = Release|Any CPU + {E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Release|x64.Build.0 = Release|Any CPU + {E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Release|x86.ActiveCfg = Release|Any CPU + {E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Release|x86.Build.0 = Release|Any CPU + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|x64.ActiveCfg = Debug|x64 + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|x64.Build.0 = Debug|x64 + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|x64.Deploy.0 = Debug|x64 + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|x86.ActiveCfg = Debug|x86 + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|x86.Build.0 = Debug|x86 + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Debug|x86.Deploy.0 = Debug|x86 + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|Any CPU.Build.0 = Release|Any CPU + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|Any CPU.Deploy.0 = Release|Any CPU + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|x64.ActiveCfg = Release|x64 + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|x64.Build.0 = Release|x64 + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|x64.Deploy.0 = Release|x64 + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|x86.ActiveCfg = Release|x86 + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|x86.Build.0 = Release|x86 + {01391A7F-A9A1-4C90-89EB-29E0C98BF9BE}.Release|x86.Deploy.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3F135F78-F70E-4127-BA77-6C262C7CCCEF} + EndGlobalSection EndGlobal diff --git a/OnTopReplica/AspectRatioForm.cs b/OnTopReplica/AspectRatioForm.cs index 499dd4d..4a22c3c 100644 --- a/OnTopReplica/AspectRatioForm.cs +++ b/OnTopReplica/AspectRatioForm.cs @@ -4,14 +4,13 @@ using System.Drawing; using System.Runtime.InteropServices; using System.Windows.Forms; using OnTopReplica.Native; -using WindowsFormsAero.Dwm.Helpers; namespace OnTopReplica { /// /// Form that automatically keeps a certain aspect ratio and resizes without flickering. /// - public class AspectRatioForm : GlassForm { + public class AspectRatioForm : WindowsFormsAero.AeroForm { bool _keepAspectRatio = true; diff --git a/OnTopReplica/FullscreenFormManager.cs b/OnTopReplica/FullscreenFormManager.cs index 1263c3d..a09ddcb 100644 --- a/OnTopReplica/FullscreenFormManager.cs +++ b/OnTopReplica/FullscreenFormManager.cs @@ -97,9 +97,8 @@ namespace OnTopReplica { private void CommonCompleteSwitch(bool enabled) { //UI stuff switching - _mainForm.GlassEnabled = !enabled; + _mainForm.GlassMargins = (!enabled) ? new Padding(-1) : Padding.Empty; _mainForm.TopMost = !enabled; - _mainForm.HandleMouseMove = !enabled; IsFullscreen = enabled; diff --git a/OnTopReplica/MainForm.cs b/OnTopReplica/MainForm.cs index 921e84a..341d227 100644 --- a/OnTopReplica/MainForm.cs +++ b/OnTopReplica/MainForm.cs @@ -64,8 +64,7 @@ namespace OnTopReplica { //Window init KeepAspectRatio = false; - GlassEnabled = true; - GlassMargins = new Margins(-1); + GlassMargins = new Padding(-1); //Managers _msgPumpManager.Initialize(this); diff --git a/OnTopReplica/MainForm_Features.cs b/OnTopReplica/MainForm_Features.cs index 1638808..d39bac9 100644 --- a/OnTopReplica/MainForm_Features.cs +++ b/OnTopReplica/MainForm_Features.cs @@ -18,9 +18,9 @@ namespace OnTopReplica { set { if (value && Settings.Default.FirstTimeClickForwarding) { TaskDialog dlg = new TaskDialog(Strings.InfoClickForwarding, Strings.InfoClickForwardingTitle, Strings.InfoClickForwardingContent) { - CommonButtons = TaskDialogButton.Yes | TaskDialogButton.No + CommonButtons = CommonButton.Yes | CommonButton.No }; - if (dlg.Show(this).CommonButton == Result.No) + if (dlg.Show(this).CommonButton == CommonButtonResult.No) return; Settings.Default.FirstTimeClickForwarding = false; diff --git a/OnTopReplica/MainForm_Gui.cs b/OnTopReplica/MainForm_Gui.cs index 8cf1879..78b1366 100644 --- a/OnTopReplica/MainForm_Gui.cs +++ b/OnTopReplica/MainForm_Gui.cs @@ -54,7 +54,7 @@ namespace OnTopReplica { /// Expanded error codes/messages. private void ShowErrorDialog(string mainInstruction, string explanation, string errorMessage) { TaskDialog dlg = new TaskDialog(mainInstruction, Strings.ErrorGenericTitle, explanation) { - CommonIcon = TaskDialogIcon.Stop, + CommonIcon = CommonIcon.Stop, IsExpanded = false }; @@ -85,12 +85,12 @@ namespace OnTopReplica { var dlg = new TaskDialog(Strings.AskReset, Strings.AskResetTitle, Strings.AskResetContent); dlg.UseCommandLinks = true; dlg.CustomButtons = new CustomButton[] { - new CustomButton(Result.OK, Strings.AskResetButtonOk), - new CustomButton(Result.Cancel, Strings.ButtonCancel) - }; - dlg.CommonIcon = TaskDialogIcon.Information; + new CustomButton(CommonButtonResult.OK, Strings.AskResetButtonOk), + new CustomButton(CommonButtonResult.Cancel, Strings.ButtonCancel) + }; + dlg.CommonIcon = CommonIcon.Information; - if (dlg.Show(this).CommonButton == Result.OK) { + if (dlg.Show(this).CommonButton == CommonButtonResult.OK) { ResetMainForm(); } } diff --git a/OnTopReplica/OnTopReplica.csproj b/OnTopReplica/OnTopReplica.csproj index c7895e8..6b32287 100644 --- a/OnTopReplica/OnTopReplica.csproj +++ b/OnTopReplica/OnTopReplica.csproj @@ -98,8 +98,8 @@ - - ..\Lib\WindowsFormsAero.dll + + ..\packages\Windows-Forms-Aero.3.0.1\lib\net461\WindowsFormsAero.dll @@ -408,6 +408,7 @@ Strings.pt.Designer.cs + SettingsSingleFileGenerator Settings.Designer.cs @@ -535,72 +536,72 @@ False + Exclude + True - Exclude - True File False + Exclude + True - Exclude - True File False + Exclude + True - Exclude - True File False + Exclude + True - Exclude - True File False + Include + True - Include - True Satellite False + Include + True - Include - True Satellite False + Include + True - Include - True Satellite diff --git a/OnTopReplica/Platforms/WindowsSeven.cs b/OnTopReplica/Platforms/WindowsSeven.cs index 46cb2c3..1a2360e 100644 --- a/OnTopReplica/Platforms/WindowsSeven.cs +++ b/OnTopReplica/Platforms/WindowsSeven.cs @@ -15,7 +15,7 @@ namespace OnTopReplica.Platforms { } public override void PostHandleFormInit(MainForm form) { - DwmManager.SetWindowFlip3dPolicy(form, Flip3DPolicy.ExcludeAbove); + DwmManager.SetWindowFlip3dPolicy(form, WindowsFormsAero.Flip3DPolicy.ExcludeAbove); DwmManager.SetExcludeFromPeek(form, true); DwmManager.SetDisallowPeek(form, true); } diff --git a/OnTopReplica/Platforms/WindowsVista.cs b/OnTopReplica/Platforms/WindowsVista.cs index 368db7f..c513a3f 100644 --- a/OnTopReplica/Platforms/WindowsVista.cs +++ b/OnTopReplica/Platforms/WindowsVista.cs @@ -23,7 +23,7 @@ namespace OnTopReplica.Platforms { //NOTE: this also makes HotKey registration critically fail on Windows 7 form.ShowInTaskbar = false; - DwmManager.SetWindowFlip3dPolicy(form, Flip3DPolicy.ExcludeAbove); + DwmManager.SetWindowFlip3dPolicy(form, WindowsFormsAero.Flip3DPolicy.ExcludeAbove); _icon = new NotificationIcon(form); } diff --git a/OnTopReplica/SidePanel.cs b/OnTopReplica/SidePanel.cs index 5294b9a..52efd81 100644 --- a/OnTopReplica/SidePanel.cs +++ b/OnTopReplica/SidePanel.cs @@ -65,11 +65,11 @@ namespace OnTopReplica { } /// - /// Gets the panel's desired glass margins or null if no glass surface is required. + /// Gets the panel's desired glass margins. /// - public virtual Margins? GlassMargins { + public virtual Padding GlassMargins { get { - return null; + return Padding.Empty; } } diff --git a/OnTopReplica/SidePanelContainer.cs b/OnTopReplica/SidePanelContainer.cs index 9a195a6..1860116 100644 --- a/OnTopReplica/SidePanelContainer.cs +++ b/OnTopReplica/SidePanelContainer.cs @@ -4,13 +4,12 @@ using System.ComponentModel; using System.Drawing; using System.Text; using System.Windows.Forms; -using WindowsFormsAero.Dwm.Helpers; namespace OnTopReplica { /// /// Acts as a form that can contain a SidePanel instance. /// - partial class SidePanelContainer : GlassForm { + partial class SidePanelContainer : WindowsFormsAero.AeroForm { EventHandler RequestClosingHandler; @@ -56,15 +55,7 @@ namespace OnTopReplica { var minSize = panel.MinimumSize.Expand(this.Padding); this.ClientSize = minSize; this.EnsureMinimumClientSize(minSize); - - //Enable glass if needed - var margins = panel.GlassMargins; - if (margins.HasValue) { - this.GlassMargins = margins.Value; - this.GlassEnabled = true; - } - else - this.GlassEnabled = false; + this.GlassMargins = panel.GlassMargins; this.ResumeLayout(); } diff --git a/OnTopReplica/SidePanels/AboutPanel.Designer.cs b/OnTopReplica/SidePanels/AboutPanel.Designer.cs index 3b05562..64c9697 100644 --- a/OnTopReplica/SidePanels/AboutPanel.Designer.cs +++ b/OnTopReplica/SidePanels/AboutPanel.Designer.cs @@ -23,7 +23,7 @@ /// the contents of this method with the code editor. /// private void InitializeComponent() { - this.labelVersion = new WindowsFormsAero.ThemeText.ThemedLabel(); + this.labelVersion = new WindowsFormsAero.ThemeLabel(); this.panelContents = new OnTopReplica.SidePanels.AboutPanelContents(); this.SuspendLayout(); // @@ -66,7 +66,7 @@ #endregion - private WindowsFormsAero.ThemeText.ThemedLabel labelVersion; + private WindowsFormsAero.ThemeLabel labelVersion; private AboutPanelContents panelContents; } diff --git a/OnTopReplica/SidePanels/AboutPanel.cs b/OnTopReplica/SidePanels/AboutPanel.cs index 679c2d3..0e7a323 100644 --- a/OnTopReplica/SidePanels/AboutPanel.cs +++ b/OnTopReplica/SidePanels/AboutPanel.cs @@ -23,9 +23,9 @@ namespace OnTopReplica.SidePanels { } } - public override Margins? GlassMargins { + public override Padding GlassMargins { get { - return new Margins(0, 0, 0, labelVersion.Height); + return new Padding(0, 0, 0, labelVersion.Height); } } diff --git a/OnTopReplica/ThumbnailPanel.cs b/OnTopReplica/ThumbnailPanel.cs index 6422176..c30d79f 100644 --- a/OnTopReplica/ThumbnailPanel.cs +++ b/OnTopReplica/ThumbnailPanel.cs @@ -3,30 +3,29 @@ using System.Collections.Generic; using System.Text; using System.Windows.Forms; using WindowsFormsAero.Dwm; -using WindowsFormsAero.ThemeText; using System.Drawing; using System.Windows.Forms.VisualStyles; using OnTopReplica.Native; namespace OnTopReplica { - class ThumbnailPanel : Panel { + class ThumbnailPanel : Panel { - //DWM Thumbnail stuff - Thumbnail _thumbnail = null; + //DWM Thumbnail stuff + Thumbnail _thumbnail = null; - //Labels - ThemedLabel _labelGlass; + //Labels + WindowsFormsAero.ThemeLabel _labelGlass; - public ThumbnailPanel() { - InitFormComponents(); - } + public ThumbnailPanel() { + InitFormComponents(); + } - private void InitFormComponents() { + private void InitFormComponents() { BackColor = Color.Black; - //Themed Label - _labelGlass = new ThemedLabel { + //Themed Label + _labelGlass = new WindowsFormsAero.ThemeLabel { Dock = DockStyle.Fill, ForeColor = SystemColors.ControlText, Location = Point.Empty, @@ -36,43 +35,43 @@ namespace OnTopReplica { TextAlign = HorizontalAlignment.Center, TextAlignVertical = VerticalAlignment.Center }; - this.Controls.Add(_labelGlass); - } + this.Controls.Add(_labelGlass); + } - #region Properties and settings + #region Properties and settings ThumbnailRegion _currentRegion; /// /// Gets or sets the region that is currently shown on the thumbnail. When set, also enables region constrain. /// - public ThumbnailRegion SelectedRegion { - get { + public ThumbnailRegion SelectedRegion { + get { return _currentRegion; - } - set { + } + set { _currentRegion = value; _regionEnabled = (value != null); UpdateThubmnail(); - } - } + } + } bool _regionEnabled = false; /// /// Gets or sets whether the thumbnail is constrained to a region or not. /// - public bool ConstrainToRegion { - get { - return _regionEnabled; - } - set { + public bool ConstrainToRegion { + get { + return _regionEnabled; + } + set { if (_regionEnabled != value) { _regionEnabled = value; UpdateThubmnail(); } - } - } + } + } /// /// Enables mouse regions drawing, simulating one first click on the panel at the current cursor's position. @@ -87,38 +86,38 @@ namespace OnTopReplica { OnMouseDown(new MouseEventArgs(System.Windows.Forms.MouseButtons.Left, 1, localCursor.X, localCursor.Y, 0)); } - bool _drawMouseRegions = false; + bool _drawMouseRegions = false; /// /// Gets or sets whether the control is is "region drawing" mode and reports them via events. /// - public bool DrawMouseRegions { - get { - return _drawMouseRegions; - } - set { - //Set mode and reset region - _drawMouseRegions = value; - _drawingRegion = false; + public bool DrawMouseRegions { + get { + return _drawMouseRegions; + } + set { + //Set mode and reset region + _drawMouseRegions = value; + _drawingRegion = false; - //Cursor change - Cursor = (value) ? Cursors.Cross : Cursors.Default; + //Cursor change + Cursor = (value) ? Cursors.Cross : Cursors.Default; //Refresh gui - UpdateThubmnail(); + UpdateThubmnail(); _labelGlass.Visible = !value; this.Invalidate(); - } - } + } + } /// /// Gets the target opacity of the thumbnail, depending on the control's state. /// - protected byte ThumbnailOpacity { - get { + protected byte ThumbnailOpacity { + get { return (_drawMouseRegions) ? (byte)130 : (byte)255; - } - } + } + } /// /// Gets or sets whether the control should report clicks made on the cloned thumbnail. @@ -138,11 +137,11 @@ namespace OnTopReplica { get { if (_thumbnail != null && !_thumbnail.IsInvalid) { if (_regionEnabled) { - return _currentRegion.ComputeRegionSize(_thumbnail.SourceSize); + return _currentRegion.ComputeRegionSize(_thumbnail.GetSourceSize()); } else { //Thumbnail is not cropped, return full thumbnail source size - return _thumbnail.SourceSize; + return _thumbnail.GetSourceSize(); } } else { @@ -164,7 +163,7 @@ namespace OnTopReplica { public Size ThumbnailOriginalSize { get { if (_thumbnail != null && !_thumbnail.IsInvalid) { - return _thumbnail.SourceSize; + return _thumbnail.GetSourceSize(); } else { #if DEBUG @@ -176,7 +175,7 @@ namespace OnTopReplica { } } - #endregion + #endregion #region GUI event handling @@ -206,7 +205,7 @@ namespace OnTopReplica { /// /// Handle of the window to clone. /// Optional region. - public void SetThumbnailHandle(WindowHandle handle, ThumbnailRegion region) { + public void SetThumbnailHandle(WindowHandle handle, ThumbnailRegion region) { Log.WriteDetails("Setting new thumbnail", "HWND {0}, region {1}", handle, region ); @@ -216,52 +215,52 @@ namespace OnTopReplica { _thumbnail = null; } - //Attempt to get top level Form from Control - Form owner = this.TopLevelControl as Form; + //Attempt to get top level Form from Control + Form owner = this.TopLevelControl as Form; if (owner == null) throw new Exception("Internal error: ThumbnailPanel.TopLevelControl is not a Form."); _labelGlass.Visible = false; //Register new thumbnail, update regioning directly and refresh thumbnail - _thumbnail = DwmManager.Register(owner, handle.Handle); + _thumbnail = DwmManager.Register(owner, handle.Handle); _currentRegion = region; _regionEnabled = (region != null); UpdateThubmnail(); - } + } /// /// Disposes current thumbnail and enters stand-by mode. /// - public void UnsetThumbnail() { + public void UnsetThumbnail() { Log.Write("Unsetting thumbnail"); if (_thumbnail != null && !_thumbnail.IsInvalid) { _thumbnail.Close(); } - _thumbnail = null; + _thumbnail = null; _labelGlass.Visible = true; - } + } /// /// Gets whether the control is currently displaying a thumbnail. /// - public bool IsShowingThumbnail { - get { - return (_thumbnail != null && !_thumbnail.IsInvalid); - } - } + public bool IsShowingThumbnail { + get { + return (_thumbnail != null && !_thumbnail.IsInvalid); + } + } - int _padWidth = 0; - int _padHeight = 0; - Size _thumbnailSize; + int _padWidth = 0; + int _padHeight = 0; + Size _thumbnailSize; - /// + /// /// Updates the thumbnail options and the right-click label. /// - private void UpdateThubmnail() { - if (_thumbnail != null && !_thumbnail.IsInvalid){ + private void UpdateThubmnail() { + if (_thumbnail != null && !_thumbnail.IsInvalid){ try { //Get thumbnail size and attempt to fit to control, with padding Size sourceSize = ThumbnailPixelSize; @@ -272,7 +271,7 @@ namespace OnTopReplica { System.Diagnostics.Debug.WriteLine("Fitting {0} inside {1} as {2}. Padding {3},{4}.", sourceSize, Size, _thumbnailSize, _padWidth, _padHeight); var target = new Rectangle(_padWidth, _padHeight, _thumbnailSize.Width, _thumbnailSize.Height); - Rectangle source = (_regionEnabled) ? _currentRegion.ComputeRegionRectangle(_thumbnail.SourceSize) : new Rectangle(Point.Empty, _thumbnail.SourceSize); + Rectangle source = (_regionEnabled) ? _currentRegion.ComputeRegionRectangle(_thumbnail.GetSourceSize()) : new Rectangle(Point.Empty, _thumbnail.GetSourceSize()); _thumbnail.Update(target, source, ThumbnailOpacity, true, true); } @@ -281,12 +280,12 @@ namespace OnTopReplica { UnsetThumbnail(); return; } - } - } + } + } #endregion - #region Region drawing + #region Region drawing const int MinimumRegionSize = 1; @@ -348,39 +347,39 @@ namespace OnTopReplica { OnRegionDrawn(final); } - protected override void OnMouseDown(MouseEventArgs e) { - if (DrawMouseRegions && e.Button == MouseButtons.Left) { + protected override void OnMouseDown(MouseEventArgs e) { + if (DrawMouseRegions && e.Button == MouseButtons.Left) { //Start new region drawing - _drawingRegion = true; + _drawingRegion = true; _drawingSuspended = false; - _regionStartPoint = _regionLastPoint = e.Location; + _regionStartPoint = _regionLastPoint = e.Location; - this.Invalidate(); - } + this.Invalidate(); + } - base.OnMouseDown(e); - } + base.OnMouseDown(e); + } - protected override void OnMouseUp(MouseEventArgs e) { - if (DrawMouseRegions && e.Button == MouseButtons.Left) { + protected override void OnMouseUp(MouseEventArgs e) { + if (DrawMouseRegions && e.Button == MouseButtons.Left) { //Region completed - _drawingRegion = false; + _drawingRegion = false; _drawingSuspended = false; - RaiseRegionDrawn(_regionStartPoint, _regionLastPoint); + RaiseRegionDrawn(_regionStartPoint, _regionLastPoint); - this.Invalidate(); - } + this.Invalidate(); + } - base.OnMouseUp(e); - } + base.OnMouseUp(e); + } - protected override void OnMouseLeave(EventArgs e) { + protected override void OnMouseLeave(EventArgs e) { _drawingSuspended = true; - this.Invalidate(); + this.Invalidate(); - base.OnMouseLeave(e); - } + base.OnMouseLeave(e); + } protected override void OnMouseEnter(EventArgs e) { _drawingSuspended = false; @@ -390,13 +389,13 @@ namespace OnTopReplica { base.OnMouseEnter(e); } - protected override void OnMouseMove(MouseEventArgs e) { - if (_drawingRegion && e.Button == MouseButtons.Left) { + protected override void OnMouseMove(MouseEventArgs e) { + if (_drawingRegion && e.Button == MouseButtons.Left) { //Continue drawing - _regionLastPoint = e.Location; + _regionLastPoint = e.Location; - this.Invalidate(); - } + this.Invalidate(); + } else if(DrawMouseRegions && !_drawingRegion){ //Keep track of region start point _regionLastPoint = e.Location; @@ -404,31 +403,31 @@ namespace OnTopReplica { this.Invalidate(); } - base.OnMouseMove(e); - } + base.OnMouseMove(e); + } - readonly static Pen RedPen = new Pen(Color.FromArgb(255, Color.Red), 1.5f); //TODO: check width + readonly static Pen RedPen = new Pen(Color.FromArgb(255, Color.Red), 1.5f); //TODO: check width - protected override void OnPaint(PaintEventArgs e) { - if (_drawingRegion) { + protected override void OnPaint(PaintEventArgs e) { + if (_drawingRegion) { //Is currently drawing, show rectangle - int left = Math.Min(_regionStartPoint.X, _regionLastPoint.X); - int right = Math.Max(_regionStartPoint.X, _regionLastPoint.X); - int top = Math.Min(_regionStartPoint.Y, _regionLastPoint.Y); - int bottom = Math.Max(_regionStartPoint.Y, _regionLastPoint.Y); + int left = Math.Min(_regionStartPoint.X, _regionLastPoint.X); + int right = Math.Max(_regionStartPoint.X, _regionLastPoint.X); + int top = Math.Min(_regionStartPoint.Y, _regionLastPoint.Y); + int bottom = Math.Max(_regionStartPoint.Y, _regionLastPoint.Y); - e.Graphics.DrawRectangle(RedPen, left, top, right - left, bottom - top); - } + e.Graphics.DrawRectangle(RedPen, left, top, right - left, bottom - top); + } else if (DrawMouseRegions && ! _drawingSuspended) { //Show cursor coordinates e.Graphics.DrawLine(RedPen, new Point(0, _regionLastPoint.Y), new Point(ClientSize.Width, _regionLastPoint.Y)); e.Graphics.DrawLine(RedPen, new Point(_regionLastPoint.X, 0), new Point(_regionLastPoint.X, ClientSize.Height)); } - base.OnPaint(e); - } + base.OnPaint(e); + } - #endregion + #endregion #region Thumbnail clone click @@ -459,12 +458,12 @@ namespace OnTopReplica { /// /// Is raised when the thumbnail clone is clicked. /// - public event EventHandler CloneClick; + public event EventHandler CloneClick; - protected virtual void OnCloneClick(Point location, MouseButtons buttons, bool doubleClick){ + protected virtual void OnCloneClick(Point location, MouseButtons buttons, bool doubleClick){ var evt = CloneClick; - if(evt != null) - evt(this, new CloneClickEventArgs(location, buttons, doubleClick)); + if(evt != null) + evt(this, new CloneClickEventArgs(location, buttons, doubleClick)); } #endregion diff --git a/OnTopReplica/Update/UpdateManager.cs b/OnTopReplica/Update/UpdateManager.cs index de14199..8d9e215 100644 --- a/OnTopReplica/Update/UpdateManager.cs +++ b/OnTopReplica/Update/UpdateManager.cs @@ -146,14 +146,14 @@ namespace OnTopReplica.Update { Instruction = string.Format(Strings.UpdateAvailableInstruction, LastInformation.LatestVersion), Content = Strings.UpdateAvailableContent, CustomButtons = new CustomButton[] { - new CustomButton(Result.OK, string.Format(Strings.UpdateAvailableCommandOk, LastInformation.LatestVersion)), - new CustomButton(Result.Cancel, Strings.UpdateAvailableCommandCancel) + new CustomButton(CommonButtonResult.OK, string.Format(Strings.UpdateAvailableCommandOk, LastInformation.LatestVersion)), + new CustomButton(CommonButtonResult.Cancel, Strings.UpdateAvailableCommandCancel) }, UseCommandLinks = true, - CommonIcon = TaskDialogIcon.Information, + CommonIcon = CommonIcon.Information, ExpandedInformation = string.Format(Strings.UpdateAvailableExpanded, LastInformation.CurrentVersion, LastInformation.LatestVersion), }; - if (updateDialog.Show(AttachedForm).CommonButton == Result.OK) { + if (updateDialog.Show(AttachedForm).CommonButton == CommonButtonResult.OK) { Shell.Execute(LastInformation.DownloadPage); } } @@ -175,9 +175,9 @@ namespace OnTopReplica.Update { Instruction = Strings.UpdateInfoInstruction, Content = Strings.UpdateInfoContent, EnableHyperlinks = true, - CommonButtons = TaskDialogButton.Close, + CommonButtons = CommonButton.Close, AllowDialogCancellation = true, - CommonIcon = TaskDialogIcon.Information, + CommonIcon = CommonIcon.Information, Footer = string.Format(Strings.UpdateInfoFooter, LastInformation.LatestVersionRelease.ToLongDateString()) }; dlg.HyperlinkClick += delegate(object sender, HyperlinkEventArgs args) { diff --git a/OnTopReplica/packages.config b/OnTopReplica/packages.config new file mode 100644 index 0000000..adaf239 --- /dev/null +++ b/OnTopReplica/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file