diff --git a/CakeScripts/Settings.cake b/CakeScripts/Settings.cake index 419f5b3ee..ccc390f79 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[] { "GLibSharp", "GtkSharp", "GioSharp", "CairoSharp", "PangoSharp", "GdkSharp" }, } }; } 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/Shared/GLibrary.cs b/Source/Libs/Shared/GLibrary.cs index 788ffa08a..68e36ea2c 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.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 a5da66c57..b47e74888 100644 --- a/Source/Libs/Shared/Library.cs +++ b/Source/Libs/Shared/Library.cs @@ -10,5 +10,6 @@ enum Library PangoCairo, Gdk, GdkPixbuf, - Gtk + Gtk, + 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/SourceView-api.xml b/Source/Libs/SourceView/SourceView-api.xml new file mode 100644 index 000000000..47ff74d96 --- /dev/null +++ b/Source/Libs/SourceView/SourceView-api.xml @@ -0,0 +1,3108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file 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/Libs/SourceView/SourceView.csproj b/Source/Libs/SourceView/SourceView.csproj new file mode 100644 index 000000000..8c86bdce1 --- /dev/null +++ b/Source/Libs/SourceView/SourceView.csproj @@ -0,0 +1,27 @@ + + + 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 + true + ..\..\GtkSharp.snk + + + ..\..\..\BuildOutput\Debug + + + ..\..\..\BuildOutput\Release + + + + %(RecursiveDir)%(Filename)%(Extension) + + + + + + diff --git a/Source/Libs/SourceView/SourceView.metadata b/Source/Libs/SourceView/SourceView.metadata new file mode 100644 index 000000000..d42891890 --- /dev/null +++ b/Source/Libs/SourceView/SourceView.metadata @@ -0,0 +1,58 @@ + + + RedoFired + UndoFired + SmartHomeEndFired + Activated + true + true + Hidden + ActivatableQueried + DataQueried + TooltipQueried + DrawQueued + EmitChanged + EmitCanRedoChanged + EmitCanUndoChanged + ref + ref + out + ref + ref + out + + + + Mark + Mark + CompletionProvider + Encoding + Encoding + notify + async + notify + async + async + async + + SourceView + + 1 + + Library.GtkSource + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + \ 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..81c3d64d8 --- /dev/null +++ b/Source/Libs/SourceView/SourceView.source @@ -0,0 +1,9 @@ + + + + + gtksourceview-4.0.0/gtksourceview + + + + diff --git a/Source/Samples/MainWindow.cs b/Source/Samples/MainWindow.cs index 6dad94535..ddce848bc 100644 --- a/Source/Samples/MainWindow.cs +++ b/Source/Samples/MainWindow.cs @@ -2,6 +2,7 @@ // Happy coding!!! - GtkSharp Team using Gtk; +using GtkSource; using System; using System.Collections.Generic; using System.IO; @@ -15,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) @@ -55,7 +56,11 @@ namespace Samples _notebook.AppendPage(scroll1, new Label { Text = "Data", Expand = true }); var scroll2 = new ScrolledWindow(); - _textViewCode = new TextView(); + + _textViewCode = new SourceView(); + _textViewCode.ShowLineNumbers = true; + _textViewCode.Buffer.Language = new LanguageManager().GetLanguage("c-sharp"); + _textViewCode.Margin = 3; scroll2.Child = _textViewCode; _notebook.AppendPage(scroll2, new Label { Text = "Code", Expand = true }); @@ -143,4 +148,4 @@ namespace Samples _treeView.ExpandAll(); } } -} \ No newline at end of file +} 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 @@ +