[PHP-GTK-DEV] Source Code Highlighting
by Anant Narayanan other posts by this author
Mar 23 2006 3:45PM messages near this date
Re: [PHP-GTK-DEV] PHP-Gtk1 version
|
[PHP-GTK-DEV] GdkPixbuf Trouble
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/
--
PHP-GTK Development Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|