data-browser

data-browser — Data browser

Synopsis




enum        GwyAppWhat;
enum        GwyDataItem;
enum        GwyVisibilityResetType;
void        (*GwyAppDataForeachFunc)        (GwyContainer *data,
                                             gpointer user_data);
void        gwy_app_data_browser_add        (GwyContainer *data);
void        gwy_app_data_browser_remove     (GwyContainer *data);
gboolean    gwy_app_data_browser_reset_visibility
                                            (GwyContainer *data,
                                             GwyVisibilityResetType reset_type);
void        gwy_app_data_browser_set_keep_invisible
                                            (GwyContainer *data,
                                             gboolean keep_invisible);
gboolean    gwy_app_data_browser_get_keep_invisible
                                            (GwyContainer *data);
void        gwy_app_data_browser_select_data_view
                                            (GwyDataView *data_view);
void        gwy_app_data_browser_select_graph
                                            (GwyGraph *graph);
gint        gwy_app_data_browser_add_data_field
                                            (GwyDataField *dfield,
                                             GwyContainer *data,
                                             gboolean showit);
gint        gwy_app_data_browser_add_graph_model
                                            (GwyGraphModel *gmodel,
                                             GwyContainer *data,
                                             gboolean showit);
void        gwy_app_data_browser_get_current
                                            (GwyAppWhat what,
                                             ...);
gint*       gwy_app_data_browser_get_data_ids
                                            (GwyContainer *data);
gint*       gwy_app_data_browser_get_graph_ids
                                            (GwyContainer *data);
void        gwy_app_data_clear_selections   (GwyContainer *data,
                                             gint id);
void        gwy_app_data_browser_foreach    (GwyAppDataForeachFunc function,
                                             gpointer user_data);
void        gwy_app_sync_data_items         (GwyContainer *source,
                                             GwyContainer *dest,
                                             gint from_id,
                                             gint to_id,
                                             gboolean delete_too,
                                             ...);
gint        gwy_app_data_browser_copy_channel
                                            (GwyContainer *source,
                                             gint id,
                                             GwyContainer *dest);
GQuark      gwy_app_get_data_key_for_id     (gint id);
GQuark      gwy_app_get_mask_key_for_id     (gint id);
GQuark      gwy_app_get_show_key_for_id     (gint id);
void        gwy_app_set_data_field_title    (GwyContainer *data,
                                             gint id,
                                             const gchar *name);
gchar*      gwy_app_get_data_field_title    (GwyContainer *data,
                                             gint id);
void        gwy_app_data_browser_show       (void);
void        gwy_app_data_browser_restore    (void);
void        gwy_app_data_browser_shut_down  (void);
GdkPixbuf*  gwy_app_get_channel_thumbnail   (GwyContainer *data,
                                             gint id,
                                             gint max_width,
                                             gint max_height);
void        gwy_app_data_browser_select_data_field
                                            (GwyContainer *data,
                                             gint id);
void        gwy_app_data_browser_select_graph_model
                                            (GwyContainer *data,
                                             gint id);
void        gwy_app_data_browser_show_3d    (GwyContainer *data,
                                             gint id);
GtkWindow*  gwy_app_find_window_for_channel (GwyContainer *data,
                                             gint id);

Description

Details

enum GwyAppWhat

typedef enum {
    GWY_APP_CONTAINER = 1,
    GWY_APP_DATA_VIEW,
    GWY_APP_GRAPH,
    GWY_APP_DATA_FIELD,
    GWY_APP_DATA_FIELD_KEY,
    GWY_APP_DATA_FIELD_ID,
    GWY_APP_MASK_FIELD,
    GWY_APP_MASK_FIELD_KEY,
    GWY_APP_SHOW_FIELD,
    GWY_APP_SHOW_FIELD_KEY,
    GWY_APP_GRAPH_MODEL,
    GWY_APP_GRAPH_MODEL_KEY,
    GWY_APP_GRAPH_MODEL_ID
} GwyAppWhat;

Types of current objects that can be requested with gwy_app_data_browser_get_current().

