## visu_basic

visu_basic — Main functions of V_Sim (except graphical ones).

## Synopsis

    void                visuBasicInit                       ();
    gboolean            visuBasicQuit                       (gpointer data);

    gboolean            visuBasicDump                       (VisuData *data);
    int                 visuBasicExport_main                (void);
    void                visuBasicLoad_fileWithoutGtk        (VisuData *data);
    gboolean            visuBasicLoad_dataFromFile          (VisuData *data,
                                                             FileFormat *format,
                                                             int nSet,
                                                             GError **error);
    void                visuBasicSet_paths                  ();

## Description

There are here the main functions of V_Sim (except for graphical methods) such as open file.

## Details

### visuBasicInit ()

    void                visuBasicInit                       ();

A call to this method is done at startup after having probe the locale of the file system and having initialized the rendering window. It makes the following actions : create the visu object to store the signals, initialize the module part (parameters, and resources), initialize the dump part, the OpenGL part and its extensions, the storage of elements and the 'colorize with data' part.

### visuBasicQuit ()

    gboolean            visuBasicQuit                       (gpointer data);

A call to this method makes the GMainLoop stop.

`data` : | a pointer to the GMainLoop.
Returns : | FALSE, always.

### visuBasicDump ()

    gboolean            visuBasicDump                       (VisuData *data);

This method analyzes the `data` parameter to find the file format for export and call dump functions.

`data` : | the VisuData to be exported.
Returns : | TRUE if no error occured.

### visuBasicExport_main ()

    int                 visuBasicExport_main                (void);

This method is called when V_Sim is in export mode from the command line.

Returns : | 0 if everything is normal, 1 if an error occured.

### visuBasicLoad_fileWithoutGtk ()

    void                visuBasicLoad_fileWithoutGtk        (VisuData *data);

This method creates a VisuData from the file which is stored in the visu_object through a call to `setFileLoaded()`. And it calls the `renderStoredData()` method.

`data` : | a pointer to some user defined data.

### visuBasicLoad_dataFromFile ()

    gboolean            visuBasicLoad_dataFromFile          (VisuData *data,
                                                             FileFormat *format,
                                                             int nSet,
                                                             GError **error);

This calls the load method of the current rendering method. Some informations may be store in `error->message` if the returned value is FALSE. The file(s) which is(are) opened is(are) stored in the VisuData. The `nSet` argument is used to load a specific set of nodes if the input format supports it. If `nSet` is 0, then the default set of nodes is loaded.

`data` : | a VisuData object ;
`format` : | a pointer on a format (can be NULL if format is to be guessed) ;
`nSet` : | an integer ;
`error` : | a pointer to store a possible error, location must be initialized to (GError*)0.
Returns : | TRUE if everithing is OK, if FALSE, the `error` is set and should be freed with `g_error_free()`.

### visuBasicSet_paths ()

    void                visuBasicSet_paths                  ();

This method sets the paths. On Unix systems, this method sets the paths from macros defined by configure. On Win32 systems, it reads paths in a v_sim.ini file found in the current directory or in the C:\windows.

`exeLocation` : | give argv[0] which is the complete path to the executable.