PDA

View Full Version : Lazarus and GTK2



cragwolf
17-04-2005, 02:31 AM
Lazarus is currently my IDE of choice (I'm a Linux user), although I don't use it for anything other than compiling FreePascal programs (but I have experimented quite a bit with the LCL). It's nice to have a cross-platform Delphi clone (plus or minus a few things). On the other hand, I really don't like the old GTK user interface, especially with its relatively crappy text rendering ability. It just doesn't compare to GTK2. For example, in GTK2 the GtkTextView widget includes more functionality and a much higher quality text rendering capability.

But as of today, I have been able to compile Lazarus with the GTK2 bindings. Bravo! At least now my eyes don't have to suffer. But there's still some way to go. For example, a few features of the IDE don't work with GTK2. The text rendering is a little slow. Some LCL components don't work properly. But if the work continues, then things should improve.

By the way, has anyone managed to get OpenGL working with a Lazarus window in Linux? It's easy on Windows (almost identical to the Delphi way), but I haven't figured out a way on Linux.

Sly
17-04-2005, 09:50 AM
Do you have a screenshot of Lazarus with GTK2? I'm keen to see the difference.

cragwolf
18-04-2005, 03:43 AM
Sure. Here is a screenshot of Lazarus under GTK1 (using the best-looking font I could find for GTK1, Courier 10 Pitch):

http://www.urbanaustralia.org/cragwolf/gtk1laz.png

and here is a screenshot of Lazarus under GTK2 (with same font, but there are some better-looking fonts, in my opinion, like Monospace):

http://www.urbanaustralia.org/cragwolf/gtk2laz.png

The other advantage of the GTK2 version is that it is consistent with every other GTK app that I use. Firefox, gFTP, Nautilus (file manager), Pan (newsreader), Thunderbird (mail client), gnome-terminal, Acroread, the GIMP, bluefish (HTML editor), gedit (text editor), WebDownloader for X, and AbiWord (word processor) are all GTK2 apps.

Sly
18-04-2005, 03:48 AM
Oh yeah. That is better by orders of magnitude. Good work.

{MSX}
18-04-2005, 06:48 AM
Very nice! I realyl must do this too, before gtk1 fonts burn out my eyes :P
Why not explaining a little how you did it ? :)

Bye!

{MSX}
18-04-2005, 08:10 PM
I'm tring to compile it too :P
Thanks to the mighty Almindor that's helping me i've almost done :)

cragwolf
18-04-2005, 11:35 PM
Actually, I don't know exactly how I did it, but I know what I did. :shock: :lol: Let me explain:

1) In the latest FPC release (v1.9.8 ) I noticed that they included GTK2 Pascal bindings. So I decided to try a few demos. Most worked fine. But a few didn't. The reason was that the GTK2_4 define was not defined. So that meant that I had to switch on this define and recompile the GTK2 Pascal bindings. I did this using the following method:

a) I edited the Makefile.fpc file in the ".../src/fpc-1.9.8/packages/extra/gtk2" subdirectory, adding "options=-dGTK2_4" in the [compiler] section.
b) I then issued a "fpcmake -w" command. This generated a new Makefile.
c) I then went to the top level of the source tree, ".../src/fpc-1.9.8" and issued a "make all" command, which took a while to run, and then a "make install" command, which moved the compiled binaries to the right place.

I suppose I could have run "make all && make install" from the ".../src/fpc-1.9.8/packages/extra/gtk2" directory, so that only the gtk2 files would be recompiled, instead of all the files in the fpc system, but I guess I wanted to be on the safe/pedantic side.

2) I had already installed Lazarus from source with the "make clean all" command. This by default compiles it with GTK1 bindings on Linux. You should probably do this first.

3) I ran Lazarus, went to Tools | Configure "Build Lazarus", and in the resulting dialog, for "LCL Interface" checked the GTK2 option, and then unchecked the "With Packages" checkbox.

4) From the Tools menu again, I selected Build Lazarus. Then I waited and hoped. And it worked!

I am not sure if step 1 is necessary. But it's a good idea to do it anyway. The GTK2 interface for Lazarus is still very buggy/incomplete, so be prepared for the occasional crash and speed/memory issues.

Almindor
24-04-2005, 08:56 PM
Long story short:
make LCL_PLATFORM="gtk2"

Hope this helps :)