GWY_APP_CONTAINER Data container (corresponds to files).
GWY_APP_DATA_VIEW Data view widget (shows a channel).
GWY_APP_GRAPH Graph widget (shows a graph model).
GWY_APP_DATA_FIELD Data field (channel).
GWY_APP_DATA_FIELD_KEY Quark corresponding to the data field (channel).
GWY_APP_DATA_FIELD_ID Number (id) of the data field (channel) in its container.
GWY_APP_MASK_FIELD Mask data field.
GWY_APP_MASK_FIELD_KEY Quark corresponding to the mask field.
GWY_APP_SHOW_FIELD Presentation data field.
GWY_APP_SHOW_FIELD_KEY Quark corresponding to the presentation field.
GWY_APP_GRAPH_MODEL Graph model.
GWY_APP_GRAPH_MODEL_KEY Quark corresponding to the graph model.
GWY_APP_GRAPH_MODEL_ID Number (id) of the graph model in its container.

enum GwyDataItem

typedef enum {
    GWY_DATA_ITEM_GRADIENT = 1,
    GWY_DATA_ITEM_PALETTE = GWY_DATA_ITEM_GRADIENT,
    GWY_DATA_ITEM_MASK_COLOR,
    GWY_DATA_ITEM_TITLE,
    GWY_DATA_ITEM_RANGE,
    GWY_DATA_ITEM_RANGE_TYPE,
    GWY_DATA_ITEM_REAL_SQUARE,
    GWY_DATA_ITEM_SELECTIONS,
    GWY_DATA_ITEM_META
} GwyDataItem;

Auxiliary channel data type.

GWY_DATA_ITEM_GRADIENT Color gradient.
GWY_DATA_ITEM_PALETTE An alias of GWY_DATA_ITEM_GRADIENT.
GWY_DATA_ITEM_MASK_COLOR Mask color components.
GWY_DATA_ITEM_TITLE Channel title.
GWY_DATA_ITEM_RANGE Range type and range boundaries.
GWY_DATA_ITEM_RANGE_TYPE Range type.
GWY_DATA_ITEM_REAL_SQUARE Physical/pixel aspect ratio mode.
GWY_DATA_ITEM_SELECTIONS Data selections.
GWY_DATA_ITEM_META Metadata.

enum GwyVisibilityResetType

typedef enum {
    GWY_VISIBILITY_RESET_DEFAULT,
    GWY_VISIBILITY_RESET_RESTORE,
    GWY_VISIBILITY_RESET_SHOW_ALL,
    GWY_VISIBILITY_RESET_HIDE_ALL
} GwyVisibilityResetType;

Data object visibility reset type.

The precise behaviour of GWY_VISIBILITY_RESET_DEFAULT may be subject of further changes. It indicates the wish to restore saved visibilities and do something reasonable when there are no visibilities to restore.

GWY_VISIBILITY_RESET_DEFAULT Restore visibilities from container and if nothing would be visible, make an arbitrary data object visible.
GWY_VISIBILITY_RESET_RESTORE Restore visibilities from container.
GWY_VISIBILITY_RESET_SHOW_ALL Show all data objects.
GWY_VISIBILITY_RESET_HIDE_ALL Hide all data objects. This normally makes the file inaccessible.

GwyAppDataForeachFunc ()

void        (*GwyAppDataForeachFunc)        (GwyContainer *data,
                                             gpointer user_data);

data :
user_data :

gwy_app_data_browser_add ()

void        gwy_app_data_browser_add        (GwyContainer *data);

Adds a data container to the application data browser.

data : A data container.

gwy_app_data_browser_remove ()

void        gwy_app_data_browser_remove     (GwyContainer *data);

Removed a data container from the application data browser.

data : A data container.

gwy_app_data_browser_reset_visibility ()

gboolean    gwy_app_data_browser_reset_visibility
                                            (GwyContainer *data,
                                             GwyVisibilityResetType reset_type);

Resets visibility of all data objects in a container.

data : A data container.
reset_type : Type of visibility reset.
Returns : TRUE if anything is visible after the reset.

gwy_app_data_browser_set_keep_invisible ()

void        gwy_app_data_browser_set_keep_invisible
                                            (GwyContainer *data,
                                             gboolean keep_invisible);

Sets data browser behaviour for inaccessible data.

Normally, when all visual objects belonging to a file are closed the container is removed from the data browser and dereferenced, leading to its finalization. By setting keep_invisible to TRUE the container can be made to sit in the browser indefinitely.

data : A data container.
keep_invisible : TRUE to retain data in the browser even when it becomes inaccessible, FALSE to dispose of it.

