Source Code Highlighting
| From: | Anant Narayanan | Date: | Thu, 23 Mar 2006 23:44:41 +0000 |
| Subject: | Source Code Highlighting | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-2678@lists.php.net to get a copy of this message | ||
Hi Everyone,
Just to keep you informed (and also explain my last CVS commit :)),
Source code highlighting is now functional for the GtkSourceView widget.
Here's a quick snippet as to how you can do it:
$lm = new GtkSourceLanguagesManager();
$la = $lm->get_language_from_mime_type("text/x-php-source");
$buffer = GtkSourceBuffer::new_with_language($la);
$buffer->set_highlight(true);
$view = GtkSourceView::new_with_buffer($buffer);
Voila, The colours begin to appear! You can replace the mime type with
anything else sourceview supports too, like "text/xml", "text/x-diff",
and even "text/x-makefile". It currently supports around 40 "languages".
(And I plan to add a language definition for PHP-Gtk soon).
Cheers,
--
Anant
Find Freedom, Go Open Source!
http://www.kix.in/