![]() |
![]() |
Gwyddion Application Library Reference Manual | ![]() |
|
---|---|---|---|---|
Top | Description |
#include <app/gwyapp.h> enum GwyAppWhat; enum GwyDataItem; enum GwyVisibilityResetType; enum GwyDataWatchEventType; void (*GwyAppDataForeachFunc) (GwyContainer *data
,gpointer user_data
); void (*GwyAppDataWatchFunc) (GwyContainer *data
,gint id
,GwyDataWatchEventType event
,gpointer user_data
); void gwy_app_data_browser_add (GwyContainer *data
); void gwy_app_data_browser_remove (GwyContainer *data
); void gwy_app_data_browser_merge (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
); void gwy_app_data_browser_select_spectra (GwySpectra *spectra
); 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
); gint gwy_app_data_browser_add_spectra (GwySpectra *spectra
,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
); gint * gwy_app_data_browser_get_spectra_ids (GwyContainer *data
); gint * gwy_app_data_browser_find_data_by_title (GwyContainer *data
,const gchar *titleglob
); gint * gwy_app_data_browser_find_graphs_by_title (GwyContainer *data
,const gchar *titleglob
); gint * gwy_app_data_browser_find_spectra_by_title (GwyContainer *data
,const gchar *titleglob
); void gwy_app_data_clear_selections (GwyContainer *data
,gint id
); void gwy_app_data_browser_foreach (GwyAppDataForeachFunc function
,gpointer user_data
); gulong gwy_app_data_browser_add_channel_watch (GwyAppDataWatchFunc function
,gpointer user_data
); void gwy_app_data_browser_remove_channel_watch (gulong id
); 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
); GQuark gwy_app_get_graph_key_for_id (gint id
); GQuark gwy_app_get_spectra_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
); gboolean gwy_app_data_browser_get_gui_enabled (void
); void gwy_app_data_browser_set_gui_enabled (gboolean setting
);
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, GWY_APP_SPECTRA, GWY_APP_SPECTRA_KEY, GWY_APP_SPECTRA_ID } GwyAppWhat;
Types of current objects that can be requested with
gwy_app_data_browser_get_current()
.
Data container (corresponds to files). | |
Data view widget (shows a channel). | |
Graph widget (shows a graph model). | |
Data field (channel). | |
Quark corresponding to the data field (channel). | |
Number (id) of the data field (channel) in its container. | |
Mask data field. | |
Quark corresponding to the mask field. | |
Presentation data field. | |
Quark corresponding to the presentation field. | |
Graph model. | |
Quark corresponding to the graph model. | |
Number (id) of the graph model in its container. | |
Single point spectra. | |
Quark corresponding to the single point spectra. | |
Number (id) of the the single point spectra in its container. |
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, GWY_DATA_ITEM_CALDATA } GwyDataItem;
Auxiliary channel data type.
Color gradient. | |
An alias of GWY_DATA_ITEM_GRADIENT .
|
|
Mask color components. | |
Channel title. | |
Range type and range boundaries. | |
Range type. | |
Physical/pixel aspect ratio mode. | |
Data selections. | |
Metadata. | |
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.
Restore visibilities from container and if nothing would be visible, make an arbitrary data object visible. | |
Restore visibilities from container. | |
Show all data objects. | |
Hide all data objects. This normally makes the file inaccessible. |
typedef enum { GWY_DATA_WATCH_EVENT_ADDED, GWY_DATA_WATCH_EVENT_CHANGED, GWY_DATA_WATCH_EVENT_REMOVED } GwyDataWatchEventType;
Type of event reported to GwyAppDataWatchFunc watcher functions.
A new data object has appeared. | |
A data object has changed. | |
A data object has been removed. |
Since 2.21
void (*GwyAppDataForeachFunc) (GwyContainer *data
,gpointer user_data
);
Type of function passed to gwy_app_data_browser_foreach()
.
|
A data container managed by the data-browser. |
|
User data passed to gwy_app_data_browser_foreach() . |
void (*GwyAppDataWatchFunc) (GwyContainer *data
,gint id
,GwyDataWatchEventType event
,gpointer user_data
);
Type of function passed to gwy_app_data_browser_add_channel_watch()
.
|
A data container managed by the data-browser. |
|
Object (channel) id in the container. |
|
User data passed to gwy_app_data_browser_add_channel_watch() . |
Since 2.21
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.
|
A data container. |
void gwy_app_data_browser_remove (GwyContainer *data
);
Removed a data container from the application data browser.
|
A data container. |
void gwy_app_data_browser_merge (GwyContainer *data
);
Merges the data from a data container to the current one.
|
A data container, not managed by the data browser. |
Since 2.7
gboolean gwy_app_data_browser_reset_visibility (GwyContainer *data
,GwyVisibilityResetType reset_type
);
Resets visibility of all data objects in a container.
|
A data container. |
|
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.
|
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.
|
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.
|
A graph widget. |
void gwy_app_data_browser_select_spectra (GwySpectra *spectra
);
Switches application data browser to display container of spectra
's data
and selects spectra
's data in the graph list.
However, it is not actually supposed to work with spectra from a different container than those of the currently active channel, so do not try that for now.
|
A spectra object. |
Since 2.7
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.
gint gwy_app_data_browser_add_spectra (GwySpectra *spectra
,GwyContainer *data
,gboolean showit
);
Adds a spectra object to a data container.
|
A spectra object to add. |
|
A data container to add gmodel to.
It can be NULL to add the spectra to current data container. |
|
TRUE to display it immediately, FALSE to just add it. |
Returns : |
The id of the spectra object in the container. |
Since 2.7
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 is 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 common with presentations and masks. They are be set to 0 if no corresponding location exists -- for example, when the current mask key is requested but the current data contains no channel (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 current objects at once.
|
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.
|
A data container managed by the data-browser. |
Returns : |
A newly allocated array with channel ids, -1 terminated. |
gint * gwy_app_data_browser_get_graph_ids (GwyContainer *data
);
Gets the list of all graphs in a data container.
|
A data container managed by the data-browser. |
Returns : |
A newly allocated array with graph ids, -1 terminated. |
gint * gwy_app_data_browser_get_spectra_ids
(GwyContainer *data
);
Gets the list of all spectra in a data container.
|
A data container managed by the data-browser. |
Returns : |
A newly allocated array with spectrum ids, -1 terminated. |
Since 2.7
gint * gwy_app_data_browser_find_data_by_title (GwyContainer *data
,const gchar *titleglob
);
Gets the list of all channels in a data container whose titles match the specified pattern.
|
A data container managed by the data-browser. |
|
Pattern, as used by GPatternSpec, to match the channel titles against. |
Returns : |
A newly allocated array with channel ids, -1 terminated. |
Since 2.21
gint * gwy_app_data_browser_find_graphs_by_title (GwyContainer *data
,const gchar *titleglob
);
Gets the list of all graphs in a data container whose titles match the specified pattern.
|
A data container managed by the data-browser. |
|
Pattern, as used by GPatternSpec, to match the graph titles against. |
Returns : |
A newly allocated array with graph ids, -1 terminated. |
Since 2.21
gint * gwy_app_data_browser_find_spectra_by_title (GwyContainer *data
,const gchar *titleglob
);
Gets the list of all spectra in a data container whose titles match the specified pattern.
|
A data container managed by the data-browser. |
|
Pattern, as used by GPatternSpec, to match the spectra titles against. |
Returns : |
A newly allocated array with spectra ids, -1 terminated. |
Since 2.21
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.
|
A data container. |
|
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 to run on each data container. |
|
Data to pass as second argument of function . |
gulong gwy_app_data_browser_add_channel_watch (GwyAppDataWatchFunc function
,gpointer user_data
);
Adds a watch function called when a channel changes.
The function is called whenever a channel is added, removed, its data changes or its metadata such as the title changes. If a channel is removed it may longer exist when the function is called.
|
Function to call when a channel changes. |
|
User data to pass to function . |
Returns : |
The id of the added watch func that can be used to remove it later
using gwy_app_data_browser_remove_channel_watch() .
Since 2.21. |
void gwy_app_data_browser_remove_channel_watch
(gulong id
);
Removes a channel watch function.
|
Watch function id, as returned by
gwy_app_data_browser_add_channel_watch() . |
Since 2.21
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 container. |
|
Target container (may be identical to source). |
|
Data number to copy items from. |
|
Data number to copy items to. |
|
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 container. |
|
Data channel id. |
|
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.
|
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.
|
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.
|
Data number in container. |
Returns : |
The quark key identifying presentation number id . |
GQuark gwy_app_get_graph_key_for_id (gint id
);
Calculates graph model quark identifier from its id.
|
Graph number in container. |
Returns : |
The quark key identifying graph model number id . |
Since 2.7
GQuark gwy_app_get_spectra_key_for_id (gint id
);
Calculates spectra quark identifier from its id.
|
Spectra number in container. |
Returns : |
The quark key identifying spectra number id . |
Since 2.7
void gwy_app_set_data_field_title (GwyContainer *data
,gint id
,const gchar *name
);
Sets channel title.
|
A data container. |
|
The data channel id. |
|
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.
|
A data container. |
|
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.
|
A data container. |
|
Data channel id. |
|
Maximum width of the created pixbuf, it must be at least 2. |
|
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.
|
The container to select. |
|
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.
|
The container to select. |
|
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()
.
|
A data container. |
|
Channel id. |
GtkWindow * gwy_app_find_window_for_channel (GwyContainer *data
,gint id
);
Finds the window displaying a data channel.
|
A data container to find window for. |
|
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. |
gboolean gwy_app_data_browser_get_gui_enabled
(void
);
Reports whether creation of windows by the data-browser is enabled.
Since 2.21
void gwy_app_data_browser_set_gui_enabled
(gboolean setting
);
Globally enables or disables creation of widgets by the data-browser.
By default, the data-browser creates windows for data objects automatically,
for instance when reconstructing view of a loaded file, after a module
function creates a new channel or graph or when it is explicitly asked so
by gwy_app_data_browser_show_3d()
. Non-GUI applications that run module
functions usually wish to disable GUI.
If GUI is disabled the data browser never creates windows showing data
objects and also gwy_app_data_browser_show()
becomes no-op.
Disabling GUI after widgets have been already created is a bad idea. Hence you should do so before loading files or calling module functions.
Since 2.21