remove Gtk projects

This commit is contained in:
Pilzinsel64
2025-11-06 11:43:38 +01:00
parent 5650cb8fd6
commit 8bc09d9a59
11 changed files with 0 additions and 445 deletions

View File

@@ -1,128 +0,0 @@
using Gtk;
namespace Pilz.Plugins.Advanced.UI.Gtk;
public static class Extensions
{
private class PluginFunctionEventArgs(EventArgs original, PluginFunction function) : EventArgs
{
public EventArgs Original { get; } = original;
public PluginFunction Function { get; } = function;
}
private class PluginModuleEventArgs(EventArgs original, PluginModuleBase function) : EventArgs
{
public EventArgs Original { get; } = original;
public PluginModuleBase Function { get; } = function;
}
public static MenuItem GetAsItem(this PluginModuleBase module)
{
return module.GetAsItem(true);
}
public static MenuItem GetAsItem(this PluginModuleBase module, bool addDefaultHandler)
{
return module.GetAsItem(addDefaultHandler ? (sender, e) => RadMenuItem_RMMethod_Click(sender, new PluginModuleEventArgs(e, module)) : null);
}
public static MenuItem GetAsItem(this PluginFunction function)
{
return function.GetAsItem(true);
}
public static MenuItem GetAsItem(this PluginFunction function, bool addDefaultHandler)
{
return function.GetAsItem(addDefaultHandler ? (sender, e) => RadMenuItem_RMFunction_Click(sender, new PluginFunctionEventArgs(e, function)) : null);
}
public static MenuItem GetAsItem(this PluginFeature module, EventHandler? clickHandler)
{
var item = new MenuItem(module.Name)
{
Visible = module.Enabled,
TooltipText = module.Description ?? module.Name
};
if (clickHandler is not null)
item.Activated += clickHandler;
return item;
}
/// <summary>
/// Inserts all items to a menu item.
/// </summary>
/// <param name="parentMenuItem"></param>
/// <param name="features"></param>
/// <param name="addDefaultHandler">Will add a default click handler that executes the feature.<br/>
/// You usually don't set customClickHandler if you set this parameter to true.</param>
/// <param name="customClickHandler">Adds a custom click handler. If addDefaultHandler is true, it will only work on <see cref="PluginFeature"/>s.<br/>
/// You usually don't set addDefaultHandler to true if you set this parameter to something not null.</param>
/// <param name="customDefault">Defines a custom default position (index).</param>
/// <param name="customTop">Defines a custom top position (index).</param>
/// <param name="customBottom">Defines a custom bottom position (index).</param>
/// <param name="insertPrioSplitters">Defines if splitters should be inserted to seperate the new items by priorization.</param>
public static IEnumerable<KeyValuePair<MenuItem, PluginFeature>> InsertItemsTo(this IEnumerable<PluginFeature> features,
MenuItem parentMenuItem,
bool addDefaultHandler = false,
EventHandler? customClickHandler = null,
int? customDefault = null,
int? customTop = null,
int? customBottom = null,
bool insertPrioSplitters = false)
{
var insertedItems = new List<KeyValuePair<MenuItem, PluginFeature>>();
FeaturePrioritization? prevPrio = null;
// Oder by priorization
features = features.OrderByDescending(n => n.Prioritization);
foreach (var feature in features)
{
MenuItem item;
if (feature is PluginFunction function)
item = function.GetAsItem(addDefaultHandler);
else if (feature is PluginModuleBase module)
item = module.GetAsItem(addDefaultHandler);
else
item = feature.GetAsItem(null);
if (!addDefaultHandler && customClickHandler != null)
item.Activated += customClickHandler;
if (insertPrioSplitters && prevPrio > feature.Prioritization)
{
if (prevPrio != null)
insertItem(new SeparatorMenuItem());
prevPrio = feature.Prioritization;
}
insertItem(item);
void insertItem(MenuItem item)
{
if (parentMenuItem.Submenu is Menu subMenu)
subMenu.Append(item);
}
if (item.Parent != null)
insertedItems.Add(new(item, feature));
}
return insertedItems;
}
private static void RadMenuItem_RMMethod_Click(object? sender, EventArgs e)
{
if (sender is MenuItem item && item.Sensitive && e is PluginFunctionEventArgs args && args.Function.Enabled)
throw new NotImplementedException();
}
private static void RadMenuItem_RMFunction_Click(object? sender, EventArgs e)
{
if (sender is MenuItem item && item.Sensitive && e is PluginFunctionEventArgs args && args.Function.Enabled)
args.Function.Execute();
}
}

