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,15 +1,9 @@
using Pilz.Drawing;
using Pilz.UI.WinForms.PaintingControl.EventArgs;
using Pilz.UI.WinForms.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Windows.Forms;
namespace Pilz.UI.WinForms.PaintingControl;
@@ -48,7 +42,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
public Color GridColor { get; set; } = Color.LightGray;
public DelegateDrawPaintingControlGridMethode DrawGridMethode { get; set; } = DefaultDrawMethodes.DrawGrid;
public DelegateDrawPaintingControlAreaSelectionMethode DrawAreaSelectionMethode { get; set; } = DefaultDrawMethodes.DrawAreaSelection;
private SizeF _ZoomFactor = new SizeF(1f, 1f);
private SizeF _ZoomFactor = new(1f, 1f);
private int _stopDrawing = -1;
private Image bufferedImg = null;
@@ -57,7 +51,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
private bool pressedControl = false;
private bool pressedAlt = false;
private Dictionary<PaintingObject, PointF> savedPos = new Dictionary<PaintingObject, PointF>();
private Dictionary<PaintingObject, PointF> savedPos = [];
public event SelectionChangedEventHandler SelectionChanged;
@@ -413,8 +407,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
{
if (IsResizingObjs(objs))
return;
if (movedObjs is null)
movedObjs = new List<PaintingObject>();
movedObjs ??= [];
SuspendDrawing();
@@ -663,7 +656,8 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
{
obj2.X -= modLeft;
}
};
}
;
zoomLocation(obj);
@@ -674,7 +668,8 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
var modW = (int)Math.Round(obj.Width % zoomedGridChunkSize.Width);
void zoomSize(PaintingObject obj2) { if (obj2.EnableResize && !obj2.HardcodedSize) { if (modH > halfHeight) obj2.Height += zoomedGridChunkSize.Height - modH; else { obj2.Height -= modH; } if (modW > halfWidth) obj2.Width += zoomedGridChunkSize.Width - modW; else { obj2.Width -= modW; } } };
void zoomSize(PaintingObject obj2) { if (obj2.EnableResize && !obj2.HardcodedSize) { if (modH > halfHeight) obj2.Height += zoomedGridChunkSize.Height - modH; else { obj2.Height -= modH; } if (modW > halfWidth) obj2.Width += zoomedGridChunkSize.Width - modW; else { obj2.Width -= modW; } } }
;
zoomSize(obj);