more work on gtk & code cleanup
This commit is contained in:
@@ -5,6 +5,6 @@ public class ObjectBase
|
||||
public static int DefaultPriorityValue { get; set; } = 1000;
|
||||
|
||||
public int UndoPriority { get; set; } = DefaultPriorityValue;
|
||||
|
||||
|
||||
public int RedoPriority { get; set; } = DefaultPriorityValue;
|
||||
}
|
||||
@@ -10,7 +10,7 @@ public class ConfigurationManagerList : IList<ConfigurationManager>
|
||||
|
||||
public delegate void GettingParentManagerEventHandler(object sender, GetValueEventArgs<SimpleConfiguration> e);
|
||||
|
||||
private readonly List<ConfigurationManager> myList = new List<ConfigurationManager>();
|
||||
private readonly List<ConfigurationManager> myList = [];
|
||||
|
||||
private object GetParentManager()
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Pilz.Configuration;
|
||||
public class SimpleConfiguration
|
||||
{
|
||||
[JsonIgnore]
|
||||
public readonly ConfigurationManagerList Managers = new ConfigurationManagerList();
|
||||
public readonly ConfigurationManagerList Managers = [];
|
||||
|
||||
public SimpleConfiguration()
|
||||
{
|
||||
|
||||
@@ -44,8 +44,7 @@ public class SecureString
|
||||
{
|
||||
if (Crypter == null)
|
||||
{
|
||||
if (DefaultCrypter == null)
|
||||
DefaultCrypter = new SimpleStringCrypter(string.Empty);
|
||||
DefaultCrypter ??= new SimpleStringCrypter(string.Empty);
|
||||
Crypter = DefaultCrypter;
|
||||
}
|
||||
return Crypter;
|
||||
@@ -66,7 +65,7 @@ public class SecureString
|
||||
}
|
||||
|
||||
public static implicit operator string(SecureString value) => value?.Value;
|
||||
public static implicit operator SecureString(string value) => new SecureString(value, false);
|
||||
public static implicit operator SecureString(string value) => new(value, false);
|
||||
|
||||
public static bool operator ==(SecureString left, SecureString right) => left?.EncryptedValue == right?.EncryptedValue;
|
||||
public static bool operator !=(SecureString left, SecureString right) => left?.EncryptedValue != right?.EncryptedValue;
|
||||
|
||||
@@ -120,7 +120,7 @@ Namespace CameraN
|
||||
|
||||
Private Sub OrientateCam(ang As Single, ang2 As Single)
|
||||
Dim CamLX As Single = CSng(Math.Sin(ang)) * CSng(Math.Sin(-ang2))
|
||||
Dim CamLY As Single = CSng(Math.Cos(ang2))
|
||||
Dim CamLY As Single = Math.Cos(ang2)
|
||||
Dim CamLZ As Single = CSng(-Math.Cos(ang)) * CSng(Math.Sin(-ang2))
|
||||
|
||||
myLookat.X = pos.X + (-CamLX) * 100.0F
|
||||
@@ -131,11 +131,11 @@ Namespace CameraN
|
||||
Private Sub OffsetCam(xAmt As Integer, yAmt As Integer, zAmt As Integer)
|
||||
Dim pitch_Renamed As Double = CamAngleY - (Math.PI / 2)
|
||||
Dim CamLX As Single = CSng(Math.Sin(CamAngleX)) * CSng(Math.Cos(-pitch_Renamed))
|
||||
Dim CamLY As Single = CSng(Math.Sin(pitch_Renamed))
|
||||
Dim CamLY As Single = Math.Sin(pitch_Renamed)
|
||||
Dim CamLZ As Single = CSng(-Math.Cos(CamAngleX)) * CSng(Math.Cos(-pitch_Renamed))
|
||||
pos.X = pos.X + xAmt * (CamLX) * CamSpeedMultiplier
|
||||
pos.Y = pos.Y + yAmt * (CamLY) * CamSpeedMultiplier
|
||||
pos.Z = pos.Z + zAmt * (CamLZ) * CamSpeedMultiplier
|
||||
pos.X += xAmt * (CamLX) * CamSpeedMultiplier
|
||||
pos.Y += yAmt * (CamLY) * CamSpeedMultiplier
|
||||
pos.Z += zAmt * (CamLZ) * CamSpeedMultiplier
|
||||
End Sub
|
||||
|
||||
Public Sub Move(y As Single, ByRef camMtx As Matrix4)
|
||||
@@ -154,7 +154,7 @@ Namespace CameraN
|
||||
Dim x_diff As Single = myLookat.X - pos.X
|
||||
Dim y_diff As Single = myLookat.Y - pos.Y
|
||||
Dim z_diff As Single = myLookat.Z - pos.Z
|
||||
Dim dist As Single = CSng(Math.Sqrt(x_diff * x_diff + y_diff * y_diff + z_diff * z_diff))
|
||||
Dim dist As Single = Math.Sqrt(x_diff * x_diff + y_diff * y_diff + z_diff * z_diff)
|
||||
If z_diff = 0 Then
|
||||
z_diff = 0.001F
|
||||
End If
|
||||
@@ -210,32 +210,32 @@ Namespace CameraN
|
||||
currentLookDirection = dir
|
||||
Select Case currentLookDirection
|
||||
Case LookDirection.Top
|
||||
pos = lookPositions(CInt(LookDirection.Top))
|
||||
pos = lookPositions(LookDirection.Top)
|
||||
myLookat = New Vector3(pos.X, -25000, pos.Z - 1)
|
||||
UpdateMatrix(cameraMatrix)
|
||||
SetRotationFromLookAt()
|
||||
Case LookDirection.Bottom
|
||||
pos = lookPositions(CInt(LookDirection.Bottom))
|
||||
pos = lookPositions(LookDirection.Bottom)
|
||||
myLookat = New Vector3(pos.X, 25000, pos.Z + 1)
|
||||
UpdateMatrix(cameraMatrix)
|
||||
SetRotationFromLookAt()
|
||||
Case LookDirection.Left
|
||||
pos = lookPositions(CInt(LookDirection.Left))
|
||||
pos = lookPositions(LookDirection.Left)
|
||||
myLookat = New Vector3(25000, pos.Y, pos.Z)
|
||||
UpdateMatrix(cameraMatrix)
|
||||
SetRotationFromLookAt()
|
||||
Case LookDirection.Right
|
||||
pos = lookPositions(CInt(LookDirection.Right))
|
||||
pos = lookPositions(LookDirection.Right)
|
||||
myLookat = New Vector3(-25000, pos.Y, pos.Z)
|
||||
UpdateMatrix(cameraMatrix)
|
||||
SetRotationFromLookAt()
|
||||
Case LookDirection.Front
|
||||
pos = lookPositions(CInt(LookDirection.Front))
|
||||
pos = lookPositions(LookDirection.Front)
|
||||
myLookat = New Vector3(pos.X, pos.Y, -25000)
|
||||
UpdateMatrix(cameraMatrix)
|
||||
SetRotationFromLookAt()
|
||||
Case LookDirection.Back
|
||||
pos = lookPositions(CInt(LookDirection.Back))
|
||||
pos = lookPositions(LookDirection.Back)
|
||||
myLookat = New Vector3(pos.X, pos.Y, 25000)
|
||||
UpdateMatrix(cameraMatrix)
|
||||
SetRotationFromLookAt()
|
||||
@@ -313,9 +313,9 @@ Namespace CameraN
|
||||
|
||||
Dim pitch_Renamed As Double = CamAngleY - (Math.PI / 2)
|
||||
Dim yaw_Renamed As Double = CamAngleX - (Math.PI / 2)
|
||||
Dim CamLX As Single = CSng(Math.Sin(yaw_Renamed))
|
||||
Dim CamLY As Single = CSng(Math.Cos(pitch_Renamed))
|
||||
Dim CamLZ As Single = CSng(-Math.Cos(yaw_Renamed))
|
||||
Dim CamLX As Single = Math.Sin(yaw_Renamed)
|
||||
Dim CamLY As Single = Math.Cos(pitch_Renamed)
|
||||
Dim CamLZ As Single = -Math.Cos(yaw_Renamed)
|
||||
|
||||
Dim m As Single = 8.0F
|
||||
|
||||
@@ -324,36 +324,36 @@ Namespace CameraN
|
||||
pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m) - ((MousePosY * CamSpeedMultiplier) * (CamLZ) * m)
|
||||
pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m) - ((MousePosY * CamSpeedMultiplier) * (CamLX) * m)
|
||||
cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X, pos.Y - 1000, pos.Z - 1, 0, 1, 0)
|
||||
lookPositions(CInt(currentLookDirection)) = pos
|
||||
lookPositions(currentLookDirection) = pos
|
||||
Case LookDirection.Bottom
|
||||
pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m) + ((MousePosY * CamSpeedMultiplier) * (CamLZ) * m)
|
||||
pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m) + ((MousePosY * CamSpeedMultiplier) * (CamLX) * m)
|
||||
cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X, pos.Y + 1000, pos.Z + 1, 0, 1, 0)
|
||||
lookPositions(CInt(currentLookDirection)) = pos
|
||||
lookPositions(currentLookDirection) = pos
|
||||
Case LookDirection.Left
|
||||
pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m)
|
||||
pos.Y = orgPos.Y - ((MousePosY * CamSpeedMultiplier) * (-1.0F) * m)
|
||||
pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m)
|
||||
cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X + 12500, pos.Y, pos.Z, 0, 1, 0)
|
||||
lookPositions(CInt(currentLookDirection)) = pos
|
||||
lookPositions(currentLookDirection) = pos
|
||||
Case LookDirection.Right
|
||||
pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m)
|
||||
pos.Y = orgPos.Y - ((MousePosY * CamSpeedMultiplier) * (-1.0F) * m)
|
||||
pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m)
|
||||
cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X - 12500, pos.Y, pos.Z, 0, 1, 0)
|
||||
lookPositions(CInt(currentLookDirection)) = pos
|
||||
lookPositions(currentLookDirection) = pos
|
||||
Case LookDirection.Front
|
||||
pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m)
|
||||
pos.Y = orgPos.Y - ((MousePosY * CamSpeedMultiplier) * (-1.0F) * m)
|
||||
pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m)
|
||||
cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X, pos.Y, pos.Z - 12500, 0, 1, 0)
|
||||
lookPositions(CInt(currentLookDirection)) = pos
|
||||
lookPositions(currentLookDirection) = pos
|
||||
Case LookDirection.Back
|
||||
pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m)
|
||||
pos.Y = orgPos.Y - ((MousePosY * CamSpeedMultiplier) * (-1.0F) * m)
|
||||
pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m)
|
||||
cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X, pos.Y, pos.Z + 12500, 0, 1, 0)
|
||||
lookPositions(CInt(currentLookDirection)) = pos
|
||||
lookPositions(currentLookDirection) = pos
|
||||
End Select
|
||||
|
||||
RaisePerspectiveChanged()
|
||||
@@ -372,7 +372,7 @@ Namespace CameraN
|
||||
End If
|
||||
Dim MousePosX As Integer = mouseX - lastMouseX
|
||||
Dim MousePosY As Integer = mouseY - lastMouseY
|
||||
CamAngleX = CamAngleX + (0.01F * MousePosX)
|
||||
CamAngleX += (0.01F * MousePosX)
|
||||
' This next part isn't neccessary, but it keeps the Yaw rotation value within [0, 2*pi] which makes debugging simpler.
|
||||
If CamAngleX > TAU Then
|
||||
CamAngleX -= TAU
|
||||
@@ -419,9 +419,9 @@ Namespace CameraN
|
||||
'Console.WriteLine(MousePosX+","+ MousePosY);
|
||||
Dim pitch_Renamed As Double = CamAngleY - (Math.PI / 2)
|
||||
Dim yaw_Renamed As Double = CamAngleX - (Math.PI / 2)
|
||||
Dim CamLX As Single = CSng(Math.Sin(yaw_Renamed))
|
||||
Dim CamLX As Single = Math.Sin(yaw_Renamed)
|
||||
' float CamLY = (float)Math.Cos(pitch);
|
||||
Dim CamLZ As Single = CSng(-Math.Cos(yaw_Renamed))
|
||||
Dim CamLZ As Single = -Math.Cos(yaw_Renamed)
|
||||
pos.X += ((horz_amount * CamSpeedMultiplier) * (CamLX))
|
||||
pos.Y += ((vert_amount * CamSpeedMultiplier) * (-1.0F))
|
||||
pos.Z += ((horz_amount * CamSpeedMultiplier) * (CamLZ))
|
||||
|
||||
@@ -136,12 +136,13 @@ Namespace PreviewN
|
||||
DoubleBuffered = True
|
||||
|
||||
'glControl1
|
||||
Me.glControl1 = New GLControl
|
||||
Me.glControl1.BackColor = Color.Black
|
||||
Me.glControl1.Location = New Point(0, 0)
|
||||
Me.glControl1.MinimumSize = New Size(600, 120)
|
||||
Me.glControl1.Name = "glControl1"
|
||||
Me.glControl1.Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Right Or AnchorStyles.Bottom
|
||||
Me.glControl1 = New GLControl With {
|
||||
.BackColor = Color.Black,
|
||||
.Location = New Point(0, 0),
|
||||
.MinimumSize = New Size(600, 120),
|
||||
.Name = "glControl1",
|
||||
.Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Right Or AnchorStyles.Bottom
|
||||
}
|
||||
Me.glControl1.Location = New Point(0, 0)
|
||||
Me.glControl1.Size = Me.ClientSize
|
||||
Me.glControl1.TabIndex = 0
|
||||
@@ -268,7 +269,7 @@ Namespace PreviewN
|
||||
|
||||
Private Sub glControl1_Wheel(sender As Object, e As MouseEventArgs)
|
||||
MyCamera.ResetMouseStuff()
|
||||
MyCamera.UpdateCameraMatrixWithScrollWheel(CInt(Math.Truncate(e.Delta * (If(IsShiftPressed, 3.5F, 1.5F)))), camMtx)
|
||||
MyCamera.UpdateCameraMatrixWithScrollWheel(Math.Truncate(e.Delta * (If(IsShiftPressed, 3.5F, 1.5F))), camMtx)
|
||||
savedCamPos = MyCamera.Position
|
||||
glControl1.Invalidate()
|
||||
End Sub
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
Imports System.Drawing.Imaging
|
||||
Imports System.Drawing
|
||||
Imports System.Drawing.Imaging
|
||||
|
||||
Imports OpenTK.Graphics.OpenGL
|
||||
|
||||
Imports Bitmap = System.Drawing.Bitmap
|
||||
Imports System.Drawing
|
||||
|
||||
Namespace RenderingN
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
Public Module HelpfulDrawingFunctions
|
||||
|
||||
Public Function IsPointInRectangle(p As PointF, rect As RectangleF) As Boolean
|
||||
Dim bList As New List(Of Boolean)
|
||||
|
||||
bList.Add(p.X > rect.Left)
|
||||
bList.Add(p.X < rect.Right)
|
||||
bList.Add(p.Y > rect.Top)
|
||||
bList.Add(p.Y < rect.Bottom)
|
||||
Dim bList As New List(Of Boolean) From {
|
||||
p.X > rect.Left,
|
||||
p.X < rect.Right,
|
||||
p.Y > rect.Top,
|
||||
p.Y < rect.Bottom
|
||||
}
|
||||
|
||||
Return Not bList.Contains(False)
|
||||
End Function
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Pilz.IO;
|
||||
public class EmbeddedFilesContainer
|
||||
{
|
||||
[JsonProperty("CompressedFiles")]
|
||||
private readonly Dictionary<string, byte[]> compressedFiles = new Dictionary<string, byte[]>();
|
||||
private readonly Dictionary<string, byte[]> compressedFiles = [];
|
||||
|
||||
/// <summary>
|
||||
/// Returns the names of all embedded files.
|
||||
|
||||
@@ -7,7 +7,7 @@ public class ManagedPipeServer : ManagedPipe
|
||||
{
|
||||
|
||||
// Pro Verbindung (Anfrage) wird ein Client-Objekt generiert, das den Datenaustausch dieser Verbindung abwickelt
|
||||
public List<ManagedPipeClient> Clients { get; private set; } = new List<ManagedPipeClient>();
|
||||
public List<ManagedPipeClient> Clients { get; private set; } = [];
|
||||
|
||||
private readonly string pipeName = "";
|
||||
private readonly int maxNumbersOfServerInstances;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Pilz.Net.CloudProviders.Nextcloud;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention.Model;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention.Model;
|
||||
|
||||
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Pilz.Net.CloudProviders.Nextcloud;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention.Ocs;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention.Ocs;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.OCS;
|
||||
|
||||
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention;
|
||||
|
||||
@@ -65,7 +65,7 @@ public class Column
|
||||
public int? TextMaxLength { get; set; }
|
||||
|
||||
[JsonProperty("selectionOptions")]
|
||||
public List<ColumnSelectionOption> SelectionOptions { get; } = new();
|
||||
public List<ColumnSelectionOption> SelectionOptions { get; } = [];
|
||||
|
||||
[JsonProperty("selectionDefault")]
|
||||
public int? SelectionDefault { get; set; }
|
||||
|
||||
@@ -23,5 +23,5 @@ public class Row
|
||||
public DateTime LastEditAt { get; set; }
|
||||
|
||||
[JsonProperty("data")]
|
||||
public List<RowData> Data { get; set; } = new();
|
||||
public List<RowData> Data { get; set; } = [];
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
|
||||
public class RowUpdate
|
||||
{
|
||||
[JsonProperty("data")]
|
||||
public Dictionary<long, object?> Data { get; set; } = new();
|
||||
public Dictionary<long, object?> Data { get; set; } = [];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Pilz.Net.CloudProviders.Nextcloud;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.OCS;
|
||||
|
||||
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Pilz.Net.CloudProviders.Nextcloud;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
|
||||
|
||||
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Model;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Model;
|
||||
|
||||
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Cloud;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Pilz.Net.CloudProviders.Nextcloud;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Ocs;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Ocs;
|
||||
|
||||
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Model;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Pilz.Net.CloudProviders.Nextcloud;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Ocs;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Ocs;
|
||||
using Pilz.Net.CloudProviders.Nextcloud.OCS;
|
||||
|
||||
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Cloud;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Pilz.Net.CloudProviders.Nextcloud;
|
||||
|
||||
public class NextcloudClient : IDisposable
|
||||
{
|
||||
private readonly List<ClientBase> clients = new();
|
||||
private readonly List<ClientBase> clients = [];
|
||||
private NextcloudLogin? currentLogin;
|
||||
|
||||
public OcsApi Ocs { get; init; } = new();
|
||||
|
||||
@@ -13,7 +13,7 @@ public class OcsApi : IDisposable
|
||||
public event GetOcsApiAuthCredentailsEventHandler? GetOcsApiAuthCredentails;
|
||||
|
||||
private readonly HttpClient client = new();
|
||||
private readonly List<OcsApiBase> apis = new();
|
||||
private readonly List<OcsApiBase> apis = [];
|
||||
|
||||
public string BaseUrl { get; set; } = string.Empty;
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Pilz.Extensions.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Web;
|
||||
|
||||
namespace Pilz.Net.Api;
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public class ApiServer : IApiServer
|
||||
var httpListener = new HttpListener();
|
||||
|
||||
httpListener.TimeoutManager.IdleConnection = new TimeSpan(0, 2, 0);
|
||||
|
||||
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
httpListener.TimeoutManager.RequestQueue = new TimeSpan(0, 2, 0);
|
||||
|
||||
@@ -9,7 +9,7 @@ public abstract class BaseChildItemClient<T>(IApiClient client) : BaseClient<T>(
|
||||
public abstract string ApiEndpointParent { get; }
|
||||
public abstract string ApiEndpointChild { get; }
|
||||
|
||||
public virtual async Task<IEnumerable<T>> GetAll(int parentId)
|
||||
public virtual async Task<IEnumerable<T>> GetAll(int parentId)
|
||||
{
|
||||
return (await client.SendRequest<GeneralItemMessages<T>.Items>($"{ApiEndpointParent}/{parentId}{ApiEndpointChild}", HttpMethod.Get)).EnsureOk().Items;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Pilz.Data;
|
||||
using Pilz.Net.Api.Messages;
|
||||
|
||||
namespace Pilz.Net.Api.Client;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Pilz.Extensions.Reflection;
|
||||
using Pilz.Net.Api.Messages;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
|
||||
namespace Pilz.Net.Api.Server;
|
||||
|
||||
@@ -41,7 +40,7 @@ public class MaintenanceHandler : IApiHandlerInitializer
|
||||
{
|
||||
if (MaintenanceEnabled)
|
||||
{
|
||||
|
||||
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Pilz.Net;
|
||||
public abstract class ConnectionManagerBase(int port)
|
||||
{
|
||||
private const int HEADER_LENGTH = 12;
|
||||
|
||||
|
||||
private bool listening = false;
|
||||
private readonly Dictionary<int, Dictionary<int, byte[]>> dicData = [];
|
||||
|
||||
@@ -122,13 +122,15 @@ public abstract class ConnectionManagerBase(int port)
|
||||
finalBuffer.Add((byte)(value >> 16 & 0xFF));
|
||||
finalBuffer.Add((byte)(value >> 8 & 0xFF));
|
||||
finalBuffer.Add((byte)(value & 0xFF));
|
||||
};
|
||||
}
|
||||
;
|
||||
void addHeader(int packageID, int packagesCount)
|
||||
{
|
||||
addInteger(dataID); // Data ID
|
||||
addInteger(packageID); // Package ID
|
||||
addInteger(packagesCount); // Packages Count
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
// Send data (this if statement and else content might be useless)
|
||||
if (data.Length > maxDataSize)
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Pilz.Net;
|
||||
|
||||
public class TCPManager(int port) : ConnectionManagerBase(port)
|
||||
{
|
||||
private readonly TcpListener listener = new TcpListener(IPAddress.Any, port);
|
||||
private readonly TcpListener listener = new(IPAddress.Any, port);
|
||||
public int BufferSize { get; set; } = 10240;
|
||||
|
||||
public override void Start()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Pilz.UI.Telerik.Dialogs;
|
||||
using Pilz.UI.WinForms;
|
||||
using Pilz.UI;
|
||||
using Pilz.UI.Telerik.Dialogs;
|
||||
|
||||
namespace Pilz.Plugins.Advanced.UI.WinForms.Telerik;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public abstract class ControlListenerFeature : PluginFeature
|
||||
{
|
||||
public string? ControlName { get; set; }
|
||||
public string? ControlName { get; set; }
|
||||
|
||||
public bool ControlNameRegEx { get; set; }
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Pilz.UI.WinForms;
|
||||
using Pilz.UI;
|
||||
using Pilz.UI.WinForms.Dialogs;
|
||||
|
||||
namespace Pilz.Plugins.Advanced.UI.WinForms;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Reflection.Metadata;
|
||||
|
||||
namespace Pilz.Plugins.Advanced;
|
||||
namespace Pilz.Plugins.Advanced;
|
||||
|
||||
public abstract class PluginFeature
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Reflection;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Pilz.Plugins.Advanced;
|
||||
|
||||
|
||||
@@ -118,12 +118,12 @@ Namespace Aspose3DModule
|
||||
'Create Vertices
|
||||
For Each vert As Vector4 In curMesh.ControlPoints
|
||||
'Create new Vertex
|
||||
Dim newVert As New Vertex
|
||||
|
||||
'Set Vertex Data
|
||||
newVert.X = vert.x
|
||||
newVert.Y = vert.y
|
||||
newVert.Z = vert.z
|
||||
Dim newVert As New Vertex With {
|
||||
.X = vert.x,
|
||||
.Y = vert.y,
|
||||
.Z = vert.z
|
||||
}
|
||||
|
||||
'Add new Vertex
|
||||
newMesh.Vertices.Add(newVert)
|
||||
@@ -134,12 +134,12 @@ Namespace Aspose3DModule
|
||||
If veNormals IsNot Nothing Then
|
||||
For Each n As Vector4 In veNormals.Data
|
||||
'Create new Normal
|
||||
Dim newNormal As New Normal
|
||||
|
||||
'Set Normal Data
|
||||
newNormal.X = n.x
|
||||
newNormal.Y = n.y
|
||||
newNormal.Z = n.z
|
||||
Dim newNormal As New Normal With {
|
||||
.X = n.x,
|
||||
.Y = n.y,
|
||||
.Z = n.z
|
||||
}
|
||||
|
||||
'Add new Normal
|
||||
newMesh.Normals.Add(newNormal)
|
||||
@@ -151,11 +151,11 @@ Namespace Aspose3DModule
|
||||
If veUVs IsNot Nothing Then
|
||||
For Each uv As Vector4 In veUVs.Data
|
||||
'Create new UV
|
||||
Dim newUV As New UV
|
||||
|
||||
'Set UV Data
|
||||
newUV.U = uv.x
|
||||
newUV.V = uv.y
|
||||
Dim newUV As New UV With {
|
||||
.U = uv.x,
|
||||
.V = uv.y
|
||||
}
|
||||
|
||||
'Add new UV
|
||||
newMesh.UVs.Add(newUV)
|
||||
@@ -167,13 +167,13 @@ Namespace Aspose3DModule
|
||||
If veVertexColor IsNot Nothing Then
|
||||
For Each n As Vector4 In veVertexColor.Data
|
||||
'Create new Normal
|
||||
Dim newVC As New VertexColor
|
||||
|
||||
'Set Normal Data
|
||||
newVC.R = n.x
|
||||
newVC.G = n.y
|
||||
newVC.B = n.z
|
||||
newVC.A = n.w
|
||||
Dim newVC As New VertexColor With {
|
||||
.R = n.x,
|
||||
.G = n.y,
|
||||
.B = n.z,
|
||||
.A = n.w
|
||||
}
|
||||
|
||||
'Add new Normal
|
||||
newMesh.VertexColors.Add(newVC)
|
||||
@@ -203,10 +203,10 @@ Namespace Aspose3DModule
|
||||
|
||||
For Each index As Integer In poly
|
||||
'Create new Point
|
||||
Dim p As New Point
|
||||
|
||||
'Set Vertex
|
||||
p.Vertex = newMesh.Vertices(index)
|
||||
Dim p As New Point With {
|
||||
.Vertex = newMesh.Vertices(index)
|
||||
}
|
||||
|
||||
'Set Normal
|
||||
If veNormals IsNot Nothing Then
|
||||
|
||||
@@ -68,7 +68,7 @@ Namespace AssimpModule
|
||||
Dim dicUVs = pc.DicUVs
|
||||
Dim dicVertexColors = pc.DicVertexColors
|
||||
|
||||
trafo = trafo * node.Transform
|
||||
trafo *= node.Transform
|
||||
|
||||
If node.HasMeshes Then
|
||||
For Each meshIndex In node.MeshIndices
|
||||
@@ -126,10 +126,10 @@ Namespace AssimpModule
|
||||
For Each uvList As List(Of Vector3D) In m.TextureCoordinateChannels
|
||||
For Each uv As Vector3D In uvList
|
||||
If Not dicUVs.ContainsKey(uv) Then
|
||||
Dim newUV As New UV
|
||||
|
||||
newUV.U = uv.X
|
||||
newUV.V = uv.Y
|
||||
Dim newUV As New UV With {
|
||||
.U = uv.X,
|
||||
.V = uv.Y
|
||||
}
|
||||
|
||||
newMesh.UVs.Add(newUV)
|
||||
dicUVs.Add(uv, newUV)
|
||||
@@ -140,12 +140,12 @@ Namespace AssimpModule
|
||||
For Each vcList As List(Of Color4D) In m.VertexColorChannels
|
||||
For Each vc As Color4D In vcList
|
||||
If Not dicVertexColors.ContainsKey(vc) Then
|
||||
Dim newVC As New VertexColor
|
||||
|
||||
newVC.R = vc.R
|
||||
newVC.G = vc.G
|
||||
newVC.B = vc.B
|
||||
newVC.A = vc.A
|
||||
Dim newVC As New VertexColor With {
|
||||
.R = vc.R,
|
||||
.G = vc.G,
|
||||
.B = vc.B,
|
||||
.A = vc.A
|
||||
}
|
||||
|
||||
newMesh.VertexColors.Add(newVC)
|
||||
dicVertexColors.Add(vc, newVC)
|
||||
@@ -298,15 +298,16 @@ Namespace AssimpModule
|
||||
End If
|
||||
|
||||
For Each kvp As KeyValuePair(Of String, Material) In obj.Materials
|
||||
Dim mat As New Assimp.Material
|
||||
|
||||
mat.Name = If(kvp.Key <> "", kvp.Key, "_" & mdl.Materials.Count)
|
||||
Dim mat As New Assimp.Material With {
|
||||
.Name = If(kvp.Key <> "", kvp.Key, "_" & mdl.Materials.Count)
|
||||
}
|
||||
mat.Opacity = mat.Opacity
|
||||
|
||||
Dim texslot As New TextureSlot
|
||||
texslot.TextureIndex = mdl.Textures.Count
|
||||
texslot.TextureType = TextureType.Diffuse
|
||||
texslot.UVIndex = 0
|
||||
Dim texslot As New TextureSlot With {
|
||||
.TextureIndex = mdl.Textures.Count,
|
||||
.TextureType = TextureType.Diffuse,
|
||||
.UVIndex = 0
|
||||
}
|
||||
|
||||
Dim ms As New MemoryStream
|
||||
kvp.Value.Image.Save(ms, Imaging.ImageFormat.Png)
|
||||
@@ -342,8 +343,9 @@ Namespace AssimpModule
|
||||
If dicTexMesh.ContainsKey(f.Material) Then
|
||||
m = dicTexMesh(f.Material)
|
||||
Else
|
||||
m = New Assimp.Mesh("Mesh_" & mdl.MeshCount + 1)
|
||||
m.PrimitiveType = PrimitiveType.Triangle
|
||||
m = New Assimp.Mesh("Mesh_" & mdl.MeshCount + 1) With {
|
||||
.PrimitiveType = PrimitiveType.Triangle
|
||||
}
|
||||
If dicMatIndex.ContainsKey(f.Material) Then
|
||||
m.MaterialIndex = dicMatIndex(f.Material)
|
||||
End If
|
||||
@@ -359,20 +361,22 @@ Namespace AssimpModule
|
||||
newFace.Indices.Add(dicCounter(m))
|
||||
|
||||
If p.Vertex IsNot Nothing Then
|
||||
Dim vert As New Vector3D
|
||||
vert.X = p.Vertex.X
|
||||
vert.Y = p.Vertex.Y
|
||||
vert.Z = p.Vertex.Z
|
||||
Dim vert As New Vector3D With {
|
||||
.X = p.Vertex.X,
|
||||
.Y = p.Vertex.Y,
|
||||
.Z = p.Vertex.Z
|
||||
}
|
||||
m.Vertices.Add(vert)
|
||||
Else
|
||||
m.Vertices.Add(New Vector3D(0, 0, 0))
|
||||
End If
|
||||
|
||||
If p.Normal IsNot Nothing Then
|
||||
Dim norm As New Vector3D
|
||||
norm.X = p.Normal.X
|
||||
norm.Y = p.Normal.Y
|
||||
norm.Z = p.Normal.Z
|
||||
Dim norm As New Vector3D With {
|
||||
.X = p.Normal.X,
|
||||
.Y = p.Normal.Y,
|
||||
.Z = p.Normal.Z
|
||||
}
|
||||
m.Normals.Add(norm)
|
||||
Else
|
||||
m.Normals.Add(New Vector3D(0, 0, 0))
|
||||
|
||||
@@ -68,11 +68,11 @@ Public Class File3DLoaderModule
|
||||
End Property
|
||||
|
||||
Private Shared Function GetLoaderModules() As File3DLoaderModule()
|
||||
Dim list As New List(Of File3DLoaderModule)
|
||||
|
||||
list.Add(New File3DLoaderModule("Simple File Parser",
|
||||
Dim list As New List(Of File3DLoaderModule) From {
|
||||
New File3DLoaderModule("Simple File Parser",
|
||||
AddressOf LoadViaSimpleFileParser,
|
||||
New Dictionary(Of String, String) From {{"obj", "OBJ"}}))
|
||||
New Dictionary(Of String, String) From {{"obj", "OBJ"}})
|
||||
}
|
||||
|
||||
AssimpModule.AssimpLoader.LoadAssimpLibs()
|
||||
Dim exts As New Dictionary(Of String, String)
|
||||
@@ -111,11 +111,11 @@ Public Class File3DLoaderModule
|
||||
End Function
|
||||
|
||||
Private Shared Function GetExporterModules() As File3DLoaderModule()
|
||||
Dim list As New List(Of File3DLoaderModule)
|
||||
|
||||
list.Add(New File3DLoaderModule("Simple File Parser",
|
||||
Dim list As New List(Of File3DLoaderModule) From {
|
||||
New File3DLoaderModule("Simple File Parser",
|
||||
AddressOf ExportViaSimpleFileParser,
|
||||
New Dictionary(Of String, String) From {{"obj", "OBJ"}}))
|
||||
New Dictionary(Of String, String) From {{"obj", "OBJ"}})
|
||||
}
|
||||
|
||||
AssimpModule.AssimpLoader.LoadAssimpLibs()
|
||||
Dim exts As New Dictionary(Of String, String)
|
||||
|
||||
34
Pilz.UI.Gtk/Dialogs/GtkContent.cs
Normal file
34
Pilz.UI.Gtk/Dialogs/GtkContent.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Gtk;
|
||||
|
||||
namespace Pilz.UI.Gtk.Dialogs;
|
||||
|
||||
public class GtkContent : Box
|
||||
{
|
||||
public GtkDialogBase Dialog { get; internal set; } = null!;
|
||||
public ResponseType Result { get; set; } = ResponseType.Cancel;
|
||||
|
||||
public bool RegisterDialogAccept { get; set; } = true;
|
||||
public bool RegisterDialogCancel { get; set; } = true;
|
||||
|
||||
protected void Close(ResponseType result)
|
||||
{
|
||||
Result = result;
|
||||
Dialog.Destroy();
|
||||
}
|
||||
|
||||
protected virtual bool ValidateOK()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected virtual void Button_Confirm_Clicked(object? sender, EventArgs e)
|
||||
{
|
||||
if (ValidateOK())
|
||||
Close(ResponseType.Ok);
|
||||
}
|
||||
|
||||
protected virtual void Button_Cancel_Clicked(object? sender, EventArgs e)
|
||||
{
|
||||
Close(ResponseType.Cancel);
|
||||
}
|
||||
}
|
||||
33
Pilz.UI.Gtk/Dialogs/GtkDialogBase.Statics.cs
Normal file
33
Pilz.UI.Gtk/Dialogs/GtkDialogBase.Statics.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Gtk;
|
||||
|
||||
namespace Pilz.UI.Gtk.Dialogs;
|
||||
|
||||
public partial class GtkDialogBase
|
||||
{
|
||||
private static GtkDialogBase CreateDialog<TContent>(TContent content, string title) where TContent : Widget
|
||||
{
|
||||
var dialog = new GtkDialogBase
|
||||
{
|
||||
Title = title,
|
||||
};
|
||||
dialog.ContentArea.Add(content);
|
||||
content.Show();
|
||||
return dialog;
|
||||
}
|
||||
|
||||
public static TContent Show<TContent>(TContent content, string title) where TContent : Widget
|
||||
{
|
||||
var dialog = CreateDialog(content, title);
|
||||
dialog.Show();
|
||||
dialog.Destroy();
|
||||
return content;
|
||||
}
|
||||
|
||||
public static TContent ShowDialog<TContent>(TContent content, string title) where TContent : Widget
|
||||
{
|
||||
var dialog = CreateDialog(content, title);
|
||||
dialog.Run();
|
||||
dialog.Destroy();
|
||||
return content;
|
||||
}
|
||||
}
|
||||
20
Pilz.UI.Gtk/Dialogs/GtkDialogBase.cs
Normal file
20
Pilz.UI.Gtk/Dialogs/GtkDialogBase.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Gtk;
|
||||
|
||||
namespace Pilz.UI.Gtk.Dialogs;
|
||||
|
||||
public partial class GtkDialogBase : Dialog
|
||||
{
|
||||
public GtkDialogBase() : this(new Builder("GtkDialogBase.glade")) { }
|
||||
|
||||
private GtkDialogBase(Builder builder) : base(builder.GetRawOwnedObject("GtkDialogBase"))
|
||||
{
|
||||
builder.Autoconnect(this);
|
||||
DefaultResponse = ResponseType.Cancel;
|
||||
Response += Dialog_Response;
|
||||
}
|
||||
|
||||
protected virtual void Dialog_Response(object o, ResponseArgs args)
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
65
Pilz.UI.Gtk/Dialogs/GtkDialogBase.glade
Normal file
65
Pilz.UI.Gtk/Dialogs/GtkDialogBase.glade
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.40.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.18"/>
|
||||
<object class="GtkDialog" id="GtkDialogBase">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="window-position">center-on-parent</property>
|
||||
<property name="type-hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="layout-style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="buttonOkay">
|
||||
<property name="label">gtk-apply</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="use-stock">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="buttonCancel">
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="use-stock">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="-5">buttonOkay</action-widget>
|
||||
<action-widget response="-6">buttonCancel</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -11,6 +11,14 @@
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="**\*.glade" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="**\*.glade" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GtkSharp" Version="3.24.24.95" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -24,7 +24,7 @@ public abstract class GtkSymbolFactory<TSymbols> : BaseSymbolFactory<TSymbols>,
|
||||
pixbuf = new(stream);
|
||||
else
|
||||
pixbuf = new(stream, size.Width, size.Height);
|
||||
|
||||
|
||||
return GetImageFromPixbuf(pixbuf);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Pilz.SymbolPacks.Sets;
|
||||
using Pilz.UI.Telerik.Symbols.Factories;
|
||||
using Pilz.UI.WinForms.Telerik.Symbols.Factories;
|
||||
|
||||
namespace Pilz.UI.WinForms.Telerik.Symbols;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Design;
|
||||
using System.Globalization;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.ComponentModel;
|
||||
using Telerik.WinControls.Data;
|
||||
//using System.Linq;
|
||||
|
||||
namespace Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Pilz.UI.WinForms;
|
||||
using Pilz.UI.WinForms.Telerik.Dialogs;
|
||||
using Telerik.WinControls.UI;
|
||||
|
||||
namespace Pilz.UI.Telerik.Dialogs;
|
||||
@@ -30,6 +30,6 @@ public partial class RadDialogBase : RadForm
|
||||
|
||||
private void DialogBaseForm_FormClosed(object? sender, FormClosedEventArgs e)
|
||||
{
|
||||
DialogClosed?.Invoke(new DialogClosedEventArgs(this));
|
||||
DialogClosed?.Invoke(new WinForms.Telerik.Dialogs.DialogClosedEventArgs(this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Pilz.UI.WinForms;
|
||||
using Pilz.UI.WinForms.Telerik.Dialogs;
|
||||
using Pilz.UI.WinForms.Telerik.Dialogs;
|
||||
using Telerik.WinControls;
|
||||
using Telerik.WinControls.UI;
|
||||
using Telerik.WinControls.UI.SplashScreen;
|
||||
@@ -9,7 +8,7 @@ namespace Pilz.UI.Telerik.Dialogs;
|
||||
partial class RadFlyoutBase
|
||||
{
|
||||
public delegate void FlyoutCreatedEventHandler(FlyoutCreatedEventArgs e);
|
||||
public delegate void FlyoutClosedEventHandler(FlyoutClosedEventArgs e);
|
||||
public delegate void FlyoutClosedEventHandler(global::Telerik.WinControls.UI.SplashScreen.FlyoutClosedEventArgs e);
|
||||
|
||||
public static event FlyoutCreatedEventHandler FlyoutCreated
|
||||
{
|
||||
@@ -72,7 +71,7 @@ partial class RadFlyoutBase
|
||||
{
|
||||
if (e.Content is RadFlyoutBase dialogBase)
|
||||
{
|
||||
var eventArgs = new FlyoutClosedEventArgs((RadFlyoutBase)e.Content);
|
||||
var eventArgs = new global::Telerik.WinControls.UI.SplashScreen.FlyoutClosedEventArgs((RadFlyoutBase)e.Content);
|
||||
|
||||
foreach (var args in flyoutCloseHandlers.ToArray())
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;
|
||||
using System.ComponentModel;
|
||||
using Telerik.WinControls;
|
||||
using Telerik.WinControls.Data;
|
||||
using Telerik.WinControls.UI;
|
||||
|
||||
namespace Pilz.UI.Telerik.Dialogs;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Pilz.UI.WinForms;
|
||||
using Pilz.UI.WinForms.Dialogs;
|
||||
using Pilz.UI.WinForms.Dialogs;
|
||||
|
||||
namespace Pilz.UI.Dialogs;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Pilz.UI.Dialogs;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Pilz.UI.WinForms.Dialogs;
|
||||
|
||||
@@ -150,7 +149,7 @@ public partial class FlyoutBase : UserControl
|
||||
tableLayoutPanel_ActionPanel.RowStyles.Add(new RowStyle());
|
||||
tableLayoutPanel_ActionPanel.Controls.Add(button_Cancel, 2, 0);
|
||||
tableLayoutPanel_ActionPanel.Controls.Add(button_Accept, 1, 0);
|
||||
|
||||
|
||||
// FlyoutBase
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace Pilz.UI.WinForms;
|
||||
|
||||
@@ -61,9 +60,11 @@ public class DisplayHelp
|
||||
else
|
||||
{
|
||||
using var brush = CreateLinearGradientBrush(r, color1, color2, gradientAngle);
|
||||
var blend = new Blend(factors.Length);
|
||||
blend.Factors = factors;
|
||||
blend.Positions = positions;
|
||||
var blend = new Blend(factors.Length)
|
||||
{
|
||||
Factors = factors,
|
||||
Positions = positions
|
||||
};
|
||||
brush.Blend = blend;
|
||||
g.FillRectangle(brush, r);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Pilz.UI.WinForms.Dialogs;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Pilz.UI.WinForms.Extensions;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Pilz.UI.WinForms;
|
||||
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Pilz.UI.WinForms;
|
||||
namespace Pilz.UI.WinForms;
|
||||
|
||||
|
||||
internal class HighlightPanel : Control
|
||||
{
|
||||
|
||||
private Dictionary<Control, eHighlightColor> _Highlights = null;
|
||||
private List<HighlightRegion> _HighlightRegions = new List<HighlightRegion>();
|
||||
private List<HighlightRegion> _HighlightRegions = [];
|
||||
|
||||
public HighlightPanel(Dictionary<Control, eHighlightColor> highlights)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.ComponentModel;
|
||||
// Nicht gemergte Änderung aus Projekt "Pilz.UI (net8.0-windows)"
|
||||
// Vor:
|
||||
// Imports System.Windows.Forms
|
||||
@@ -9,7 +6,6 @@ using System.Drawing;
|
||||
// Nach:
|
||||
// Imports System.Drawing
|
||||
// Imports System.Windows.Forms
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Pilz.UI.WinForms;
|
||||
|
||||
@@ -17,8 +13,8 @@ namespace Pilz.UI.WinForms;
|
||||
public class Highlighter : Component
|
||||
{
|
||||
|
||||
private Dictionary<Control, eHighlightColor> _Highlights = new Dictionary<Control, eHighlightColor>();
|
||||
private Dictionary<Control, bool> _HighlightOnFocus = new Dictionary<Control, bool>();
|
||||
private Dictionary<Control, eHighlightColor> _Highlights = [];
|
||||
private Dictionary<Control, bool> _HighlightOnFocus = [];
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
@@ -143,8 +139,8 @@ public class Highlighter : Component
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<TabControl, int> _TabControl2 = new Dictionary<TabControl, int>();
|
||||
private Dictionary<Panel, int> _ParentPanel = new Dictionary<Panel, int>();
|
||||
private Dictionary<TabControl, int> _TabControl2 = [];
|
||||
private Dictionary<Panel, int> _ParentPanel = [];
|
||||
|
||||
private void AddHighlight(Dictionary<Control, eHighlightColor> highlights, Control c, eHighlightColor highlightColor)
|
||||
{
|
||||
@@ -386,15 +382,14 @@ public class Highlighter : Component
|
||||
if (_ContainerControl is not null)
|
||||
{
|
||||
|
||||
if (_HighlightPanel is null)
|
||||
_HighlightPanel ??= new HighlightPanel(_Highlights)
|
||||
{
|
||||
_HighlightPanel = new HighlightPanel(_Highlights);
|
||||
_HighlightPanel.FocusHighlightColor = _FocusHighlightColor;
|
||||
_HighlightPanel.Margin = new Padding(0);
|
||||
_HighlightPanel.Padding = new Padding(0);
|
||||
_HighlightPanel.CustomHighlightColors = _CustomHighlightColors;
|
||||
_HighlightPanel.Visible = false;
|
||||
}
|
||||
FocusHighlightColor = _FocusHighlightColor,
|
||||
Margin = new Padding(0),
|
||||
Padding = new Padding(0),
|
||||
CustomHighlightColors = _CustomHighlightColors,
|
||||
Visible = false
|
||||
};
|
||||
|
||||
_ContainerControl.SizeChanged += ContainerControlSizeChanged;
|
||||
_ContainerControl.HandleCreated += ContainerControlHandleCreated;
|
||||
@@ -452,8 +447,10 @@ public class Highlighter : Component
|
||||
|
||||
if (_DelayTimer is null)
|
||||
{
|
||||
_DelayTimer = new();
|
||||
_DelayTimer.Interval = 100;
|
||||
_DelayTimer = new()
|
||||
{
|
||||
Interval = 100
|
||||
};
|
||||
_DelayTimer.Tick += new EventHandler(DelayTimerTick);
|
||||
_DelayTimer.Start();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace Pilz.UI.WinForms.PaintingControl;
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using Pilz.Drawing;
|
||||
using Pilz.UI.WinForms.PaintingControl.EventArgs;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Pilz.UI.WinForms.PaintingControl;
|
||||
|
||||
@@ -35,7 +31,7 @@ public class DefaultDrawMethodes
|
||||
|
||||
e.Graphics.DrawString(obj.Text, new Font(obj.TextFont.FontFamily, obj.TextFont.Size * zoomFactor, obj.TextFont.Style), b, rect, f);
|
||||
}
|
||||
private static object _DrawPicture_newSyncObj = new object();
|
||||
private static object _DrawPicture_newSyncObj = new();
|
||||
|
||||
public static void DrawPicture(PaintingObjectPaintEventArgs e)
|
||||
{
|
||||
@@ -276,9 +272,11 @@ public class DefaultDrawMethodes
|
||||
public static void DrawAreaSelection(PaintEventArgs e, PaintingControl pc, PointF startMousePos, PointF lastMousePos)
|
||||
{
|
||||
var rectToDraw = HelpfulDrawingFunctions.GetRectangle(startMousePos, lastMousePos);
|
||||
var p = new Pen(pc.AreaSelectionColor);
|
||||
p.DashStyle = startMousePos.X >= lastMousePos.X ? DashStyle.DashDot : DashStyle.Solid;
|
||||
p.Width = 3f;
|
||||
var p = new Pen(pc.AreaSelectionColor)
|
||||
{
|
||||
DashStyle = startMousePos.X >= lastMousePos.X ? DashStyle.DashDot : DashStyle.Solid,
|
||||
Width = 3f
|
||||
};
|
||||
e.Graphics.DrawRectangle(p, rectToDraw.X, rectToDraw.Y, rectToDraw.Width, rectToDraw.Height);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
|
||||
namespace Pilz.UI.WinForms.PaintingControl.EventArgs;
|
||||
namespace Pilz.UI.WinForms.PaintingControl;
|
||||
|
||||
public class PaintingObjectEventArgs(PaintingObject[] paintingObjects) : EventArgs
|
||||
{
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Pilz.UI.WinForms.PaintingControl.EventArgs;
|
||||
namespace Pilz.UI.WinForms.PaintingControl;
|
||||
|
||||
public class PaintingObjectPaintEventArgs(PaintingObject obj, Graphics g, PointF offset) : EventArgs
|
||||
{
|
||||
@@ -45,7 +42,7 @@ public class PaintingObjectPaintEventArgs(PaintingObject obj, Graphics g, PointF
|
||||
/// The rectangle of the PaintingObject on Screen.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public RectangleF Rectangle => new RectangleF(X, Y, PaintingObject.Width, PaintingObject.Height);
|
||||
public RectangleF Rectangle => new(X, Y, PaintingObject.Width, PaintingObject.Height);
|
||||
|
||||
public PaintingObjectPaintEventArgs(PaintingObject obj, Graphics g) : this(obj, g, obj.Parent.Offset)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using Pilz.UI.WinForms.PaintingControl.EventArgs;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Pilz.UI.WinForms.PaintingControl;
|
||||
namespace Pilz.UI.WinForms.PaintingControl;
|
||||
|
||||
|
||||
public delegate void DelegateDrawPaintingObjectMethode(PaintingObjectPaintEventArgs e);
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Data;
|
||||
|
||||
namespace Pilz.UI.WinForms.PaintingControl;
|
||||
|
||||
@@ -10,7 +7,7 @@ public class PaintingObjectListLayering
|
||||
|
||||
|
||||
public PaintingObjectList ObjectList { get; private set; }
|
||||
public Dictionary<int, Func<PaintingObject, bool>> Conditions { get; private set; } = new Dictionary<int, Func<PaintingObject, bool>>();
|
||||
public Dictionary<int, Func<PaintingObject, bool>> Conditions { get; private set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Get the order function will checkout the conditions.
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using Pilz.Drawing;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Pilz.UI.WinForms.PaintingControl;
|
||||
|
||||
@@ -95,7 +92,7 @@ internal class PaintingObjectResizing
|
||||
private EdgeEnum mEdge = EdgeEnum.None;
|
||||
private int mWidth = 4;
|
||||
private int qWidth = 4 * 4;
|
||||
private Rectangle rect = new Rectangle();
|
||||
private Rectangle rect = new();
|
||||
|
||||
public bool Enabled { get; set; } = true;
|
||||
public SizeF MinimumSize { get; set; } = new SizeF(15f, 15f);
|
||||
@@ -239,11 +236,13 @@ internal class PaintingObjectResizing
|
||||
RectangleF extRect = mObj.RectangleExtended;
|
||||
var oldRect = mObj.Rectangle;
|
||||
|
||||
var newRect = new RectangleF();
|
||||
newRect.X = extRect.X - oldRect.X;
|
||||
newRect.Y = extRect.Y - oldRect.Y;
|
||||
newRect.Width = (extRect.Width - oldRect.Width) / 2f;
|
||||
newRect.Height = (extRect.Height - oldRect.Height) / 2f;
|
||||
var newRect = new RectangleF
|
||||
{
|
||||
X = extRect.X - oldRect.X,
|
||||
Y = extRect.Y - oldRect.Y,
|
||||
Width = (extRect.Width - oldRect.Width) / 2f,
|
||||
Height = (extRect.Height - oldRect.Height) / 2f
|
||||
};
|
||||
|
||||
var setToNone = false;
|
||||
var isOnTop = ReferenceEquals(mObj.Parent.GetObject(new PointF(realX, realY), true), mObj);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Pilz.UI.Symbols;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Pilz.UI.WinForms.Symbols;
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Pilz.UI.WinForms.Utilities;
|
||||
namespace Pilz.UI.WinForms.Utilities;
|
||||
|
||||
|
||||
public static class DrawingControl
|
||||
{
|
||||
|
||||
private const int WM_SETREDRAW = 11;
|
||||
private readonly static Dictionary<nint, int> dicSuspendCount = new Dictionary<nint, int>();
|
||||
private readonly static Dictionary<nint, int> dicSuspendCount = [];
|
||||
|
||||
public static void SuspendDrawing(this Control control)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Pilz.UI.WinForms;
|
||||
namespace Pilz.UI;
|
||||
|
||||
public interface ILoadContent
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Pilz.UI.WinForms;
|
||||
namespace Pilz.UI;
|
||||
|
||||
public interface ILoadContentAsync
|
||||
{
|
||||
Reference in New Issue
Block a user