From 884b2a473a4348617553a0639a7ec0d5ab86f394 Mon Sep 17 00:00:00 2001 From: cra0zy Date: Mon, 18 May 2020 20:20:54 +0200 Subject: [PATCH] minnor fixes --- Source/Samples/Samples.csproj | 2 +- Source/Samples/Sections/Category.cs | 3 +- .../Miscellaneous/PolarFixedSection.cs | 64 +++++++++++++++++++ .../Sections/Widgets/PolarFixedSection.cs | 64 ------------------- .../GtkNamespace.csproj | 2 +- .../GtkNamespace.fsproj | 2 +- .../GtkNamespace.vbproj | 2 +- 7 files changed, 70 insertions(+), 69 deletions(-) create mode 100644 Source/Samples/Sections/Miscellaneous/PolarFixedSection.cs delete mode 100644 Source/Samples/Sections/Widgets/PolarFixedSection.cs diff --git a/Source/Samples/Samples.csproj b/Source/Samples/Samples.csproj index 026a3ff24..500b5ef9f 100644 --- a/Source/Samples/Samples.csproj +++ b/Source/Samples/Samples.csproj @@ -1,7 +1,7 @@ WinExe - netcoreapp2.0 + netcoreapp3.1 false ..\..\BuildOutput\Samples diff --git a/Source/Samples/Sections/Category.cs b/Source/Samples/Sections/Category.cs index 4643b1cc0..c832d664c 100644 --- a/Source/Samples/Sections/Category.cs +++ b/Source/Samples/Sections/Category.cs @@ -6,6 +6,7 @@ namespace Samples enum Category { Widgets, - Dialogs + Dialogs, + Miscellaneous } } \ No newline at end of file diff --git a/Source/Samples/Sections/Miscellaneous/PolarFixedSection.cs b/Source/Samples/Sections/Miscellaneous/PolarFixedSection.cs new file mode 100644 index 000000000..a8bf8f25d --- /dev/null +++ b/Source/Samples/Sections/Miscellaneous/PolarFixedSection.cs @@ -0,0 +1,64 @@ +using System; +using Gtk; + +namespace Samples +{ + [Section(ContentType = typeof(PolarFixed), Category = Category.Miscellaneous)] + class PolarFixedSection : ListSection + { + public PolarFixedSection() + { + AddItem(CreateClock()); + AddItem(CreateSpiral()); + } + + public (string, Widget) CreateClock() + { + double theta; + + // Clock + PolarFixed pf = new PolarFixed(); + + for (int hour = 1; hour <= 12; hour++) + { + theta = (Math.PI / 2) - hour * (Math.PI / 6); + if (theta < 0) + theta += 2 * Math.PI; + + Label l = new Label("" + hour.ToString() + ""); + l.UseMarkup = true; + pf.Put(l, theta, 50); + } + + return ("Clock", pf); + } + + public (string, Widget) CreateSpiral() + { + uint r; + double theta; + + var pf = new PolarFixed(); + + + r = 0; + theta = 0.0; + + foreach (string id in Gtk.Stock.ListIds()) + { + StockItem item = Gtk.Stock.Lookup(id); + if (item.Label == null) + continue; + var icon = Gtk.Image.NewFromIconName(item.StockId, IconSize.SmallToolbar); + + pf.Put(icon, theta, r); + + // Logarithmic spiral: r = a*e^(b*theta) + r += 1; + theta = 10 * Math.Log(10 * r); + } + + return ("Spiral", pf); + } + } +} \ No newline at end of file diff --git a/Source/Samples/Sections/Widgets/PolarFixedSection.cs b/Source/Samples/Sections/Widgets/PolarFixedSection.cs deleted file mode 100644 index 668cfafe1..000000000 --- a/Source/Samples/Sections/Widgets/PolarFixedSection.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using Gtk; - -namespace Samples -{ - [Section(ContentType = typeof(PolarFixed), Category = Category.Widgets)] - class PolarFixedSection : ListSection - { - public PolarFixedSection() - { - AddItem(CreateClock()); - AddItem(CreateSpiral()); - } - - public (string, Widget) CreateClock() - { - uint r; - double theta; - - - // Clock - PolarFixed pf = new PolarFixed(); - - for (int hour = 1; hour <= 12; hour++) { - theta = (Math.PI / 2) - hour * (Math.PI / 6); - if (theta < 0) - theta += 2 * Math.PI; - - Label l = new Label("" + hour.ToString() + ""); - l.UseMarkup = true; - pf.Put(l, theta, 50); - } - - return ("Clock", pf); - } - - public (string, Widget) CreateSpiral() - { - uint r; - double theta; - - var pf = new PolarFixed(); - - - r = 0; - theta = 0.0; - - foreach (string id in Gtk.Stock.ListIds()) { - StockItem item = Gtk.Stock.Lookup(id); - if (item.Label == null) - continue; - var icon = Gtk.Image.NewFromIconName(item.StockId, IconSize.SmallToolbar); - - pf.Put(icon, theta, r); - - // Logarithmic spiral: r = a*e^(b*theta) - r += 1; - theta = 10 * Math.Log(10 * r); - } - - return ("Spiral", pf); - } - } -} \ No newline at end of file diff --git a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj index 80ee6a2e1..68d9201a0 100644 --- a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj +++ b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj @@ -2,7 +2,7 @@ WinExe - netcoreapp3.0 + netcoreapp3.1 diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj index 7ebd1e676..eaba991e2 100644 --- a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.0 + netcoreapp3.1 diff --git a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj index 80ee6a2e1..68d9201a0 100644 --- a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj +++ b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj @@ -2,7 +2,7 @@ WinExe - netcoreapp3.0 + netcoreapp3.1