AMAYA with GTK

This release aims to start the migration from MOTIF to GTK user interface. It implements features needed to use AMAYA just like a browser and not like an Editor/Browser. In further release, I hope that a Browser/Editor version will be avaliable. We make this GTK release in order to get some feedback, and maybe some contribution to help the current development. I know there is a lot of bug in it, and I hope that most of them will be fixed soon.

GTK Screenshot

Amaya (GTK) Screenshot

  1. Libs needed to compile Amaya with GTK

    You can find it on: ftp://ftp.gtk.org/pub/gtk/v1.2

  2. How to compile Amaya with GTK
  3. New features

  4. Missing features
  5. Known bugs

  6. Bug fixed
  7. How did I work

    How did I proceed to implement GTK, in AMAYA sources ? First of all, I have learned the GTK lib by compiling a lot of small and easy codes. When I was partially ok with GTK lib, I looked the thotlib sources. It was not easy but I finaly understand globally how work thotlib. Looking and understanding the thotlib code was the harder job.

    Now, I can start to work and produce something.

    I choose to generate all form dialogue by using the thotlib functions used by motif. Motif is able to produce widget dynamically, Windows is not able to, and GTK is able to. So thotlib function was able to generate dynamically Motif widget. My work was just to replace the Motif code by the GTK equivalent code !!

    Here a small example:

    w = AddInFormulary (parentCatalogue, &i, &ent, &adbloc); /* Reserve one place in the dialogue box and return a pointer on this container (w) */

    #ifndef _GTK

    n = 0;

    title_string = XmStringCreateSimple (text);/* Create a Motif string in order to put the label into */

    XtSetArg (args[n], XmNfontList, DefaultFont);/* Assigne the label Font */

    n++;

    XtSetArg (args[n], XmNlabelString, title_string);/* Assigne the string to the label */

    n++;

    XtSetArg (args[n], XmNbackground, BgMenu_Color);/* Put the label color backgroung */

    n++;

    XtSetArg (args[n], XmNforeground, FgMenu_Color);/* Put the label color foreground */

    n++;

    w = XmCreateLabel (w, "Dialogue", args, n); /* Create the label widget, and put it in the reserved container (w)*/

    #else /* _GTK */

    tmpw = gtk_label_new (text); /* Create the label widget */

    gtk_misc_set_alignment (GTK_MISC (tmpw), 0.0, 0.5); /* Left justify the label */

    gtk_widget_show (GTK_WIDGET(tmpw)); /* Show the label */

    tmpw->style->font=DefaultFont;/* Assigne the label Font */

    gtk_box_pack_start (GTK_BOX(w), GTK_WIDGET(tmpw), FALSE, FALSE, 0);/* Put the label in the reserved container */

    w=tmpw;/* w become the pointer on the label widget */

    #endif /* !_GTK */

    /* Initialise the thotlib structure catalogue */

    catalogue->Cat_Widget = w;

    catalogue->Cat_Ref = ref;

    catalogue->Cat_Type = CAT_LABEL;

    catalogue->Cat_PtParent = parentCatalogue;

    adbloc->E_ThotWidget[ent] = (ThotWidget) (catalogue);

    adbloc->E_Free[ent] = 'N';

    catalogue->Cat_EntryParent = i;

    catalogue->Cat_Entries = NULL;

    In green: the motif code
    In orange: the GTK code
    In dark blue: the common GTK and Motif code (Thotlib code)
    I have added #ifndef _GTK #else #endif precompilation codes in order to compile with Motif flag or with GTK flag.
    My job was just to replace the XWindow (Motif) code by the GTK equivalent functions.
    To create a label, the Motif function is: XmCreateLabel and the equivalent GTK function is: gtk_label_new. Most of the time, function name which become with 'X' are XWindow or Motif functions.

    I have adopted the same strategie for all the thotlib functions with some XWindow & Motif reference. I try to find the correct function which could do the same action in GTK. Sometime no function was avaliable. Also, I try to make the equivalent function with many other GTK function.

    This job is not easy because you must understand the thotlib function aim and find the right GTK function which could be used to do the same action.

  8. Glossary

Stéphane GULLY

Last modified: 10 July; 2001