more work on gtk & code cleanup

This commit is contained in:
2025-06-16 15:30:56 +02:00
parent 6f7bb5d92c
commit a49a3b2beb
69 changed files with 374 additions and 268 deletions

View File

@@ -1,12 +1,7 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
namespace Pilz.UI.WinForms.PaintingControl;
@@ -33,9 +28,9 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
public Font TextFont { get; set; } = new Font(FontFamily.GenericSansSerif, 8.25f);
public Color TextColor { get; set; } = Color.Black;
[JsonProperty]
private PointF _Location = new PointF(50f, 50f);
private PointF _Location = new(50f, 50f);
[JsonProperty]
private SizeF _Size = new SizeF(50f, 80f);
private SizeF _Size = new(50f, 80f);
public bool EnableFill { get; set; } = true;
public bool EnableOutline { get; set; } = true;
public Color SelectionColor { get; set; } = Color.CornflowerBlue;
@@ -50,9 +45,9 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
[JsonIgnore]
public object Tag { get; set; } = null;
public string Name { get; set; } = "";
public List<PaintingObject> PinnedObjects { get; private set; } = new List<PaintingObject>();
public List<PaintingObject> PinnedObjects { get; private set; } = [];
[JsonIgnore]
public List<DelegateDrawPaintingObjectMethode> DrawMethodes { get; private set; } = new List<DelegateDrawPaintingObjectMethode>();
public List<DelegateDrawPaintingObjectMethode> DrawMethodes { get; private set; } = [];
[JsonIgnore]
public DelegateDrawPaintingObjectMethode DrawSelectionMethode { get; private set; } = DefaultDrawMethodes.DrawSelection;
public Cursor Cursor { get; set; } = Cursors.Default;
@@ -165,32 +160,32 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
{
case "DrawPicture":
{
tt = tt | PaintingObjectType.Picture;
tt |= PaintingObjectType.Picture;
break;
}
case "DrawText":
{
tt = tt | PaintingObjectType.Text;
tt |= PaintingObjectType.Text;
break;
}
case "DrawRectangle":
{
tt = tt | PaintingObjectType.Rectangle;
tt |= PaintingObjectType.Rectangle;
break;
}
case "DrawEllipse":
{
tt = tt | PaintingObjectType.Elipse;
tt |= PaintingObjectType.Elipse;
break;
}
case "DrawTriangle":
{
tt = tt | PaintingObjectType.Triangle;
tt |= PaintingObjectType.Triangle;
break;
}
case "DrawLine":
{
tt = tt | PaintingObjectType.Line;
tt |= PaintingObjectType.Line;
break;
}
}
@@ -699,7 +694,8 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
if (!blackFields.Contains(@field.Name))
@field.SetValue(dest, @field.GetValue(source));
}
};
}
;
copyFields(this, obj, blackField, metype);
copyFields(ImageProperties, obj.ImageProperties, Array.Empty<string>(), ImageProperties.GetType());