ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-gtk-dev
php-gtk-dev
[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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved