"turn on" GtkSourceView feature

View: New views
6 Messages — Rating Filter:   Alert me  

"turn on" GtkSourceView feature

by kksou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

In case you want to use GtkSourceView to display source codes with automatic numbering and syntax highlighting, take note that the SourceView classes is an extension of php-gtk2, and some setting needs to be done to "turn on" this feature.

Here's a quick summary:
- Edit php.ini
php-gtk.extensions = php_gtk_libglade2.dll, php_gtk_sourceview2.dll

- Download a copy of language-specs from
http://gtksourceview.sourceforge.net/downloads.html

- Location of the language-specs file:
C:\Documents and Settings\<username>\.gnome2\gtksourceview-1.0\language-specs

Details and a sample code to test the SourceView classes can be found here:
http://www.kksou.com/php-gtk2/articles/use-GtkSourceView-to-display-source-code---Part-1.php

The above took me one whole night to figure out! Hope will save some of you some time...

Regards,
/kksou

Re: "turn on" GtkSourceView feature

by Anant Narayanan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> - Download a copy of language-specs from
> http://gtksourceview.sourceforge.net/downloads.html

A quick note for Linux users, the language-specs are included in your
GtkSourceView package.

- Anant

--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: "turn on" GtkSourceView feature

by kksou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some additional notes for linux users...

1. Assuming you have gtk+ 2.x in place, download 2 more packages. Compile libgnomeprint first, then gtksourceview.
a) libgnomeprint-2.12.1
http://www.linuxfromscratch.org/blfs/view/cvs/gnome/libgnomeprint.html

b) gtksourceview-1.6.0
http://gtksourceview.sourceforge.net/

2. Remove the previously compiled php_gtk2.so
rm /usr/local/php-5.1.6/lib/php/extensions/no-debug-non-zts-20050922/php_gtk2.so
Note: if you don't remove this, you will get an error when running ./configure

3. Recompile php-gtk2
Note: remember to add the switch "--enable-sourceview"
./configure --prefix=/usr/local/php-gtk-2.0.0 --enable-sourceview --with-php-config=/usr/local/php-5.1.6/bin/php-config
make
make install

If you use the default configure, the language-specs will be stored in
/usr/local/share/gtksourceview-1.0/language-specs

Additional notes in:
http://www.kksou.com/php-gtk2/articles/install-php-gtk2-on-linux.php

Regards,
/kksou

Sample output:
http://www.kksou.com/php-gtk2/gif/gtksourceview_linux.gif

p.s. linux uses the latest version of gtksourceview (v1.6), whereas the sourceview.dll that comes bundled with Gnope Installer is v1.4. If you have played with the windows version, it is somewhat buggy. Initial display of syntax highlighting is ok. But as you type in more text, sometimes syntax highlighting just stop working.

Would be great if anyone could point us to an updated win32 binary of gtksourceview-1.6.0.

Re: "turn on" GtkSourceView feature

by Anant Narayanan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> 1. Assuming you have gtk+ 2.x in place, download 2 more packages. Compile
> libgnomeprint first, then gtksourceview.
> a) libgnomeprint-2.12.1
> http://www.linuxfromscratch.org/blfs/view/cvs/gnome/libgnomeprint.html

I don't think you need libgnomeprint. There's no check for it in the
configure script, and the printing functions haven't been overridden,
which means they won't work. I'll be removing these functions
altogether simply because libgnomeprint is not available on Windows.
The scenario will change when the php-gnome extension is introduced
though.

> Would be great if anyone could point us to an updated win32 binary of
> gtksourceview-1.6.0.

Ask xxoes (sorry, don't remember your real name!) or Steph nicely, and
they may build one for you :)

Cheers,

- Anant

--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: "turn on" GtkSourceView feature

by Steph Fox :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

libgnomeprint _is_ available on Windows, it's just pointless there!

xxoes (I didn't know his real name in the first place, please share!) should
have a copy hanging around. I still haven't built it for an official release
because doing so means making changes in third-party source code.

- Steph

>> 1. Assuming you have gtk+ 2.x in place, download 2 more packages. Compile
>> libgnomeprint first, then gtksourceview.
>> a) libgnomeprint-2.12.1
>> http://www.linuxfromscratch.org/blfs/view/cvs/gnome/libgnomeprint.html
>
> I don't think you need libgnomeprint. There's no check for it in the
> configure script, and the printing functions haven't been overridden,
> which means they won't work. I'll be removing these functions
> altogether simply because libgnomeprint is not available on Windows.
> The scenario will change when the php-gnome extension is introduced
> though.
>
>> Would be great if anyone could point us to an updated win32 binary of
>> gtksourceview-1.6.0.
>
> Ask xxoes (sorry, don't remember your real name!) or Steph nicely, and
> they may build one for you :)
>
> Cheers,
>
> - Anant
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: "turn on" GtkSourceView feature

by Anant Narayanan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> libgnomeprint _is_ available on Windows, it's just pointless there!

Hehe, I guess there's no point in having the print functions in there
anyway, I'll remove it at-least so that the coverage looks better!

- Anant

--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php