From 12d88414055f54b900c6c1e2159b875339708ba6 Mon Sep 17 00:00:00 2001 From: cra0zy Date: Mon, 26 Feb 2018 22:41:01 +0100 Subject: [PATCH] F# templates + minnor template fixes --- .../GtkSharp.Template.CSharp.nuspec | 3 +- .../GtkNamespace.csproj | 4 ++ .../GtkSharp.Template.FSharp.nuspec | 20 ++++++++ .../.template.config/template.json | 25 +++++++++ .../GtkNamespace.fsproj | 24 +++++++++ .../GtkSharp.Application.FSharp/MainWindow.fs | 24 +++++++++ .../MainWindow.glade | 46 +++++++++++++++++ .../GtkSharp.Application.FSharp/Program.fs | 18 +++++++ .../.template.config/template.json | 33 ++++++++++++ .../GtkSharp.Dialog.FSharp/Gtk_Dialog.fs | 13 +++++ .../GtkSharp.Dialog.FSharp/Gtk_Dialog.glade | 51 +++++++++++++++++++ .../.template.config/template.json | 33 ++++++++++++ .../GtkSharp.Widget.FSharp/Gtk_Widget.fs | 8 +++ .../GtkSharp.Widget.FSharp/Gtk_Widget.glade | 11 ++++ .../.template.config/template.json | 33 ++++++++++++ .../GtkSharp.Window.FSharp/Gtk_Window.fs | 8 +++ .../GtkSharp.Window.FSharp/Gtk_Window.glade | 11 ++++ .../GtkSharp.Template.VBNet.nuspec | 3 +- .../GtkNamespace.vbproj | 4 ++ build.cake | 3 ++ 20 files changed, 373 insertions(+), 2 deletions(-) create mode 100755 Source/Templates/GtkSharp.Template.FSharp/GtkSharp.Template.FSharp.nuspec create mode 100755 Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/.template.config/template.json create mode 100644 Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj create mode 100644 Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.fs create mode 100755 Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.glade create mode 100644 Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/Program.fs create mode 100755 Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/.template.config/template.json create mode 100755 Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs create mode 100755 Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.glade create mode 100755 Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/.template.config/template.json create mode 100755 Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.fs create mode 100755 Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.glade create mode 100755 Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/.template.config/template.json create mode 100755 Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.fs create mode 100755 Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.glade diff --git a/Source/Templates/GtkSharp.Template.CSharp/GtkSharp.Template.CSharp.nuspec b/Source/Templates/GtkSharp.Template.CSharp/GtkSharp.Template.CSharp.nuspec index b89373e98..70efccdc2 100755 --- a/Source/Templates/GtkSharp.Template.CSharp/GtkSharp.Template.CSharp.nuspec +++ b/Source/Templates/GtkSharp.Template.CSharp/GtkSharp.Template.CSharp.nuspec @@ -4,6 +4,7 @@ GtkSharp.Template.CSharp 3.0.0 Gtk templates for CSharp + https://raw.githubusercontent.com/GtkSharp/GtkSharp/develop/Source/Libs/GtkSharp/Icon.png A set of C# templates for your .Net Core Gtk Application. A set of C# templates for your .Net Core Gtk Application. GtkSharp Contributors @@ -16,4 +17,4 @@ - \ 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 03daceb9d..2e82847d6 100755 --- a/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj +++ b/Source/Templates/GtkSharp.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj @@ -1,15 +1,19 @@ + WinExe netcoreapp2.0 + %(Filename)%(Extension) + + diff --git a/Source/Templates/GtkSharp.Template.FSharp/GtkSharp.Template.FSharp.nuspec b/Source/Templates/GtkSharp.Template.FSharp/GtkSharp.Template.FSharp.nuspec new file mode 100755 index 000000000..07b237949 --- /dev/null +++ b/Source/Templates/GtkSharp.Template.FSharp/GtkSharp.Template.FSharp.nuspec @@ -0,0 +1,20 @@ + + + + GtkSharp.Template.FSharp + 3.0.0 + Gtk templates for FSharp + https://raw.githubusercontent.com/GtkSharp/GtkSharp/develop/Source/Libs/GtkSharp/Icon.png + A set of F# templates for your .Net Core Gtk Application. + A set of F# templates for your .Net Core Gtk Application. + GtkSharp Contributors + GtkSharp Contributors + https://github.com/GtkSharp/GtkSharp + false + + gtk gtksharp gtk-sharp app dotnet new template f# fsharp + + + + + diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/.template.config/template.json b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/.template.config/template.json new file mode 100755 index 000000000..67b5b10da --- /dev/null +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/.template.config/template.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "GtkSharp Contributors", + "classifications": [ + "Gtk", + "GUI App" + ], + "name": "Gtk Application", + "identity": "GtkSharp.Application.FSharp", + "groupIdentity": "GtkSharp.Application", + "shortName": "gtkapp", + "tags": { + "language": "F#", + "type": "project" + }, + "sourceName": "GtkNamespace", + "preferNameDirectory": true, + "symbols": { + "targetframework": { + "type": "parameter", + "defaultValue": "netcoreapp2.0", + "replaces": "netcoreapp2.0" + } + } +} 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 new file mode 100644 index 000000000..ca0d3f176 --- /dev/null +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj @@ -0,0 +1,24 @@ + + + + Exe + netcoreapp2.0 + + + + + + + + + + + %(Filename)%(Extension) + + + + + + + + diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.fs b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.fs new file mode 100644 index 000000000..316e2f848 --- /dev/null +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.fs @@ -0,0 +1,24 @@ +namespace GtkNamespace + +open Gtk + +type MainWindow (builder : Builder) as this = + inherit Window(builder.GetObject("MainWindow").Handle) + + let mutable _label1 : Label = null + let mutable _button1 : Button = null + let mutable _counter = 0; + + do + _label1 <- builder.GetObject("_label1") :?> Label + _button1 <- builder.GetObject("_button1") :?> Button + + this.DeleteEvent.Add(fun _ -> + Application.Quit() + ) + _button1.Clicked.Add(fun _ -> + _counter <- _counter + 1 + _label1.Text <- "Hello World! This button has been clicked " + _counter.ToString() + " time(s)." + ) + + new() = new MainWindow(new Builder("MainWindow.glade")) diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.glade b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.glade new file mode 100755 index 000000000..a13c41b20 --- /dev/null +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.glade @@ -0,0 +1,46 @@ + + + + + False + Example Window + 480 + 240 + + + True + False + 4 + 4 + 4 + 4 + vertical + + + True + False + Hello World! + + + True + True + 0 + + + + + Click me! + True + False + True + + + False + True + 1 + + + + + + diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/Program.fs b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/Program.fs new file mode 100644 index 000000000..3a123dc36 --- /dev/null +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Application.FSharp/Program.fs @@ -0,0 +1,18 @@ +namespace GtkNamespace +module Program = + + open Gtk + + [] + let main argv = + Application.Init() + + let app = new Application("org.GtkNamespace.GtkNamespace", GLib.ApplicationFlags.None) + app.Register(GLib.Cancellable.Current) |> ignore; + + let win = new MainWindow() + app.AddWindow(win) + + win.Show() + Application.Run() + 0 diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/.template.config/template.json b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/.template.config/template.json new file mode 100755 index 000000000..82d90535a --- /dev/null +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/.template.config/template.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "GtkSharp Contributors", + "classifications": [ + "Gtk", + "UI" + ], + "name": "Gtk Dialog", + "identity": "GtkSharp.Dialog.FSharp", + "groupIdentity": "GtkSharp.Dialog", + "shortName": "gtkdialog", + "tags": { + "language": "F#", + "type": "item" + }, + "sourceName": "Gtk_Dialog", + "primaryOutputs": [ + { + "path": "Gtk_Dialog.fs" + }, + { + "path": "Gtk_Dialog.glade" + } + ], + "defaultName": "Gtk_Dialog", + "symbols": { + "namespace": { + "description": "Namespace for the generated files", + "replaces": "GtkNamespace", + "type": "parameter" + } + } +} diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs new file mode 100755 index 000000000..369db5478 --- /dev/null +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs @@ -0,0 +1,13 @@ +namespace GtkNamespace + +open Gtk + +type Gtk_Dialog (builder : Builder) as this = + inherit Dialog(builder.GetObject("Gtk_Dialog").Handle) + do + this.DefaultResponse <- ResponseType.Cancel; + this.Response.Add(fun _ -> + this.Hide(); + ) + + new() = new Gtk_Dialog(new Builder("Gtk_Dialog.glade")) diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.glade b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.glade new file mode 100755 index 000000000..8cc7c549a --- /dev/null +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.glade @@ -0,0 +1,51 @@ + + + + + False + 320 + 260 + dialog + + + False + vertical + 2 + + + False + end + + + + + + gtk-close + True + True + True + True + + + True + True + 1 + + + + + False + False + 0 + + + + + + + + + button1 + + + diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/.template.config/template.json b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/.template.config/template.json new file mode 100755 index 000000000..53dd6eb65 --- /dev/null +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/.template.config/template.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "GtkSharp Contributors", + "classifications": [ + "Gtk", + "UI" + ], + "name": "Gtk Widget", + "identity": "GtkSharp.Widget.FSharp", + "groupIdentity": "GtkSharp.Widget", + "shortName": "gtkwidget", + "tags": { + "language": "F#", + "type": "item" + }, + "sourceName": "Gtk_Widget", + "primaryOutputs": [ + { + "path": "Gtk_Widget.fs" + }, + { + "path": "Gtk_Widget.glade" + } + ], + "defaultName": "Gtk_Widget", + "symbols": { + "namespace": { + "description": "Namespace for the generated files", + "replaces": "GtkNamespace", + "type": "parameter" + } + } +} diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.fs b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.fs new file mode 100755 index 000000000..7d4d3d4ce --- /dev/null +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.fs @@ -0,0 +1,8 @@ +namespace GtkNamespace + +open Gtk + +type Gtk_Widget (builder : Builder) = + inherit Box(builder.GetObject("Gtk_Widget").Handle) + + new() = new Gtk_Widget(new Builder("Gtk_Widget.glade")) diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.glade b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.glade new file mode 100755 index 000000000..7a1be14d1 --- /dev/null +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.glade @@ -0,0 +1,11 @@ + + + + + True + False + + + + + diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/.template.config/template.json b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/.template.config/template.json new file mode 100755 index 000000000..0d43a621d --- /dev/null +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/.template.config/template.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "GtkSharp Contributors", + "classifications": [ + "Gtk", + "UI" + ], + "name": "Gtk Window", + "identity": "GtkSharp.Window.FSharp", + "groupIdentity": "GtkSharp.Window", + "shortName": "gtkwindow", + "tags": { + "language": "F#", + "type": "item" + }, + "sourceName": "Gtk_Window", + "primaryOutputs": [ + { + "path": "Gtk_Window.fs" + }, + { + "path": "Gtk_Window.glade" + } + ], + "defaultName": "Gtk_Window", + "symbols": { + "namespace": { + "description": "Namespace for the generated files", + "replaces": "GtkNamespace", + "type": "parameter" + } + } +} diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.fs b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.fs new file mode 100755 index 000000000..ab3fb159a --- /dev/null +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.fs @@ -0,0 +1,8 @@ +namespace GtkNamespace + +open Gtk + +type Gtk_Window (builder : Builder) = + inherit Window(builder.GetObject("Gtk_Window").Handle) + + new() = new Gtk_Window(new Builder("Gtk_Window.glade")) diff --git a/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.glade b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.glade new file mode 100755 index 000000000..44e554e80 --- /dev/null +++ b/Source/Templates/GtkSharp.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.glade @@ -0,0 +1,11 @@ + + + + + False + Gtk_Window + + + + + diff --git a/Source/Templates/GtkSharp.Template.VBNet/GtkSharp.Template.VBNet.nuspec b/Source/Templates/GtkSharp.Template.VBNet/GtkSharp.Template.VBNet.nuspec index a1147b128..3470bd1f6 100755 --- a/Source/Templates/GtkSharp.Template.VBNet/GtkSharp.Template.VBNet.nuspec +++ b/Source/Templates/GtkSharp.Template.VBNet/GtkSharp.Template.VBNet.nuspec @@ -4,6 +4,7 @@ GtkSharp.Template.VBNet 3.0.0 Gtk templates for VBNet + https://raw.githubusercontent.com/GtkSharp/GtkSharp/develop/Source/Libs/GtkSharp/Icon.png A set of VB templates for your .Net Core Gtk Application. A set of VB templates for your .Net Core Gtk Application. GtkSharp Contributors @@ -16,4 +17,4 @@ - \ No newline at end of file + 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 03daceb9d..2e82847d6 100755 --- a/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj +++ b/Source/Templates/GtkSharp.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj @@ -1,15 +1,19 @@ + WinExe netcoreapp2.0 + %(Filename)%(Extension) + + diff --git a/build.cake b/build.cake index 5263aea04..2034f9636 100755 --- a/build.cake +++ b/build.cake @@ -125,6 +125,9 @@ Task("PackageTemplates") settings.BasePath = "Source/Templates/GtkSharp.Template.CSharp"; NuGetPack("Source/Templates/GtkSharp.Template.CSharp/GtkSharp.Template.CSharp.nuspec", settings); + settings.BasePath = "Source/Templates/GtkSharp.Template.FSharp"; + NuGetPack("Source/Templates/GtkSharp.Template.FSharp/GtkSharp.Template.FSharp.nuspec", settings); + settings.BasePath = "Source/Templates/GtkSharp.Template.VBNet"; NuGetPack("Source/Templates/GtkSharp.Template.VBNet/GtkSharp.Template.VBNet.nuspec", settings); });