gwy_app_data_browser_get_keep_invisible ()

gboolean    gwy_app_data_browser_get_keep_invisible
                                            (GwyContainer *data);

Gets data browser behaviour for inaccessible data.

data : A data container.
Returns : See gwy_app_data_browser_set_keep_invisible().

gwy_app_data_browser_select_data_view ()

void        gwy_app_data_browser_select_data_view
                                            (GwyDataView *data_view);

Switches application data browser to display container of data_view's data and selects data_view's data in the channel list.

data_view : A data view widget.

gwy_app_data_browser_select_graph ()

void        gwy_app_data_browser_select_graph
                                            (GwyGraph *graph);

Switches application data browser to display container of graph's data and selects graph's data in the graph list.

graph : A graph widget.

gwy_app_data_browser_add_data_field ()

gint        gwy_app_data_browser_add_data_field
                                            (GwyDataField *dfield,
                                             GwyContainer *data,
                                             gboolean showit);

Adds a data field to a data container.

dfield : A data field to add.
data : A data container to add dfield to. It can be NULL to add the data field to current data container.
showit : TRUE to display it immediately, FALSE to just add it.
Returns : The id of the data field in the container.

gwy_app_data_browser_add_graph_model ()

gint        gwy_app_data_browser_add_graph_model
                                            (GwyGraphModel *gmodel,
                                             GwyContainer *data,
                                             gboolean showit);

Adds a graph model to a data container.

gmodel : A graph model to add.
data : A data container to add gmodel to. It can be NULL to add the graph model to current data container.
showit : TRUE to display it immediately, FALSE to just add it.
Returns : The id of the graph model in the container.

gwy_app_data_browser_get_current ()

void        gwy_app_data_browser_get_current
                                            (GwyAppWhat what,
                                             ...);

Gets information about current objects.

All output arguments are always set to some value, even if the requested object does not exist. Object arguments are set to pointer to the object if it exists (no reference added), or cleared to NULL if no such object exists.

Quark arguments are set to the corresponding key even if no such object is actually present (use object arguments to check for object presence) but the location where it would be stored is known. This is commond with presentations and masks. They are be set to 0 if no corresponding location exists -- for example, when current mask key is requested but the current data contain no data field (or there is no current data at all).

The rules for id arguments are similar to quarks, except they are set to -1 to indicate undefined result.

The current objects can change due to user interaction even during the execution of modal dialogs (typically used by modules). Therefore to achieve consistency one has to ask for the complete set of interesting current objects at once.

