mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-22 20:05:41 +00:00
Merge pull request #173 from hol430/sourceview
Added sourceview bindings
This commit is contained in:
commit
759d62966a
|
@ -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" },
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -10,5 +10,6 @@ enum Library
|
|||
PangoCairo,
|
||||
Gdk,
|
||||
GdkPixbuf,
|
||||
Gtk
|
||||
Gtk,
|
||||
GtkSource
|
||||
}
|
12
Source/Libs/SourceView/Buffer.cs
Normal file
12
Source/Libs/SourceView/Buffer.cs
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
3108
Source/Libs/SourceView/SourceView-api.xml
Normal file
3108
Source/Libs/SourceView/SourceView-api.xml
Normal file
File diff suppressed because it is too large
Load diff
12
Source/Libs/SourceView/SourceView.cs
Normal file
12
Source/Libs/SourceView/SourceView.cs
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
Source/Libs/SourceView/SourceView.csproj
Normal file
27
Source/Libs/SourceView/SourceView.csproj
Normal file
|
@ -0,0 +1,27 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<PackageProjectUrl>https://github.com/GtkSharp/GtkSharp</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/GtkSharp/GtkSharp</RepositoryUrl>
|
||||
<Description>SourceView is a C# wrapper for the GtkSourceView library.</Description>
|
||||
<PackageTags>sourceview;sourceviewsharp;sourceview-sharp;wrapper</PackageTags>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\..\GtkSharp.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<OutputPath>..\..\..\BuildOutput\Debug</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<OutputPath>..\..\..\BuildOutput\Release</OutputPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Shared\*.cs">
|
||||
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\GtkSharp\GtkSharp.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
58
Source/Libs/SourceView/SourceView.metadata
Normal file
58
Source/Libs/SourceView/SourceView.metadata
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0"?>
|
||||
<metadata>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceBuffer']/signal[@name='Redo']" name="name">RedoFired</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceBuffer']/signal[@name='Undo']" name="name">UndoFired</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceView']/signal[@name='SmartHomeEnd']" name="name">SmartHomeEndFired</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceGutterRenderer']/signal[@name='Activate']" name="name">Activated</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceView']/implements/interface[@cname='GtkBuildable']" name="hidden">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceCompletion']/implements/interface[@cname='GtkBuildable']" name="hidden">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceCompletion']/signal[@name='Hide']" name="name">Hidden</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceGutterRenderer']/signal[@name='QueryActivatable']" name="name">ActivatableQueried</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceGutterRenderer']/signal[@name='QueryData']" name="name">DataQueried</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceGutterRenderer']/signal[@name='QueryTooltip']" name="name">TooltipQueried</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceGutterRenderer']/signal[@name='QueueDraw']" name="name">DrawQueued</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GtkSourceCompletionProposal']/signal[@name='Changed']" name="name">EmitChanged</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GtkSourceUndoManager']/signal[@name='CanRedoChanged']" name="name">EmitCanRedoChanged</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GtkSourceUndoManager']/signal[@name='CanUndoChanged']" name="name">EmitCanUndoChanged</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='Backward']/*/*[@name='match_start']" name="pass_as">ref</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='Backward']/*/*[@name='match_end']" name="pass_as">ref</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='Backward']/*/*[@name='has_wrapped_around']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='Forward']/*/*[@name='match_start']" name="pass_as">ref</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='Forward']/*/*[@name='match_end']" name="pass_as">ref</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='Forward']/*/*[@name='has_wrapped_around']" name="pass_as">out</attr>
|
||||
<remove-node path="/api/namespace/object[@cname='GtkSourceBuffer']/method[@cname='gtk_source_buffer_can_undo']" />
|
||||
<remove-node path="/api/namespace/object[@cname='GtkSourceBuffer']/method[@cname='gtk_source_buffer_can_redo']" />
|
||||
<remove-node path="/api/namespace/interface[@cname='GtkSourceStyleSchemeChooser']/property[@cname='style-scheme']" />
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceBuffer']/method[@cname='gtk_source_buffer_get_source_marks_at_iter']/return-type" name="element_type">Mark</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceBuffer']/method[@cname='gtk_source_buffer_get_source_marks_at_line']/return-type" name="element_type">Mark</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceCompletion']/method[@cname='gtk_source_completion_get_providers']/return-type" name="element_type">CompletionProvider</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkSourceEncoding']/method[@cname='gtk_source_encoding_get_all']/return-type" name="element_type">Encoding</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkSourceEncoding']/method[@cname='gtk_source_encoding_get_default_candidates']/return-type" name="element_type">Encoding</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceFileLoader']/method[@cname='gtk_source_file_loader_load_async']/parameters/parameter[@name='progress_callback']" name="scope">notify</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceFileLoader']/method[@cname='gtk_source_file_loader_load_async']/parameters/parameter[@name='callback']" name="scope">async</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceFileSaver']/method[@cname='gtk_source_file_saver_save_async']/parameters/parameter[@name='progress_callback']" name="scope">notify</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceFileSaver']/method[@cname='gtk_source_file_saver_save_async']/parameters/parameter[@name='callback']" name="scope">async</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@cname='gtk_source_search_context_backward_async']/parameters/parameter[@name='callback']" name="scope">async</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@cname='gtk_source_search_context_forward_async']/parameters/parameter[@name='callback']" name="scope">async</attr>
|
||||
<!-- Rename View to SourceView -->
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceView']" name="name">SourceView</attr>
|
||||
<!-- This is a variadic function. Unsure how we're supposed to handle it in the binding. For now I've removed it. -->
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceBuffer']/method[@cname='gtk_source_buffer_create_source_tag']" name="hidden">1</attr>
|
||||
<add-node path="/api"><symbol type="ownable" cname="variant" name="GLib.Variant"/></add-node>
|
||||
<attr path="/api/namespace" name="library">Library.GtkSource</attr>
|
||||
|
||||
<!-- Hide a few internal/private datatypes -->
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceBufferInputStream']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceBufferOutputStream']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceCompletionContainer']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceCompletionModel']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceContextEngine']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GtkSourceEngine']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceGutterRendererLines']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceGutterRendererMarks']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceMarksSequence']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GtkSourcePixbufHelper']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GtkSourceRegex']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceUndoManagerDefault']" name="hidden">1</attr>
|
||||
|
||||
</metadata>
|
9
Source/Libs/SourceView/SourceView.source
Normal file
9
Source/Libs/SourceView/SourceView.source
Normal file
|
@ -0,0 +1,9 @@
|
|||
<gapi-parser-input>
|
||||
<api filename="SourceView-api.xml">
|
||||
<library name="libgtksourceview-4.so">
|
||||
<namespace name="GtkSource">
|
||||
<dir>gtksourceview-4.0.0/gtksourceview</dir>
|
||||
</namespace>
|
||||
</library>
|
||||
</api>
|
||||
</gapi-parser-input>
|
|
@ -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<string, (Type type, Widget widget)> _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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,5 +25,6 @@
|
|||
<ProjectReference Include="..\Libs\GLibSharp\GLibSharp.csproj" />
|
||||
<ProjectReference Include="..\Libs\GtkSharp\GtkSharp.csproj" />
|
||||
<ProjectReference Include="..\Libs\PangoSharp\PangoSharp.csproj" />
|
||||
<ProjectReference Include="..\Libs\SourceView\SourceView.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
Loading…
Reference in a new issue