mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 18:57:28 -07:00
Code quality changes [skip ci]
This commit is contained in:
parent
61cfe004c5
commit
798ca503a5
108 changed files with 1981 additions and 2258 deletions
|
@ -24,7 +24,6 @@ using Greenshot.Plugin.Drawing.Adorners;
|
|||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
using System;
|
||||
|
||||
namespace Greenshot.Drawing.Adorners
|
||||
{
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
using Greenshot.Helpers;
|
||||
using Greenshot.Plugin.Drawing;
|
||||
using Greenshot.Plugin.Drawing.Adorners;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
using Greenshot.Helpers;
|
||||
using Greenshot.Plugin.Drawing;
|
||||
using Greenshot.Plugin.Drawing.Adorners;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
*/
|
||||
|
||||
using Greenshot.Configuration;
|
||||
using Greenshot.Drawing.Fields;
|
||||
using Greenshot.Memento;
|
||||
using Greenshot.Plugin;
|
||||
using Greenshot.Plugin.Drawing;
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Greenshot.Drawing.Fields
|
|||
{
|
||||
/// <summary>
|
||||
/// Basic IFieldHolderWithChildren implementation. Similar to IFieldHolder,
|
||||
/// but has a List<IFieldHolder> of children.
|
||||
/// but has a List of IFieldHolder for children.
|
||||
/// Field values are passed to and from children as well.
|
||||
/// </summary>
|
||||
[Serializable()]
|
||||
|
|
|
@ -22,7 +22,7 @@ using System;
|
|||
|
||||
namespace Greenshot.Drawing.Fields.Binding {
|
||||
/// <summary>
|
||||
/// Converts decimal to double (%) and vice versa, e.g. 95f <---> 0.95d
|
||||
/// Converts decimal to double (%) and vice versa, e.g. 95f to 0.95d
|
||||
/// </summary>
|
||||
public class DecimalDoublePercentageConverter : AbstractBindingConverter<double, decimal>
|
||||
{
|
||||
|
|
|
@ -23,7 +23,6 @@ using Greenshot.Configuration;
|
|||
using Greenshot.IniFile;
|
||||
using Greenshot.Plugin;
|
||||
using Greenshot.Plugin.Drawing;
|
||||
using GreenshotPlugin.Interfaces;
|
||||
using GreenshotPlugin.Interfaces.Drawing;
|
||||
using log4net;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -25,12 +25,12 @@ using System.Drawing;
|
|||
using Greenshot.Drawing.Fields;
|
||||
using Greenshot.Plugin.Drawing;
|
||||
|
||||
/// <summary>
|
||||
/// Graphical filter which can be added to DrawableContainer.
|
||||
/// Subclasses should fulfill INotifyPropertyChanged contract, i.e. call
|
||||
/// OnPropertyChanged whenever a public property has been changed.
|
||||
/// </summary>
|
||||
namespace Greenshot.Drawing.Filters {
|
||||
/// <summary>
|
||||
/// Graphical filter which can be added to DrawableContainer.
|
||||
/// Subclasses should fulfill INotifyPropertyChanged contract, i.e. call
|
||||
/// OnPropertyChanged whenever a public property has been changed.
|
||||
/// </summary>
|
||||
[Serializable()]
|
||||
public abstract class AbstractFilter : AbstractFieldHolder, IFilter {
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Greenshot.Drawing {
|
|||
/// To make sure that deleting recalculates, we check the location before every draw.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class StepLabelContainer : DrawableContainer {
|
||||
public sealed class StepLabelContainer : DrawableContainer {
|
||||
[NonSerialized]
|
||||
private StringFormat _stringFormat = new StringFormat();
|
||||
|
||||
|
@ -103,7 +103,7 @@ namespace Greenshot.Drawing {
|
|||
}
|
||||
base.SwitchParent(newParent);
|
||||
if (newParent != null) {
|
||||
((Surface)Parent).AddStepLabel(this);
|
||||
((Surface)Parent)?.AddStepLabel(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,8 +207,8 @@ namespace Greenshot.Drawing {
|
|||
EllipseContainer.DrawEllipse(rect, graphics, rm, 0, Color.Transparent, fillColor, false);
|
||||
}
|
||||
using (FontFamily fam = new FontFamily(FontFamily.GenericSansSerif.Name)) {
|
||||
using (Font _font = new Font(fam, fontSize, FontStyle.Bold, GraphicsUnit.Pixel)) {
|
||||
TextContainer.DrawText(graphics, rect, 0, lineColor, false, _stringFormat, text, _font);
|
||||
using (Font font = new Font(fam, fontSize, FontStyle.Bold, GraphicsUnit.Pixel)) {
|
||||
TextContainer.DrawText(graphics, rect, 0, lineColor, false, _stringFormat, text, font);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace Greenshot.Drawing
|
|||
/// <summary>
|
||||
/// Description of Surface.
|
||||
/// </summary>
|
||||
public class Surface : Control, ISurface
|
||||
public sealed class Surface : Control, ISurface
|
||||
{
|
||||
private static ILog LOG = LogManager.GetLogger(typeof(Surface));
|
||||
public static int Count = 0;
|
||||
|
@ -1609,6 +1609,7 @@ namespace Greenshot.Drawing
|
|||
/// <param name="elementToRemove">Element to remove</param>
|
||||
/// <param name="makeUndoable">flag specifying if the remove needs to be undoable</param>
|
||||
/// <param name="invalidate">flag specifying if an surface invalidate needs to be called</param>
|
||||
/// <param name="generateEvents">false to skip event generation</param>
|
||||
public void RemoveElement(IDrawableContainer elementToRemove, bool makeUndoable = true, bool invalidate = true, bool generateEvents = true)
|
||||
{
|
||||
DeselectElement(elementToRemove, generateEvents);
|
||||
|
@ -1639,7 +1640,6 @@ namespace Greenshot.Drawing
|
|||
/// </summary>
|
||||
/// <param name="elementsToAdd">DrawableContainerList</param>
|
||||
/// <param name="makeUndoable">true if the adding should be undoable</param>
|
||||
/// <param name="invalidate">true if invalidate needs to be called</param>
|
||||
public void AddElements(IDrawableContainerList elementsToAdd, bool makeUndoable = true)
|
||||
{
|
||||
// fix potential issues with iterating a changing list
|
||||
|
@ -1901,7 +1901,8 @@ namespace Greenshot.Drawing
|
|||
/// <summary>
|
||||
/// Deselect the specified element
|
||||
/// </summary>
|
||||
/// <param name="container"></param>
|
||||
/// <param name="container">IDrawableContainerList</param>
|
||||
/// <param name="generateEvents">false to skip event generation</param>
|
||||
public void DeselectElement(IDrawableContainer container, bool generateEvents = true)
|
||||
{
|
||||
container.Selected = false;
|
||||
|
@ -1909,8 +1910,7 @@ namespace Greenshot.Drawing
|
|||
FieldAggregator.UnbindElement(container);
|
||||
if (generateEvents && _movingElementChanged != null)
|
||||
{
|
||||
SurfaceElementEventArgs eventArgs = new SurfaceElementEventArgs();
|
||||
eventArgs.Elements = selectedElements;
|
||||
SurfaceElementEventArgs eventArgs = new SurfaceElementEventArgs {Elements = selectedElements};
|
||||
_movingElementChanged(this, eventArgs);
|
||||
}
|
||||
}
|
||||
|
@ -1918,7 +1918,7 @@ namespace Greenshot.Drawing
|
|||
/// <summary>
|
||||
/// Deselect the specified elements
|
||||
/// </summary>
|
||||
/// <param name="container"></param>
|
||||
/// <param name="elements">IDrawableContainerList</param>
|
||||
public void DeselectElements(IDrawableContainerList elements)
|
||||
{
|
||||
if (elements.Count == 0)
|
||||
|
@ -1951,6 +1951,8 @@ namespace Greenshot.Drawing
|
|||
/// Select the supplied element
|
||||
/// </summary>
|
||||
/// <param name="container"></param>
|
||||
/// <param name="invalidate">false to skip invalidation</param>
|
||||
/// <param name="generateEvents">false to skip event generation</param>
|
||||
public void SelectElement(IDrawableContainer container, bool invalidate = true, bool generateEvents = true)
|
||||
{
|
||||
if (!selectedElements.Contains(container))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue