minnor fixes
This commit is contained in:
parent
e2c2ab1cf5
commit
884b2a473a
7 changed files with 70 additions and 69 deletions
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<OutputPath>..\..\BuildOutput\Samples</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Samples
|
|||
enum Category
|
||||
{
|
||||
Widgets,
|
||||
Dialogs
|
||||
Dialogs,
|
||||
Miscellaneous
|
||||
}
|
||||
}
|
64
Source/Samples/Sections/Miscellaneous/PolarFixedSection.cs
Normal file
64
Source/Samples/Sections/Miscellaneous/PolarFixedSection.cs
Normal file
|
@ -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("<big><b>" + hour.ToString() + "</b></big>");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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("<big><b>" + hour.ToString() + "</b></big>");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
Loading…
Reference in a new issue