View File

@@ -1,22 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<Version>1.0.0</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GtkSharp" Version="3.24.24.95" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Pilz.Plugins.Advanced\Pilz.Plugins.Advanced.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,42 +0,0 @@
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 GtkContent()
{
}
protected GtkContent(nint raw) : base(raw)
{
}
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);
}
}

View File

@@ -1,33 +0,0 @@
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;
}
}

View File

@@ -1,20 +0,0 @@
using Gtk;
namespace Pilz.UI.Gtk.Dialogs;
public partial class GtkDialogBase : Dialog
{
public GtkDialogBase() : this(new Builder("GtkDialogBase.glade")) { }
protected 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();
}
}

View File

@@ -1,65 +0,0 @@
<?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>

View File

@@ -1,23 +0,0 @@
using Gtk;
namespace Pilz.UI.Gtk.Dialogs;
public static class MessageBox
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Nicht verwendete Parameter entfernen", Justification = "Can be used for easier migration from WinForms. However, the title get ignored as Gtk has no title parameter.")]
public static ResponseType Show(Window window, string message, string title, ButtonsType buttons, MessageType type)
{
var msgBox = new MessageDialog(window, DialogFlags.DestroyWithParent, type, buttons, message);
var result = msgBox.Run();
msgBox.Destroy();
return (ResponseType)result;
}
public static ResponseType Show(Window window, ButtonsType buttons, MessageType type, string format, params object[] args)
{
var msgBox = new MessageDialog(window, DialogFlags.DestroyWithParent, type, buttons, format, args);
var result = msgBox.Run();
msgBox.Destroy();
return (ResponseType)result;
}
}

View File

@@ -1,30 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<PropertyGroup>
<Version>1.0.2</Version>
</PropertyGroup>
<ItemGroup>
<None Remove="**\*.glade" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="**\*.glade" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="GtkSharp" Version="3.24.24.95" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Pilz.UI\Pilz.UI.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,48 +0,0 @@
using Gdk;
using Gtk;
using Pilz.UI.Symbols;
using Size = System.Drawing.Size;
namespace Pilz.UI.Gtk.Symbols;
public abstract class GtkSymbolFactory<TSymbols> : BaseSymbolFactory<TSymbols>, IGtkSymbolFactory<TSymbols>
{
public virtual Pixbuf? GetPixbuf(TSymbols svgImage, SymbolSize size)
{
return GetPixbuf(svgImage, ResolveCommonSize(size));
}
public virtual Pixbuf? GetPixbuf(TSymbols svgImage, Size size)
{
using var stream = GetImageRessourceStream(svgImage);
if (stream is null)
return null;
Pixbuf pixbuf;
if (size.IsEmpty)
pixbuf = new(stream);
else
pixbuf = new(stream, size.Width, size.Height);
return pixbuf;
}
public virtual Image? GetImage(TSymbols svgImage, SymbolSize size)
{
return GetImage(svgImage, ResolveCommonSize(size));
}
public virtual Image? GetImage(TSymbols svgImage, Size size)
{
if (GetPixbuf(svgImage, size) is Pixbuf pixbuf)
return GetImageFromPixbuf(pixbuf);
return null;
}
public virtual Image GetImageFromPixbuf(Pixbuf pixbuf)
{
return new Image(pixbuf);
}
}

View File

@@ -1,14 +0,0 @@
using Gtk;
using Pilz.UI.Symbols;
using System.Drawing;
namespace Pilz.UI.Gtk.Symbols;
public interface IGtkSymbolFactory<TSymbols> : IBaseSymbolFactory<TSymbols>
{
Image? GetImage(TSymbols svgImage, Size size);
Image? GetImage(TSymbols svgImage, SymbolSize size);
Gdk.Pixbuf? GetPixbuf(TSymbols svgImage, Size size);
Gdk.Pixbuf? GetPixbuf(TSymbols svgImage, SymbolSize size);
Image GetImageFromPixbuf(Gdk.Pixbuf pixbuf);
}

View File

@@ -47,12 +47,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pilz.Extensions", "Pilz.Ext
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pilz.UI.WinForms.Telerik.Symbols", "Pilz.UI.WinForms.Telerik.Symbols\Pilz.UI.WinForms.Telerik.Symbols.csproj", "{9F10C26F-1D9F-4B0B-8A7A-73A6082C5BF7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pilz.UI.Gtk", "Pilz.UI.Gtk\Pilz.UI.Gtk.csproj", "{AA8CCE40-6BEE-4DC3-B973-D4F719940793}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pilz.UI", "Pilz.UI\Pilz.UI.csproj", "{E75FBCEF-B971-4036-85D3-27D4ACA77156}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pilz.Plugins.Advanced.UI.Gtk", "Pilz.Plugins.Advanced.UI.Gtk\Pilz.Plugins.Advanced.UI.Gtk.csproj", "{F9CA6B5C-F14F-418D-9617-6007ED75E82F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pilz.UI.AvaloniaUI.Symbols", "Pilz.UI.AvaloniaUI.Symbols\Pilz.UI.AvaloniaUI.Symbols.csproj", "{C425EA21-F478-4FDB-B05D-5AE2A2FE1865}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pilz.UI.AvaloniaUI", "Pilz.UI.AvaloniaUI\Pilz.UI.AvaloniaUI.csproj", "{919DC195-50C2-48AE-9885-94897B3DC5B4}"
@@ -241,14 +237,6 @@ Global
{9F10C26F-1D9F-4B0B-8A7A-73A6082C5BF7}.Release|Any CPU.Build.0 = Release|Any CPU
{9F10C26F-1D9F-4B0B-8A7A-73A6082C5BF7}.Release|x86.ActiveCfg = Release|Any CPU
{9F10C26F-1D9F-4B0B-8A7A-73A6082C5BF7}.Release|x86.Build.0 = Release|Any CPU
{AA8CCE40-6BEE-4DC3-B973-D4F719940793}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA8CCE40-6BEE-4DC3-B973-D4F719940793}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA8CCE40-6BEE-4DC3-B973-D4F719940793}.Debug|x86.ActiveCfg = Debug|Any CPU
{AA8CCE40-6BEE-4DC3-B973-D4F719940793}.Debug|x86.Build.0 = Debug|Any CPU
{AA8CCE40-6BEE-4DC3-B973-D4F719940793}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA8CCE40-6BEE-4DC3-B973-D4F719940793}.Release|Any CPU.Build.0 = Release|Any CPU
{AA8CCE40-6BEE-4DC3-B973-D4F719940793}.Release|x86.ActiveCfg = Release|Any CPU
{AA8CCE40-6BEE-4DC3-B973-D4F719940793}.Release|x86.Build.0 = Release|Any CPU
{E75FBCEF-B971-4036-85D3-27D4ACA77156}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E75FBCEF-B971-4036-85D3-27D4ACA77156}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E75FBCEF-B971-4036-85D3-27D4ACA77156}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -257,14 +245,6 @@ Global
{E75FBCEF-B971-4036-85D3-27D4ACA77156}.Release|Any CPU.Build.0 = Release|Any CPU
{E75FBCEF-B971-4036-85D3-27D4ACA77156}.Release|x86.ActiveCfg = Release|Any CPU
{E75FBCEF-B971-4036-85D3-27D4ACA77156}.Release|x86.Build.0 = Release|Any CPU
{F9CA6B5C-F14F-418D-9617-6007ED75E82F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F9CA6B5C-F14F-418D-9617-6007ED75E82F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9CA6B5C-F14F-418D-9617-6007ED75E82F}.Debug|x86.ActiveCfg = Debug|Any CPU
{F9CA6B5C-F14F-418D-9617-6007ED75E82F}.Debug|x86.Build.0 = Debug|Any CPU
{F9CA6B5C-F14F-418D-9617-6007ED75E82F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F9CA6B5C-F14F-418D-9617-6007ED75E82F}.Release|Any CPU.Build.0 = Release|Any CPU
{F9CA6B5C-F14F-418D-9617-6007ED75E82F}.Release|x86.ActiveCfg = Release|Any CPU
{F9CA6B5C-F14F-418D-9617-6007ED75E82F}.Release|x86.Build.0 = Release|Any CPU
{C425EA21-F478-4FDB-B05D-5AE2A2FE1865}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C425EA21-F478-4FDB-B05D-5AE2A2FE1865}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C425EA21-F478-4FDB-B05D-5AE2A2FE1865}.Debug|x86.ActiveCfg = Debug|Any CPU