mail-archives/gtk-sharp-list/2009-April/009559.html

102 строки
4.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Gtk-sharp-list] GtkSourceView language and style definitions
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20GtkSourceView%20language%20and%20style%20definitions&In-Reply-To=49DEF4F7.1010207%40gmail.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="009558.html">
<LINK REL="Next" HREF="009560.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Gtk-sharp-list] GtkSourceView language and style definitions</H1>
<B>Michael Hutchinson</B>
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20GtkSourceView%20language%20and%20style%20definitions&In-Reply-To=49DEF4F7.1010207%40gmail.com"
TITLE="[Gtk-sharp-list] GtkSourceView language and style definitions">m.j.hutchinson at gmail.com
</A><BR>
<I>Fri Apr 10 12:36:17 EDT 2009</I>
<P><UL>
<LI>Previous message: <A HREF="009558.html">[Gtk-sharp-list] GtkSourceView language and style definitions
</A></li>
<LI>Next message: <A HREF="009560.html">[Gtk-sharp-list] can't configure gtk#2.8.5
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#9559">[ date ]</a>
<a href="thread.html#9559">[ thread ]</a>
<a href="subject.html#9559">[ subject ]</a>
<a href="author.html#9559">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>2009/4/10 Alexander Kriv&#225;cs Schr&#248;der &lt;<A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">alexschrod at gmail.com</A>&gt;:
&gt;<i> Hi everybody.
</I>&gt;<i>
</I>&gt;<i> I'm moving a project of mine from C &amp; Gtk to C# &amp; Gtk#. Most of the
</I>&gt;<i> transition has gone smoothly, but I find myself facing one small issue.
</I>&gt;<i> I'm using the GtkSourceView Widget, and in my original C code, here's
</I>&gt;<i> what I did to load my self-defined language and style scheme:
</I>&gt;<i>
</I>&gt;<i> &#160; &#160; &#160; &#160;GtkSourceLanguageManager *lm;
</I>&gt;<i> &#160; &#160; &#160; &#160;GtkSourceStyleSchemeManager *ssm;
</I>&gt;<i> &#160; &#160; &#160; &#160;gchar *dirs[3];
</I>&gt;<i>
</I>&gt;<i> &#160; &#160; &#160; &#160;dirs[0] = g_strdup(&quot;lang&quot;);
</I>&gt;<i> &#160; &#160; &#160; &#160;dirs[1] = g_strdup(DEFAULT_DATA_DIR &quot;/&quot; PACKAGE &quot;/lang&quot;);
</I>&gt;<i> &#160; &#160; &#160; &#160;dirs[2] = NULL; /* Sentinel */
</I>&gt;<i>
</I>&gt;<i> &#160; &#160; &#160; &#160;/* Load the language file */
</I>&gt;<i> &#160; &#160; &#160; &#160;lm = gtk_source_language_manager_new();
</I>&gt;<i> &#160; &#160; &#160; &#160;gtk_source_language_manager_set_search_path(lm, dirs);
</I>&gt;<i> &#160; &#160; &#160; &#160;lang = &#160;gtk_source_language_manager_get_language(lm, &quot;mylang&quot;);
</I>&gt;<i>
</I>&gt;<i> &#160; &#160; &#160; &#160;/* Load the scheme file */
</I>&gt;<i> &#160; &#160; &#160; &#160;ssm = gtk_source_style_scheme_manager_new();
</I>&gt;<i> &#160; &#160; &#160; &#160;gtk_source_style_scheme_manager_set_search_path(ssm, dirs);
</I>&gt;<i> &#160; &#160; &#160; &#160;style =gtk_source_style_scheme_manager_get_scheme(ssm,&quot;mylang&quot;);
</I>&gt;<i>
</I>&gt;<i> However, looking at the SourceLanguagesManager class, I couldn't find
</I>&gt;<i> any SearchPath property or SetSearchPath method, and I couldn't even
</I>&gt;<i> find a SourceStyleManager class at all! Can somebody help me figure this
</I>&gt;<i> out?
</I>&gt;<i>
</I>&gt;<i> Essentially what I'm asking is how I load my style scheme and language
</I>&gt;<i> definition file.
</I>
The search paths were only added in GtkSourceView2. Because
GtkSourceView2 broke binary compatibility with GtkSourceview1.8, there
are two bindings -- GtkSourceView-Sharp-2.0 (the 2.0 version of the
binding to the 1.8 library) and GtkSourceView2-Sharp. It sounds like
you want the latter.
--
Michael Hutchinson
<A HREF="http://mjhutchinson.com">http://mjhutchinson.com</A>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="009558.html">[Gtk-sharp-list] GtkSourceView language and style definitions
</A></li>
<LI>Next message: <A HREF="009560.html">[Gtk-sharp-list] can't configure gtk#2.8.5
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#9559">[ date ]</a>
<a href="thread.html#9559">[ thread ]</a>
<a href="subject.html#9559">[ subject ]</a>
<a href="author.html#9559">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">More information about the Gtk-sharp-list
mailing list</a><br>
</body></html>