what : First information about current objects to obtain.
... : pointer to store the information to (object pointer for objects, GQuark pointer for keys, gint pointer for id's), followed by 0-terminated list of GwyAppWhat, pointer couples.

gwy_app_data_browser_get_data_ids ()

gint*       gwy_app_data_browser_get_data_ids
                                            (GwyContainer *data);

Gets the list of all channels in a data container.

The container must be known to the data browser.

data : A data container.
Returns : A newly allocated array with channels ids, -1 terminated.

gwy_app_data_browser_get_graph_ids ()

gint*       gwy_app_data_browser_get_graph_ids
                                            (GwyContainer *data);

Gets the list of all graphs in a data container.

The container must be known to the data browser.

data : A data container.
Returns : A newly allocated array with graph ids, -1 terminated.

gwy_app_data_clear_selections ()

void        gwy_app_data_clear_selections   (GwyContainer *data,
                                             gint id);

Clears all selections associated with a data channel.

This is the preferred selection handling after changes in data geometry as they have generally unpredictable effects on selections. Selection should not be removed because this is likely to make the current tool stop working.

data : A data container.
id : Data channel id.

gwy_app_data_browser_foreach ()

void        gwy_app_data_browser_foreach    (GwyAppDataForeachFunc function,
                                             gpointer user_data);

Calls a function for each data container managed by data browser.

function : Function to run on each data container.
user_data : Data to pass as second argument of function.

gwy_app_sync_data_items ()

void        gwy_app_sync_data_items         (GwyContainer *source,
                                             GwyContainer *dest,
                                             gint from_id,
                                             gint to_id,
                                             gboolean delete_too,
                                             ...);

Copy auxiliary data items between data containers.

Items that do not exist in source are removed from dest. Therefore the operation is more of a synchronization than a copy.

source : Source container.
dest : Target container (may be identical to source).
from_id : Data number to copy items from.
to_id : Data number to copy items to.
delete_too : TRUE to delete items in target if source does not contain them, FALSE to copy only.
... : 0-terminated list of GwyDataItem values defining the items to copy.

gwy_app_data_browser_copy_channel ()

gint        gwy_app_data_browser_copy_channel
                                            (GwyContainer *source,
                                             gint id,
                                             GwyContainer *dest);

Copies a channel including all auxiliary data.

source : Source container.
id : Data channel id.
dest : Target container (may be identical to source).
Returns : The id of the copy.

gwy_app_get_data_key_for_id ()

GQuark      gwy_app_get_data_key_for_id     (gint id);

Calculates data field quark identifier from its id.

id : Data number in container.
Returns : The quark key identifying mask number id.

gwy_app_get_mask_key_for_id ()

GQuark      gwy_app_get_mask_key_for_id     (gint id);

Calculates mask field quark identifier from its id.

id : Data number in container.
Returns : The quark key identifying mask number id.

gwy_app_get_show_key_for_id ()

GQuark      gwy_app_get_show_key_for_id     (gint id);

Calculates presentation field quark identifier from its id.

id : Data number in container.
Returns : The quark key identifying presentation number id.

gwy_app_set_data_field_title ()

void        gwy_app_set_data_field_title    (GwyContainer *data,
                                             gint id,
                                             const gchar *name);

Sets channel title.

data : A data container.
id : The data channel id.
name : The title to set. It can be NULL to use somthing like "Untitled". The id will be appended to it or (replaced in it if it already ends with digits).

gwy_app_get_data_field_title ()

gchar*      gwy_app_get_data_field_title    (GwyContainer *data,
                                             gint id);

Gets a data channel title.

This function should return a reasoanble title for untitled channels, channels with old titles, channels with and without a file, etc.

data : A data container.
id : Data channel id.
Returns : The channel title as a newly allocated string.

gwy_app_data_browser_show ()

void        gwy_app_data_browser_show       (void);

Shows the data browser window.

If the window does not exist, it is created.


gwy_app_data_browser_restore ()

void        gwy_app_data_browser_restore    (void);

Restores the data browser window.

The data browser window is always created (if it does not exist). If it should be visible according to settings, is shown at the saved position. Otherwise it is kept hidden until gwy_app_data_browser_show().


gwy_app_data_browser_shut_down ()

void        gwy_app_data_browser_shut_down  (void);

Releases data browser resources and saves its state.


gwy_app_get_channel_thumbnail ()

GdkPixbuf*  gwy_app_get_channel_thumbnail   (GwyContainer *data,
                                             gint id,
                                             gint max_width,
                                             gint max_height);

Creates a channel thumbnail.

data : A data container.
id : Data channel id.
max_width : Maximum width of the created pixbuf, it must be at least 2.
max_height : Maximum height of the created pixbuf, it must be at least 2.
Returns : A newly created pixbuf with channel thumbnail. It keeps the aspect ratio of the data field while not exceeding max_width and max_height.

gwy_app_data_browser_select_data_field ()

void        gwy_app_data_browser_select_data_field
                                            (GwyContainer *data,
                                             gint id);

Makes a data field (channel) current in the data browser.

data : The container to select.
id : Number (id) of the data field in data to select.

gwy_app_data_browser_select_graph_model ()

void        gwy_app_data_browser_select_graph_model
                                            (GwyContainer *data,
                                             gint id);

Makes a graph model (channel) current in the data browser.

data : The container to select.
id : Number (id) of the graph model in data to select.

gwy_app_data_browser_show_3d ()

void        gwy_app_data_browser_show_3d    (GwyContainer *data,
                                             gint id);

Shows a 3D window displaying a channel.

If a 3D window of the specified channel already exists, it is just presented to the user. If it does not exist, it is created.

The caller must ensure 3D display is available, for example by checking gwy_app_gl_is_ok().

data : A data container.
id : Channel id.

gwy_app_find_window_for_channel ()

GtkWindow*  gwy_app_find_window_for_channel (GwyContainer *data,
                                             gint id);

Finds the window displaying a data channel.

data : A data container to find window for.
id : Data channel id. It can be -1 to find any data window displaying a channel from data.
Returns : The window if found, NULL if no data window displays the requested channel.