visu_gtk

visu_gtk

Synopsis

int                 visuGtkMain                         (int argc,
                                                         char *argv[]);
GList*              visuGtkCreate_fileChooserFilter     (GList *list,
                                                         GtkWidget *fileChooser);
gchar**             visuGtkGet_selectedDirectory        (GtkWindow *parent,
                                                         gboolean multiple,
                                                         const gchar *dir);
gboolean            visuGtkLoadAndRender_file           (gpointer data);
void                visuGtkRaise_warning                (gchar *action,
                                                         gchar *message,
                                                         GtkWindow *window);
void                visuGtkRaise_warningLong            (gchar *action,
                                                         gchar *message,
                                                         GtkWindow *window);
void                visuGtkWait                         ();
gboolean            visuGtkGet_fileFromDefaultFileChooser
                                                        (VisuData *data,
                                                         GtkWindow *parent);
VisuGtkPreview*     visuGtkPreview_add                  (VisuGtkPreview *preview,
                                                         GtkFileChooser *chooser);
void                visuGtkPreview_update               (VisuGtkPreview *preview,
                                                         const char *filenames[]);

Description

Details

visuGtkMain ()

int                 visuGtkMain                         (int argc,
                                                         char *argv[]);

It initializses the GTK part of V_Sim: all subpanels, pick and observe window, pair window...

argc :

the number of arguments.

argv :

the values of all arguments.

Returns :

1 if something goes wrong, 0 otherwise.

visuGtkCreate_fileChooserFilter ()

GList*              visuGtkCreate_fileChooserFilter     (GList *list,
                                                         GtkWidget *fileChooser);

Create a list of GtkFileFilter created from the given list of file formats and attach it to the given fileChooser.

list :

a GList of FileFormat ;

fileChooser :

a file chooser to associate filters with.

Returns :

a list of FileFilterCustom. This list should be freed after use.

visuGtkGet_selectedDirectory ()

gchar**             visuGtkGet_selectedDirectory        (GtkWindow *parent,
                                                         gboolean multiple,
                                                         const gchar *dir);

General procedure to get the location of one or more directories. In the multiple case, all selected directories shares a common ancestor since the selection is done through the same selector that for single directory but with multiple selection activated. If dir is NULL the last opened (and stored) directory is used (see gtkMainClassGet_lastOpenDirectory() and gtkMainClassSet_lastOpenDirectory()).

parent :

if NULL, the command panel window is used ;

multiple :

if TRUE, multiple directories can be selected ;

dir :

if not NULL, give the opening directory.

Returns :

a newly allocated array of paths, NULL terminated. Use g_strfreev() to free it after use. If no directory is selected, then NULL is returned.

visuGtkLoadAndRender_file ()

gboolean            visuGtkLoadAndRender_file           (gpointer data);

This method loads the general function to load data from file and deals with errors with gtkDialogs.

data :

some user defined information.

Returns :

FALSE, always to stop any idle repetitions.

visuGtkRaise_warning ()

void                visuGtkRaise_warning                (gchar *action,
                                                         gchar *message,
                                                         GtkWindow *window);

Raise a warning window with the action in bold and the message written underneath.

action :

a string ;

message :

another string ;

window :

the parent window to raise the warning on.

visuGtkRaise_warningLong ()

void                visuGtkRaise_warningLong            (gchar *action,
                                                         gchar *message,
                                                         GtkWindow *window);

Same as visuGtkRaise_warning() except that the message is displayed in a text buffer, ideal for a log.

action :

a string ;

message :

another string ;

window :

the parent window to raise the warning on.

visuGtkWait ()

void                visuGtkWait                         ();

It runs the Gtk event loop, flushing it before returning.


visuGtkGet_fileFromDefaultFileChooser ()

gboolean            visuGtkGet_fileFromDefaultFileChooser
                                                        (VisuData *data,
                                                         GtkWindow *parent);

This method is a default method to launch a file chooser that select a single file, with the filters of the current RenderingMethod. It creates a modal dialog, and wait for its reponse. If OK is clicked, the selected filename is stored. If Cancel is clicked, nothing is done. The dialog is destroyed after use.

data :

an allocated VisuData to store the file names ;

parent :

the parent window of the dialog.

Returns :

FALSE if no file has been set, TRUE if the calling method should call gtkMainLoadAndRender_file() with a g_idle_add() method.

visuGtkPreview_add ()

VisuGtkPreview*     visuGtkPreview_add                  (VisuGtkPreview *preview,
                                                         GtkFileChooser *chooser);

Create the widgets to have a preview attached to filechooser. But the signal raised by filechooser when previewing is needed is not attached and this must be done by the user with custom routine.

preview :

a location on VisuGtkPreview (uninitialised) ;

chooser :

the filechooser the preview must be attached to.

Returns :

preview itself.

visuGtkPreview_update ()

void                visuGtkPreview_update               (VisuGtkPreview *preview,
                                                         const char *filenames[]);

This routine update the content of the given preview by making a rendering in a pixmap of the given filenames. The number of given filenames must match the number required by the current rendering method. Only the nodes, the box and the background (plus fog) is actually previewed.

preview :

a location on VisuGtkPreview (initialised) ;

filenames :

an array of filenames.