From b6b806ac8068a197c5d1869091aaf05d01f04df6 Mon Sep 17 00:00:00 2001 From: Drew Holzworth Date: Thu, 2 Jul 2020 15:09:23 +1000 Subject: [PATCH 01/13] Initial commit of sourceview files. --- Source/Libs/SourceView/GtkSourceBuffer.cs | 13 + Source/Libs/SourceView/SourceView-api.raw | 1198 ++++++++++++++++++++ Source/Libs/SourceView/SourceView.csproj | 25 + Source/Libs/SourceView/SourceView.metadata | 31 + Source/Libs/SourceView/SourceView.source | 9 + Source/Libs/SourceView/generate.sh | 12 + 6 files changed, 1288 insertions(+) create mode 100644 Source/Libs/SourceView/GtkSourceBuffer.cs create mode 100644 Source/Libs/SourceView/SourceView-api.raw create mode 100644 Source/Libs/SourceView/SourceView.csproj create mode 100644 Source/Libs/SourceView/SourceView.metadata create mode 100644 Source/Libs/SourceView/SourceView.source create mode 100755 Source/Libs/SourceView/generate.sh diff --git a/Source/Libs/SourceView/GtkSourceBuffer.cs b/Source/Libs/SourceView/GtkSourceBuffer.cs new file mode 100644 index 000000000..82ee48ed0 --- /dev/null +++ b/Source/Libs/SourceView/GtkSourceBuffer.cs @@ -0,0 +1,13 @@ +namespace GtkSharp.SourceView +{ + + using System; + public partial class GtkSourceBuffer : Gtk.TextBuffer + { + public GtkSourceBuffer() : base(IntPtr.Zero) + { + owned = true; + Raw = gtk_source_buffer_new(IntPtr.Zero); + } + } +} diff --git a/Source/Libs/SourceView/SourceView-api.raw b/Source/Libs/SourceView/SourceView-api.raw new file mode 100644 index 000000000..9bad88e03 --- /dev/null +++ b/Source/Libs/SourceView/SourceView-api.raw @@ -0,0 +1,1198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/Libs/SourceView/SourceView.csproj b/Source/Libs/SourceView/SourceView.csproj new file mode 100644 index 000000000..7388895e8 --- /dev/null +++ b/Source/Libs/SourceView/SourceView.csproj @@ -0,0 +1,25 @@ + + + true + netstandard2.0 + https://github.com/GtkSharp/GtkSharp + https://github.com/GtkSharp/GtkSharp + SourceView is a C# wrapper for the GtkSourceView library. + sourceview;sourceviewsharp;sourceview-sharp;wrapper + AnyCPU + + + + + + + + + + diff --git a/Source/Libs/SourceView/SourceView.metadata b/Source/Libs/SourceView/SourceView.metadata new file mode 100644 index 000000000..c0d25486f --- /dev/null +++ b/Source/Libs/SourceView/SourceView.metadata @@ -0,0 +1,31 @@ + + + RedoFired + UndoFired + SmartHomeEndFired + Activated + true + true + Hidden + ActivatableQueried + DataQueried + TooltipQueried + DrawQueued + EmitChanged + EmitCanRedoChanged + EmitCanUndoChanged + + + + true + true + true + true + true + ref + ref + out + ref + ref + out + \ No newline at end of file diff --git a/Source/Libs/SourceView/SourceView.source b/Source/Libs/SourceView/SourceView.source new file mode 100644 index 000000000..eee36e243 --- /dev/null +++ b/Source/Libs/SourceView/SourceView.source @@ -0,0 +1,9 @@ + + + + + gtksourceview-4.0.0/gtksourceview + + + + diff --git a/Source/Libs/SourceView/generate.sh b/Source/Libs/SourceView/generate.sh new file mode 100755 index 000000000..561b93be3 --- /dev/null +++ b/Source/Libs/SourceView/generate.sh @@ -0,0 +1,12 @@ +#!/usr/bin/bash + +wget http://ftp.acc.umu.se/pub/GNOME/sources/gtksourceview/4.0/gtksourceview-4.0.0.tar.xz +tar xf gtksourceview-4.0.0.tar.xz + +gapi3-parser SourceView.source +gapi3-fixup --api=SourceView-api.xml --metadata=SourceView.metadata +gapi3-codegen --outdir=Generated `pkg-config --cflags gtk-sharp-3.0` --generate SourceView-api.xml +dotnet build + +rm gtksourceview-4.0.0.tar.xz +rm -rf gtksourceview-4.0.0 \ No newline at end of file From a0080977e9029a7c3b8a09819183448e2b83600f Mon Sep 17 00:00:00 2001 From: Drew Holzworth Date: Tue, 7 Jul 2020 09:43:47 +1000 Subject: [PATCH 02/13] Checkpoint progress : generate.sh is now working. --- Source/Libs/SourceView/GtkSourceBuffer.cs | 3 +- Source/Libs/SourceView/SourceView-api.raw | 1806 +++++++++++++++++++- Source/Libs/SourceView/SourceView.csproj | 17 +- Source/Libs/SourceView/SourceView.metadata | 23 +- Source/Libs/SourceView/SourceView.source | 2 +- Source/Libs/SourceView/generate.sh | 28 +- 6 files changed, 1850 insertions(+), 29 deletions(-) diff --git a/Source/Libs/SourceView/GtkSourceBuffer.cs b/Source/Libs/SourceView/GtkSourceBuffer.cs index 82ee48ed0..30bca91ba 100644 --- a/Source/Libs/SourceView/GtkSourceBuffer.cs +++ b/Source/Libs/SourceView/GtkSourceBuffer.cs @@ -1,6 +1,5 @@ -namespace GtkSharp.SourceView +namespace Gtk.Source { - using System; public partial class GtkSourceBuffer : Gtk.TextBuffer { diff --git a/Source/Libs/SourceView/SourceView-api.raw b/Source/Libs/SourceView/SourceView-api.raw index 9bad88e03..45b5682ab 100644 --- a/Source/Libs/SourceView/SourceView-api.raw +++ b/Source/Libs/SourceView/SourceView-api.raw @@ -6,7 +6,7 @@ Please DO NOT MODIFY THIS FILE, modify .metadata files instead. --> - + @@ -174,6 +174,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -260,6 +296,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -323,6 +423,18 @@ + + + + + + + + + + + + @@ -368,6 +480,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -378,6 +517,14 @@ + + + + + + + + @@ -407,6 +554,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -489,6 +840,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -509,6 +911,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -516,6 +938,17 @@ + + + + + + + + + + + @@ -533,6 +966,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -648,6 +1127,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -659,6 +1183,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -673,6 +1262,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -682,6 +1354,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -785,6 +1496,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -814,6 +1662,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -823,6 +1702,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -834,6 +1747,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -843,13 +1798,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -858,6 +1859,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -888,6 +1913,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -907,6 +1994,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -920,6 +2202,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -932,6 +2334,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -939,7 +2390,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -963,6 +2458,18 @@ + + + + + + + + + + + + @@ -974,6 +2481,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -983,6 +2514,10 @@ + + + + @@ -992,6 +2527,10 @@ + + + + @@ -1001,6 +2540,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1112,6 +2691,179 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1135,7 +2887,44 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1181,6 +2970,19 @@ + + + + + + + + + + + + + diff --git a/Source/Libs/SourceView/SourceView.csproj b/Source/Libs/SourceView/SourceView.csproj index 7388895e8..d22e327a8 100644 --- a/Source/Libs/SourceView/SourceView.csproj +++ b/Source/Libs/SourceView/SourceView.csproj @@ -8,16 +8,17 @@ sourceview;sourceviewsharp;sourceview-sharp;wrapper AnyCPU + - + - + + + + %(RecursiveDir)%(Filename)%(Extension) + + + diff --git a/Source/Libs/SourceView/SourceView.metadata b/Source/Libs/SourceView/SourceView.metadata index c0d25486f..8753dc402 100644 --- a/Source/Libs/SourceView/SourceView.metadata +++ b/Source/Libs/SourceView/SourceView.metadata @@ -11,21 +11,30 @@ DataQueried TooltipQueried DrawQueued - EmitChanged - EmitCanRedoChanged - EmitCanUndoChanged - - + EmitChanged + EmitCanRedoChanged + EmitCanUndoChanged + true true true true true - ref + + + + + + + + + Library.Source \ No newline at end of file diff --git a/Source/Libs/SourceView/SourceView.source b/Source/Libs/SourceView/SourceView.source index eee36e243..b90fb8326 100644 --- a/Source/Libs/SourceView/SourceView.source +++ b/Source/Libs/SourceView/SourceView.source @@ -1,7 +1,7 @@ - + gtksourceview-4.0.0/gtksourceview diff --git a/Source/Libs/SourceView/generate.sh b/Source/Libs/SourceView/generate.sh index 561b93be3..824b00a8e 100755 --- a/Source/Libs/SourceView/generate.sh +++ b/Source/Libs/SourceView/generate.sh @@ -1,12 +1,22 @@ -#!/usr/bin/bash +#!/usr/bin/env bash +outdir=Generated +sourcever=4.0.0 -wget http://ftp.acc.umu.se/pub/GNOME/sources/gtksourceview/4.0/gtksourceview-4.0.0.tar.xz -tar xf gtksourceview-4.0.0.tar.xz +clear +wget http://ftp.acc.umu.se/pub/GNOME/sources/gtksourceview/4.0/gtksourceview-$sourcever.tar.xz +tar xf gtksourceview-$sourcever.tar.xz -gapi3-parser SourceView.source -gapi3-fixup --api=SourceView-api.xml --metadata=SourceView.metadata -gapi3-codegen --outdir=Generated `pkg-config --cflags gtk-sharp-3.0` --generate SourceView-api.xml -dotnet build +if [ -d $outdir ]; +then + rm -rf $outdir +fi -rm gtksourceview-4.0.0.tar.xz -rm -rf gtksourceview-4.0.0 \ No newline at end of file +../../OldStuff/parser/gapi3-parser SourceView.source +cp SourceView-api.raw SourceView-api.xml + +dotnet ../../../BuildOutput/Tools/GapiFixup.dll --api=SourceView-api.xml --metadata=SourceView.metadata +dotnet ../../../BuildOutput/Tools/GapiCodegen.dll --outdir=$outdir --assembly-name=SourceView `pkg-config --cflags gtk-sharp-3.0` --generate SourceView-api.xml +dotnet build -v m + +rm gtksourceview-$sourcever.tar.xz +rm -rf gtksourceview-$sourcever From 9b52ca07131c005464fe30295b7354982c409a41 Mon Sep 17 00:00:00 2001 From: Drew Holzworth Date: Tue, 7 Jul 2020 09:45:07 +1000 Subject: [PATCH 03/13] Add Gtk.Source to Library.cs todo - check with maintainers, is this correct. --- Source/Libs/Shared/GLibrary.cs | 1 + Source/Libs/Shared/Library.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Libs/Shared/GLibrary.cs b/Source/Libs/Shared/GLibrary.cs index 788ffa08a..38020ce26 100644 --- a/Source/Libs/Shared/GLibrary.cs +++ b/Source/Libs/Shared/GLibrary.cs @@ -27,6 +27,7 @@ class GLibrary _libraryDefinitions[Library.GdkPixbuf] = new[] { "libgdk_pixbuf-2.0-0.dll", "libgdk_pixbuf-2.0.so.0", "libgdk_pixbuf-2.0.dylib", "gdk_pixbuf-2.dll" }; _libraryDefinitions[Library.Gtk] = new[] { "libgtk-3-0.dll", "libgtk-3.so.0", "libgtk-3.0.dylib", "gtk-3.dll" }; _libraryDefinitions[Library.PangoCairo] = new[] { "libpangocairo-1.0-0.dll", "libpangocairo-1.0.so.0", "libpangocairo-1.0.0.dylib", "pangocairo-1.dll" }; + _libraryDefinitions[Library.Source] = new[] { "libgtksourceview-4-0.dll", "libgtksourceview-4.so.0", "libgtksourceview-4.0.dylib", "gtksourceview-4.dll" }; } public static IntPtr Load(Library library) diff --git a/Source/Libs/Shared/Library.cs b/Source/Libs/Shared/Library.cs index a5da66c57..0e2ad9410 100644 --- a/Source/Libs/Shared/Library.cs +++ b/Source/Libs/Shared/Library.cs @@ -10,5 +10,6 @@ enum Library PangoCairo, Gdk, GdkPixbuf, - Gtk + Gtk, + Source } \ No newline at end of file From 865bd0dac42aa9d40bc36b644d0236704094aa86 Mon Sep 17 00:00:00 2001 From: Drew Holzworth Date: Tue, 7 Jul 2020 10:08:21 +1000 Subject: [PATCH 04/13] Changed samples project to show code in sourceview. --- Source/Samples/MainWindow.cs | 3 ++- Source/Samples/Samples.csproj | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Samples/MainWindow.cs b/Source/Samples/MainWindow.cs index 6dad94535..724a78d6f 100644 --- a/Source/Samples/MainWindow.cs +++ b/Source/Samples/MainWindow.cs @@ -2,6 +2,7 @@ // Happy coding!!! - GtkSharp Team using Gtk; +using Gtk.Source; using System; using System.Collections.Generic; using System.IO; @@ -55,7 +56,7 @@ namespace Samples _notebook.AppendPage(scroll1, new Label { Text = "Data", Expand = true }); var scroll2 = new ScrolledWindow(); - _textViewCode = new TextView(); + _textViewCode = new GtkSourceView(); _textViewCode.Margin = 3; scroll2.Child = _textViewCode; _notebook.AppendPage(scroll2, new Label { Text = "Code", Expand = true }); diff --git a/Source/Samples/Samples.csproj b/Source/Samples/Samples.csproj index 500b5ef9f..ba36e22dd 100644 --- a/Source/Samples/Samples.csproj +++ b/Source/Samples/Samples.csproj @@ -25,5 +25,6 @@ + From 7eae2a3f6d35b3b4a8d75605bdafe2c74cd75fca Mon Sep 17 00:00:00 2001 From: Drew Holzworth Date: Tue, 7 Jul 2020 10:17:47 +1000 Subject: [PATCH 05/13] SourceView should access GtkSharp via project reference (rather than nuget package reference.) --- Source/Libs/SourceView/SourceView.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Libs/SourceView/SourceView.csproj b/Source/Libs/SourceView/SourceView.csproj index d22e327a8..0e4aad0cf 100644 --- a/Source/Libs/SourceView/SourceView.csproj +++ b/Source/Libs/SourceView/SourceView.csproj @@ -10,7 +10,7 @@ - + @@ -18,7 +18,7 @@ %(RecursiveDir)%(Filename)%(Extension) - + From dc1410b51192eb168cf67bfa14dd81a2b590b52b Mon Sep 17 00:00:00 2001 From: Drew Holzworth Date: Tue, 7 Jul 2020 12:21:51 +1000 Subject: [PATCH 06/13] Let's see if we can integrate sourceview code generation into cake --- CakeScripts/Settings.cake | 4 ++++ .../SourceView/{SourceView-api.raw => SourceView-api.xml} | 0 Source/Libs/SourceView/SourceView.source | 2 +- Source/Libs/SourceView/generate.sh | 1 - 4 files changed, 5 insertions(+), 2 deletions(-) rename Source/Libs/SourceView/{SourceView-api.raw => SourceView-api.xml} (100%) diff --git a/CakeScripts/Settings.cake b/CakeScripts/Settings.cake index 419f5b3ee..9cf47a98a 100644 --- a/CakeScripts/Settings.cake +++ b/CakeScripts/Settings.cake @@ -34,6 +34,10 @@ class Settings { Deps = new[] { "GLibSharp", "GioSharp", "AtkSharp", "CairoSharp", "PangoSharp", "GdkSharp" }, ExtraArgs = "--abi-cs-usings=Gtk,GLib" + }, + new GAssembly("SourceView") + { + Deps = new[] { "GdkSharp" }, } }; } diff --git a/Source/Libs/SourceView/SourceView-api.raw b/Source/Libs/SourceView/SourceView-api.xml similarity index 100% rename from Source/Libs/SourceView/SourceView-api.raw rename to Source/Libs/SourceView/SourceView-api.xml diff --git a/Source/Libs/SourceView/SourceView.source b/Source/Libs/SourceView/SourceView.source index b90fb8326..e1730d22c 100644 --- a/Source/Libs/SourceView/SourceView.source +++ b/Source/Libs/SourceView/SourceView.source @@ -1,5 +1,5 @@ - + gtksourceview-4.0.0/gtksourceview diff --git a/Source/Libs/SourceView/generate.sh b/Source/Libs/SourceView/generate.sh index 824b00a8e..35a7172ed 100755 --- a/Source/Libs/SourceView/generate.sh +++ b/Source/Libs/SourceView/generate.sh @@ -12,7 +12,6 @@ then fi ../../OldStuff/parser/gapi3-parser SourceView.source -cp SourceView-api.raw SourceView-api.xml dotnet ../../../BuildOutput/Tools/GapiFixup.dll --api=SourceView-api.xml --metadata=SourceView.metadata dotnet ../../../BuildOutput/Tools/GapiCodegen.dll --outdir=$outdir --assembly-name=SourceView `pkg-config --cflags gtk-sharp-3.0` --generate SourceView-api.xml From 43e78d943ad47342a7ae08bc5a6ea4c947de2d43 Mon Sep 17 00:00:00 2001 From: Drew Holzworth Date: Tue, 7 Jul 2020 15:45:59 +1000 Subject: [PATCH 07/13] Fixed cake settings for sourceview Need ref. to GioSharp. --- CakeScripts/Settings.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CakeScripts/Settings.cake b/CakeScripts/Settings.cake index 9cf47a98a..bba82f303 100644 --- a/CakeScripts/Settings.cake +++ b/CakeScripts/Settings.cake @@ -37,7 +37,7 @@ class Settings }, new GAssembly("SourceView") { - Deps = new[] { "GdkSharp" }, + Deps = new[] { "GtkSharp", "GioSharp" }, } }; } From 5ceb86423d7698b962bf6499a82f0bbefa7c9f3e Mon Sep 17 00:00:00 2001 From: Drew Holzworth Date: Wed, 8 Jul 2020 09:04:28 +1000 Subject: [PATCH 08/13] Fixed some more SourceView warnings from the code generator. --- CakeScripts/Settings.cake | 2 +- Source/Libs/SourceView/SourceView.metadata | 31 +++++++++++++--------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/CakeScripts/Settings.cake b/CakeScripts/Settings.cake index bba82f303..ccc390f79 100644 --- a/CakeScripts/Settings.cake +++ b/CakeScripts/Settings.cake @@ -37,7 +37,7 @@ class Settings }, new GAssembly("SourceView") { - Deps = new[] { "GtkSharp", "GioSharp" }, + Deps = new[] { "GLibSharp", "GtkSharp", "GioSharp", "CairoSharp", "PangoSharp", "GdkSharp" }, } }; } diff --git a/Source/Libs/SourceView/SourceView.metadata b/Source/Libs/SourceView/SourceView.metadata index 8753dc402..015d20b96 100644 --- a/Source/Libs/SourceView/SourceView.metadata +++ b/Source/Libs/SourceView/SourceView.metadata @@ -15,26 +15,31 @@ EmitCanRedoChanged EmitCanUndoChanged - - true - true - true - true - true - - - + out - Library.Source + GtkSourceMark + GtkSourceMark + GtkSourceCompletionProvider + GtkSourceEncoding + GtkSourceEncoding + notify + async + notify + async + async + async + + + 1 + + \ No newline at end of file From 5f27d9f903e34dd7525c2962a2b4feb44236e570 Mon Sep 17 00:00:00 2001 From: Drew Holzworth Date: Mon, 13 Jul 2020 10:02:59 +1000 Subject: [PATCH 09/13] Changed SourceView namespace to GtkSource. --- Source/Libs/Shared/GLibrary.cs | 2 +- Source/Libs/Shared/Library.cs | 2 +- Source/Libs/SourceView/Buffer.cs | 12 + Source/Libs/SourceView/GtkSourceBuffer.cs | 12 - Source/Libs/SourceView/SourceView-api.xml | 250 +++++++++++++++------ Source/Libs/SourceView/SourceView.metadata | 20 +- Source/Libs/SourceView/SourceView.source | 2 +- Source/Libs/SourceView/generate.sh | 5 - Source/Samples/MainWindow.cs | 4 +- 9 files changed, 206 insertions(+), 103 deletions(-) create mode 100644 Source/Libs/SourceView/Buffer.cs delete mode 100644 Source/Libs/SourceView/GtkSourceBuffer.cs diff --git a/Source/Libs/Shared/GLibrary.cs b/Source/Libs/Shared/GLibrary.cs index 38020ce26..68e36ea2c 100644 --- a/Source/Libs/Shared/GLibrary.cs +++ b/Source/Libs/Shared/GLibrary.cs @@ -27,7 +27,7 @@ class GLibrary _libraryDefinitions[Library.GdkPixbuf] = new[] { "libgdk_pixbuf-2.0-0.dll", "libgdk_pixbuf-2.0.so.0", "libgdk_pixbuf-2.0.dylib", "gdk_pixbuf-2.dll" }; _libraryDefinitions[Library.Gtk] = new[] { "libgtk-3-0.dll", "libgtk-3.so.0", "libgtk-3.0.dylib", "gtk-3.dll" }; _libraryDefinitions[Library.PangoCairo] = new[] { "libpangocairo-1.0-0.dll", "libpangocairo-1.0.so.0", "libpangocairo-1.0.0.dylib", "pangocairo-1.dll" }; - _libraryDefinitions[Library.Source] = new[] { "libgtksourceview-4-0.dll", "libgtksourceview-4.so.0", "libgtksourceview-4.0.dylib", "gtksourceview-4.dll" }; + _libraryDefinitions[Library.GtkSource] = new[] { "libgtksourceview-4-0.dll", "libgtksourceview-4.so.0", "libgtksourceview-4.0.dylib", "gtksourceview-4.dll" }; } public static IntPtr Load(Library library) diff --git a/Source/Libs/Shared/Library.cs b/Source/Libs/Shared/Library.cs index 0e2ad9410..b47e74888 100644 --- a/Source/Libs/Shared/Library.cs +++ b/Source/Libs/Shared/Library.cs @@ -11,5 +11,5 @@ enum Library Gdk, GdkPixbuf, Gtk, - Source + GtkSource } \ No newline at end of file diff --git a/Source/Libs/SourceView/Buffer.cs b/Source/Libs/SourceView/Buffer.cs new file mode 100644 index 000000000..daf62c0b5 --- /dev/null +++ b/Source/Libs/SourceView/Buffer.cs @@ -0,0 +1,12 @@ +namespace GtkSource +{ + using System; + public partial class Buffer : Gtk.TextBuffer + { + public Buffer() : base(IntPtr.Zero) + { + owned = true; + Raw = gtk_source_buffer_new(IntPtr.Zero); + } + } +} diff --git a/Source/Libs/SourceView/GtkSourceBuffer.cs b/Source/Libs/SourceView/GtkSourceBuffer.cs deleted file mode 100644 index 30bca91ba..000000000 --- a/Source/Libs/SourceView/GtkSourceBuffer.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Gtk.Source -{ - using System; - public partial class GtkSourceBuffer : Gtk.TextBuffer - { - public GtkSourceBuffer() : base(IntPtr.Zero) - { - owned = true; - Raw = gtk_source_buffer_new(IntPtr.Zero); - } - } -} diff --git a/Source/Libs/SourceView/SourceView-api.xml b/Source/Libs/SourceView/SourceView-api.xml index 45b5682ab..47ff74d96 100644 --- a/Source/Libs/SourceView/SourceView-api.xml +++ b/Source/Libs/SourceView/SourceView-api.xml @@ -6,37 +6,37 @@ Please DO NOT MODIFY THIS FILE, modify .metadata files instead. --> - - + + - + - + - + - + - + - + @@ -44,62 +44,62 @@ - + - + - + - + - + - + - + - + - + - + - + @@ -107,18 +107,18 @@ - + - + - + @@ -211,7 +211,7 @@ - + @@ -361,7 +361,7 @@ - + @@ -405,7 +405,7 @@ - + @@ -436,7 +436,7 @@ - + @@ -508,7 +508,7 @@ - + @@ -759,7 +759,7 @@ - + @@ -768,7 +768,7 @@ - + @@ -776,7 +776,7 @@ - + @@ -892,12 +892,12 @@ - + - + @@ -932,7 +932,7 @@ - + @@ -950,7 +950,7 @@ - + @@ -1013,7 +1013,7 @@ - + @@ -1107,7 +1107,7 @@ - + @@ -1116,7 +1116,7 @@ - + @@ -1173,7 +1173,7 @@ - + @@ -1249,7 +1249,7 @@ - + @@ -1346,7 +1346,7 @@ - + @@ -1394,7 +1394,7 @@ - + @@ -1634,7 +1634,7 @@ - + @@ -1644,7 +1644,7 @@ - + @@ -1653,7 +1653,7 @@ - + @@ -1694,7 +1694,7 @@ - + @@ -1737,7 +1737,7 @@ - + @@ -1790,7 +1790,7 @@ - + @@ -1831,7 +1831,7 @@ - + @@ -1852,7 +1852,7 @@ - + @@ -1884,14 +1884,14 @@ - + - + @@ -1976,7 +1976,7 @@ - + @@ -2190,7 +2190,7 @@ - + @@ -2323,7 +2323,7 @@ - + @@ -2384,7 +2384,7 @@ - + @@ -2436,7 +2436,7 @@ - + @@ -2471,7 +2471,7 @@ - + @@ -2506,7 +2506,7 @@ - + @@ -2519,7 +2519,7 @@ - + @@ -2532,7 +2532,7 @@ - + @@ -2581,7 +2581,7 @@ - + @@ -2601,7 +2601,7 @@ - + @@ -2874,7 +2874,7 @@ - + @@ -2885,9 +2885,9 @@ - - - + + + @@ -2925,7 +2925,7 @@ - + @@ -2965,8 +2965,8 @@ - - + + @@ -2984,8 +2984,8 @@ - - + + @@ -2996,5 +2996,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/Libs/SourceView/SourceView.metadata b/Source/Libs/SourceView/SourceView.metadata index 015d20b96..ed1fea2dd 100644 --- a/Source/Libs/SourceView/SourceView.metadata +++ b/Source/Libs/SourceView/SourceView.metadata @@ -4,8 +4,8 @@ UndoFired SmartHomeEndFired Activated - true - true + true + true Hidden ActivatableQueried DataQueried @@ -25,21 +25,21 @@ - Library.Source - GtkSourceMark - GtkSourceMark - GtkSourceCompletionProvider - GtkSourceEncoding - GtkSourceEncoding + Mark + Mark + CompletionProvider + Encoding + Encoding notify async notify async async async - + + SourceView 1 - + Library.GtkSource \ No newline at end of file diff --git a/Source/Libs/SourceView/SourceView.source b/Source/Libs/SourceView/SourceView.source index e1730d22c..81c3d64d8 100644 --- a/Source/Libs/SourceView/SourceView.source +++ b/Source/Libs/SourceView/SourceView.source @@ -1,7 +1,7 @@ - + gtksourceview-4.0.0/gtksourceview diff --git a/Source/Libs/SourceView/generate.sh b/Source/Libs/SourceView/generate.sh index 35a7172ed..36bb9827c 100755 --- a/Source/Libs/SourceView/generate.sh +++ b/Source/Libs/SourceView/generate.sh @@ -2,7 +2,6 @@ outdir=Generated sourcever=4.0.0 -clear wget http://ftp.acc.umu.se/pub/GNOME/sources/gtksourceview/4.0/gtksourceview-$sourcever.tar.xz tar xf gtksourceview-$sourcever.tar.xz @@ -13,9 +12,5 @@ fi ../../OldStuff/parser/gapi3-parser SourceView.source -dotnet ../../../BuildOutput/Tools/GapiFixup.dll --api=SourceView-api.xml --metadata=SourceView.metadata -dotnet ../../../BuildOutput/Tools/GapiCodegen.dll --outdir=$outdir --assembly-name=SourceView `pkg-config --cflags gtk-sharp-3.0` --generate SourceView-api.xml -dotnet build -v m - rm gtksourceview-$sourcever.tar.xz rm -rf gtksourceview-$sourcever diff --git a/Source/Samples/MainWindow.cs b/Source/Samples/MainWindow.cs index 724a78d6f..2518c7796 100644 --- a/Source/Samples/MainWindow.cs +++ b/Source/Samples/MainWindow.cs @@ -2,7 +2,7 @@ // Happy coding!!! - GtkSharp Team using Gtk; -using Gtk.Source; +using GtkSource; using System; using System.Collections.Generic; using System.IO; @@ -56,7 +56,7 @@ namespace Samples _notebook.AppendPage(scroll1, new Label { Text = "Data", Expand = true }); var scroll2 = new ScrolledWindow(); - _textViewCode = new GtkSourceView(); + _textViewCode = new SourceView(); _textViewCode.Margin = 3; scroll2.Child = _textViewCode; _notebook.AppendPage(scroll2, new Label { Text = "Code", Expand = true }); From 27125e5984bb06b6640dfd47a901e7a665500257 Mon Sep 17 00:00:00 2001 From: Drew Holzworth Date: Mon, 13 Jul 2020 12:47:45 +1000 Subject: [PATCH 10/13] Hide a few of sourceview's internal datatypes --- Source/Libs/SourceView/SourceView.metadata | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Source/Libs/SourceView/SourceView.metadata b/Source/Libs/SourceView/SourceView.metadata index ed1fea2dd..d42891890 100644 --- a/Source/Libs/SourceView/SourceView.metadata +++ b/Source/Libs/SourceView/SourceView.metadata @@ -14,8 +14,6 @@ EmitChanged EmitCanRedoChanged EmitCanUndoChanged - - ref ref out @@ -42,4 +40,19 @@ 1 Library.GtkSource + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + \ No newline at end of file From 6d3c0cf744b596fe7d60174c1f1d05f4f073377c Mon Sep 17 00:00:00 2001 From: Drew Holzworth Date: Mon, 13 Jul 2020 13:04:02 +1000 Subject: [PATCH 11/13] Changed sample project to show line numbers in sourceview Just to make it a bit more obvious that the widget is a SourceView and not a TextView. --- Source/Samples/MainWindow.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Samples/MainWindow.cs b/Source/Samples/MainWindow.cs index 2518c7796..2689b4753 100644 --- a/Source/Samples/MainWindow.cs +++ b/Source/Samples/MainWindow.cs @@ -16,7 +16,7 @@ namespace Samples private Box _boxContent; private TreeStore _store; private Dictionary _items; - private TextView _textViewCode; + private SourceView _textViewCode; private Notebook _notebook; public MainWindow() : base(WindowType.Toplevel) @@ -56,7 +56,10 @@ namespace Samples _notebook.AppendPage(scroll1, new Label { Text = "Data", Expand = true }); var scroll2 = new ScrolledWindow(); + _textViewCode = new SourceView(); + _textViewCode.ShowLineNumbers = true; + _textViewCode.Margin = 3; scroll2.Child = _textViewCode; _notebook.AppendPage(scroll2, new Label { Text = "Code", Expand = true }); From c3f768c537b8d867c30023d94870283fd8fb402d Mon Sep 17 00:00:00 2001 From: Benjamin Quinn Date: Mon, 13 Jul 2020 21:08:30 -0400 Subject: [PATCH 12/13] Update SourceView to return SourceView.Buffer Add syntax highlighting to sample application. --- Source/Libs/SourceView/SourceView.cs | 12 ++++++++++++ Source/Samples/MainWindow.cs | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 Source/Libs/SourceView/SourceView.cs diff --git a/Source/Libs/SourceView/SourceView.cs b/Source/Libs/SourceView/SourceView.cs new file mode 100644 index 000000000..6a8e935dd --- /dev/null +++ b/Source/Libs/SourceView/SourceView.cs @@ -0,0 +1,12 @@ +namespace GtkSource +{ + public partial class SourceView : Gtk.TextView + { + new public GtkSource.Buffer Buffer + { + get => base.Buffer as GtkSource.Buffer; + set => base.Buffer = value; + } + } +} + diff --git a/Source/Samples/MainWindow.cs b/Source/Samples/MainWindow.cs index 2689b4753..ddce848bc 100644 --- a/Source/Samples/MainWindow.cs +++ b/Source/Samples/MainWindow.cs @@ -59,6 +59,7 @@ namespace Samples _textViewCode = new SourceView(); _textViewCode.ShowLineNumbers = true; + _textViewCode.Buffer.Language = new LanguageManager().GetLanguage("c-sharp"); _textViewCode.Margin = 3; scroll2.Child = _textViewCode; @@ -147,4 +148,4 @@ namespace Samples _treeView.ExpandAll(); } } -} \ No newline at end of file +} From 0b07ea0c52939d7b4c64fa78c0041d6120846561 Mon Sep 17 00:00:00 2001 From: harry-cpp Date: Wed, 22 Jul 2020 18:49:13 +0200 Subject: [PATCH 13/13] Finishing touches --- Source/GtkSharp.sln | 17 ++++++++++++++++- Source/Libs/SourceView/SourceView.csproj | 19 ++++++++++--------- Source/Libs/SourceView/generate.sh | 16 ---------------- 3 files changed, 26 insertions(+), 26 deletions(-) delete mode 100755 Source/Libs/SourceView/generate.sh diff --git a/Source/GtkSharp.sln b/Source/GtkSharp.sln index cd2a0e5a3..2ba81a6bf 100644 --- a/Source/GtkSharp.sln +++ b/Source/GtkSharp.sln @@ -1,4 +1,4 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29424.173 MinimumVisualStudioVersion = 15.0.26124.0 @@ -20,6 +20,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GtkSharp", "Libs\GtkSharp\G EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples", "Samples\Samples.csproj", "{A5667C9B-5D29-4FB6-B548-D1317A2CEF90}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourceView", "Libs\SourceView\SourceView.csproj", "{2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -126,6 +128,18 @@ Global {A5667C9B-5D29-4FB6-B548-D1317A2CEF90}.Release|x64.Build.0 = Release|Any CPU {A5667C9B-5D29-4FB6-B548-D1317A2CEF90}.Release|x86.ActiveCfg = Release|Any CPU {A5667C9B-5D29-4FB6-B548-D1317A2CEF90}.Release|x86.Build.0 = Release|Any CPU + {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Debug|x64.ActiveCfg = Debug|Any CPU + {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Debug|x64.Build.0 = Debug|Any CPU + {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Debug|x86.ActiveCfg = Debug|Any CPU + {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Debug|x86.Build.0 = Debug|Any CPU + {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Release|Any CPU.Build.0 = Release|Any CPU + {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Release|x64.ActiveCfg = Release|Any CPU + {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Release|x64.Build.0 = Release|Any CPU + {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Release|x86.ActiveCfg = Release|Any CPU + {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -138,6 +152,7 @@ Global {E6D83259-6389-4768-B0A0-A649892DFE62} = {CCEA1235-D75F-4919-83F6-16793B11BEF5} {B4B26375-BED5-4000-A38F-899FF1672B47} = {CCEA1235-D75F-4919-83F6-16793B11BEF5} {04597E0B-375D-4E08-A16C-EE5FF3937B73} = {CCEA1235-D75F-4919-83F6-16793B11BEF5} + {2BD3D08E-0FDD-4DC3-A063-58B10B525DA8} = {CCEA1235-D75F-4919-83F6-16793B11BEF5} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {DA4DD75D-B6C8-4836-AF84-B5FF538D9D86} diff --git a/Source/Libs/SourceView/SourceView.csproj b/Source/Libs/SourceView/SourceView.csproj index 0e4aad0cf..8c86bdce1 100644 --- a/Source/Libs/SourceView/SourceView.csproj +++ b/Source/Libs/SourceView/SourceView.csproj @@ -2,25 +2,26 @@ true netstandard2.0 + false https://github.com/GtkSharp/GtkSharp https://github.com/GtkSharp/GtkSharp SourceView is a C# wrapper for the GtkSourceView library. sourceview;sourceviewsharp;sourceview-sharp;wrapper - AnyCPU + true + ..\..\GtkSharp.snk + + + ..\..\..\BuildOutput\Debug + + + ..\..\..\BuildOutput\Release - - - - - %(RecursiveDir)%(Filename)%(Extension) - - - + diff --git a/Source/Libs/SourceView/generate.sh b/Source/Libs/SourceView/generate.sh deleted file mode 100755 index 36bb9827c..000000000 --- a/Source/Libs/SourceView/generate.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -outdir=Generated -sourcever=4.0.0 - -wget http://ftp.acc.umu.se/pub/GNOME/sources/gtksourceview/4.0/gtksourceview-$sourcever.tar.xz -tar xf gtksourceview-$sourcever.tar.xz - -if [ -d $outdir ]; -then - rm -rf $outdir -fi - -../../OldStuff/parser/gapi3-parser SourceView.source - -rm gtksourceview-$sourcever.tar.xz -rm -rf gtksourceview-$sourcever