diff --git a/Pinta.Core/Actions/Command.cs b/Pinta.Core/Actions/Command.cs index 763f7fc38..ab52575fd 100644 --- a/Pinta.Core/Actions/Command.cs +++ b/Pinta.Core/Actions/Command.cs @@ -48,7 +48,7 @@ public void Activate () public string? IconName { get; } public string FullName => $"app.{Name}"; public bool IsImportant { get; set; } = false; - public bool Sensitive { get { return Action.Enabled; } set { Action.Enabled = value; } } + public bool Sensitive { get => Action.Enabled; set => Action.Enabled = value; } public Command (string name, string label, string? tooltip, string? icon_name, GLib.Variant? state = null) { @@ -85,7 +85,7 @@ public ToggleCommand (string name, string label, string? tooltip, string? stock_ } public bool Value { - get { return GetBoolValue (Action.GetState ()); } + get => GetBoolValue (Action.GetState ()); set { if (value != Value) { Toggled?.Invoke (value); diff --git a/Pinta.Core/Actions/ViewActions.cs b/Pinta.Core/Actions/ViewActions.cs index c4c7f056c..406429d65 100644 --- a/Pinta.Core/Actions/ViewActions.cs +++ b/Pinta.Core/Actions/ViewActions.cs @@ -53,7 +53,7 @@ public class ViewActions private bool zoom_to_window_activated = false; public bool ZoomToWindowActivated { - get { return zoom_to_window_activated; } + get => zoom_to_window_activated; set { zoom_to_window_activated = value; old_zoom_text = ZoomComboBox.ComboBox.GetActiveText ()!; diff --git a/Pinta.Core/Classes/Document.cs b/Pinta.Core/Classes/Document.cs index 135dd066d..c442cdd1d 100644 --- a/Pinta.Core/Classes/Document.cs +++ b/Pinta.Core/Classes/Document.cs @@ -41,7 +41,7 @@ public class Document private DocumentSelection selection = null!; // NRT - Set by constructor via Selection property public DocumentSelection Selection { - get { return selection; } + get => selection; set { selection = value; @@ -118,7 +118,7 @@ public Gio.File? File { public Core.Size ImageSize { get; set; } public bool IsDirty { - get { return is_dirty; } + get => is_dirty; set { if (is_dirty != value) { is_dirty = value; diff --git a/Pinta.Core/Classes/DocumentSelection.cs b/Pinta.Core/Classes/DocumentSelection.cs index aa5a6fa62..749810ef2 100644 --- a/Pinta.Core/Classes/DocumentSelection.cs +++ b/Pinta.Core/Classes/DocumentSelection.cs @@ -44,7 +44,7 @@ public class DocumentSelection private bool _visible = true; public bool Visible { - get { return _visible; } + get => _visible; set { _visible = value; diff --git a/Pinta.Core/Classes/DocumentWorkspace.cs b/Pinta.Core/Classes/DocumentWorkspace.cs index 8d9498711..bc1772570 100644 --- a/Pinta.Core/Classes/DocumentWorkspace.cs +++ b/Pinta.Core/Classes/DocumentWorkspace.cs @@ -71,7 +71,7 @@ public bool ImageViewFitsInWindow { /// Size of the zoomed image. /// public Size ViewSize { - get { return view_size; } + get => view_size; set { if (view_size.Width != value.Width || view_size.Height != value.Height) { view_size = value; @@ -108,7 +108,7 @@ public bool ImageFitsInWindow { /// Scale factor for the zoomed image. /// public double Scale { - get { return (double) ViewSize.Width / (double) document.ImageSize.Width; } + get => (double) ViewSize.Width / (double) document.ImageSize.Width; set { if (value != (double) ViewSize.Width / (double) document.ImageSize.Width || value != (double) ViewSize.Height / (double) document.ImageSize.Height) { if (document.ImageSize.Width == 0) { diff --git a/Pinta.Core/Classes/Layer.cs b/Pinta.Core/Classes/Layer.cs index 5061afe14..14d6ae5df 100644 --- a/Pinta.Core/Classes/Layer.cs +++ b/Pinta.Core/Classes/Layer.cs @@ -62,22 +62,22 @@ public Layer (ImageSurface surface, bool hidden, double opacity, string name) public static readonly string BlendModeProperty = "BlendMode"; public double Opacity { - get { return opacity; } + get => opacity; set { if (opacity != value) SetValue (OpacityProperty, ref opacity, value); } } public bool Hidden { - get { return hidden; } + get => hidden; set { if (hidden != value) SetValue (HiddenProperty, ref hidden, value); } } public string Name { - get { return name; } + get => name; set { if (name != value) SetValue (NameProperty, ref name, value); } } public BlendMode BlendMode { - get { return blend_mode; } + get => blend_mode; set { if (blend_mode != value) SetValue (BlendModeProperty, ref blend_mode, value); } } diff --git a/Pinta.Core/Classes/Palette.cs b/Pinta.Core/Classes/Palette.cs index f873adf54..522a2bac3 100644 --- a/Pinta.Core/Classes/Palette.cs +++ b/Pinta.Core/Classes/Palette.cs @@ -53,9 +53,7 @@ private void OnPaletteChanged () public int Count => colors.Count; public Color this[int index] { - get { - return colors[index]; - } + get => colors[index]; set { colors[index] = value; diff --git a/Pinta.Core/Classes/Re-editable/ReEditableLayer.cs b/Pinta.Core/Classes/Re-editable/ReEditableLayer.cs index 14a4b39eb..f662342d2 100644 --- a/Pinta.Core/Classes/Re-editable/ReEditableLayer.cs +++ b/Pinta.Core/Classes/Re-editable/ReEditableLayer.cs @@ -48,9 +48,7 @@ public Layer Layer { return actualLayer!; // NRT - Set in SetupLayer } - set { - actualLayer = value; - } + set => actualLayer = value; } public bool IsLayerSetup => isLayerSetup; diff --git a/Pinta.Core/Classes/Re-editable/Text/TextLayout.cs b/Pinta.Core/Classes/Re-editable/Text/TextLayout.cs index 9d4f672f0..193254aaf 100644 --- a/Pinta.Core/Classes/Re-editable/Text/TextLayout.cs +++ b/Pinta.Core/Classes/Re-editable/Text/TextLayout.cs @@ -35,7 +35,7 @@ public class TextLayout private TextEngine engine = null!; // NRT - Not sure how this is set, but all callers assume it is not-null public TextEngine Engine { - get { return engine; } + get => engine; set { if (engine != null) engine.Modified -= OnEngineModified; diff --git a/Pinta.Core/Classes/Re-editable/Text/TextPosition.cs b/Pinta.Core/Classes/Re-editable/Text/TextPosition.cs index 77e2c57f1..61559c4c2 100644 --- a/Pinta.Core/Classes/Re-editable/Text/TextPosition.cs +++ b/Pinta.Core/Classes/Re-editable/Text/TextPosition.cs @@ -23,13 +23,13 @@ public TextPosition (int line, int offset) } public int Line { - readonly get { return line; } - set { line = Math.Max (value, 0); } + readonly get => line; + set => line = Math.Max (value, 0); } public int Offset { - readonly get { return offset; } - set { offset = Math.Max (value, 0); } + readonly get => offset; + set => offset = Math.Max (value, 0); } #region Operators diff --git a/Pinta.Core/Effects/Histogram.cs b/Pinta.Core/Effects/Histogram.cs index 94cccf00d..a15fdee10 100644 --- a/Pinta.Core/Effects/Histogram.cs +++ b/Pinta.Core/Effects/Histogram.cs @@ -19,9 +19,7 @@ public abstract class Histogram { protected long[][] histogram; public long[][] HistogramValues { - get { - return this.histogram; - } + get => this.histogram; set { if (value.Length == this.histogram.Length && value[0].Length == this.histogram[0].Length) { diff --git a/Pinta.Core/Effects/UnaryPixelOps.cs b/Pinta.Core/Effects/UnaryPixelOps.cs index 23fdc6dd5..d4b95025f 100644 --- a/Pinta.Core/Effects/UnaryPixelOps.cs +++ b/Pinta.Core/Effects/UnaryPixelOps.cs @@ -427,9 +427,7 @@ public class Level { private ColorBgra color_in_low; public ColorBgra ColorInLow { - get { - return color_in_low; - } + get => color_in_low; set { if (value.R == 255) { @@ -463,9 +461,7 @@ public ColorBgra ColorInLow { private ColorBgra color_in_high; public ColorBgra ColorInHigh { - get { - return color_in_high; - } + get => color_in_high; set { if (value.R == 0) { @@ -499,9 +495,7 @@ public ColorBgra ColorInHigh { private ColorBgra color_out_low; public ColorBgra ColorOutLow { - get { - return color_out_low; - } + get => color_out_low; set { if (value.R == 255) { @@ -535,9 +529,7 @@ public ColorBgra ColorOutLow { private ColorBgra color_out_high; public ColorBgra ColorOutHigh { - get { - return color_out_high; - } + get => color_out_high; set { if (value.R == 0) { diff --git a/Pinta.Core/Extensions/GioStream.cs b/Pinta.Core/Extensions/GioStream.cs index 631f41642..a83eb8591 100644 --- a/Pinta.Core/Extensions/GioStream.cs +++ b/Pinta.Core/Extensions/GioStream.cs @@ -108,9 +108,7 @@ public override long Position { throw new ObjectDisposedException ("The stream is closed"); return ((Gio.Seekable) stream).Tell (); } - set { - Seek (value, System.IO.SeekOrigin.Begin); - } + set => Seek (value, System.IO.SeekOrigin.Begin); } public override void Flush () diff --git a/Pinta.Core/Managers/ChromeManager.cs b/Pinta.Core/Managers/ChromeManager.cs index 3999cf4b1..c45cf44e3 100644 --- a/Pinta.Core/Managers/ChromeManager.cs +++ b/Pinta.Core/Managers/ChromeManager.cs @@ -60,7 +60,7 @@ public ChromeManager () #region Public Properties public PointI LastCanvasCursorPoint { - get { return last_canvas_cursor_point; } + get => last_canvas_cursor_point; set { if (last_canvas_cursor_point != value) { last_canvas_cursor_point = value; @@ -70,7 +70,7 @@ public PointI LastCanvasCursorPoint { } public bool MainWindowBusy { - get { return main_window_busy; } + get => main_window_busy; set { main_window_busy = value; diff --git a/Pinta.Core/Managers/RecentFileManager.cs b/Pinta.Core/Managers/RecentFileManager.cs index b7c272706..d6eccb287 100644 --- a/Pinta.Core/Managers/RecentFileManager.cs +++ b/Pinta.Core/Managers/RecentFileManager.cs @@ -39,7 +39,7 @@ public RecentFileManager () } public Gio.File? LastDialogDirectory { - get { return last_dialog_directory; } + get => last_dialog_directory; set { // The file chooser dialog may return null for the current folder in certain cases, // such as the Recently Used pane in the Gnome file chooser. diff --git a/Pinta.Effects/Adjustments/BrightnessContrastEffect.cs b/Pinta.Effects/Adjustments/BrightnessContrastEffect.cs index 947c18dcb..36d6aacaa 100644 --- a/Pinta.Effects/Adjustments/BrightnessContrastEffect.cs +++ b/Pinta.Effects/Adjustments/BrightnessContrastEffect.cs @@ -139,7 +139,7 @@ public class BrightnessContrastData : EffectData [Caption ("Brightness")] public int Brightness { - get { return brightness; } + get => brightness; set { if (value != brightness) { brightness = value; @@ -150,7 +150,7 @@ public int Brightness { [Caption ("Contrast")] public int Contrast { - get { return contrast; } + get => contrast; set { if (value != contrast) { contrast = value; diff --git a/Pinta.Effects/Dialogs/Effects.CurvesDialog.cs b/Pinta.Effects/Dialogs/Effects.CurvesDialog.cs index 89c5bacd8..89429fb5a 100644 --- a/Pinta.Effects/Dialogs/Effects.CurvesDialog.cs +++ b/Pinta.Effects/Dialogs/Effects.CurvesDialog.cs @@ -67,9 +67,7 @@ private class ControlPointDrawingInfo private SortedList[] rgb_cps = null!; public SortedList[] ControlPoints { - get { - return (Mode == ColorTransferMode.Luminosity) ? luminosity_cps : rgb_cps; - } + get => (Mode == ColorTransferMode.Luminosity) ? luminosity_cps : rgb_cps; set { if (Mode == ColorTransferMode.Luminosity) luminosity_cps = value; diff --git a/Pinta.Gui.Widgets/Widgets/PointPickerWidget.cs b/Pinta.Gui.Widgets/Widgets/PointPickerWidget.cs index 5aeb46fd2..e17496bfc 100644 --- a/Pinta.Gui.Widgets/Widgets/PointPickerWidget.cs +++ b/Pinta.Gui.Widgets/Widgets/PointPickerWidget.cs @@ -76,14 +76,10 @@ public PointI Point { } public PointD DefaultOffset { - get { - return new PointD ((DefaultPoint.X * 2.0 / PintaCore.Workspace.ImageSize.Width) - 1.0, + get => new PointD ((DefaultPoint.X * 2.0 / PintaCore.Workspace.ImageSize.Width) - 1.0, (DefaultPoint.Y * 2.0 / PintaCore.Workspace.ImageSize.Height) - 1.0); - } - set { - DefaultPoint = new PointI ((int) ((value.X + 1.0) * PintaCore.Workspace.ImageSize.Width / 2.0), + set => DefaultPoint = new PointI ((int) ((value.X + 1.0) * PintaCore.Workspace.ImageSize.Width / 2.0), (int) ((value.Y + 1.0) * PintaCore.Workspace.ImageSize.Height / 2.0)); - } } public PointD Offset diff --git a/Pinta.Tools/Editable/EditEngines/BaseEditEngine.cs b/Pinta.Tools/Editable/EditEngines/BaseEditEngine.cs index 896d0e137..ebafe7a50 100644 --- a/Pinta.Tools/Editable/EditEngines/BaseEditEngine.cs +++ b/Pinta.Tools/Editable/EditEngines/BaseEditEngine.cs @@ -60,13 +60,13 @@ public enum ShapeTypes protected PointD current_point; public static Color OutlineColor { - get { return PintaCore.Palette.PrimaryColor; } - set { PintaCore.Palette.PrimaryColor = value; } + get => PintaCore.Palette.PrimaryColor; + set => PintaCore.Palette.PrimaryColor = value; } public static Color FillColor { - get { return PintaCore.Palette.SecondaryColor; } - set { PintaCore.Palette.SecondaryColor = value; } + get => PintaCore.Palette.SecondaryColor; + set => PintaCore.Palette.SecondaryColor = value; } // NRT - Created by HandleBuildToolBar diff --git a/Pinta.Tools/Tools/TextTool.cs b/Pinta.Tools/Tools/TextTool.cs index 8252b959e..78ead3f53 100644 --- a/Pinta.Tools/Tools/TextTool.cs +++ b/Pinta.Tools/Tools/TextTool.cs @@ -41,9 +41,7 @@ public class TextTool : BaseTool private readonly Pinta.Core.TextLayout layout; private RectangleI CurrentTextBounds { - get { - return PintaCore.Workspace.ActiveDocument.Layers.CurrentUserLayer.textBounds; - } + get => PintaCore.Workspace.ActiveDocument.Layers.CurrentUserLayer.textBounds; set { PintaCore.Workspace.ActiveDocument.Layers.CurrentUserLayer.previousTextBounds = PintaCore.Workspace.ActiveDocument.Layers.CurrentUserLayer.textBounds; diff --git a/Pinta/Actions/File/DBus/ScreenshotPortal.cs b/Pinta/Actions/File/DBus/ScreenshotPortal.cs index 9bade5282..4e9223682 100644 --- a/Pinta/Actions/File/DBus/ScreenshotPortal.cs +++ b/Pinta/Actions/File/DBus/ScreenshotPortal.cs @@ -28,13 +28,9 @@ class ScreenshotProperties { private uint _version = default (uint); public uint Version { - get { - return _version; - } + get => _version; - set { - _version = (value); - } + set => _version = (value); } } diff --git a/Pinta/Dialogs/ProgressDialog.cs b/Pinta/Dialogs/ProgressDialog.cs index 4b32b70f0..67f175d3c 100644 --- a/Pinta/Dialogs/ProgressDialog.cs +++ b/Pinta/Dialogs/ProgressDialog.cs @@ -55,13 +55,13 @@ public ProgressDialog () } public string Text { - get { return label.GetText (); } - set { label.SetText (value); } + get => label.GetText (); + set => label.SetText (value); } public double Progress { - get { return progress_bar.Fraction; } - set { progress_bar.Fraction = value; } + get => progress_bar.Fraction; + set => progress_bar.Fraction = value; } public event EventHandler? Canceled; diff --git a/Pinta/Options.cs b/Pinta/Options.cs index e14f73254..5d18b5c14 100644 --- a/Pinta/Options.cs +++ b/Pinta/Options.cs @@ -194,7 +194,7 @@ internal OptionValueCollection (OptionContext c) void IList.Remove (object value) { (values as IList).Remove (value); } void IList.RemoveAt (int index) { (values as IList).RemoveAt (index); } bool IList.IsFixedSize => false; - object IList.this[int index] { get { return this[index]; } set { (values as IList)[index] = value; } } + object IList.this[int index] { get => this[index]; set => (values as IList)[index] = value; } #endregion #region IList @@ -220,9 +220,7 @@ public string this[int index] { AssertValid (index); return index >= values.Count ? null : values[index]; } - set { - values[index] = value; - } + set => values[index] = value; } #endregion @@ -257,18 +255,18 @@ public OptionContext (OptionSet set) } public Option Option { - get { return option; } - set { option = value; } + get => option; + set => option = value; } public string OptionName { - get { return name; } - set { name = value; } + get => name; + set => name = value; } public int OptionIndex { - get { return index; } - set { index = value; } + get => index; + set => index = value; } public OptionSet OptionSet => set;