mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
Small cleanups [skip ci]
This commit is contained in:
parent
02a06a12b0
commit
98e6be5eb6
171 changed files with 1607 additions and 1769 deletions
|
@ -22,7 +22,6 @@ using System;
|
|||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using Greenshot.Drawing;
|
||||
using log4net;
|
||||
|
||||
namespace Greenshot.Helpers {
|
||||
/// <summary>
|
||||
|
@ -45,9 +44,7 @@ namespace Greenshot.Helpers {
|
|||
/// </summary>
|
||||
Rational = 0x02
|
||||
}
|
||||
|
||||
private static readonly ILog LOG = LogManager.GetLogger(typeof(ScaleHelper));
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// calculates the Size an element must be resized to, in order to fit another element, keeping aspect ratio
|
||||
/// </summary>
|
||||
|
@ -77,7 +74,7 @@ namespace Greenshot.Helpers {
|
|||
newRect.X = (targetRect.Width - currentRect.Width) / 2;
|
||||
break;
|
||||
case ContentAlignment.TopRight:
|
||||
newRect.X = (targetRect.Width - currentRect.Width);
|
||||
newRect.X = targetRect.Width - currentRect.Width;
|
||||
break;
|
||||
case ContentAlignment.MiddleLeft:
|
||||
newRect.Y = (targetRect.Height - currentRect.Height) / 2;
|
||||
|
@ -88,18 +85,18 @@ namespace Greenshot.Helpers {
|
|||
break;
|
||||
case ContentAlignment.MiddleRight:
|
||||
newRect.Y = (targetRect.Height - currentRect.Height) / 2;
|
||||
newRect.X = (targetRect.Width - currentRect.Width);
|
||||
newRect.X = targetRect.Width - currentRect.Width;
|
||||
break;
|
||||
case ContentAlignment.BottomLeft:
|
||||
newRect.Y = (targetRect.Height - currentRect.Height);
|
||||
newRect.Y = targetRect.Height - currentRect.Height;
|
||||
break;
|
||||
case ContentAlignment.BottomCenter:
|
||||
newRect.Y = (targetRect.Height - currentRect.Height);
|
||||
newRect.Y = targetRect.Height - currentRect.Height;
|
||||
newRect.X = (targetRect.Width - currentRect.Width) / 2;
|
||||
break;
|
||||
case ContentAlignment.BottomRight:
|
||||
newRect.Y = (targetRect.Height - currentRect.Height);
|
||||
newRect.X = (targetRect.Width - currentRect.Width);
|
||||
newRect.Y = targetRect.Height - currentRect.Height;
|
||||
newRect.X = targetRect.Width - currentRect.Width;
|
||||
break;
|
||||
}
|
||||
return newRect;
|
||||
|
@ -323,7 +320,7 @@ namespace Greenshot.Helpers {
|
|||
/// <returns>the current ScaleOptions depending on modifier keys held down</returns>
|
||||
public static ScaleOptions GetScaleOptions() {
|
||||
bool anchorAtCenter = (Control.ModifierKeys & Keys.Control) != 0;
|
||||
bool maintainAspectRatio = ((Control.ModifierKeys & Keys.Shift) != 0);
|
||||
bool maintainAspectRatio = (Control.ModifierKeys & Keys.Shift) != 0;
|
||||
ScaleOptions opts = ScaleOptions.Default;
|
||||
if(anchorAtCenter) opts |= ScaleOptions.Centered;
|
||||
if(maintainAspectRatio) opts |= ScaleOptions.Rational;
|
||||
|
@ -349,7 +346,7 @@ namespace Greenshot.Helpers {
|
|||
}
|
||||
}
|
||||
public class FixedAngleRoundBehavior : IDoubleProcessor {
|
||||
private double fixedAngle;
|
||||
private readonly double fixedAngle;
|
||||
public FixedAngleRoundBehavior(double fixedAngle) {
|
||||
this.fixedAngle = fixedAngle;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue