From 6bb42aed361c3c162b9222a257b89391aefec4af Mon Sep 17 00:00:00 2001 From: Lehonti Ramos Date: Wed, 9 Aug 2023 20:44:14 +0200 Subject: [PATCH 1/2] Initialization of object properties is made in initialization block --- Pinta.Core/Actions/ImageActions.cs | 8 ++-- Pinta.Core/Classes/AsyncEffectRenderer.cs | 38 ++++++++-------- Pinta.Core/Classes/Document.cs | 7 +-- Pinta.Core/Effects/ColorBgra.cs | 34 +++++++------- Pinta.Core/Effects/UnaryPixelOps.cs | 10 ++--- Pinta.Core/ImageFormats/OraFormat.cs | 10 +++-- Pinta.Core/ImageFormats/TgaExporter.cs | 28 ++++++------ .../Dialogs/Effects.PosterizeDialog.cs | 15 ++++--- .../Widgets/AnglePickerWidget.cs | 7 +-- .../Widgets/PointPickerWidget.cs | 7 +-- Pinta.Tools/Editable/Shapes/Arrow.cs | 12 ++--- Pinta.Tools/Tools/EraserTool.cs | 5 ++- Pinta.Tools/Tools/LassoSelectTool.cs | 5 ++- Pinta.Tools/Tools/PaintBucketTool.cs | 5 ++- Pinta.Tools/Tools/TextTool.cs | 45 ++++++++++--------- Pinta/Dialogs/LayerPropertiesDialog.cs | 7 +-- Pinta/Dialogs/NewImageDialog.cs | 43 +++++++++--------- Pinta/Dialogs/ResizeCanvasDialog.cs | 9 ++-- Pinta/MainWindow.cs | 17 +++---- 19 files changed, 168 insertions(+), 144 deletions(-) diff --git a/Pinta.Core/Actions/ImageActions.cs b/Pinta.Core/Actions/ImageActions.cs index 134323241..8f3dde19e 100644 --- a/Pinta.Core/Actions/ImageActions.cs +++ b/Pinta.Core/Actions/ImageActions.cs @@ -281,10 +281,10 @@ static void CropImageToRectangle (Document doc, RectangleI rect, Path? selection if (rect.Width <= 0 || rect.Height <= 0) return; - ResizeHistoryItem hist = new ResizeHistoryItem (doc.ImageSize); - - hist.Icon = Resources.Icons.ImageCrop; - hist.Text = Translations.GetString ("Crop to Selection"); + ResizeHistoryItem hist = new ResizeHistoryItem (doc.ImageSize) { + Icon = Resources.Icons.ImageCrop, + Text = Translations.GetString ("Crop to Selection") + }; hist.StartSnapshotOfImage (); hist.RestoreSelection = doc.Selection.Clone (); diff --git a/Pinta.Core/Classes/AsyncEffectRenderer.cs b/Pinta.Core/Classes/AsyncEffectRenderer.cs index 98212ec12..362539e85 100644 --- a/Pinta.Core/Classes/AsyncEffectRenderer.cs +++ b/Pinta.Core/Classes/AsyncEffectRenderer.cs @@ -184,26 +184,26 @@ void StartRender () int threadCount = settings.ThreadCount; var slaves = new Thread[threadCount - 1]; for (int threadId = 1; threadId < threadCount; threadId++) - slaves[threadId - 1] = StartSlaveThread (renderId, threadId); - - // Start the master render thread. - var master = new Thread (() => { - - // Do part of the rendering on the master thread. - Render (renderId, 0); - - // Wait for slave threads to complete. + slaves[threadId - 1] = StartSlaveThread (renderId, threadId); + + // Start the master render thread. + var master = new Thread (() => { + + // Do part of the rendering on the master thread. + Render (renderId, 0); + + // Wait for slave threads to complete. foreach (var slave in slaves) - slave.Join (); - - // Change back to the UI thread to notify of completion. + slave.Join (); + + // Change back to the UI thread to notify of completion. GLib.Functions.TimeoutAdd (0, 0, () => { HandleRenderCompletion (); - return false; // don't call the timer again + return false; // don't call the timer again }); - }); - - master.Priority = settings.ThreadPriority; + }) { + Priority = settings.ThreadPriority + }; master.Start (); // Start timer used to periodically fire update events on the UI thread. @@ -214,9 +214,9 @@ Thread StartSlaveThread (int renderId, int threadId) { var slave = new Thread (() => { Render (renderId, threadId); - }); - - slave.Priority = settings.ThreadPriority; + }) { + Priority = settings.ThreadPriority + }; slave.Start (); return slave; diff --git a/Pinta.Core/Classes/Document.cs b/Pinta.Core/Classes/Document.cs index c442cdd1d..36f17c88b 100644 --- a/Pinta.Core/Classes/Document.cs +++ b/Pinta.Core/Classes/Document.cs @@ -294,9 +294,10 @@ public void ResizeCanvas (int width, int height, Anchor anchor, CompoundHistoryI PintaCore.Tools.Commit (); - ResizeHistoryItem hist = new ResizeHistoryItem (ImageSize); - hist.Icon = Resources.Icons.ImageResizeCanvas; - hist.Text = Translations.GetString ("Resize Canvas"); + ResizeHistoryItem hist = new ResizeHistoryItem (ImageSize) { + Icon = Resources.Icons.ImageResizeCanvas, + Text = Translations.GetString ("Resize Canvas") + }; hist.StartSnapshotOfImage (); scale = Workspace.Scale; diff --git a/Pinta.Core/Effects/ColorBgra.cs b/Pinta.Core/Effects/ColorBgra.cs index 2849f1a6c..99352591e 100644 --- a/Pinta.Core/Effects/ColorBgra.cs +++ b/Pinta.Core/Effects/ColorBgra.cs @@ -191,8 +191,9 @@ public readonly ColorBgra NewAlpha (byte newA) /// public static ColorBgra FromBgra (byte b, byte g, byte r, byte a) { - ColorBgra color = new ColorBgra (); - color.Bgra = BgraToUInt32 (b, g, r, a); + ColorBgra color = new ColorBgra { + Bgra = BgraToUInt32 (b, g, r, a) + }; return color; } @@ -259,8 +260,9 @@ public static ColorBgra FromBgr (byte b, byte g, byte r) /// public static ColorBgra FromUInt32 (UInt32 bgra) { - ColorBgra color = new ColorBgra (); - color.Bgra = bgra; + ColorBgra color = new ColorBgra { + Bgra = bgra + }; return color; } @@ -313,12 +315,12 @@ public static ColorBgra Blend (ColorBgra ca, ColorBgra cb, byte cbAlpha) /// public static ColorBgra Lerp (ColorBgra from, ColorBgra to, float frac) { - ColorBgra ret = new ColorBgra (); - - ret.B = (byte) ClampToByte (Lerp (from.B, to.B, frac)); - ret.G = (byte) ClampToByte (Lerp (from.G, to.G, frac)); - ret.R = (byte) ClampToByte (Lerp (from.R, to.R, frac)); - ret.A = (byte) ClampToByte (Lerp (from.A, to.A, frac)); + ColorBgra ret = new ColorBgra { + B = (byte) ClampToByte (Lerp (from.B, to.B, frac)), + G = (byte) ClampToByte (Lerp (from.G, to.G, frac)), + R = (byte) ClampToByte (Lerp (from.R, to.R, frac)), + A = (byte) ClampToByte (Lerp (from.A, to.A, frac)) + }; return ret; } @@ -343,12 +345,12 @@ public static double Lerp (double from, double to, double frac) /// public static ColorBgra Lerp (ColorBgra from, ColorBgra to, double frac) { - ColorBgra ret = new ColorBgra (); - - ret.B = (byte) ClampToByte (Lerp (from.B, to.B, frac)); - ret.G = (byte) ClampToByte (Lerp (from.G, to.G, frac)); - ret.R = (byte) ClampToByte (Lerp (from.R, to.R, frac)); - ret.A = (byte) ClampToByte (Lerp (from.A, to.A, frac)); + ColorBgra ret = new ColorBgra { + B = (byte) ClampToByte (Lerp (from.B, to.B, frac)), + G = (byte) ClampToByte (Lerp (from.G, to.G, frac)), + R = (byte) ClampToByte (Lerp (from.R, to.R, frac)), + A = (byte) ClampToByte (Lerp (from.A, to.A, frac)) + }; return ret; } diff --git a/Pinta.Core/Effects/UnaryPixelOps.cs b/Pinta.Core/Effects/UnaryPixelOps.cs index d4b95025f..151438306 100644 --- a/Pinta.Core/Effects/UnaryPixelOps.cs +++ b/Pinta.Core/Effects/UnaryPixelOps.cs @@ -686,11 +686,11 @@ public void UnApply (ColorBgra after, float[] beforeOut, float[] slopesOut) public object Clone () { - Level copy = new Level (color_in_low, color_in_high, (float[]) gamma.Clone (), color_out_low, color_out_high); - - copy.CurveB = (byte[]) this.CurveB.Clone (); - copy.CurveG = (byte[]) this.CurveG.Clone (); - copy.CurveR = (byte[]) this.CurveR.Clone (); + Level copy = new Level (color_in_low, color_in_high, (float[]) gamma.Clone (), color_out_low, color_out_high) { + CurveB = (byte[]) this.CurveB.Clone (), + CurveG = (byte[]) this.CurveG.Clone (), + CurveR = (byte[]) this.CurveR.Clone () + }; return copy; } diff --git a/Pinta.Core/ImageFormats/OraFormat.cs b/Pinta.Core/ImageFormats/OraFormat.cs index 63bc798cb..2e1e0888c 100644 --- a/Pinta.Core/ImageFormats/OraFormat.cs +++ b/Pinta.Core/ImageFormats/OraFormat.cs @@ -145,8 +145,9 @@ private static Size GetThumbDimensions (int width, int height) private byte[] GetLayerXmlData (IReadOnlyList layers) { MemoryStream ms = new MemoryStream (); - XmlTextWriter writer = new XmlTextWriter (ms, System.Text.Encoding.UTF8); - writer.Formatting = Formatting.Indented; + XmlTextWriter writer = new XmlTextWriter (ms, System.Text.Encoding.UTF8) { + Formatting = Formatting.Indented + }; writer.WriteStartElement ("image"); writer.WriteAttributeString ("w", layers[0].Surface.Width.ToString ()); @@ -183,8 +184,9 @@ public void Export (Document document, Gio.File file, Gtk.Window parent) using var stream = new ZipOutputStream (file_stream) { UseZip64 = UseZip64.Off // For backwards compatibility with older versions. }; - ZipEntry mimetype = new ZipEntry ("mimetype"); - mimetype.CompressionMethod = CompressionMethod.Stored; + ZipEntry mimetype = new ZipEntry ("mimetype") { + CompressionMethod = CompressionMethod.Stored + }; stream.PutNextEntry (mimetype); byte[] databytes = System.Text.Encoding.ASCII.GetBytes ("image/openraster"); diff --git a/Pinta.Core/ImageFormats/TgaExporter.cs b/Pinta.Core/ImageFormats/TgaExporter.cs index dc4e75d38..b020c6e70 100644 --- a/Pinta.Core/ImageFormats/TgaExporter.cs +++ b/Pinta.Core/ImageFormats/TgaExporter.cs @@ -95,20 +95,20 @@ public void Export (Document document, Gio.File file, Gtk.Window parent) using var file_stream = new GioStream (file.Replace ()); using var writer = new BinaryWriter (file_stream); - TgaHeader header = new TgaHeader (); - - header.idLength = (byte) (ImageIdField.Length + 1); - header.cmapType = 0; - header.imageType = 2; // uncompressed RGB - header.cmapIndex = 0; - header.cmapLength = 0; - header.cmapEntrySize = 0; - header.xOrigin = 0; - header.yOrigin = 0; - header.imageWidth = (ushort) surf.Width; - header.imageHeight = (ushort) surf.Height; - header.pixelDepth = 32; - header.imageDesc = 8; // 32-bit, lower-left origin, which is weird but hey... + TgaHeader header = new TgaHeader { + idLength = (byte) (ImageIdField.Length + 1), + cmapType = 0, + imageType = 2, // uncompressed RGB + cmapIndex = 0, + cmapLength = 0, + cmapEntrySize = 0, + xOrigin = 0, + yOrigin = 0, + imageWidth = (ushort) surf.Width, + imageHeight = (ushort) surf.Height, + pixelDepth = 32, + imageDesc = 8 // 32-bit, lower-left origin, which is weird but hey... + }; header.WriteTo (writer); writer.Write (ImageIdField); diff --git a/Pinta.Effects/Dialogs/Effects.PosterizeDialog.cs b/Pinta.Effects/Dialogs/Effects.PosterizeDialog.cs index ff8eac150..ac107b76f 100644 --- a/Pinta.Effects/Dialogs/Effects.PosterizeDialog.cs +++ b/Pinta.Effects/Dialogs/Effects.PosterizeDialog.cs @@ -105,18 +105,21 @@ private void Build () content_area.SetAllMargins (6); content_area.Spacing = 6; - red_spinbox = new HScaleSpinButtonWidget (); - red_spinbox.Label = Translations.GetString ("Red"); + red_spinbox = new HScaleSpinButtonWidget { + Label = Translations.GetString ("Red") + }; InitSpinBox (red_spinbox); content_area.Append (red_spinbox); - green_spinbox = new HScaleSpinButtonWidget (); - green_spinbox.Label = Translations.GetString ("Green"); + green_spinbox = new HScaleSpinButtonWidget { + Label = Translations.GetString ("Green") + }; InitSpinBox (green_spinbox); content_area.Append (green_spinbox); - blue_spinbox = new HScaleSpinButtonWidget (); - blue_spinbox.Label = Translations.GetString ("Blue"); + blue_spinbox = new HScaleSpinButtonWidget { + Label = Translations.GetString ("Blue") + }; InitSpinBox (blue_spinbox); content_area.Append (blue_spinbox); diff --git a/Pinta.Gui.Widgets/Widgets/AnglePickerWidget.cs b/Pinta.Gui.Widgets/Widgets/AnglePickerWidget.cs index e16ee9633..8433150b2 100644 --- a/Pinta.Gui.Widgets/Widgets/AnglePickerWidget.cs +++ b/Pinta.Gui.Widgets/Widgets/AnglePickerWidget.cs @@ -94,9 +94,10 @@ private void Build () var hbox2 = new Box () { Spacing = spacing }; hbox2.SetOrientation (Orientation.Horizontal); - anglepickergraphic1 = new AnglePickerGraphic (); - anglepickergraphic1.Hexpand = true; - anglepickergraphic1.Halign = Align.Center; + anglepickergraphic1 = new AnglePickerGraphic { + Hexpand = true, + Halign = Align.Center + }; hbox2.Append (anglepickergraphic1); spin = SpinButton.NewWithRange (0, 360, 1); diff --git a/Pinta.Gui.Widgets/Widgets/PointPickerWidget.cs b/Pinta.Gui.Widgets/Widgets/PointPickerWidget.cs index e17496bfc..731442807 100644 --- a/Pinta.Gui.Widgets/Widgets/PointPickerWidget.cs +++ b/Pinta.Gui.Widgets/Widgets/PointPickerWidget.cs @@ -157,9 +157,10 @@ private void Build () var hbox2 = new Box () { Spacing = spacing }; hbox2.SetOrientation (Orientation.Horizontal); - pointpickergraphic1 = new PointPickerGraphic (); - pointpickergraphic1.Hexpand = true; - pointpickergraphic1.Halign = Align.Center; + pointpickergraphic1 = new PointPickerGraphic { + Hexpand = true, + Halign = Align.Center + }; hbox2.Append (pointpickergraphic1); // X spinner diff --git a/Pinta.Tools/Editable/Shapes/Arrow.cs b/Pinta.Tools/Editable/Shapes/Arrow.cs index 8767fc110..d26805a38 100644 --- a/Pinta.Tools/Editable/Shapes/Arrow.cs +++ b/Pinta.Tools/Editable/Shapes/Arrow.cs @@ -44,12 +44,12 @@ public class Arrow /// A clone of the Arrow. public Arrow Clone () { - Arrow clonedA = new Arrow (); - - clonedA.Show = Show; - clonedA.ArrowSize = ArrowSize; - clonedA.AngleOffset = AngleOffset; - clonedA.LengthOffset = LengthOffset; + Arrow clonedA = new Arrow { + Show = Show, + ArrowSize = ArrowSize, + AngleOffset = AngleOffset, + LengthOffset = LengthOffset + }; return clonedA; } diff --git a/Pinta.Tools/Tools/EraserTool.cs b/Pinta.Tools/Tools/EraserTool.cs index 1aa690a0b..dfabc70fc 100644 --- a/Pinta.Tools/Tools/EraserTool.cs +++ b/Pinta.Tools/Tools/EraserTool.cs @@ -144,8 +144,9 @@ private static ImageSurface CopySurfacePart (ImageSurface surf, RectangleI dest_ { var tmp_surface = CairoExtensions.CreateImageSurface (Format.Argb32, dest_rect.Width, dest_rect.Height); - var g = new Context (tmp_surface); - g.Operator = Operator.Source; + var g = new Context (tmp_surface) { + Operator = Operator.Source + }; g.SetSourceSurface (surf, -dest_rect.Left, -dest_rect.Top); g.Rectangle (new RectangleD (0, 0, dest_rect.Width, dest_rect.Height)); g.Fill (); diff --git a/Pinta.Tools/Tools/LassoSelectTool.cs b/Pinta.Tools/Tools/LassoSelectTool.cs index 150e198b7..4e3681e74 100644 --- a/Pinta.Tools/Tools/LassoSelectTool.cs +++ b/Pinta.Tools/Tools/LassoSelectTool.cs @@ -90,8 +90,9 @@ protected override void OnMouseMove (Document document, ToolMouseEventArgs e) var surf = document.Layers.SelectionLayer.Surface; - var g = new Context (surf); - g.Antialias = Antialias.Subpixel; + var g = new Context (surf) { + Antialias = Antialias.Subpixel + }; if (path != null) { g.AppendPath (path); diff --git a/Pinta.Tools/Tools/PaintBucketTool.cs b/Pinta.Tools/Tools/PaintBucketTool.cs index 0689c8fb9..2dc958d15 100644 --- a/Pinta.Tools/Tools/PaintBucketTool.cs +++ b/Pinta.Tools/Tools/PaintBucketTool.cs @@ -62,8 +62,9 @@ protected override void OnFillRegionComputed (Document document, BitMask stencil { var surf = document.Layers.ToolLayer.Surface; - var g = new Context (surf); - g.Operator = Operator.Source; + var g = new Context (surf) { + Operator = Operator.Source + }; g.SetSourceSurface (document.Layers.CurrentUserLayer.Surface, 0, 0); g.Paint (); diff --git a/Pinta.Tools/Tools/TextTool.cs b/Pinta.Tools/Tools/TextTool.cs index 78ead3f53..2801786d2 100644 --- a/Pinta.Tools/Tools/TextTool.cs +++ b/Pinta.Tools/Tools/TextTool.cs @@ -139,9 +139,12 @@ protected override void OnBuildToolBar (Gtk.Box tb) tb.Append (font_label); if (font_button == null) { - font_button = new FontButton () { UseSize = false, UseFont = true, CanFocus = false }; - // Default to Arial if possible. - font_button.Font = Settings.GetSetting (FONT_SETTING, "Arial 12"); + font_button = new FontButton { + UseSize = false, + UseFont = true, + CanFocus = false, // Default to Arial if possible. + Font = Settings.GetSetting (FONT_SETTING, "Arial 12") + }; font_button.OnFontSet += HandleFontChanged; } @@ -151,36 +154,36 @@ protected override void OnBuildToolBar (Gtk.Box tb) tb.Append (GtkExtensions.CreateToolBarSeparator ()); if (bold_btn == null) { - bold_btn = new ToggleButton () { + bold_btn = new ToggleButton { IconName = Pinta.Resources.StandardIcons.FormatTextBold, TooltipText = Translations.GetString ("Bold"), - CanFocus = false + CanFocus = false, + Active = Settings.GetSetting (BOLD_SETTING, false) }; - bold_btn.Active = Settings.GetSetting (BOLD_SETTING, false); bold_btn.OnToggled += HandleBoldButtonToggled; } tb.Append (bold_btn); if (italic_btn == null) { - italic_btn = new ToggleButton () { + italic_btn = new ToggleButton { IconName = Pinta.Resources.StandardIcons.FormatTextItalic, TooltipText = Translations.GetString ("Italic"), - CanFocus = false + CanFocus = false, + Active = Settings.GetSetting (ITALIC_SETTING, false) }; - italic_btn.Active = Settings.GetSetting (ITALIC_SETTING, false); italic_btn.OnToggled += HandleItalicButtonToggled; } tb.Append (italic_btn); if (underscore_btn == null) { - underscore_btn = new ToggleButton () { + underscore_btn = new ToggleButton { IconName = Pinta.Resources.StandardIcons.FormatTextUnderline, TooltipText = Translations.GetString ("Underline"), - CanFocus = false + CanFocus = false, + Active = Settings.GetSetting (UNDERLINE_SETTING, false) }; - underscore_btn.Active = Settings.GetSetting (UNDERLINE_SETTING, false); underscore_btn.OnToggled += HandleUnderscoreButtonToggled; } @@ -191,36 +194,36 @@ protected override void OnBuildToolBar (Gtk.Box tb) var alignment = (TextAlignment) Settings.GetSetting (ALIGNMENT_SETTING, (int) TextAlignment.Left); if (left_alignment_btn == null) { - left_alignment_btn = new ToggleButton () { + left_alignment_btn = new ToggleButton { IconName = Pinta.Resources.StandardIcons.FormatJustifyLeft, TooltipText = Translations.GetString ("Left Align"), - CanFocus = false + CanFocus = false, + Active = alignment == TextAlignment.Left }; - left_alignment_btn.Active = alignment == TextAlignment.Left; left_alignment_btn.OnToggled += HandleLeftAlignmentButtonToggled; } tb.Append (left_alignment_btn); if (center_alignment_btn == null) { - center_alignment_btn = new ToggleButton () { + center_alignment_btn = new ToggleButton { IconName = Pinta.Resources.StandardIcons.FormatJustifyCenter, TooltipText = Translations.GetString ("Center Align"), - CanFocus = false + CanFocus = false, + Active = alignment == TextAlignment.Center }; - center_alignment_btn.Active = alignment == TextAlignment.Center; center_alignment_btn.OnToggled += HandleCenterAlignmentButtonToggled; } tb.Append (center_alignment_btn); if (right_alignment_btn == null) { - right_alignment_btn = new ToggleButton () { + right_alignment_btn = new ToggleButton { IconName = Pinta.Resources.StandardIcons.FormatJustifyRight, TooltipText = Translations.GetString ("Right Align"), - CanFocus = false + CanFocus = false, + Active = alignment == TextAlignment.Right }; - right_alignment_btn.Active = alignment == TextAlignment.Right; right_alignment_btn.OnToggled += HandleRightAlignmentButtonToggled; } diff --git a/Pinta/Dialogs/LayerPropertiesDialog.cs b/Pinta/Dialogs/LayerPropertiesDialog.cs index 73b0d713a..60a822297 100644 --- a/Pinta/Dialogs/LayerPropertiesDialog.cs +++ b/Pinta/Dialogs/LayerPropertiesDialog.cs @@ -180,9 +180,10 @@ private void Build () name_label.Halign = Align.End; grid.Attach (name_label, 0, 0, 1, 1); - layerNameEntry = new Entry (); - layerNameEntry.Hexpand = true; - layerNameEntry.Halign = Align.Fill; + layerNameEntry = new Entry { + Hexpand = true, + Halign = Align.Fill + }; grid.Attach (layerNameEntry, 1, 0, 1, 1); // Visible checkbox diff --git a/Pinta/Dialogs/NewImageDialog.cs b/Pinta/Dialogs/NewImageDialog.cs index 366bb43c4..3090d8266 100644 --- a/Pinta/Dialogs/NewImageDialog.cs +++ b/Pinta/Dialogs/NewImageDialog.cs @@ -186,14 +186,14 @@ private void InitializePresets () [MemberNotNull (nameof (preset_dropdown_model), nameof (preset_dropdown), nameof (portrait_radio), nameof (landscape_radio), nameof (white_bg_radio), nameof (secondary_bg_radio), nameof (trans_bg_radio), nameof (width_entry), nameof (height_entry), nameof (preview))] private void BuildDialog () - { - // Layout table for preset, width, and height - var layout_grid = new Grid (); - - layout_grid.RowSpacing = 5; - layout_grid.ColumnSpacing = 6; - - // Preset Combo + { + // Layout table for preset, width, and height + var layout_grid = new Grid { + RowSpacing = 5, + ColumnSpacing = 6 + }; + + // Preset Combo var size_label = Label.New (Translations.GetString ("Preset:")); size_label.Xalign = 1f; size_label.Yalign = .5f; @@ -217,9 +217,10 @@ private void BuildDialog () width_label.Xalign = 1f; width_label.Yalign = .5f; - width_entry = new Entry (); - width_entry.WidthRequest = 50; - width_entry.ActivatesDefault = true; + width_entry = new Entry { + WidthRequest = 50, + ActivatesDefault = true + }; var width_units = Label.New (Translations.GetString ("pixels")); width_units.MarginStart = 5; @@ -236,9 +237,10 @@ private void BuildDialog () height_label.Xalign = 1f; height_label.Yalign = .5f; - height_entry = new Entry (); - height_entry.WidthRequest = 50; - height_entry.ActivatesDefault = true; + height_entry = new Entry { + WidthRequest = 50, + ActivatesDefault = true + }; var height_units = Label.New (Translations.GetString ("pixels")); height_units.MarginStart = 5; @@ -340,12 +342,13 @@ private void BuildDialog () background_vbox.MarginTop = 4; options_vbox.Append (layout_grid); options_vbox.Append (orientation_vbox); - options_vbox.Append (background_vbox); - - // Layout the preview + the options - preview = new PreviewArea (); - preview.Vexpand = true; - preview.Valign = Align.Fill; + options_vbox.Append (background_vbox); + + // Layout the preview + the options + preview = new PreviewArea { + Vexpand = true, + Valign = Align.Fill + }; var preview_label = Label.New (Translations.GetString ("Preview")); diff --git a/Pinta/Dialogs/ResizeCanvasDialog.cs b/Pinta/Dialogs/ResizeCanvasDialog.cs index 22d0c0163..ee8b375fd 100644 --- a/Pinta/Dialogs/ResizeCanvasDialog.cs +++ b/Pinta/Dialogs/ResizeCanvasDialog.cs @@ -370,9 +370,12 @@ private void Build () SButton = CreateAnchorButton (); SEButton = CreateAnchorButton (); - var grid = new Grid () { RowSpacing = spacing, ColumnSpacing = spacing }; - grid.Halign = Align.Center; - grid.Valign = Align.Center; + var grid = new Grid { + RowSpacing = spacing, + ColumnSpacing = spacing, + Halign = Align.Center, + Valign = Align.Center + }; grid.Attach (NWButton, 0, 0, 1, 1); grid.Attach (NButton, 1, 0, 1, 1); grid.Attach (NEButton, 2, 0, 1, 1); diff --git a/Pinta/MainWindow.cs b/Pinta/MainWindow.cs index 276f9693a..ec3acf0b6 100644 --- a/Pinta/MainWindow.cs +++ b/Pinta/MainWindow.cs @@ -405,14 +405,15 @@ private void CreateDockAndPads (Box container) WindowPlacement = CornerType.BottomRight }; container.Append (toolbox_scroll); - PintaCore.Chrome.InitializeToolBox (toolbox); - - // Dock widget - dock = new Dock (); - dock.Hexpand = true; - dock.Halign = Align.Fill; - - // Canvas pad + PintaCore.Chrome.InitializeToolBox (toolbox); + + // Dock widget + dock = new Dock { + Hexpand = true, + Halign = Align.Fill + }; + + // Canvas pad canvas_pad = new CanvasPad (); canvas_pad.Initialize (dock); PintaCore.Chrome.InitializeImageTabsNotebook (canvas_pad.Notebook); From 4ea9c84fa8ee231ddb1e147eb94e1a7eec4042c2 Mon Sep 17 00:00:00 2001 From: Lehonti Ramos Date: Wed, 9 Aug 2023 20:45:48 +0200 Subject: [PATCH 2/2] Fixed formatting --- Pinta.Core/Actions/ImageActions.cs | 6 +-- Pinta.Core/Classes/AsyncEffectRenderer.cs | 34 +++++++------- Pinta.Core/Classes/Document.cs | 6 +-- Pinta.Core/Effects/ColorBgra.cs | 28 +++++------ Pinta.Core/Effects/UnaryPixelOps.cs | 8 ++-- Pinta.Core/ImageFormats/OraFormat.cs | 8 ++-- Pinta.Core/ImageFormats/TgaExporter.cs | 26 +++++------ .../Dialogs/Effects.PosterizeDialog.cs | 12 ++--- .../Widgets/AnglePickerWidget.cs | 6 +-- .../Widgets/PointPickerWidget.cs | 6 +-- Pinta.Tools/Editable/Shapes/Arrow.cs | 10 ++-- Pinta.Tools/Tools/EraserTool.cs | 4 +- Pinta.Tools/Tools/LassoSelectTool.cs | 4 +- Pinta.Tools/Tools/PaintBucketTool.cs | 4 +- Pinta.Tools/Tools/TextTool.cs | 46 +++++++++---------- Pinta/Dialogs/LayerPropertiesDialog.cs | 6 +-- Pinta/Dialogs/NewImageDialog.cs | 40 ++++++++-------- Pinta/Dialogs/ResizeCanvasDialog.cs | 10 ++-- Pinta/MainWindow.cs | 18 ++++---- 19 files changed, 141 insertions(+), 141 deletions(-) diff --git a/Pinta.Core/Actions/ImageActions.cs b/Pinta.Core/Actions/ImageActions.cs index 8f3dde19e..51d6a5b0a 100644 --- a/Pinta.Core/Actions/ImageActions.cs +++ b/Pinta.Core/Actions/ImageActions.cs @@ -281,9 +281,9 @@ static void CropImageToRectangle (Document doc, RectangleI rect, Path? selection if (rect.Width <= 0 || rect.Height <= 0) return; - ResizeHistoryItem hist = new ResizeHistoryItem (doc.ImageSize) { - Icon = Resources.Icons.ImageCrop, - Text = Translations.GetString ("Crop to Selection") + ResizeHistoryItem hist = new ResizeHistoryItem (doc.ImageSize) { + Icon = Resources.Icons.ImageCrop, + Text = Translations.GetString ("Crop to Selection") }; hist.StartSnapshotOfImage (); hist.RestoreSelection = doc.Selection.Clone (); diff --git a/Pinta.Core/Classes/AsyncEffectRenderer.cs b/Pinta.Core/Classes/AsyncEffectRenderer.cs index 362539e85..fb887afc6 100644 --- a/Pinta.Core/Classes/AsyncEffectRenderer.cs +++ b/Pinta.Core/Classes/AsyncEffectRenderer.cs @@ -184,25 +184,25 @@ void StartRender () int threadCount = settings.ThreadCount; var slaves = new Thread[threadCount - 1]; for (int threadId = 1; threadId < threadCount; threadId++) - slaves[threadId - 1] = StartSlaveThread (renderId, threadId); - - // Start the master render thread. - var master = new Thread (() => { - - // Do part of the rendering on the master thread. - Render (renderId, 0); - - // Wait for slave threads to complete. + slaves[threadId - 1] = StartSlaveThread (renderId, threadId); + + // Start the master render thread. + var master = new Thread (() => { + + // Do part of the rendering on the master thread. + Render (renderId, 0); + + // Wait for slave threads to complete. foreach (var slave in slaves) - slave.Join (); - - // Change back to the UI thread to notify of completion. + slave.Join (); + + // Change back to the UI thread to notify of completion. GLib.Functions.TimeoutAdd (0, 0, () => { HandleRenderCompletion (); - return false; // don't call the timer again + return false; // don't call the timer again }); - }) { - Priority = settings.ThreadPriority + }) { + Priority = settings.ThreadPriority }; master.Start (); @@ -214,8 +214,8 @@ Thread StartSlaveThread (int renderId, int threadId) { var slave = new Thread (() => { Render (renderId, threadId); - }) { - Priority = settings.ThreadPriority + }) { + Priority = settings.ThreadPriority }; slave.Start (); diff --git a/Pinta.Core/Classes/Document.cs b/Pinta.Core/Classes/Document.cs index 36f17c88b..38180beee 100644 --- a/Pinta.Core/Classes/Document.cs +++ b/Pinta.Core/Classes/Document.cs @@ -294,9 +294,9 @@ public void ResizeCanvas (int width, int height, Anchor anchor, CompoundHistoryI PintaCore.Tools.Commit (); - ResizeHistoryItem hist = new ResizeHistoryItem (ImageSize) { - Icon = Resources.Icons.ImageResizeCanvas, - Text = Translations.GetString ("Resize Canvas") + ResizeHistoryItem hist = new ResizeHistoryItem (ImageSize) { + Icon = Resources.Icons.ImageResizeCanvas, + Text = Translations.GetString ("Resize Canvas") }; hist.StartSnapshotOfImage (); diff --git a/Pinta.Core/Effects/ColorBgra.cs b/Pinta.Core/Effects/ColorBgra.cs index 99352591e..fd815324f 100644 --- a/Pinta.Core/Effects/ColorBgra.cs +++ b/Pinta.Core/Effects/ColorBgra.cs @@ -191,8 +191,8 @@ public readonly ColorBgra NewAlpha (byte newA) /// public static ColorBgra FromBgra (byte b, byte g, byte r, byte a) { - ColorBgra color = new ColorBgra { - Bgra = BgraToUInt32 (b, g, r, a) + ColorBgra color = new ColorBgra { + Bgra = BgraToUInt32 (b, g, r, a) }; return color; } @@ -260,8 +260,8 @@ public static ColorBgra FromBgr (byte b, byte g, byte r) /// public static ColorBgra FromUInt32 (UInt32 bgra) { - ColorBgra color = new ColorBgra { - Bgra = bgra + ColorBgra color = new ColorBgra { + Bgra = bgra }; return color; } @@ -315,11 +315,11 @@ public static ColorBgra Blend (ColorBgra ca, ColorBgra cb, byte cbAlpha) /// public static ColorBgra Lerp (ColorBgra from, ColorBgra to, float frac) { - ColorBgra ret = new ColorBgra { - B = (byte) ClampToByte (Lerp (from.B, to.B, frac)), - G = (byte) ClampToByte (Lerp (from.G, to.G, frac)), - R = (byte) ClampToByte (Lerp (from.R, to.R, frac)), - A = (byte) ClampToByte (Lerp (from.A, to.A, frac)) + ColorBgra ret = new ColorBgra { + B = (byte) ClampToByte (Lerp (from.B, to.B, frac)), + G = (byte) ClampToByte (Lerp (from.G, to.G, frac)), + R = (byte) ClampToByte (Lerp (from.R, to.R, frac)), + A = (byte) ClampToByte (Lerp (from.A, to.A, frac)) }; return ret; @@ -345,11 +345,11 @@ public static double Lerp (double from, double to, double frac) /// public static ColorBgra Lerp (ColorBgra from, ColorBgra to, double frac) { - ColorBgra ret = new ColorBgra { - B = (byte) ClampToByte (Lerp (from.B, to.B, frac)), - G = (byte) ClampToByte (Lerp (from.G, to.G, frac)), - R = (byte) ClampToByte (Lerp (from.R, to.R, frac)), - A = (byte) ClampToByte (Lerp (from.A, to.A, frac)) + ColorBgra ret = new ColorBgra { + B = (byte) ClampToByte (Lerp (from.B, to.B, frac)), + G = (byte) ClampToByte (Lerp (from.G, to.G, frac)), + R = (byte) ClampToByte (Lerp (from.R, to.R, frac)), + A = (byte) ClampToByte (Lerp (from.A, to.A, frac)) }; return ret; diff --git a/Pinta.Core/Effects/UnaryPixelOps.cs b/Pinta.Core/Effects/UnaryPixelOps.cs index 151438306..630f95a0c 100644 --- a/Pinta.Core/Effects/UnaryPixelOps.cs +++ b/Pinta.Core/Effects/UnaryPixelOps.cs @@ -686,10 +686,10 @@ public void UnApply (ColorBgra after, float[] beforeOut, float[] slopesOut) public object Clone () { - Level copy = new Level (color_in_low, color_in_high, (float[]) gamma.Clone (), color_out_low, color_out_high) { - CurveB = (byte[]) this.CurveB.Clone (), - CurveG = (byte[]) this.CurveG.Clone (), - CurveR = (byte[]) this.CurveR.Clone () + Level copy = new Level (color_in_low, color_in_high, (float[]) gamma.Clone (), color_out_low, color_out_high) { + CurveB = (byte[]) this.CurveB.Clone (), + CurveG = (byte[]) this.CurveG.Clone (), + CurveR = (byte[]) this.CurveR.Clone () }; return copy; diff --git a/Pinta.Core/ImageFormats/OraFormat.cs b/Pinta.Core/ImageFormats/OraFormat.cs index 2e1e0888c..4267f5822 100644 --- a/Pinta.Core/ImageFormats/OraFormat.cs +++ b/Pinta.Core/ImageFormats/OraFormat.cs @@ -145,8 +145,8 @@ private static Size GetThumbDimensions (int width, int height) private byte[] GetLayerXmlData (IReadOnlyList layers) { MemoryStream ms = new MemoryStream (); - XmlTextWriter writer = new XmlTextWriter (ms, System.Text.Encoding.UTF8) { - Formatting = Formatting.Indented + XmlTextWriter writer = new XmlTextWriter (ms, System.Text.Encoding.UTF8) { + Formatting = Formatting.Indented }; writer.WriteStartElement ("image"); @@ -184,8 +184,8 @@ public void Export (Document document, Gio.File file, Gtk.Window parent) using var stream = new ZipOutputStream (file_stream) { UseZip64 = UseZip64.Off // For backwards compatibility with older versions. }; - ZipEntry mimetype = new ZipEntry ("mimetype") { - CompressionMethod = CompressionMethod.Stored + ZipEntry mimetype = new ZipEntry ("mimetype") { + CompressionMethod = CompressionMethod.Stored }; stream.PutNextEntry (mimetype); diff --git a/Pinta.Core/ImageFormats/TgaExporter.cs b/Pinta.Core/ImageFormats/TgaExporter.cs index b020c6e70..4ffae5c9f 100644 --- a/Pinta.Core/ImageFormats/TgaExporter.cs +++ b/Pinta.Core/ImageFormats/TgaExporter.cs @@ -95,19 +95,19 @@ public void Export (Document document, Gio.File file, Gtk.Window parent) using var file_stream = new GioStream (file.Replace ()); using var writer = new BinaryWriter (file_stream); - TgaHeader header = new TgaHeader { - idLength = (byte) (ImageIdField.Length + 1), - cmapType = 0, - imageType = 2, // uncompressed RGB - cmapIndex = 0, - cmapLength = 0, - cmapEntrySize = 0, - xOrigin = 0, - yOrigin = 0, - imageWidth = (ushort) surf.Width, - imageHeight = (ushort) surf.Height, - pixelDepth = 32, - imageDesc = 8 // 32-bit, lower-left origin, which is weird but hey... + TgaHeader header = new TgaHeader { + idLength = (byte) (ImageIdField.Length + 1), + cmapType = 0, + imageType = 2, // uncompressed RGB + cmapIndex = 0, + cmapLength = 0, + cmapEntrySize = 0, + xOrigin = 0, + yOrigin = 0, + imageWidth = (ushort) surf.Width, + imageHeight = (ushort) surf.Height, + pixelDepth = 32, + imageDesc = 8 // 32-bit, lower-left origin, which is weird but hey... }; header.WriteTo (writer); diff --git a/Pinta.Effects/Dialogs/Effects.PosterizeDialog.cs b/Pinta.Effects/Dialogs/Effects.PosterizeDialog.cs index ac107b76f..845552321 100644 --- a/Pinta.Effects/Dialogs/Effects.PosterizeDialog.cs +++ b/Pinta.Effects/Dialogs/Effects.PosterizeDialog.cs @@ -105,20 +105,20 @@ private void Build () content_area.SetAllMargins (6); content_area.Spacing = 6; - red_spinbox = new HScaleSpinButtonWidget { - Label = Translations.GetString ("Red") + red_spinbox = new HScaleSpinButtonWidget { + Label = Translations.GetString ("Red") }; InitSpinBox (red_spinbox); content_area.Append (red_spinbox); - green_spinbox = new HScaleSpinButtonWidget { - Label = Translations.GetString ("Green") + green_spinbox = new HScaleSpinButtonWidget { + Label = Translations.GetString ("Green") }; InitSpinBox (green_spinbox); content_area.Append (green_spinbox); - blue_spinbox = new HScaleSpinButtonWidget { - Label = Translations.GetString ("Blue") + blue_spinbox = new HScaleSpinButtonWidget { + Label = Translations.GetString ("Blue") }; InitSpinBox (blue_spinbox); content_area.Append (blue_spinbox); diff --git a/Pinta.Gui.Widgets/Widgets/AnglePickerWidget.cs b/Pinta.Gui.Widgets/Widgets/AnglePickerWidget.cs index 8433150b2..e834ae167 100644 --- a/Pinta.Gui.Widgets/Widgets/AnglePickerWidget.cs +++ b/Pinta.Gui.Widgets/Widgets/AnglePickerWidget.cs @@ -94,9 +94,9 @@ private void Build () var hbox2 = new Box () { Spacing = spacing }; hbox2.SetOrientation (Orientation.Horizontal); - anglepickergraphic1 = new AnglePickerGraphic { - Hexpand = true, - Halign = Align.Center + anglepickergraphic1 = new AnglePickerGraphic { + Hexpand = true, + Halign = Align.Center }; hbox2.Append (anglepickergraphic1); diff --git a/Pinta.Gui.Widgets/Widgets/PointPickerWidget.cs b/Pinta.Gui.Widgets/Widgets/PointPickerWidget.cs index 731442807..26056b74c 100644 --- a/Pinta.Gui.Widgets/Widgets/PointPickerWidget.cs +++ b/Pinta.Gui.Widgets/Widgets/PointPickerWidget.cs @@ -157,9 +157,9 @@ private void Build () var hbox2 = new Box () { Spacing = spacing }; hbox2.SetOrientation (Orientation.Horizontal); - pointpickergraphic1 = new PointPickerGraphic { - Hexpand = true, - Halign = Align.Center + pointpickergraphic1 = new PointPickerGraphic { + Hexpand = true, + Halign = Align.Center }; hbox2.Append (pointpickergraphic1); diff --git a/Pinta.Tools/Editable/Shapes/Arrow.cs b/Pinta.Tools/Editable/Shapes/Arrow.cs index d26805a38..88094ca5f 100644 --- a/Pinta.Tools/Editable/Shapes/Arrow.cs +++ b/Pinta.Tools/Editable/Shapes/Arrow.cs @@ -44,11 +44,11 @@ public class Arrow /// A clone of the Arrow. public Arrow Clone () { - Arrow clonedA = new Arrow { - Show = Show, - ArrowSize = ArrowSize, - AngleOffset = AngleOffset, - LengthOffset = LengthOffset + Arrow clonedA = new Arrow { + Show = Show, + ArrowSize = ArrowSize, + AngleOffset = AngleOffset, + LengthOffset = LengthOffset }; return clonedA; diff --git a/Pinta.Tools/Tools/EraserTool.cs b/Pinta.Tools/Tools/EraserTool.cs index dfabc70fc..529ae2b31 100644 --- a/Pinta.Tools/Tools/EraserTool.cs +++ b/Pinta.Tools/Tools/EraserTool.cs @@ -144,8 +144,8 @@ private static ImageSurface CopySurfacePart (ImageSurface surf, RectangleI dest_ { var tmp_surface = CairoExtensions.CreateImageSurface (Format.Argb32, dest_rect.Width, dest_rect.Height); - var g = new Context (tmp_surface) { - Operator = Operator.Source + var g = new Context (tmp_surface) { + Operator = Operator.Source }; g.SetSourceSurface (surf, -dest_rect.Left, -dest_rect.Top); g.Rectangle (new RectangleD (0, 0, dest_rect.Width, dest_rect.Height)); diff --git a/Pinta.Tools/Tools/LassoSelectTool.cs b/Pinta.Tools/Tools/LassoSelectTool.cs index 4e3681e74..5d6c921e6 100644 --- a/Pinta.Tools/Tools/LassoSelectTool.cs +++ b/Pinta.Tools/Tools/LassoSelectTool.cs @@ -90,8 +90,8 @@ protected override void OnMouseMove (Document document, ToolMouseEventArgs e) var surf = document.Layers.SelectionLayer.Surface; - var g = new Context (surf) { - Antialias = Antialias.Subpixel + var g = new Context (surf) { + Antialias = Antialias.Subpixel }; if (path != null) { diff --git a/Pinta.Tools/Tools/PaintBucketTool.cs b/Pinta.Tools/Tools/PaintBucketTool.cs index 2dc958d15..2310655f6 100644 --- a/Pinta.Tools/Tools/PaintBucketTool.cs +++ b/Pinta.Tools/Tools/PaintBucketTool.cs @@ -62,8 +62,8 @@ protected override void OnFillRegionComputed (Document document, BitMask stencil { var surf = document.Layers.ToolLayer.Surface; - var g = new Context (surf) { - Operator = Operator.Source + var g = new Context (surf) { + Operator = Operator.Source }; g.SetSourceSurface (document.Layers.CurrentUserLayer.Surface, 0, 0); g.Paint (); diff --git a/Pinta.Tools/Tools/TextTool.cs b/Pinta.Tools/Tools/TextTool.cs index 2801786d2..21af3f4ee 100644 --- a/Pinta.Tools/Tools/TextTool.cs +++ b/Pinta.Tools/Tools/TextTool.cs @@ -139,11 +139,11 @@ protected override void OnBuildToolBar (Gtk.Box tb) tb.Append (font_label); if (font_button == null) { - font_button = new FontButton { - UseSize = false, - UseFont = true, - CanFocus = false, // Default to Arial if possible. - Font = Settings.GetSetting (FONT_SETTING, "Arial 12") + font_button = new FontButton { + UseSize = false, + UseFont = true, + CanFocus = false, // Default to Arial if possible. + Font = Settings.GetSetting (FONT_SETTING, "Arial 12") }; font_button.OnFontSet += HandleFontChanged; @@ -154,11 +154,11 @@ protected override void OnBuildToolBar (Gtk.Box tb) tb.Append (GtkExtensions.CreateToolBarSeparator ()); if (bold_btn == null) { - bold_btn = new ToggleButton { + bold_btn = new ToggleButton { IconName = Pinta.Resources.StandardIcons.FormatTextBold, TooltipText = Translations.GetString ("Bold"), - CanFocus = false, - Active = Settings.GetSetting (BOLD_SETTING, false) + CanFocus = false, + Active = Settings.GetSetting (BOLD_SETTING, false) }; bold_btn.OnToggled += HandleBoldButtonToggled; } @@ -166,11 +166,11 @@ protected override void OnBuildToolBar (Gtk.Box tb) tb.Append (bold_btn); if (italic_btn == null) { - italic_btn = new ToggleButton { + italic_btn = new ToggleButton { IconName = Pinta.Resources.StandardIcons.FormatTextItalic, TooltipText = Translations.GetString ("Italic"), - CanFocus = false, - Active = Settings.GetSetting (ITALIC_SETTING, false) + CanFocus = false, + Active = Settings.GetSetting (ITALIC_SETTING, false) }; italic_btn.OnToggled += HandleItalicButtonToggled; } @@ -178,11 +178,11 @@ protected override void OnBuildToolBar (Gtk.Box tb) tb.Append (italic_btn); if (underscore_btn == null) { - underscore_btn = new ToggleButton { + underscore_btn = new ToggleButton { IconName = Pinta.Resources.StandardIcons.FormatTextUnderline, TooltipText = Translations.GetString ("Underline"), - CanFocus = false, - Active = Settings.GetSetting (UNDERLINE_SETTING, false) + CanFocus = false, + Active = Settings.GetSetting (UNDERLINE_SETTING, false) }; underscore_btn.OnToggled += HandleUnderscoreButtonToggled; } @@ -194,11 +194,11 @@ protected override void OnBuildToolBar (Gtk.Box tb) var alignment = (TextAlignment) Settings.GetSetting (ALIGNMENT_SETTING, (int) TextAlignment.Left); if (left_alignment_btn == null) { - left_alignment_btn = new ToggleButton { + left_alignment_btn = new ToggleButton { IconName = Pinta.Resources.StandardIcons.FormatJustifyLeft, TooltipText = Translations.GetString ("Left Align"), - CanFocus = false, - Active = alignment == TextAlignment.Left + CanFocus = false, + Active = alignment == TextAlignment.Left }; left_alignment_btn.OnToggled += HandleLeftAlignmentButtonToggled; } @@ -206,11 +206,11 @@ protected override void OnBuildToolBar (Gtk.Box tb) tb.Append (left_alignment_btn); if (center_alignment_btn == null) { - center_alignment_btn = new ToggleButton { + center_alignment_btn = new ToggleButton { IconName = Pinta.Resources.StandardIcons.FormatJustifyCenter, TooltipText = Translations.GetString ("Center Align"), - CanFocus = false, - Active = alignment == TextAlignment.Center + CanFocus = false, + Active = alignment == TextAlignment.Center }; center_alignment_btn.OnToggled += HandleCenterAlignmentButtonToggled; } @@ -218,11 +218,11 @@ protected override void OnBuildToolBar (Gtk.Box tb) tb.Append (center_alignment_btn); if (right_alignment_btn == null) { - right_alignment_btn = new ToggleButton { + right_alignment_btn = new ToggleButton { IconName = Pinta.Resources.StandardIcons.FormatJustifyRight, TooltipText = Translations.GetString ("Right Align"), - CanFocus = false, - Active = alignment == TextAlignment.Right + CanFocus = false, + Active = alignment == TextAlignment.Right }; right_alignment_btn.OnToggled += HandleRightAlignmentButtonToggled; } diff --git a/Pinta/Dialogs/LayerPropertiesDialog.cs b/Pinta/Dialogs/LayerPropertiesDialog.cs index 60a822297..36ca7e07c 100644 --- a/Pinta/Dialogs/LayerPropertiesDialog.cs +++ b/Pinta/Dialogs/LayerPropertiesDialog.cs @@ -180,9 +180,9 @@ private void Build () name_label.Halign = Align.End; grid.Attach (name_label, 0, 0, 1, 1); - layerNameEntry = new Entry { - Hexpand = true, - Halign = Align.Fill + layerNameEntry = new Entry { + Hexpand = true, + Halign = Align.Fill }; grid.Attach (layerNameEntry, 1, 0, 1, 1); diff --git a/Pinta/Dialogs/NewImageDialog.cs b/Pinta/Dialogs/NewImageDialog.cs index 3090d8266..5578a2a61 100644 --- a/Pinta/Dialogs/NewImageDialog.cs +++ b/Pinta/Dialogs/NewImageDialog.cs @@ -186,14 +186,14 @@ private void InitializePresets () [MemberNotNull (nameof (preset_dropdown_model), nameof (preset_dropdown), nameof (portrait_radio), nameof (landscape_radio), nameof (white_bg_radio), nameof (secondary_bg_radio), nameof (trans_bg_radio), nameof (width_entry), nameof (height_entry), nameof (preview))] private void BuildDialog () - { - // Layout table for preset, width, and height - var layout_grid = new Grid { - RowSpacing = 5, - ColumnSpacing = 6 - }; - - // Preset Combo + { + // Layout table for preset, width, and height + var layout_grid = new Grid { + RowSpacing = 5, + ColumnSpacing = 6 + }; + + // Preset Combo var size_label = Label.New (Translations.GetString ("Preset:")); size_label.Xalign = 1f; size_label.Yalign = .5f; @@ -217,9 +217,9 @@ private void BuildDialog () width_label.Xalign = 1f; width_label.Yalign = .5f; - width_entry = new Entry { - WidthRequest = 50, - ActivatesDefault = true + width_entry = new Entry { + WidthRequest = 50, + ActivatesDefault = true }; var width_units = Label.New (Translations.GetString ("pixels")); @@ -237,9 +237,9 @@ private void BuildDialog () height_label.Xalign = 1f; height_label.Yalign = .5f; - height_entry = new Entry { - WidthRequest = 50, - ActivatesDefault = true + height_entry = new Entry { + WidthRequest = 50, + ActivatesDefault = true }; var height_units = Label.New (Translations.GetString ("pixels")); @@ -342,12 +342,12 @@ private void BuildDialog () background_vbox.MarginTop = 4; options_vbox.Append (layout_grid); options_vbox.Append (orientation_vbox); - options_vbox.Append (background_vbox); - - // Layout the preview + the options - preview = new PreviewArea { - Vexpand = true, - Valign = Align.Fill + options_vbox.Append (background_vbox); + + // Layout the preview + the options + preview = new PreviewArea { + Vexpand = true, + Valign = Align.Fill }; var preview_label = Label.New (Translations.GetString ("Preview")); diff --git a/Pinta/Dialogs/ResizeCanvasDialog.cs b/Pinta/Dialogs/ResizeCanvasDialog.cs index ee8b375fd..0cbbac397 100644 --- a/Pinta/Dialogs/ResizeCanvasDialog.cs +++ b/Pinta/Dialogs/ResizeCanvasDialog.cs @@ -370,11 +370,11 @@ private void Build () SButton = CreateAnchorButton (); SEButton = CreateAnchorButton (); - var grid = new Grid { - RowSpacing = spacing, - ColumnSpacing = spacing, - Halign = Align.Center, - Valign = Align.Center + var grid = new Grid { + RowSpacing = spacing, + ColumnSpacing = spacing, + Halign = Align.Center, + Valign = Align.Center }; grid.Attach (NWButton, 0, 0, 1, 1); grid.Attach (NButton, 1, 0, 1, 1); diff --git a/Pinta/MainWindow.cs b/Pinta/MainWindow.cs index ec3acf0b6..ce84c66a8 100644 --- a/Pinta/MainWindow.cs +++ b/Pinta/MainWindow.cs @@ -405,15 +405,15 @@ private void CreateDockAndPads (Box container) WindowPlacement = CornerType.BottomRight }; container.Append (toolbox_scroll); - PintaCore.Chrome.InitializeToolBox (toolbox); - - // Dock widget - dock = new Dock { - Hexpand = true, - Halign = Align.Fill - }; - - // Canvas pad + PintaCore.Chrome.InitializeToolBox (toolbox); + + // Dock widget + dock = new Dock { + Hexpand = true, + Halign = Align.Fill + }; + + // Canvas pad canvas_pad = new CanvasPad (); canvas_pad.Initialize (dock); PintaCore.Chrome.InitializeImageTabsNotebook (canvas_pad.Notebook);