Results 1 to 8 of 8

Thread: Lazarus and GTK2

  1. #1

    Lazarus and GTK2

    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.
    [size=10px]"In science one tries to tell people, in such a way as to be understood by everyone, something that no one ever knew before. But in poetry, it's the exact opposite." -- Paul Dirac[/size]

  2. #2

    Lazarus and GTK2

    Do you have a screenshot of Lazarus with GTK2? I'm keen to see the difference.

  3. #3

    Lazarus and GTK2

    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.
    [size=10px]"In science one tries to tell people, in such a way as to be understood by everyone, something that no one ever knew before. But in poetry, it's the exact opposite." -- Paul Dirac[/size]

  4. #4

    Lazarus and GTK2

    Oh yeah. That is better by orders of magnitude. Good work.

  5. #5

    Lazarus and GTK2

    Very nice! I realyl must do this too, before gtk1 fonts burn out my eyes
    Why not explaining a little how you did it ?

    Bye!
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  6. #6

    Lazarus and GTK2

    I'm tring to compile it too
    Thanks to the mighty Almindor that's helping me i've almost done
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  7. #7

    Lazarus and GTK2

    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.
    [size=10px]&quot;In science one tries to tell people, in such a way as to be understood by everyone, something that no one ever knew before. But in poetry, it&#39;s the exact opposite.&quot; -- Paul Dirac[/size]

  8. #8

    Lazarus and GTK2

    Long story short:
    make LCL_PLATFORM="gtk2"

    Hope this helps
    Feel the power of Open Source.
    <br />Feel the power of Free Pascal.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •