![]() |
![]() |
Gwyddion Application Library Reference Manual | ![]() |
|
---|---|---|---|---|
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);
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()
.
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.
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.
void (*GwyAppDataForeachFunc) (GwyContainer *data, gpointer user_data);
data : |
|
user_data : |
void gwy_app_data_browser_add (GwyContainer *data);
Adds a data container to the application data browser.
The data browser takes a reference on the container so you can release yours.
data : |
A data container. |
void gwy_app_data_browser_remove (GwyContainer *data);
Removed a data container from the application data browser.
data : |
A data container. |
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.
|
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.
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() .
|
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. |
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. |
gint gwy_app_data_browser_add_data_field (GwyDataField *dfield, GwyContainer *data, gboolean showit);
Adds a data field to a data container.
gint gwy_app_data_browser_add_graph_model (GwyGraphModel *gmodel, GwyContainer *data, gboolean showit);
Adds a graph model to a data container.
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. |
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. |
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. |
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. |
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 .
|
void gwy_app_sync_data_items (GwyContainer *source, GwyContainer *dest, gint from_id, gint to_id, gboolean delete_too, ...);
Synchronizes auxiliary data items between data containers.
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. |
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. |
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 .
|
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 .
|
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 .
|
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).
|
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. |
void gwy_app_data_browser_show (void);
Shows the data browser window.
If the window does not exist, it is created.
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()
.
void gwy_app_data_browser_shut_down (void);
Releases data browser resources and saves its state.
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 .
|
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.
|
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.
|
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. |
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.
|