mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 14:24:43 -07:00
Propagate DPI Changes down to Drawable Containers and Adorners and Resize Grippers Accordingly
This commit is contained in:
parent
1d20faea2b
commit
68d8082c17
7 changed files with 62 additions and 2 deletions
|
@ -22,6 +22,7 @@
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using GreenshotPlugin.Core;
|
||||||
using GreenshotPlugin.Interfaces.Drawing;
|
using GreenshotPlugin.Interfaces.Drawing;
|
||||||
using GreenshotPlugin.Interfaces.Drawing.Adorners;
|
using GreenshotPlugin.Interfaces.Drawing.Adorners;
|
||||||
|
|
||||||
|
@ -31,7 +32,8 @@ namespace Greenshot.Drawing.Adorners
|
||||||
{
|
{
|
||||||
public virtual EditStatus EditStatus { get; protected set; } = EditStatus.IDLE;
|
public virtual EditStatus EditStatus { get; protected set; } = EditStatus.IDLE;
|
||||||
|
|
||||||
protected Size _size = new Size(4, 4);
|
private static readonly Size defaultSize = new Size(4, 4);
|
||||||
|
protected Size _size = defaultSize;
|
||||||
|
|
||||||
public AbstractAdorner(IDrawableContainer owner)
|
public AbstractAdorner(IDrawableContainer owner)
|
||||||
{
|
{
|
||||||
|
@ -127,6 +129,15 @@ namespace Greenshot.Drawing.Adorners
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adjust UI elements to the supplied DPI settings
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dpi"></param>
|
||||||
|
public void AdjustToDpi(uint dpi)
|
||||||
|
{
|
||||||
|
_size = DpiHelper.ScaleWithDpi(defaultSize, dpi);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Draw the adorner
|
/// Draw the adorner
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -397,6 +397,18 @@ namespace Greenshot.Drawing
|
||||||
Draw(graphics, renderMode);
|
Draw(graphics, renderMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adjust UI elements to the supplied DPI settings
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dpi"></param>
|
||||||
|
public void AdjustToDpi(uint dpi)
|
||||||
|
{
|
||||||
|
foreach(var adorner in Adorners)
|
||||||
|
{
|
||||||
|
adorner.AdjustToDpi(dpi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual bool Contains(int x, int y) {
|
public virtual bool Contains(int x, int y) {
|
||||||
return Bounds.Contains(x , y);
|
return Bounds.Contains(x , y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -581,5 +581,16 @@ namespace Greenshot.Drawing {
|
||||||
// Do not change this code. Put cleanup code in Dispose(bool disposing) above.
|
// Do not change this code. Put cleanup code in Dispose(bool disposing) above.
|
||||||
Dispose(true);
|
Dispose(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adjust UI elements to the supplied DPI settings
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dpi"></param>
|
||||||
|
public void AdjustToDpi(uint dpi)
|
||||||
|
{
|
||||||
|
foreach (var drawableContainer in this) {
|
||||||
|
drawableContainer.AdjustToDpi(dpi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -403,6 +403,17 @@ namespace Greenshot.Drawing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ICaptureDetails CaptureDetails { get; set; }
|
public ICaptureDetails CaptureDetails { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adjust UI elements to the supplied DPI settings
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dpi"></param>
|
||||||
|
public void AdjustToDpi(uint dpi)
|
||||||
|
{
|
||||||
|
foreach (var element in this._elements) {
|
||||||
|
element.AdjustToDpi(dpi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base Surface constructor
|
/// Base Surface constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -96,6 +96,8 @@ namespace Greenshot {
|
||||||
destinationsToolStrip.ImageScalingSize = newSize;
|
destinationsToolStrip.ImageScalingSize = newSize;
|
||||||
propertiesToolStrip.ImageScalingSize = newSize;
|
propertiesToolStrip.ImageScalingSize = newSize;
|
||||||
propertiesToolStrip.MinimumSize = new Size(150, newSize.Height + 10);
|
propertiesToolStrip.MinimumSize = new Size(150, newSize.Height + 10);
|
||||||
|
|
||||||
|
_surface.AdjustToDpi(dpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageEditorForm(ISurface iSurface, bool outputMade)
|
public ImageEditorForm(ISurface iSurface, bool outputMade)
|
||||||
|
|
|
@ -87,5 +87,11 @@ namespace GreenshotPlugin.Interfaces.Drawing.Adorners
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="matrix">Matrix</param>
|
/// <param name="matrix">Matrix</param>
|
||||||
void Transform(Matrix matrix);
|
void Transform(Matrix matrix);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adjust UI elements to the supplied DPI settings
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dpi"></param>
|
||||||
|
void AdjustToDpi(uint dpi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,12 @@ namespace GreenshotPlugin.Interfaces.Drawing
|
||||||
/// Available adorners for the DrawableContainer
|
/// Available adorners for the DrawableContainer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IList<IAdorner> Adorners { get; }
|
IList<IAdorner> Adorners { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adjust UI elements to the supplied DPI settings
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dpi"></param>
|
||||||
|
void AdjustToDpi(uint dpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IDrawableContainerList : IList<IDrawableContainer>, IDisposable
|
public interface IDrawableContainerList : IList<IDrawableContainer>, IDisposable
|
||||||
|
@ -164,6 +170,7 @@ namespace GreenshotPlugin.Interfaces.Drawing
|
||||||
void PushElementsToBottom(IDrawableContainerList elements);
|
void PushElementsToBottom(IDrawableContainerList elements);
|
||||||
void ShowContextMenu(MouseEventArgs e, ISurface surface);
|
void ShowContextMenu(MouseEventArgs e, ISurface surface);
|
||||||
void HandleFieldChangedEvent(object sender, FieldChangedEventArgs e);
|
void HandleFieldChangedEvent(object sender, FieldChangedEventArgs e);
|
||||||
|
void AdjustToDpi(uint dpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ITextContainer : IDrawableContainer
|
public interface ITextContainer : IDrawableContainer
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue