libgimp/gimp.h libgimp/gimpcolordisplay.h libgimp/gimpcolorselector.h

2000-05-28  Michael Natterer  <mitch@gimp.org>

	* libgimp/gimp.h
	* libgimp/gimpcolordisplay.h
	* libgimp/gimpcolorselector.h
	* libgimp/gimpmatrix.h
	* libgimp/gimpmodule.h
	* libgimp/gimpunit_pdb.c: purely cosmetic stuff and added some
	typedefs to make the html documentation nicer. Moved the module
	documentation from the headers to the sgml files.

	* app/module_db.[ch]: The type of the "init" and "unload" functions
	has changed. Code cleanup.

2000-05-28  Michael Natterer  <mitch@gimp.org>

	* libgimp/libgimp-decl.txt
	* libgimp/libgimp-docs.sgml
	* libgimp/libgimp-sections.txt
	* libgimp/tmpl/gimp.sgml
	* libgimp/tmpl/gimpcolorbutton.sgml
	* libgimp/tmpl/gimpcolordisplay.sgml
	* libgimp/tmpl/gimpcolorselector.sgml
	* libgimp/tmpl/gimpcolorspace.sgml
	* libgimp/tmpl/gimpcompat.sgml
	* libgimp/tmpl/gimpenums.sgml
	* libgimp/tmpl/gimpfeatures.sgml
	* libgimp/tmpl/gimplimits.sgml
	* libgimp/tmpl/gimpmath.sgml
	* libgimp/tmpl/gimpmodule.sgml
	* libgimp/tmpl/gimpparasite.sgml
	* libgimp/tmpl/gimpparasiteio.sgml
	* libgimp/tmpl/gimppixmap.sgml
	* libgimp/tmpl/gimpprotocol.sgml
	* libgimp/tmpl/gimpsignal.sgml
	* libgimp/tmpl/gimpui.sgml
	* libgimp/tmpl/gimpunit.sgml
	* libgimp/tmpl/gimputils.sgml
	* libgimp/tmpl/gimpvector.sgml
	* libgimp/tmpl/gimpwire.sgml
	* libgimp/tmpl/libgimp-unused.sgml: Moved the module documentation
	from the libgimp headers here, updates, cleanups.
This commit is contained in:
Michael Natterer 2000-05-28 00:00:28 +00:00 committed by Michael Natterer
parent f2e4a9a490
commit 2b775b6b8c
39 changed files with 1865 additions and 1579 deletions

View file

@ -1,3 +1,17 @@
2000-05-28 Michael Natterer <mitch@gimp.org>
* libgimp/gimp.h
* libgimp/gimpcolordisplay.h
* libgimp/gimpcolorselector.h
* libgimp/gimpmatrix.h
* libgimp/gimpmodule.h
* libgimp/gimpunit_pdb.c: purely cosmetic stuff and added some
typedefs to make the html documentation nicer. Moved the module
documentation from the headers to the sgml files.
* app/module_db.[ch]: The type of the "init" and "unload" functions
has changed. Code cleanup.
2000-05-27 Sven Neumann <sven@gimp.org>
* app/color_select.c: use spinbuttons in the GIMP

View file

@ -41,12 +41,15 @@
#include "libgimp/gimpenv.h"
#include "libgimp/gimpmodule.h"
#include "libgimp/gimpintl.h"
/* export this to gimprc.c */
char *module_db_load_inhibit = NULL;
typedef enum {
/* export this to gimprc.c */
gchar *module_db_load_inhibit = NULL;
typedef enum
{
ST_MODULE_ERROR, /* missing module_load function or other error */
ST_LOADED_OK, /* happy and running (normal state of affairs) */
ST_LOAD_FAILED, /* module_load returned GIMP_MODULE_UNLOAD */
@ -54,7 +57,8 @@ typedef enum {
ST_UNLOADED_OK /* callback arrived, module not in memory anymore */
} module_state;
static const char * const statename[] = {
static const gchar * const statename[] =
{
N_("Module error"),
N_("Loaded OK"),
N_("Load failed"),
@ -70,12 +74,14 @@ extern void gimp_color_display_unregister();
extern void dialog_register ();
extern void dialog_unregister ();
static struct main_funcs_struc {
static struct main_funcs_struc
{
gchar *name;
void (*func) ();
}
gimp_main_funcs[] = {
gimp_main_funcs[] =
{
{ "gimp_color_selector_register", gimp_color_selector_register },
{ "gimp_color_selector_unregister", gimp_color_selector_unregister },
{ "gimp_color_display_register", gimp_color_display_register },
@ -88,39 +94,45 @@ gimp_main_funcs[] = {
/* one of these objects is kept per-module */
typedef struct {
typedef struct
{
GtkObject object;
gchar *fullpath; /* path to the module */
module_state state; /* what's happened to the module */
gboolean ondisk; /* TRUE if file still exists */
gboolean load_inhibit; /* user requests not to load at boot time */
gint refs; /* how many time we're running in the module */
/* stuff from now on may be NULL depending on the state the module is in */
GimpModuleInfo *info; /* returned values from module_init */
GModule *module; /* handle on the module */
gchar *last_module_error;
GimpModuleInitFunc *init;
GimpModuleUnloadFunc *unload;
} module_info;
GimpModuleInitFunc init;
GimpModuleUnloadFunc unload;
} ModuleInfo;
static guint module_info_get_type (void);
#define MODULE_INFO_TYPE module_info_get_type()
#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, module_info)
#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo)
#define IS_MODULE_INFO(obj) GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE)
#define NUM_INFO_LINES 7
typedef struct {
typedef struct
{
GtkWidget *table;
GtkWidget *label[NUM_INFO_LINES];
GtkWidget *button_label;
module_info *last_update;
ModuleInfo *last_update;
GtkWidget *button;
GtkWidget *list;
GtkWidget *load_inhibit_check;
} browser_st;
} BrowserState;
/* global set of module_info pointers */
static GimpSet *modules;
@ -146,26 +158,43 @@ static gboolean need_to_rewrite_modulerc = FALSE;
/* prototypes */
static void module_initialize (char *filename);
static void mod_load (module_info *mod, gboolean verbose);
static void mod_unload (module_info *mod, gboolean verbose);
static module_info *module_find_by_path (const char *fullpath);
#ifdef DUMP_DB
static void print_module_info (gpointer data, gpointer user_data);
#endif
static void browser_popdown_callback (GtkWidget *w, gpointer client_data);
static void browser_destroy_callback (GtkWidget *w, gpointer client_data);
static void browser_info_update (module_info *, browser_st *);
static void browser_info_add (GimpSet *, module_info *, browser_st *);
static void browser_info_remove (GimpSet *, module_info *, browser_st *);
static void browser_info_init (browser_st *st, GtkWidget *table);
static void browser_select_callback (GtkWidget *widget, GtkWidget *child);
static void browser_load_unload_callback (GtkWidget *widget, gpointer data);
static void browser_refresh_callback (GtkWidget *widget, gpointer data);
static void make_list_item (gpointer data, gpointer user_data);
static void module_initialize (gchar *filename);
static void mod_load (ModuleInfo *mod,
gboolean verbose);
static void mod_unload (ModuleInfo *mod,
gboolean verbose);
static ModuleInfo * module_find_by_path (const gchar *fullpath);
static void gimp_module_ref (module_info *mod);
static void gimp_module_unref (module_info *mod);
#ifdef DUMP_DB
static void print_module_info (gpointer data,
gpointer user_data);
#endif
static void browser_popdown_callback (GtkWidget *widget,
gpointer data);
static void browser_destroy_callback (GtkWidget *widget,
gpointer data);
static void browser_info_update (ModuleInfo *mod,
BrowserState *st);
static void browser_info_add (GimpSet *set,
ModuleInfo *mod,
BrowserState *st);
static void browser_info_remove (GimpSet *set,
ModuleInfo *mod,
BrowserState *st);
static void browser_info_init (BrowserState *st,
GtkWidget *table);
static void browser_select_callback (GtkWidget *widget,
GtkWidget *child);
static void browser_load_unload_callback (GtkWidget *widget,
gpointer data);
static void browser_refresh_callback (GtkWidget *widget,
gpointer data);
static void make_list_item (gpointer data,
gpointer user_data);
static void gimp_module_ref (ModuleInfo *mod);
static void gimp_module_unref (ModuleInfo *mod);
@ -175,7 +204,7 @@ static void gimp_module_unref (module_info *mod);
void
module_db_init (void)
{
char *filename;
gchar *filename;
/* load the modulerc file */
filename = gimp_personal_rc_file ("modulerc");
@ -198,7 +227,7 @@ static void
free_a_single_module (gpointer data,
gpointer user_data)
{
module_info *mod = data;
ModuleInfo *mod = data;
if (mod->module && mod->unload && mod->state == ST_LOADED_OK)
{
@ -210,7 +239,7 @@ static void
add_to_inhibit_string (gpointer data,
gpointer user_data)
{
module_info *mod = data;
ModuleInfo *mod = data;
GString *str = user_data;
if (mod->load_inhibit)
@ -226,7 +255,7 @@ module_db_write_modulerc (void)
{
GString *str;
gchar *p;
char *filename;
gchar *filename;
FILE *fp;
gboolean saved = FALSE;
@ -274,7 +303,7 @@ module_db_browser_new (void)
GtkWidget *vbox;
GtkWidget *listbox;
GtkWidget *button;
browser_st *st;
BrowserState *st;
shell = gimp_dialog_new (_("Module DB"), "module_db_dialog",
gimp_standard_help_func,
@ -300,7 +329,7 @@ module_db_browser_new (void)
gtk_widget_set_usize (listbox, 125, 100);
gtk_widget_show (listbox);
st = g_new0 (browser_st, 1);
st = g_new0 (BrowserState, 1);
st->list = gtk_list_new ();
gtk_list_set_selection_mode (GTK_LIST (st->list), GTK_SELECTION_BROWSE);
@ -361,14 +390,16 @@ module_db_browser_new (void)
/**************************************************************/
/* module_info object glue */
/* ModuleInfo object glue */
typedef struct {
typedef struct
{
GtkObjectClass parent_class;
} module_infoClass;
} ModuleInfoClass;
enum {
enum
{
MODIFIED,
LAST_SIGNAL
};
@ -378,7 +409,7 @@ static guint module_info_signals[LAST_SIGNAL];
static void
module_info_destroy (GtkObject *object)
{
module_info *mod = MODULE_INFO (object);
ModuleInfo *mod = MODULE_INFO (object);
/* if this trips, then we're onto some serious lossage in a moment */
g_return_if_fail (mod->refs == 0);
@ -389,7 +420,7 @@ module_info_destroy (GtkObject *object)
}
static void
module_info_class_init (module_infoClass *klass)
module_info_class_init (ModuleInfoClass *klass)
{
GtkObjectClass *object_class;
GtkType type;
@ -407,7 +438,7 @@ module_info_class_init (module_infoClass *klass)
}
static void
module_info_init (module_info *mod)
module_info_init (ModuleInfo *mod)
{
/* don't need to do anything */
}
@ -421,9 +452,9 @@ module_info_get_type (void)
{
static const GtkTypeInfo module_info_info =
{
"module_info",
sizeof (module_info),
sizeof (module_infoClass),
"ModuleInfo",
sizeof (ModuleInfo),
sizeof (ModuleInfoClass),
(GtkClassInitFunc) module_info_class_init,
(GtkObjectInitFunc) module_info_init,
/* reserved_1 */ NULL,
@ -431,8 +462,8 @@ module_info_get_type (void)
(GtkClassInitFunc) NULL,
};
module_info_type = gtk_type_unique (gtk_object_get_type(),
&module_info_info);
module_info_type =
gtk_type_unique (gtk_object_get_type (), &module_info_info);
}
return module_info_type;
@ -441,19 +472,19 @@ module_info_get_type (void)
/* exported API: */
static void
module_info_modified (module_info *mod)
module_info_modified (ModuleInfo *mod)
{
gtk_signal_emit (GTK_OBJECT (mod), module_info_signals[MODIFIED]);
}
static module_info *
static ModuleInfo *
module_info_new (void)
{
return MODULE_INFO (gtk_type_new (module_info_get_type ()));
}
static void
module_info_free (module_info *mod)
module_info_free (ModuleInfo *mod)
{
gtk_object_unref (GTK_OBJECT (mod));
}
@ -465,10 +496,10 @@ module_info_free (module_info *mod)
/* name must be of the form lib*.so (Unix) or *.dll (Win32) */
static gboolean
valid_module_name (const char *filename)
valid_module_name (const gchar *filename)
{
const char *basename;
int len;
const gchar *basename;
gint len;
basename = g_basename (filename);
@ -496,12 +527,13 @@ valid_module_name (const char *filename)
static gboolean
module_inhibited (const char *fullpath,
const char *inhibit_list)
module_inhibited (const gchar *fullpath,
const gchar *inhibit_list)
{
char *p;
int pathlen;
const char *start, *end;
gchar *p;
gint pathlen;
const gchar *start;
const gchar *end;
/* common case optimisation: the list is empty */
if (!inhibit_list || *inhibit_list == '\000')
@ -531,9 +563,9 @@ module_inhibited (const char *fullpath,
static void
module_initialize (char *filename)
module_initialize (gchar *filename)
{
module_info *mod;
ModuleInfo *mod;
if (!valid_module_name (filename))
return;
@ -581,7 +613,7 @@ module_initialize (char *filename)
}
static void
mod_load (module_info *mod,
mod_load (ModuleInfo *mod,
gboolean verbose)
{
gpointer symbol;
@ -648,14 +680,13 @@ mod_load (module_info *mod,
mod->unload = symbol;
else
mod->unload = NULL;
}
static void
mod_unload_completed_callback (void *data)
{
module_info *mod = data;
ModuleInfo *mod = data;
g_return_if_fail (mod->state == ST_UNLOAD_REQUESTED);
@ -672,7 +703,7 @@ mod_unload_completed_callback (void *data)
}
static void
mod_unload (module_info *mod,
mod_unload (ModuleInfo *mod,
gboolean verbose)
{
g_return_if_fail (mod->module != NULL);
@ -694,22 +725,21 @@ mod_unload (module_info *mod,
}
#ifdef DUMP_DB
static void
print_module_info (gpointer data,
gpointer user_data)
{
module_info *i = data;
ModuleInfo *i = data;
printf ("\n%s: %s\n",
g_print ("\n%s: %s\n",
i->fullpath, statename[i->state]);
printf (" module:%p lasterr:%s init:%p unload:%p\n",
g_print (" module:%p lasterr:%s init:%p unload:%p\n",
i->module, i->last_module_error? i->last_module_error : "NONE",
i->init, i->unload);
if (i->info)
{
printf (" shutdown_data: %p\n"
g_print (" shutdown_data: %p\n"
" purpose: %s\n"
" author: %s\n"
" version: %s\n"
@ -728,31 +758,31 @@ print_module_info (gpointer data,
/* UI functions */
static void
browser_popdown_callback (GtkWidget *w,
gpointer client_data)
{
gtk_widget_destroy (GTK_WIDGET (client_data));
}
static void
browser_destroy_callback (GtkWidget *w,
gpointer client_data)
{
gtk_signal_disconnect_by_data (GTK_OBJECT (modules), client_data);
gimp_set_remove_handler (modules, modules_handler);
g_free (client_data);
}
static void
browser_load_inhibit_callback (GtkWidget *w,
browser_popdown_callback (GtkWidget *widget,
gpointer data)
{
browser_st *st = data;
gtk_widget_destroy (GTK_WIDGET (data));
}
static void
browser_destroy_callback (GtkWidget *widget,
gpointer data)
{
gtk_signal_disconnect_by_data (GTK_OBJECT (modules), data);
gimp_set_remove_handler (modules, modules_handler);
g_free (data);
}
static void
browser_load_inhibit_callback (GtkWidget *widget,
gpointer data)
{
BrowserState *st = data;
gboolean new_value;
g_return_if_fail (st->last_update != NULL);
new_value = ! GTK_TOGGLE_BUTTON (w)->active;
new_value = ! GTK_TOGGLE_BUTTON (widget)->active;
if (new_value == st->last_update->load_inhibit)
return;
@ -764,12 +794,12 @@ browser_load_inhibit_callback (GtkWidget *w,
}
static void
browser_info_update (module_info *mod,
browser_st *st)
browser_info_update (ModuleInfo *mod,
BrowserState *st)
{
int i;
const char *text[NUM_INFO_LINES - 1];
char *status;
gint i;
const gchar *text[NUM_INFO_LINES - 1];
gchar *status;
/* only update the info if we're actually showing it */
if (mod != st->last_update)
@ -804,7 +834,6 @@ browser_info_update (module_info *mod,
text[5] = mod->ondisk? _("on disk") : _("nowhere (click 'refresh')");
}
if (mod->state == ST_MODULE_ERROR && mod->last_module_error)
status = g_strdup_printf ("%s (%s)", gettext (statename[mod->state]),
mod->last_module_error);
@ -827,7 +856,8 @@ browser_info_update (module_info *mod,
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), TRUE);
/* work out what the button should do (if anything) */
switch (mod->state) {
switch (mod->state)
{
case ST_MODULE_ERROR:
case ST_LOAD_FAILED:
case ST_UNLOADED_OK:
@ -848,12 +878,14 @@ browser_info_update (module_info *mod,
}
static void
browser_info_init (browser_st *st,
browser_info_init (BrowserState *st,
GtkWidget *table)
{
GtkWidget *label;
int i;
char *text[] = {
gint i;
gchar *text[] =
{
N_("Purpose:"),
N_("Author:"),
N_("Version:"),
@ -892,8 +924,8 @@ static void
browser_select_callback (GtkWidget *widget,
GtkWidget *child)
{
module_info *i;
browser_st *st;
ModuleInfo *i;
BrowserState *st;
i = gtk_object_get_user_data (GTK_OBJECT (child));
st = gtk_object_get_user_data (GTK_OBJECT (widget));
@ -911,7 +943,7 @@ static void
browser_load_unload_callback (GtkWidget *widget,
gpointer data)
{
browser_st *st = data;
BrowserState *st = data;
if (st->last_update->state == ST_LOADED_OK)
mod_unload (st->last_update, FALSE);
@ -926,8 +958,8 @@ static void
make_list_item (gpointer data,
gpointer user_data)
{
module_info *info = data;
browser_st *st = user_data;
ModuleInfo *info = data;
BrowserState *st = user_data;
GtkWidget *list_item;
if (!st->last_update)
@ -944,8 +976,8 @@ make_list_item (gpointer data,
static void
browser_info_add (GimpSet *set,
module_info *mod,
browser_st *st)
ModuleInfo *mod,
BrowserState *st)
{
make_list_item (mod, st);
}
@ -953,12 +985,12 @@ browser_info_add (GimpSet *set,
static void
browser_info_remove (GimpSet *set,
module_info *mod,
browser_st *st)
ModuleInfo *mod,
BrowserState *st)
{
GList *dlist, *free_list;
GtkWidget *list_item;
module_info *i;
ModuleInfo *i;
dlist = gtk_container_children (GTK_CONTAINER (st->list));
free_list = dlist;
@ -990,10 +1022,10 @@ static void
module_db_module_ondisk (gpointer data,
gpointer user_data)
{
module_info *mod = data;
ModuleInfo *mod = data;
struct stat statbuf;
int ret;
int old_ondisk = mod->ondisk;
gint ret;
gint old_ondisk = mod->ondisk;
GSList **kill_list = user_data;
ret = stat (mod->fullpath, &statbuf);
@ -1019,7 +1051,7 @@ static void
module_db_module_remove (gpointer data,
gpointer user_data)
{
module_info *mod = data;
ModuleInfo *mod = data;
gimp_set_remove (modules, mod);
@ -1028,23 +1060,24 @@ module_db_module_remove (gpointer data,
typedef struct {
const char *search_key;
module_info *found;
typedef struct
{
const gchar *search_key;
ModuleInfo *found;
} find_by_path_closure;
static void
module_db_path_cmp (gpointer data,
gpointer user_data)
{
module_info *mod = data;
ModuleInfo *mod = data;
find_by_path_closure *cl = user_data;
if (!strcmp (mod->fullpath, cl->search_key))
cl->found = mod;
}
static module_info *
static ModuleInfo *
module_find_by_path (const char *fullpath)
{
find_by_path_closure cl;
@ -1078,7 +1111,7 @@ browser_refresh_callback (GtkWidget *widget,
static void
gimp_module_ref (module_info *mod)
gimp_module_ref (ModuleInfo *mod)
{
g_return_if_fail (mod->refs >= 0);
g_return_if_fail (mod->module != NULL);
@ -1086,7 +1119,7 @@ gimp_module_ref (module_info *mod)
}
static void
gimp_module_unref (module_info *mod)
gimp_module_unref (ModuleInfo *mod)
{
g_return_if_fail (mod->refs > 0);
g_return_if_fail (mod->module != NULL);

View file

@ -17,9 +17,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __MODULE_DB_H__
/* Load any modules we find on the module-path set in the gimprc */
void module_db_init (void);

View file

@ -41,12 +41,15 @@
#include "libgimp/gimpenv.h"
#include "libgimp/gimpmodule.h"
#include "libgimp/gimpintl.h"
/* export this to gimprc.c */
char *module_db_load_inhibit = NULL;
typedef enum {
/* export this to gimprc.c */
gchar *module_db_load_inhibit = NULL;
typedef enum
{
ST_MODULE_ERROR, /* missing module_load function or other error */
ST_LOADED_OK, /* happy and running (normal state of affairs) */
ST_LOAD_FAILED, /* module_load returned GIMP_MODULE_UNLOAD */
@ -54,7 +57,8 @@ typedef enum {
ST_UNLOADED_OK /* callback arrived, module not in memory anymore */
} module_state;
static const char * const statename[] = {
static const gchar * const statename[] =
{
N_("Module error"),
N_("Loaded OK"),
N_("Load failed"),
@ -70,12 +74,14 @@ extern void gimp_color_display_unregister();
extern void dialog_register ();
extern void dialog_unregister ();
static struct main_funcs_struc {
static struct main_funcs_struc
{
gchar *name;
void (*func) ();
}
gimp_main_funcs[] = {
gimp_main_funcs[] =
{
{ "gimp_color_selector_register", gimp_color_selector_register },
{ "gimp_color_selector_unregister", gimp_color_selector_unregister },
{ "gimp_color_display_register", gimp_color_display_register },
@ -88,39 +94,45 @@ gimp_main_funcs[] = {
/* one of these objects is kept per-module */
typedef struct {
typedef struct
{
GtkObject object;
gchar *fullpath; /* path to the module */
module_state state; /* what's happened to the module */
gboolean ondisk; /* TRUE if file still exists */
gboolean load_inhibit; /* user requests not to load at boot time */
gint refs; /* how many time we're running in the module */
/* stuff from now on may be NULL depending on the state the module is in */
GimpModuleInfo *info; /* returned values from module_init */
GModule *module; /* handle on the module */
gchar *last_module_error;
GimpModuleInitFunc *init;
GimpModuleUnloadFunc *unload;
} module_info;
GimpModuleInitFunc init;
GimpModuleUnloadFunc unload;
} ModuleInfo;
static guint module_info_get_type (void);
#define MODULE_INFO_TYPE module_info_get_type()
#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, module_info)
#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo)
#define IS_MODULE_INFO(obj) GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE)
#define NUM_INFO_LINES 7
typedef struct {
typedef struct
{
GtkWidget *table;
GtkWidget *label[NUM_INFO_LINES];
GtkWidget *button_label;
module_info *last_update;
ModuleInfo *last_update;
GtkWidget *button;
GtkWidget *list;
GtkWidget *load_inhibit_check;
} browser_st;
} BrowserState;
/* global set of module_info pointers */
static GimpSet *modules;
@ -146,26 +158,43 @@ static gboolean need_to_rewrite_modulerc = FALSE;
/* prototypes */
static void module_initialize (char *filename);
static void mod_load (module_info *mod, gboolean verbose);
static void mod_unload (module_info *mod, gboolean verbose);
static module_info *module_find_by_path (const char *fullpath);
#ifdef DUMP_DB
static void print_module_info (gpointer data, gpointer user_data);
#endif
static void browser_popdown_callback (GtkWidget *w, gpointer client_data);
static void browser_destroy_callback (GtkWidget *w, gpointer client_data);
static void browser_info_update (module_info *, browser_st *);
static void browser_info_add (GimpSet *, module_info *, browser_st *);
static void browser_info_remove (GimpSet *, module_info *, browser_st *);
static void browser_info_init (browser_st *st, GtkWidget *table);
static void browser_select_callback (GtkWidget *widget, GtkWidget *child);
static void browser_load_unload_callback (GtkWidget *widget, gpointer data);
static void browser_refresh_callback (GtkWidget *widget, gpointer data);
static void make_list_item (gpointer data, gpointer user_data);
static void module_initialize (gchar *filename);
static void mod_load (ModuleInfo *mod,
gboolean verbose);
static void mod_unload (ModuleInfo *mod,
gboolean verbose);
static ModuleInfo * module_find_by_path (const gchar *fullpath);
static void gimp_module_ref (module_info *mod);
static void gimp_module_unref (module_info *mod);
#ifdef DUMP_DB
static void print_module_info (gpointer data,
gpointer user_data);
#endif
static void browser_popdown_callback (GtkWidget *widget,
gpointer data);
static void browser_destroy_callback (GtkWidget *widget,
gpointer data);
static void browser_info_update (ModuleInfo *mod,
BrowserState *st);
static void browser_info_add (GimpSet *set,
ModuleInfo *mod,
BrowserState *st);
static void browser_info_remove (GimpSet *set,
ModuleInfo *mod,
BrowserState *st);
static void browser_info_init (BrowserState *st,
GtkWidget *table);
static void browser_select_callback (GtkWidget *widget,
GtkWidget *child);
static void browser_load_unload_callback (GtkWidget *widget,
gpointer data);
static void browser_refresh_callback (GtkWidget *widget,
gpointer data);
static void make_list_item (gpointer data,
gpointer user_data);
static void gimp_module_ref (ModuleInfo *mod);
static void gimp_module_unref (ModuleInfo *mod);
@ -175,7 +204,7 @@ static void gimp_module_unref (module_info *mod);
void
module_db_init (void)
{
char *filename;
gchar *filename;
/* load the modulerc file */
filename = gimp_personal_rc_file ("modulerc");
@ -198,7 +227,7 @@ static void
free_a_single_module (gpointer data,
gpointer user_data)
{
module_info *mod = data;
ModuleInfo *mod = data;
if (mod->module && mod->unload && mod->state == ST_LOADED_OK)
{
@ -210,7 +239,7 @@ static void
add_to_inhibit_string (gpointer data,
gpointer user_data)
{
module_info *mod = data;
ModuleInfo *mod = data;
GString *str = user_data;
if (mod->load_inhibit)
@ -226,7 +255,7 @@ module_db_write_modulerc (void)
{
GString *str;
gchar *p;
char *filename;
gchar *filename;
FILE *fp;
gboolean saved = FALSE;
@ -274,7 +303,7 @@ module_db_browser_new (void)
GtkWidget *vbox;
GtkWidget *listbox;
GtkWidget *button;
browser_st *st;
BrowserState *st;
shell = gimp_dialog_new (_("Module DB"), "module_db_dialog",
gimp_standard_help_func,
@ -300,7 +329,7 @@ module_db_browser_new (void)
gtk_widget_set_usize (listbox, 125, 100);
gtk_widget_show (listbox);
st = g_new0 (browser_st, 1);
st = g_new0 (BrowserState, 1);
st->list = gtk_list_new ();
gtk_list_set_selection_mode (GTK_LIST (st->list), GTK_SELECTION_BROWSE);
@ -361,14 +390,16 @@ module_db_browser_new (void)
/**************************************************************/
/* module_info object glue */
/* ModuleInfo object glue */
typedef struct {
typedef struct
{
GtkObjectClass parent_class;
} module_infoClass;
} ModuleInfoClass;
enum {
enum
{
MODIFIED,
LAST_SIGNAL
};
@ -378,7 +409,7 @@ static guint module_info_signals[LAST_SIGNAL];
static void
module_info_destroy (GtkObject *object)
{
module_info *mod = MODULE_INFO (object);
ModuleInfo *mod = MODULE_INFO (object);
/* if this trips, then we're onto some serious lossage in a moment */
g_return_if_fail (mod->refs == 0);
@ -389,7 +420,7 @@ module_info_destroy (GtkObject *object)
}
static void
module_info_class_init (module_infoClass *klass)
module_info_class_init (ModuleInfoClass *klass)
{
GtkObjectClass *object_class;
GtkType type;
@ -407,7 +438,7 @@ module_info_class_init (module_infoClass *klass)
}
static void
module_info_init (module_info *mod)
module_info_init (ModuleInfo *mod)
{
/* don't need to do anything */
}
@ -421,9 +452,9 @@ module_info_get_type (void)
{
static const GtkTypeInfo module_info_info =
{
"module_info",
sizeof (module_info),
sizeof (module_infoClass),
"ModuleInfo",
sizeof (ModuleInfo),
sizeof (ModuleInfoClass),
(GtkClassInitFunc) module_info_class_init,
(GtkObjectInitFunc) module_info_init,
/* reserved_1 */ NULL,
@ -431,8 +462,8 @@ module_info_get_type (void)
(GtkClassInitFunc) NULL,
};
module_info_type = gtk_type_unique (gtk_object_get_type(),
&module_info_info);
module_info_type =
gtk_type_unique (gtk_object_get_type (), &module_info_info);
}
return module_info_type;
@ -441,19 +472,19 @@ module_info_get_type (void)
/* exported API: */
static void
module_info_modified (module_info *mod)
module_info_modified (ModuleInfo *mod)
{
gtk_signal_emit (GTK_OBJECT (mod), module_info_signals[MODIFIED]);
}
static module_info *
static ModuleInfo *
module_info_new (void)
{
return MODULE_INFO (gtk_type_new (module_info_get_type ()));
}
static void
module_info_free (module_info *mod)
module_info_free (ModuleInfo *mod)
{
gtk_object_unref (GTK_OBJECT (mod));
}
@ -465,10 +496,10 @@ module_info_free (module_info *mod)
/* name must be of the form lib*.so (Unix) or *.dll (Win32) */
static gboolean
valid_module_name (const char *filename)
valid_module_name (const gchar *filename)
{
const char *basename;
int len;
const gchar *basename;
gint len;
basename = g_basename (filename);
@ -496,12 +527,13 @@ valid_module_name (const char *filename)
static gboolean
module_inhibited (const char *fullpath,
const char *inhibit_list)
module_inhibited (const gchar *fullpath,
const gchar *inhibit_list)
{
char *p;
int pathlen;
const char *start, *end;
gchar *p;
gint pathlen;
const gchar *start;
const gchar *end;
/* common case optimisation: the list is empty */
if (!inhibit_list || *inhibit_list == '\000')
@ -531,9 +563,9 @@ module_inhibited (const char *fullpath,
static void
module_initialize (char *filename)
module_initialize (gchar *filename)
{
module_info *mod;
ModuleInfo *mod;
if (!valid_module_name (filename))
return;
@ -581,7 +613,7 @@ module_initialize (char *filename)
}
static void
mod_load (module_info *mod,
mod_load (ModuleInfo *mod,
gboolean verbose)
{
gpointer symbol;
@ -648,14 +680,13 @@ mod_load (module_info *mod,
mod->unload = symbol;
else
mod->unload = NULL;
}
static void
mod_unload_completed_callback (void *data)
{
module_info *mod = data;
ModuleInfo *mod = data;
g_return_if_fail (mod->state == ST_UNLOAD_REQUESTED);
@ -672,7 +703,7 @@ mod_unload_completed_callback (void *data)
}
static void
mod_unload (module_info *mod,
mod_unload (ModuleInfo *mod,
gboolean verbose)
{
g_return_if_fail (mod->module != NULL);
@ -694,22 +725,21 @@ mod_unload (module_info *mod,
}
#ifdef DUMP_DB
static void
print_module_info (gpointer data,
gpointer user_data)
{
module_info *i = data;
ModuleInfo *i = data;
printf ("\n%s: %s\n",
g_print ("\n%s: %s\n",
i->fullpath, statename[i->state]);
printf (" module:%p lasterr:%s init:%p unload:%p\n",
g_print (" module:%p lasterr:%s init:%p unload:%p\n",
i->module, i->last_module_error? i->last_module_error : "NONE",
i->init, i->unload);
if (i->info)
{
printf (" shutdown_data: %p\n"
g_print (" shutdown_data: %p\n"
" purpose: %s\n"
" author: %s\n"
" version: %s\n"
@ -728,31 +758,31 @@ print_module_info (gpointer data,
/* UI functions */
static void
browser_popdown_callback (GtkWidget *w,
gpointer client_data)
{
gtk_widget_destroy (GTK_WIDGET (client_data));
}
static void
browser_destroy_callback (GtkWidget *w,
gpointer client_data)
{
gtk_signal_disconnect_by_data (GTK_OBJECT (modules), client_data);
gimp_set_remove_handler (modules, modules_handler);
g_free (client_data);
}
static void
browser_load_inhibit_callback (GtkWidget *w,
browser_popdown_callback (GtkWidget *widget,
gpointer data)
{
browser_st *st = data;
gtk_widget_destroy (GTK_WIDGET (data));
}
static void
browser_destroy_callback (GtkWidget *widget,
gpointer data)
{
gtk_signal_disconnect_by_data (GTK_OBJECT (modules), data);
gimp_set_remove_handler (modules, modules_handler);
g_free (data);
}
static void
browser_load_inhibit_callback (GtkWidget *widget,
gpointer data)
{
BrowserState *st = data;
gboolean new_value;
g_return_if_fail (st->last_update != NULL);
new_value = ! GTK_TOGGLE_BUTTON (w)->active;
new_value = ! GTK_TOGGLE_BUTTON (widget)->active;
if (new_value == st->last_update->load_inhibit)
return;
@ -764,12 +794,12 @@ browser_load_inhibit_callback (GtkWidget *w,
}
static void
browser_info_update (module_info *mod,
browser_st *st)
browser_info_update (ModuleInfo *mod,
BrowserState *st)
{
int i;
const char *text[NUM_INFO_LINES - 1];
char *status;
gint i;
const gchar *text[NUM_INFO_LINES - 1];
gchar *status;
/* only update the info if we're actually showing it */
if (mod != st->last_update)
@ -804,7 +834,6 @@ browser_info_update (module_info *mod,
text[5] = mod->ondisk? _("on disk") : _("nowhere (click 'refresh')");
}
if (mod->state == ST_MODULE_ERROR && mod->last_module_error)
status = g_strdup_printf ("%s (%s)", gettext (statename[mod->state]),
mod->last_module_error);
@ -827,7 +856,8 @@ browser_info_update (module_info *mod,
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), TRUE);
/* work out what the button should do (if anything) */
switch (mod->state) {
switch (mod->state)
{
case ST_MODULE_ERROR:
case ST_LOAD_FAILED:
case ST_UNLOADED_OK:
@ -848,12 +878,14 @@ browser_info_update (module_info *mod,
}
static void
browser_info_init (browser_st *st,
browser_info_init (BrowserState *st,
GtkWidget *table)
{
GtkWidget *label;
int i;
char *text[] = {
gint i;
gchar *text[] =
{
N_("Purpose:"),
N_("Author:"),
N_("Version:"),
@ -892,8 +924,8 @@ static void
browser_select_callback (GtkWidget *widget,
GtkWidget *child)
{
module_info *i;
browser_st *st;
ModuleInfo *i;
BrowserState *st;
i = gtk_object_get_user_data (GTK_OBJECT (child));
st = gtk_object_get_user_data (GTK_OBJECT (widget));
@ -911,7 +943,7 @@ static void
browser_load_unload_callback (GtkWidget *widget,
gpointer data)
{
browser_st *st = data;
BrowserState *st = data;
if (st->last_update->state == ST_LOADED_OK)
mod_unload (st->last_update, FALSE);
@ -926,8 +958,8 @@ static void
make_list_item (gpointer data,
gpointer user_data)
{
module_info *info = data;
browser_st *st = user_data;
ModuleInfo *info = data;
BrowserState *st = user_data;
GtkWidget *list_item;
if (!st->last_update)
@ -944,8 +976,8 @@ make_list_item (gpointer data,
static void
browser_info_add (GimpSet *set,
module_info *mod,
browser_st *st)
ModuleInfo *mod,
BrowserState *st)
{
make_list_item (mod, st);
}
@ -953,12 +985,12 @@ browser_info_add (GimpSet *set,
static void
browser_info_remove (GimpSet *set,
module_info *mod,
browser_st *st)
ModuleInfo *mod,
BrowserState *st)
{
GList *dlist, *free_list;
GtkWidget *list_item;
module_info *i;
ModuleInfo *i;
dlist = gtk_container_children (GTK_CONTAINER (st->list));
free_list = dlist;
@ -990,10 +1022,10 @@ static void
module_db_module_ondisk (gpointer data,
gpointer user_data)
{
module_info *mod = data;
ModuleInfo *mod = data;
struct stat statbuf;
int ret;
int old_ondisk = mod->ondisk;
gint ret;
gint old_ondisk = mod->ondisk;
GSList **kill_list = user_data;
ret = stat (mod->fullpath, &statbuf);
@ -1019,7 +1051,7 @@ static void
module_db_module_remove (gpointer data,
gpointer user_data)
{
module_info *mod = data;
ModuleInfo *mod = data;
gimp_set_remove (modules, mod);
@ -1028,23 +1060,24 @@ module_db_module_remove (gpointer data,
typedef struct {
const char *search_key;
module_info *found;
typedef struct
{
const gchar *search_key;
ModuleInfo *found;
} find_by_path_closure;
static void
module_db_path_cmp (gpointer data,
gpointer user_data)
{
module_info *mod = data;
ModuleInfo *mod = data;
find_by_path_closure *cl = user_data;
if (!strcmp (mod->fullpath, cl->search_key))
cl->found = mod;
}
static module_info *
static ModuleInfo *
module_find_by_path (const char *fullpath)
{
find_by_path_closure cl;
@ -1078,7 +1111,7 @@ browser_refresh_callback (GtkWidget *widget,
static void
gimp_module_ref (module_info *mod)
gimp_module_ref (ModuleInfo *mod)
{
g_return_if_fail (mod->refs >= 0);
g_return_if_fail (mod->module != NULL);
@ -1086,7 +1119,7 @@ gimp_module_ref (module_info *mod)
}
static void
gimp_module_unref (module_info *mod)
gimp_module_unref (ModuleInfo *mod)
{
g_return_if_fail (mod->refs > 0);
g_return_if_fail (mod->module != NULL);

View file

@ -17,9 +17,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __MODULE_DB_H__
/* Load any modules we find on the module-path set in the gimprc */
void module_db_init (void);

View file

@ -41,12 +41,15 @@
#include "libgimp/gimpenv.h"
#include "libgimp/gimpmodule.h"
#include "libgimp/gimpintl.h"
/* export this to gimprc.c */
char *module_db_load_inhibit = NULL;
typedef enum {
/* export this to gimprc.c */
gchar *module_db_load_inhibit = NULL;
typedef enum
{
ST_MODULE_ERROR, /* missing module_load function or other error */
ST_LOADED_OK, /* happy and running (normal state of affairs) */
ST_LOAD_FAILED, /* module_load returned GIMP_MODULE_UNLOAD */
@ -54,7 +57,8 @@ typedef enum {
ST_UNLOADED_OK /* callback arrived, module not in memory anymore */
} module_state;
static const char * const statename[] = {
static const gchar * const statename[] =
{
N_("Module error"),
N_("Loaded OK"),
N_("Load failed"),
@ -70,12 +74,14 @@ extern void gimp_color_display_unregister();
extern void dialog_register ();
extern void dialog_unregister ();
static struct main_funcs_struc {
static struct main_funcs_struc
{
gchar *name;
void (*func) ();
}
gimp_main_funcs[] = {
gimp_main_funcs[] =
{
{ "gimp_color_selector_register", gimp_color_selector_register },
{ "gimp_color_selector_unregister", gimp_color_selector_unregister },
{ "gimp_color_display_register", gimp_color_display_register },
@ -88,39 +94,45 @@ gimp_main_funcs[] = {
/* one of these objects is kept per-module */
typedef struct {
typedef struct
{
GtkObject object;
gchar *fullpath; /* path to the module */
module_state state; /* what's happened to the module */
gboolean ondisk; /* TRUE if file still exists */
gboolean load_inhibit; /* user requests not to load at boot time */
gint refs; /* how many time we're running in the module */
/* stuff from now on may be NULL depending on the state the module is in */
GimpModuleInfo *info; /* returned values from module_init */
GModule *module; /* handle on the module */
gchar *last_module_error;
GimpModuleInitFunc *init;
GimpModuleUnloadFunc *unload;
} module_info;
GimpModuleInitFunc init;
GimpModuleUnloadFunc unload;
} ModuleInfo;
static guint module_info_get_type (void);
#define MODULE_INFO_TYPE module_info_get_type()
#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, module_info)
#define MODULE_INFO(obj) GTK_CHECK_CAST (obj, MODULE_INFO_TYPE, ModuleInfo)
#define IS_MODULE_INFO(obj) GTK_CHECK_TYPE (obj, MODULE_INFO_TYPE)
#define NUM_INFO_LINES 7
typedef struct {
typedef struct
{
GtkWidget *table;
GtkWidget *label[NUM_INFO_LINES];
GtkWidget *button_label;
module_info *last_update;
ModuleInfo *last_update;
GtkWidget *button;
GtkWidget *list;
GtkWidget *load_inhibit_check;
} browser_st;
} BrowserState;
/* global set of module_info pointers */
static GimpSet *modules;
@ -146,26 +158,43 @@ static gboolean need_to_rewrite_modulerc = FALSE;
/* prototypes */
static void module_initialize (char *filename);
static void mod_load (module_info *mod, gboolean verbose);
static void mod_unload (module_info *mod, gboolean verbose);
static module_info *module_find_by_path (const char *fullpath);
#ifdef DUMP_DB
static void print_module_info (gpointer data, gpointer user_data);
#endif
static void browser_popdown_callback (GtkWidget *w, gpointer client_data);
static void browser_destroy_callback (GtkWidget *w, gpointer client_data);
static void browser_info_update (module_info *, browser_st *);
static void browser_info_add (GimpSet *, module_info *, browser_st *);
static void browser_info_remove (GimpSet *, module_info *, browser_st *);
static void browser_info_init (browser_st *st, GtkWidget *table);
static void browser_select_callback (GtkWidget *widget, GtkWidget *child);
static void browser_load_unload_callback (GtkWidget *widget, gpointer data);
static void browser_refresh_callback (GtkWidget *widget, gpointer data);
static void make_list_item (gpointer data, gpointer user_data);
static void module_initialize (gchar *filename);
static void mod_load (ModuleInfo *mod,
gboolean verbose);
static void mod_unload (ModuleInfo *mod,
gboolean verbose);
static ModuleInfo * module_find_by_path (const gchar *fullpath);
static void gimp_module_ref (module_info *mod);
static void gimp_module_unref (module_info *mod);
#ifdef DUMP_DB
static void print_module_info (gpointer data,
gpointer user_data);
#endif
static void browser_popdown_callback (GtkWidget *widget,
gpointer data);
static void browser_destroy_callback (GtkWidget *widget,
gpointer data);
static void browser_info_update (ModuleInfo *mod,
BrowserState *st);
static void browser_info_add (GimpSet *set,
ModuleInfo *mod,
BrowserState *st);
static void browser_info_remove (GimpSet *set,
ModuleInfo *mod,
BrowserState *st);
static void browser_info_init (BrowserState *st,
GtkWidget *table);
static void browser_select_callback (GtkWidget *widget,
GtkWidget *child);
static void browser_load_unload_callback (GtkWidget *widget,
gpointer data);
static void browser_refresh_callback (GtkWidget *widget,
gpointer data);
static void make_list_item (gpointer data,
gpointer user_data);
static void gimp_module_ref (ModuleInfo *mod);
static void gimp_module_unref (ModuleInfo *mod);
@ -175,7 +204,7 @@ static void gimp_module_unref (module_info *mod);
void
module_db_init (void)
{
char *filename;
gchar *filename;
/* load the modulerc file */
filename = gimp_personal_rc_file ("modulerc");
@ -198,7 +227,7 @@ static void
free_a_single_module (gpointer data,
gpointer user_data)
{
module_info *mod = data;
ModuleInfo *mod = data;
if (mod->module && mod->unload && mod->state == ST_LOADED_OK)
{
@ -210,7 +239,7 @@ static void
add_to_inhibit_string (gpointer data,
gpointer user_data)
{
module_info *mod = data;
ModuleInfo *mod = data;
GString *str = user_data;
if (mod->load_inhibit)
@ -226,7 +255,7 @@ module_db_write_modulerc (void)
{
GString *str;
gchar *p;
char *filename;
gchar *filename;
FILE *fp;
gboolean saved = FALSE;
@ -274,7 +303,7 @@ module_db_browser_new (void)
GtkWidget *vbox;
GtkWidget *listbox;
GtkWidget *button;
browser_st *st;
BrowserState *st;
shell = gimp_dialog_new (_("Module DB"), "module_db_dialog",
gimp_standard_help_func,
@ -300,7 +329,7 @@ module_db_browser_new (void)
gtk_widget_set_usize (listbox, 125, 100);
gtk_widget_show (listbox);
st = g_new0 (browser_st, 1);
st = g_new0 (BrowserState, 1);
st->list = gtk_list_new ();
gtk_list_set_selection_mode (GTK_LIST (st->list), GTK_SELECTION_BROWSE);
@ -361,14 +390,16 @@ module_db_browser_new (void)
/**************************************************************/
/* module_info object glue */
/* ModuleInfo object glue */
typedef struct {
typedef struct
{
GtkObjectClass parent_class;
} module_infoClass;
} ModuleInfoClass;
enum {
enum
{
MODIFIED,
LAST_SIGNAL
};
@ -378,7 +409,7 @@ static guint module_info_signals[LAST_SIGNAL];
static void
module_info_destroy (GtkObject *object)
{
module_info *mod = MODULE_INFO (object);
ModuleInfo *mod = MODULE_INFO (object);
/* if this trips, then we're onto some serious lossage in a moment */
g_return_if_fail (mod->refs == 0);
@ -389,7 +420,7 @@ module_info_destroy (GtkObject *object)
}
static void
module_info_class_init (module_infoClass *klass)
module_info_class_init (ModuleInfoClass *klass)
{
GtkObjectClass *object_class;
GtkType type;
@ -407,7 +438,7 @@ module_info_class_init (module_infoClass *klass)
}
static void
module_info_init (module_info *mod)
module_info_init (ModuleInfo *mod)
{
/* don't need to do anything */
}
@ -421,9 +452,9 @@ module_info_get_type (void)
{
static const GtkTypeInfo module_info_info =
{
"module_info",
sizeof (module_info),
sizeof (module_infoClass),
"ModuleInfo",
sizeof (ModuleInfo),
sizeof (ModuleInfoClass),
(GtkClassInitFunc) module_info_class_init,
(GtkObjectInitFunc) module_info_init,
/* reserved_1 */ NULL,
@ -431,8 +462,8 @@ module_info_get_type (void)
(GtkClassInitFunc) NULL,
};
module_info_type = gtk_type_unique (gtk_object_get_type(),
&module_info_info);
module_info_type =
gtk_type_unique (gtk_object_get_type (), &module_info_info);
}
return module_info_type;
@ -441,19 +472,19 @@ module_info_get_type (void)
/* exported API: */
static void
module_info_modified (module_info *mod)
module_info_modified (ModuleInfo *mod)
{
gtk_signal_emit (GTK_OBJECT (mod), module_info_signals[MODIFIED]);
}
static module_info *
static ModuleInfo *
module_info_new (void)
{
return MODULE_INFO (gtk_type_new (module_info_get_type ()));
}
static void
module_info_free (module_info *mod)
module_info_free (ModuleInfo *mod)
{
gtk_object_unref (GTK_OBJECT (mod));
}
@ -465,10 +496,10 @@ module_info_free (module_info *mod)
/* name must be of the form lib*.so (Unix) or *.dll (Win32) */
static gboolean
valid_module_name (const char *filename)
valid_module_name (const gchar *filename)
{
const char *basename;
int len;
const gchar *basename;
gint len;
basename = g_basename (filename);
@ -496,12 +527,13 @@ valid_module_name (const char *filename)
static gboolean
module_inhibited (const char *fullpath,
const char *inhibit_list)
module_inhibited (const gchar *fullpath,
const gchar *inhibit_list)
{
char *p;
int pathlen;
const char *start, *end;
gchar *p;
gint pathlen;
const gchar *start;
const gchar *end;
/* common case optimisation: the list is empty */
if (!inhibit_list || *inhibit_list == '\000')
@ -531,9 +563,9 @@ module_inhibited (const char *fullpath,
static void
module_initialize (char *filename)
module_initialize (gchar *filename)
{
module_info *mod;
ModuleInfo *mod;
if (!valid_module_name (filename))
return;
@ -581,7 +613,7 @@ module_initialize (char *filename)
}
static void
mod_load (module_info *mod,
mod_load (ModuleInfo *mod,
gboolean verbose)
{
gpointer symbol;
@ -648,14 +680,13 @@ mod_load (module_info *mod,
mod->unload = symbol;
else
mod->unload = NULL;
}
static void
mod_unload_completed_callback (void *data)
{
module_info *mod = data;
ModuleInfo *mod = data;
g_return_if_fail (mod->state == ST_UNLOAD_REQUESTED);
@ -672,7 +703,7 @@ mod_unload_completed_callback (void *data)
}
static void
mod_unload (module_info *mod,
mod_unload (ModuleInfo *mod,
gboolean verbose)
{
g_return_if_fail (mod->module != NULL);
@ -694,22 +725,21 @@ mod_unload (module_info *mod,
}
#ifdef DUMP_DB
static void
print_module_info (gpointer data,
gpointer user_data)
{
module_info *i = data;
ModuleInfo *i = data;
printf ("\n%s: %s\n",
g_print ("\n%s: %s\n",
i->fullpath, statename[i->state]);
printf (" module:%p lasterr:%s init:%p unload:%p\n",
g_print (" module:%p lasterr:%s init:%p unload:%p\n",
i->module, i->last_module_error? i->last_module_error : "NONE",
i->init, i->unload);
if (i->info)
{
printf (" shutdown_data: %p\n"
g_print (" shutdown_data: %p\n"
" purpose: %s\n"
" author: %s\n"
" version: %s\n"
@ -728,31 +758,31 @@ print_module_info (gpointer data,
/* UI functions */
static void
browser_popdown_callback (GtkWidget *w,
gpointer client_data)
{
gtk_widget_destroy (GTK_WIDGET (client_data));
}
static void
browser_destroy_callback (GtkWidget *w,
gpointer client_data)
{
gtk_signal_disconnect_by_data (GTK_OBJECT (modules), client_data);
gimp_set_remove_handler (modules, modules_handler);
g_free (client_data);
}
static void
browser_load_inhibit_callback (GtkWidget *w,
browser_popdown_callback (GtkWidget *widget,
gpointer data)
{
browser_st *st = data;
gtk_widget_destroy (GTK_WIDGET (data));
}
static void
browser_destroy_callback (GtkWidget *widget,
gpointer data)
{
gtk_signal_disconnect_by_data (GTK_OBJECT (modules), data);
gimp_set_remove_handler (modules, modules_handler);
g_free (data);
}
static void
browser_load_inhibit_callback (GtkWidget *widget,
gpointer data)
{
BrowserState *st = data;
gboolean new_value;
g_return_if_fail (st->last_update != NULL);
new_value = ! GTK_TOGGLE_BUTTON (w)->active;
new_value = ! GTK_TOGGLE_BUTTON (widget)->active;
if (new_value == st->last_update->load_inhibit)
return;
@ -764,12 +794,12 @@ browser_load_inhibit_callback (GtkWidget *w,
}
static void
browser_info_update (module_info *mod,
browser_st *st)
browser_info_update (ModuleInfo *mod,
BrowserState *st)
{
int i;
const char *text[NUM_INFO_LINES - 1];
char *status;
gint i;
const gchar *text[NUM_INFO_LINES - 1];
gchar *status;
/* only update the info if we're actually showing it */
if (mod != st->last_update)
@ -804,7 +834,6 @@ browser_info_update (module_info *mod,
text[5] = mod->ondisk? _("on disk") : _("nowhere (click 'refresh')");
}
if (mod->state == ST_MODULE_ERROR && mod->last_module_error)
status = g_strdup_printf ("%s (%s)", gettext (statename[mod->state]),
mod->last_module_error);
@ -827,7 +856,8 @@ browser_info_update (module_info *mod,
gtk_widget_set_sensitive (GTK_WIDGET (st->load_inhibit_check), TRUE);
/* work out what the button should do (if anything) */
switch (mod->state) {
switch (mod->state)
{
case ST_MODULE_ERROR:
case ST_LOAD_FAILED:
case ST_UNLOADED_OK:
@ -848,12 +878,14 @@ browser_info_update (module_info *mod,
}
static void
browser_info_init (browser_st *st,
browser_info_init (BrowserState *st,
GtkWidget *table)
{
GtkWidget *label;
int i;
char *text[] = {
gint i;
gchar *text[] =
{
N_("Purpose:"),
N_("Author:"),
N_("Version:"),
@ -892,8 +924,8 @@ static void
browser_select_callback (GtkWidget *widget,
GtkWidget *child)
{
module_info *i;
browser_st *st;
ModuleInfo *i;
BrowserState *st;
i = gtk_object_get_user_data (GTK_OBJECT (child));
st = gtk_object_get_user_data (GTK_OBJECT (widget));
@ -911,7 +943,7 @@ static void
browser_load_unload_callback (GtkWidget *widget,
gpointer data)
{
browser_st *st = data;
BrowserState *st = data;
if (st->last_update->state == ST_LOADED_OK)
mod_unload (st->last_update, FALSE);
@ -926,8 +958,8 @@ static void
make_list_item (gpointer data,
gpointer user_data)
{
module_info *info = data;
browser_st *st = user_data;
ModuleInfo *info = data;
BrowserState *st = user_data;
GtkWidget *list_item;
if (!st->last_update)
@ -944,8 +976,8 @@ make_list_item (gpointer data,
static void
browser_info_add (GimpSet *set,
module_info *mod,
browser_st *st)
ModuleInfo *mod,
BrowserState *st)
{
make_list_item (mod, st);
}
@ -953,12 +985,12 @@ browser_info_add (GimpSet *set,
static void
browser_info_remove (GimpSet *set,
module_info *mod,
browser_st *st)
ModuleInfo *mod,
BrowserState *st)
{
GList *dlist, *free_list;
GtkWidget *list_item;
module_info *i;
ModuleInfo *i;
dlist = gtk_container_children (GTK_CONTAINER (st->list));
free_list = dlist;
@ -990,10 +1022,10 @@ static void
module_db_module_ondisk (gpointer data,
gpointer user_data)
{
module_info *mod = data;
ModuleInfo *mod = data;
struct stat statbuf;
int ret;
int old_ondisk = mod->ondisk;
gint ret;
gint old_ondisk = mod->ondisk;
GSList **kill_list = user_data;
ret = stat (mod->fullpath, &statbuf);
@ -1019,7 +1051,7 @@ static void
module_db_module_remove (gpointer data,
gpointer user_data)
{
module_info *mod = data;
ModuleInfo *mod = data;
gimp_set_remove (modules, mod);
@ -1028,23 +1060,24 @@ module_db_module_remove (gpointer data,
typedef struct {
const char *search_key;
module_info *found;
typedef struct
{
const gchar *search_key;
ModuleInfo *found;
} find_by_path_closure;
static void
module_db_path_cmp (gpointer data,
gpointer user_data)
{
module_info *mod = data;
ModuleInfo *mod = data;
find_by_path_closure *cl = user_data;
if (!strcmp (mod->fullpath, cl->search_key))
cl->found = mod;
}
static module_info *
static ModuleInfo *
module_find_by_path (const char *fullpath)
{
find_by_path_closure cl;
@ -1078,7 +1111,7 @@ browser_refresh_callback (GtkWidget *widget,
static void
gimp_module_ref (module_info *mod)
gimp_module_ref (ModuleInfo *mod)
{
g_return_if_fail (mod->refs >= 0);
g_return_if_fail (mod->module != NULL);
@ -1086,7 +1119,7 @@ gimp_module_ref (module_info *mod)
}
static void
gimp_module_unref (module_info *mod)
gimp_module_unref (ModuleInfo *mod)
{
g_return_if_fail (mod->refs > 0);
g_return_if_fail (mod->module != NULL);

View file

@ -17,9 +17,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __MODULE_DB_H__
/* Load any modules we find on the module-path set in the gimprc */
void module_db_init (void);

View file

@ -1,3 +1,32 @@
2000-05-28 Michael Natterer <mitch@gimp.org>
* libgimp/libgimp-decl.txt
* libgimp/libgimp-docs.sgml
* libgimp/libgimp-sections.txt
* libgimp/tmpl/gimp.sgml
* libgimp/tmpl/gimpcolorbutton.sgml
* libgimp/tmpl/gimpcolordisplay.sgml
* libgimp/tmpl/gimpcolorselector.sgml
* libgimp/tmpl/gimpcolorspace.sgml
* libgimp/tmpl/gimpcompat.sgml
* libgimp/tmpl/gimpenums.sgml
* libgimp/tmpl/gimpfeatures.sgml
* libgimp/tmpl/gimplimits.sgml
* libgimp/tmpl/gimpmath.sgml
* libgimp/tmpl/gimpmodule.sgml
* libgimp/tmpl/gimpparasite.sgml
* libgimp/tmpl/gimpparasiteio.sgml
* libgimp/tmpl/gimppixmap.sgml
* libgimp/tmpl/gimpprotocol.sgml
* libgimp/tmpl/gimpsignal.sgml
* libgimp/tmpl/gimpui.sgml
* libgimp/tmpl/gimpunit.sgml
* libgimp/tmpl/gimputils.sgml
* libgimp/tmpl/gimpvector.sgml
* libgimp/tmpl/gimpwire.sgml
* libgimp/tmpl/libgimp-unused.sgml: Moved the module documentation
from the libgimp headers here, updates, cleanups.
2000-05-27 Michael Natterer <mitch@gimp.org>
* libgimp/*: lotsa files removed/added/changed to reflect the

View file

@ -281,8 +281,8 @@ struct GParam
</MACRO>
<FUNCTION>
<NAME>gimp_main</NAME>
<RETURNS>int </RETURNS>
int argc,char *argv[]
<RETURNS>gint </RETURNS>
gint argc,gchar *argv[]
</FUNCTION>
<FUNCTION>
<NAME>gimp_set_data</NAME>
@ -302,7 +302,7 @@ gchar * id
<FUNCTION>
<NAME>gimp_progress_init</NAME>
<RETURNS>void </RETURNS>
char *message
gchar *message
</FUNCTION>
<FUNCTION>
<NAME>gimp_progress_update</NAME>
@ -662,12 +662,12 @@ gint32 image_ID,const gchar *name
<FUNCTION>
<NAME>gimp_image_set_resolution</NAME>
<RETURNS>void </RETURNS>
gint32 image_ID,double xresolution,double yresolution
gint32 image_ID,gdouble xresolution,gdouble yresolution
</FUNCTION>
<FUNCTION>
<NAME>gimp_image_get_resolution</NAME>
<RETURNS>void </RETURNS>
gint32 image_ID,double *xresolution,double *yresolution
gint32 image_ID,gdouble *xresolution,gdouble *yresolution
</FUNCTION>
<FUNCTION>
<NAME>gimp_image_set_unit</NAME>
@ -816,7 +816,7 @@ gint32 layer_ID,gint offset_x,gint offset_y
</FUNCTION>
<FUNCTION>
<NAME>gimp_layer_is_floating_selection</NAME>
<RETURNS>gint </RETURNS>
<RETURNS>gboolean </RETURNS>
gint32 layer_ID
</FUNCTION>
<FUNCTION>
@ -831,12 +831,12 @@ gint32 layer_ID
</FUNCTION>
<FUNCTION>
<NAME>gimp_layer_get_apply_mask</NAME>
<RETURNS>gint </RETURNS>
<RETURNS>gboolean </RETURNS>
gint32 layer_ID
</FUNCTION>
<FUNCTION>
<NAME>gimp_layer_get_edit_mask</NAME>
<RETURNS>gint </RETURNS>
<RETURNS>gboolean </RETURNS>
gint32 layer_ID
</FUNCTION>
<FUNCTION>
@ -846,7 +846,7 @@ gint32 layer_ID
</FUNCTION>
<FUNCTION>
<NAME>gimp_layer_get_name</NAME>
<RETURNS>char *</RETURNS>
<RETURNS>gchar *</RETURNS>
gint32 layer_ID
</FUNCTION>
<FUNCTION>
@ -856,7 +856,7 @@ gint32 layer_ID
</FUNCTION>
<FUNCTION>
<NAME>gimp_layer_get_preserve_transparency</NAME>
<RETURNS>gint </RETURNS>
<RETURNS>gboolean </RETURNS>
gint32 layer_ID
</FUNCTION>
<FUNCTION>
@ -872,12 +872,12 @@ gint32 layer_ID
<FUNCTION>
<NAME>gimp_layer_set_apply_mask</NAME>
<RETURNS>void </RETURNS>
gint32 layer_ID,gint apply_mask
gint32 layer_ID,gboolean apply_mask
</FUNCTION>
<FUNCTION>
<NAME>gimp_layer_set_edit_mask</NAME>
<RETURNS>void </RETURNS>
gint32 layer_ID,gint edit_mask
gint32 layer_ID,gboolean edit_mask
</FUNCTION>
<FUNCTION>
<NAME>gimp_layer_set_mode</NAME>
@ -887,7 +887,7 @@ gint32 layer_ID,GLayerMode mode
<FUNCTION>
<NAME>gimp_layer_set_name</NAME>
<RETURNS>void </RETURNS>
gint32 layer_ID,char *name
gint32 layer_ID,gchar *name
</FUNCTION>
<FUNCTION>
<NAME>gimp_layer_set_offsets</NAME>
@ -902,17 +902,17 @@ gint32 layer_ID,gdouble opacity
<FUNCTION>
<NAME>gimp_layer_set_preserve_transparency</NAME>
<RETURNS>void </RETURNS>
gint32 layer_ID,gint preserve_transparency
gint32 layer_ID,gboolean preserve_transparency
</FUNCTION>
<FUNCTION>
<NAME>gimp_layer_set_show_mask</NAME>
<RETURNS>void </RETURNS>
gint32 layer_ID,gint show_mask
gint32 layer_ID,gboolean show_mask
</FUNCTION>
<FUNCTION>
<NAME>gimp_layer_set_visible</NAME>
<RETURNS>void </RETURNS>
gint32 layer_ID,gint visible
gint32 layer_ID,gboolean visible
</FUNCTION>
<FUNCTION>
<NAME>gimp_layer_get_tattoo</NAME>
@ -1037,7 +1037,7 @@ gint32 drawable_ID,gint x,gint y,guint width,guint hei
<FUNCTION>
<NAME>gimp_drawable_merge_shadow</NAME>
<RETURNS>void </RETURNS>
gint32 drawable_ID,gint undoable
gint32 drawable_ID,gboolean undoable
</FUNCTION>
<FUNCTION>
<NAME>gimp_drawable_image_id</NAME>
@ -1127,7 +1127,7 @@ gint32 drawable_ID,GimpFillType fill_type
<FUNCTION>
<NAME>gimp_drawable_set_name</NAME>
<RETURNS>void </RETURNS>
gint32 drawable_ID,char *name
gint32 drawable_ID,gchar *name
</FUNCTION>
<FUNCTION>
<NAME>gimp_drawable_set_visible</NAME>
@ -1162,7 +1162,7 @@ gint32 drawable,const gchar *name,gint flags,
<FUNCTION>
<NAME>gimp_drawable_parasite_detach</NAME>
<RETURNS>void </RETURNS>
gint32 drawable,const char *name
gint32 drawable,const gchar *name
</FUNCTION>
<FUNCTION>
<NAME>gimp_drawable_get_thumbnail_data</NAME>
@ -1232,62 +1232,62 @@ void
<FUNCTION>
<NAME>gimp_pixel_rgn_init</NAME>
<RETURNS>void </RETURNS>
GPixelRgn *pr,GDrawable *drawable,int x,int y,int width,int height,int dirty,int shadow
GPixelRgn *pr,GDrawable *drawable,gint x,gint y,gint width,gint height,gint dirty,gint shadow
</FUNCTION>
<FUNCTION>
<NAME>gimp_pixel_rgn_resize</NAME>
<RETURNS>void </RETURNS>
GPixelRgn *pr,int x,int y,int width,int height
GPixelRgn *pr,gint x,gint y,gint width,gint height
</FUNCTION>
<FUNCTION>
<NAME>gimp_pixel_rgn_get_pixel</NAME>
<RETURNS>void </RETURNS>
GPixelRgn *pr,guchar *buf,int x,int y
GPixelRgn *pr,guchar *buf,gint x,gint y
</FUNCTION>
<FUNCTION>
<NAME>gimp_pixel_rgn_get_row</NAME>
<RETURNS>void </RETURNS>
GPixelRgn *pr,guchar *buf,int x,int y,int width
GPixelRgn *pr,guchar *buf,gint x,gint y,gint width
</FUNCTION>
<FUNCTION>
<NAME>gimp_pixel_rgn_get_col</NAME>
<RETURNS>void </RETURNS>
GPixelRgn *pr,guchar *buf,int x,int y,int height
GPixelRgn *pr,guchar *buf,gint x,gint y,gint height
</FUNCTION>
<FUNCTION>
<NAME>gimp_pixel_rgn_get_rect</NAME>
<RETURNS>void </RETURNS>
GPixelRgn *pr,guchar *buf,int x,int y,int width,int height
GPixelRgn *pr,guchar *buf,gint x,gint y,gint width,gint height
</FUNCTION>
<FUNCTION>
<NAME>gimp_pixel_rgn_set_pixel</NAME>
<RETURNS>void </RETURNS>
GPixelRgn *pr,guchar *buf,int x,int y
GPixelRgn *pr,guchar *buf,gint x,gint y
</FUNCTION>
<FUNCTION>
<NAME>gimp_pixel_rgn_set_row</NAME>
<RETURNS>void </RETURNS>
GPixelRgn *pr,guchar *buf,int x,int y,int width
GPixelRgn *pr,guchar *buf,gint x,gint y,gint width
</FUNCTION>
<FUNCTION>
<NAME>gimp_pixel_rgn_set_col</NAME>
<RETURNS>void </RETURNS>
GPixelRgn *pr,guchar *buf,int x,int y,int height
GPixelRgn *pr,guchar *buf,gint x,gint y,gint height
</FUNCTION>
<FUNCTION>
<NAME>gimp_pixel_rgn_set_rect</NAME>
<RETURNS>void </RETURNS>
GPixelRgn *pr,guchar *buf,int x,int y,int width,int height
GPixelRgn *pr,guchar *buf,gint x,gint y,gint width,gint height
</FUNCTION>
<FUNCTION>
<NAME>gimp_pixel_rgns_register</NAME>
<RETURNS>gpointer </RETURNS>
int nrgns,...
gint nrgns,...
</FUNCTION>
<FUNCTION>
<NAME>gimp_pixel_rgns_register2</NAME>
<RETURNS>gpointer </RETURNS>
int nrgns,GPixelRgn **prs
gint nrgns,GPixelRgn **prs
</FUNCTION>
<FUNCTION>
<NAME>gimp_pixel_rgns_process</NAME>
@ -1327,7 +1327,7 @@ void
<FUNCTION>
<NAME>gimp_gradients_set_active</NAME>
<RETURNS>void </RETURNS>
char *name
gchar *name
</FUNCTION>
<FUNCTION>
<NAME>gimp_gradients_sample_uniform</NAME>
@ -2643,22 +2643,45 @@ gpointer popup_pnt
</FUNCTION>
<ENUM>
<NAME>GimpModuleStatus</NAME>
typedef enum {
typedef enum
{
GIMP_MODULE_OK,
GIMP_MODULE_UNLOAD
} GimpModuleStatus;
</ENUM>
<STRUCT>
<NAME>GimpModuleInfo</NAME>
typedef struct {
void *shutdown_data;
const char *purpose;
const char *author;
const char *version;
const char *copyright;
const char *date;
} GimpModuleInfo;
</STRUCT>
<STRUCT>
<NAME>GimpModuleInfo</NAME>
struct GimpModuleInfo
{
gpointer shutdown_data;
const gchar *purpose;
const gchar *author;
const gchar *version;
const gchar *copyright;
const gchar *date;
};
</STRUCT>
<USER_FUNCTION>
<NAME>GimpModuleInitFunc</NAME>
<RETURNS>GimpModuleStatus </RETURNS>
GimpModuleInfo **module_info
</USER_FUNCTION>
<USER_FUNCTION>
<NAME>GimpModuleCompletedCB</NAME>
<RETURNS>void </RETURNS>
gpointer completed_data
</USER_FUNCTION>
<USER_FUNCTION>
<NAME>GimpModuleUnloadFunc</NAME>
<RETURNS>void </RETURNS>
gpointer shutdown_data,
GimpModuleCompletedCB completed_cb,
gpointer completed_data
</USER_FUNCTION>
<MACRO>
<NAME>GIMP_TYPE_PATH_EDITOR</NAME>
#define GIMP_TYPE_PATH_EDITOR (gimp_path_editor_get_type ())
@ -4455,44 +4478,52 @@ struct GimpColorDisplayMethods
<FUNCTION>
<NAME>gimp_color_display_register</NAME>
<RETURNS>gboolean </RETURNS>
const char *name,GimpColorDisplayMethods *methods
const gchar *name,GimpColorDisplayMethods *methods
</FUNCTION>
<FUNCTION>
<NAME>gimp_color_display_unregister</NAME>
<RETURNS>gboolean </RETURNS>
const char *name
const gchar *name
</FUNCTION>
<USER_FUNCTION>
<NAME>GimpColorSelector_Callback</NAME>
<RETURNS>void </RETURNS>
void *data, int r, int g, int b
gpointer data,
gint r,
gint g,
gint b
</USER_FUNCTION>
<USER_FUNCTION>
<NAME>GimpColorSelector_NewFunc</NAME>
<RETURNS>GtkWidget *</RETURNS>
int r, int g, int b,
gint r,
gint g,
gint b,
GimpColorSelector_Callback cb,
void *data,
void **selector_data
gpointer data,
gpointer *selector_data
</USER_FUNCTION>
<USER_FUNCTION>
<NAME>GimpColorSelector_FreeFunc</NAME>
<RETURNS>void </RETURNS>
void *selector_data
gpointer selector_data
</USER_FUNCTION>
<USER_FUNCTION>
<NAME>GimpColorSelector_SetColorFunc</NAME>
<RETURNS>void </RETURNS>
void *selector_data,
int r, int g, int b,
int set_current
gpointer selector_data,
gint r,
gint g,
gint b,
gboolean set_current
</USER_FUNCTION>
<STRUCT>
<NAME>GimpColorSelectorMethods</NAME>
</STRUCT>
<STRUCT>
<NAME>GimpColorSelectorMethods</NAME>
struct GimpColorSelectorMethods {
struct GimpColorSelectorMethods
{
GimpColorSelector_NewFunc new;
GimpColorSelector_FreeFunc free;
GimpColorSelector_SetColorFunc setcolor;
@ -4500,15 +4531,20 @@ struct GimpColorSelectorMethods {
</STRUCT>
<TYPEDEF>
<NAME>GimpColorSelectorID</NAME>
typedef void *GimpColorSelectorID;
typedef gpointer GimpColorSelectorID;
</TYPEDEF>
<FUNCTION>
<NAME>gimp_color_selector_register</NAME>
<RETURNS>GimpColorSelectorID </RETURNS>
const char *name,const char *help_page,GimpColorSelectorMethods *methods
const gchar *name,const gchar *help_page,GimpColorSelectorMethods *methods
</FUNCTION>
<USER_FUNCTION>
<NAME>GimpColorSelectorFinishedCB</NAME>
<RETURNS>void </RETURNS>
gpointer finished_data
</USER_FUNCTION>
<FUNCTION>
<NAME>gimp_color_selector_unregister</NAME>
<RETURNS>gboolean </RETURNS>
GimpColorSelectorID id,void (*callback)(void *data),void *data
GimpColorSelectorID id,GimpColorSelectorFinishedCB finished_cb,gpointer finished_data
</FUNCTION>

View file

@ -66,6 +66,7 @@
<chapter id="libgimpui">
<title>GIMP User Interface Library</title>
&libgimp-gimpui;
&GimpChainButton;
&GimpColorButton;
&GimpFileSelection;
@ -78,7 +79,6 @@
&libgimp-gimphelpui;
&libgimp-gimpmenu;
&libgimp-gimpquerybox;
&libgimp-gimpui;
&libgimp-gimpwidgets;
</chapter>

View file

@ -227,7 +227,6 @@ gimp_parasite_find
gimp_parasite_attach
gimp_attach_new_parasite
gimp_parasite_detach
gimp_plugin_help_func
gimp_help
gimp_plugin_help_register
gimp_plugin_domain_add_with_path
@ -528,6 +527,7 @@ GimpColorSelector_SetColorFunc
GimpColorSelectorMethods
GimpColorSelectorID
gimp_color_selector_register
GimpColorSelectorFinishedCB
gimp_color_selector_unregister
</SECTION>
@ -535,6 +535,9 @@ gimp_color_selector_unregister
<FILE>gimpmodule</FILE>
GimpModuleStatus
GimpModuleInfo
GimpModuleInitFunc
GimpModuleCompletedCB
GimpModuleUnloadFunc
</SECTION>
<SECTION>
@ -631,6 +634,7 @@ gimp_image_disable_undo
gimp_image_enable_undo
gimp_image_freeze_undo
gimp_image_thaw_undo
gimp_plugin_help_func
Parasite
PARASITE_PERSISTENT
PARASITE_UNDOABLE

View file

@ -2,10 +2,13 @@
gimp
<!-- ##### SECTION Short_Description ##### -->
Main functions needed for building a GIMP plug-in. This header includes
all other GIMP Library headers.
<!-- ##### SECTION Long_Description ##### -->
<para>
Main functions needed for building a GIMP plug-in. This header includes
all other GIMP Library headers.
</para>
@ -2177,15 +2180,6 @@ gimp
@name:
<!-- ##### MACRO gimp_plugin_help_func ##### -->
<para>
</para>
<!-- # Unused Parameters # -->
@help_data:
<!-- ##### FUNCTION gimp_help ##### -->
<para>

View file

@ -21,7 +21,7 @@ Note that the color is changed in place.
<!-- ##### SECTION See_Also ##### -->
<para>
#libgimp-gimpcolorspace
</para>
<!-- ##### STRUCT GimpColorButton ##### -->

View file

@ -2,16 +2,22 @@
gimpcolordisplay
<!-- ##### SECTION Short_Description ##### -->
Functions and definitiions for creating a pluggable GIMP
display color correction module.
<!-- ##### SECTION Long_Description ##### -->
<para>
Functions and definitiions for creating a pluggable GIMP
display color correction module.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#GModule
</para>
<para>
#libgimp-gimpmodule
</para>
<!-- ##### USER_FUNCTION GimpColorDisplayInit ##### -->

View file

@ -2,61 +2,91 @@
gimpcolorselector
<!-- ##### SECTION Short_Description ##### -->
Functions and definitiions for creating a pluggable GIMP
color selector module.
<!-- ##### SECTION Long_Description ##### -->
<para>
Functions and definitiions for creating a pluggable GIMP
color selector module.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#GModule
</para>
<para>
#libgimp-gimpmodule
</para>
<!-- ##### USER_FUNCTION GimpColorSelector_Callback ##### -->
<para>
A function of this type should be called by the color selector each
time the user modifies the selected color.
</para>
@data:
@r:
@g:
@b:
@data: The @data passed to the #GimpColorSelector_NewFunc function.
@r: The new color's red component.
@g: The new color's green component.
@b: The new color's blue component.
<!-- ##### USER_FUNCTION GimpColorSelector_NewFunc ##### -->
<para>
A function of this type is called to create a new instance of the
color selector. The new selector should set its current color to
the RGB triple given (each component is in the range 0 - 255
inclusive, with white at 255,255,255 and black at 0,0,0).
</para>
<para>
The selector should call @cb with argument @data each time the
user modifies the selected color.
</para>
<para>
The selector must return a #GtkWidget which implements the color
selection UI. The selector can optionally return @selector_data,
an opaque pointer which will be passed in to subsequent invokations
on the selector.
</para>
@r:
@g:
@b:
@cb:
@data:
@selector_data:
@Returns:
@r: The red component of intitial color.
@g: The green component of intitial color.
@b: The blue component of intitial color.
@cb: The function to call each time the user modifies the selected color.
@data: The @data to pass to @cb.
@selector_data: An optional data pointer which will be passed in to subsequent invokations on the selector.
@Returns: A #GtkWidget which implements the color selection UI.
<!-- ##### USER_FUNCTION GimpColorSelector_FreeFunc ##### -->
<para>
A function of this type is called when the color selector is no
longer required. This function should *not* free widgets that are
containted within the UI widget returned by new(), since they are
destroyed on behalf of the selector by the caller of this
function.
</para>
@selector_data:
@selector_data: The @selector_data pointer returned by the #GimpColorSelector_NewFunc function.
<!-- ##### USER_FUNCTION GimpColorSelector_SetColorFunc ##### -->
<para>
A function of this type is called to change the selector's current
color. The required color is specified as in the new() function.
If the @set_current parameter is #FALSE, then only the old color
should be set - if @set_current is #TRUE, both the old color and
the current color should be set to the RGB triple given. This
function merely gives a hint to the color selector; the selector
can choose to ignore this information.
</para>
@selector_data:
@r:
@g:
@b:
@set_current:
@selector_data: The @selector_data pointer returned by the #GimpColorSelector_NewFunc function.
@r: The new color's red component.
@g: The new color's green component.
@b: The new color's blue component.
@set_current: Set the current color.
<!-- ##### STRUCT GimpColorSelectorMethods ##### -->
@ -73,23 +103,40 @@ gimpcolorselector
<!-- ##### FUNCTION gimp_color_selector_register ##### -->
<para>
Register a color selector. Returns an identifier for the color
selector on success, or #NULL if the name is already in use. Both
the @name and @methods table are internalised, so may be g_free()'d after
this call.
</para>
@name:
@help_page:
@methods:
@Returns:
@name: The color selector's name.
@help_page: The help page.
@methods: The color selector's methods.
@Returns: The #GimpColorSelectorID of the new color selector.
<!-- ##### USER_FUNCTION GimpColorSelectorFinishedCB ##### -->
<para>
A function of this type will be called once all instances of a color
selector have finished after the selector module called
gimp_color_selector_unregister().
</para>
@finished_data: The @finished_data as specified in gimp_color_selector_register().
<!-- ##### FUNCTION gimp_color_selector_unregister ##### -->
<para>
Remove the selector @id from active service. New instances of the
selector will not be created, but existing ones are allowed to
continue. If @finished_cb is non-#NULL, it will be called once all
instances have finished. The callback could be used to unload
dynamiclly loaded code, for example.
</para>
@id:
@callback:
@data:
@Returns:
@id: The @id as returned by gimp_color_selector_register().
@finished_cb: Optional callback which will be called once all instances have finished.
@finished_data: The @finished_data which will be passed to @finished_cb.
@Returns: #TRUE on success, #FALSE if @id was not found.

View file

@ -2,10 +2,14 @@
gimpcolorspace
<!-- ##### SECTION Short_Description ##### -->
Utility functions which convert colors between different color models.
<!-- ##### SECTION Long_Description ##### -->
<para>
When programming pixel data manipulation functions you will often use
algorithms operating on a color model different from the one GIMP
uses. This file provides utility functions to concert colors between
different color spaces.
</para>

View file

@ -6,6 +6,7 @@ Compatibility definitions for older plug-ins.
<!-- ##### SECTION Long_Description ##### -->
<para>
Compatibility definitions for older plug-ins.
</para>
@ -147,6 +148,15 @@ Compatibility definitions for older plug-ins.
<!-- ##### MACRO gimp_plugin_help_func ##### -->
<para>
</para>
<!-- # Unused Parameters # -->
@help_data:
<!-- ##### MACRO Parasite ##### -->
<para>

View file

@ -2,10 +2,11 @@
gimpenums
<!-- ##### SECTION Short_Description ##### -->
Enums and definitions.
<!-- ##### SECTION Long_Description ##### -->
<para>
Enums and definitions.
</para>

View file

@ -2,10 +2,13 @@
gimpfeatures
<!-- ##### SECTION Short_Description ##### -->
Macros and constants useful for determining GIMP's version number and
capabilities.
<!-- ##### SECTION Long_Description ##### -->
<para>
Macros and constants useful for determining GIMP's version number and
capabilities.
</para>

View file

@ -2,10 +2,11 @@
gimplimits
<!-- ##### SECTION Short_Description ##### -->
Boundaries of some GIMP data types and some global constants.
<!-- ##### SECTION Long_Description ##### -->
<para>
Boundaries of some GIMP data types and some global constants.
</para>

View file

@ -6,6 +6,7 @@ Mathematical definitions and macros.
<!-- ##### SECTION Long_Description ##### -->
<para>
Mathematical definitions and macros.
</para>

View file

@ -2,16 +2,17 @@
gimpmodule
<!-- ##### SECTION Short_Description ##### -->
Common definitions for creating a pluggable GIMP module.
<!-- ##### SECTION Long_Description ##### -->
<para>
Common definitions for creating a pluggable GIMP module.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#GModule
</para>
<!-- ##### ENUM GimpModuleStatus ##### -->
@ -26,3 +27,59 @@ gimpmodule
</para>
<!-- ##### USER_FUNCTION GimpModuleInitFunc ##### -->
<para>
GIMP modules should #G_MODULE_EXPORT a function named "module_init"
of this type.
</para>
<para>
The "module_init" function is called by the GIMP at startup,
and should return either #GIMP_MODULE_OK if it sucessfully initialised or
#GIMP_MODULE_UNLOAD if the module failed to hook whatever functions
it wanted. #GIMP_MODULE_UNLOAD causes the module to be closed, so
the module must not have registered any internal functions or given
out pointers to its data to anyone.
</para>
<para>
If the module returns #GIMP_MODULE_OK, it should also return a
#GimpModuleInfo structure describing itself.
</para>
@module_info: Returns the #GimpModuleInfo desribing the module.
@Returns: A #GimpModuleStatus value indicating success.
<!-- ##### USER_FUNCTION GimpModuleCompletedCB ##### -->
<para>
The type of the @completed_cb passed to the "module_unload" function
(see below).
</para>
@completed_data: <para>
Must be the @completed_data pointer provided by the "module_unload"
function.
</para>
<!-- ##### USER_FUNCTION GimpModuleUnloadFunc ##### -->
<para>
If GIMP modules want to allow themselves to be unloaded, they
should #G_MODULE_EXPORT a function named "module_unload" of
this type.
</para>
<para>
GIMP calls the "module_unload" unload request function to ask
a module to prepare itself to be unloaded. It is called with the
value of @shutdown_data supplied in the #GimpModuleInfo struct.
The module should ensure that none of its code or data are being
used, and then call the supplied @completed_cb callback function with
the @completed_data provided. Typically the shutdown request function
will queue de-registration activities then return. Only when the
de-registration has finished should the @completed_cb be invoked.
</para>
@shutdown_data: The @shutdown_data supplied in the #GimpModuleInfo struct.
@completed_cb: The function to call after successful unload.
@completed_data: Has to be passed to the @completed_cb.

View file

@ -2,16 +2,18 @@
gimpparasite
<!-- ##### SECTION Short_Description ##### -->
Arbitrary pieces of data which can be attached to various GIMP objects.
<!-- ##### SECTION Long_Description ##### -->
<para>
Arbitrary pieces of data which can be attached to various GIMP objects.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
gimp_image_parasite_attach(), gimp_drawable_parasite_attach(),
gimp_parasite_attach() and their related functions.
</para>
<!-- ##### STRUCT GimpParasite ##### -->

View file

@ -2,16 +2,17 @@
gimpparasiteio
<!-- ##### SECTION Short_Description ##### -->
Utility functions to (de)serialize certain C structures to/from #GimpParasite's.
<!-- ##### SECTION Long_Description ##### -->
<para>
Utility functions to (de)serialize certain C structures to/from #GimpParasite's.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#GimpParasite
</para>
<!-- ##### MACRO GIMP_PIXPIPE_MAXDIM ##### -->

View file

@ -6,13 +6,25 @@ Widget which creates a #GtkPixmap from XPM data.
<!-- ##### SECTION Long_Description ##### -->
<para>
Widget which creates a #GtkPixmap from XPM data.
</para>
<para>
Use this widget instead of #GtkPixmap if you don't want to worry about
the parent container's "realized" state.
</para>
<para>
Note that the drawback of the easy interface is that the actual #GdkPixmap
and it's mask have to be constructed every time you call gimp_pixmap_new()
and cannot be cached in memory without doing bad hacks.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
gimp_pixmap_button_new()
</para>
<para>
#GtkPixmap
</para>
<!-- ##### STRUCT GimpPixmap ##### -->
<para>

View file

@ -2,16 +2,17 @@
gimpprotocol
<!-- ##### SECTION Short_Description ##### -->
The communication protocol between GIMP and it's plug-ins.
<!-- ##### SECTION Long_Description ##### -->
<para>
The communication protocol between GIMP and it's plug-ins.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#libgimp-gimpwire
</para>
<!-- ##### MACRO GP_VERSION ##### -->

View file

@ -6,6 +6,7 @@ Portable signal handling.
<!-- ##### SECTION Long_Description ##### -->
<para>
Portable signal handling.
</para>

View file

@ -2,10 +2,13 @@
gimpui
<!-- ##### SECTION Short_Description ##### -->
Common user interface functions.
Common user interface functions. This header includes all other GIMP User
Interface Library headers.
<!-- ##### SECTION Long_Description ##### -->
<para>
Common user interface functions. This header includes all other GIMP User
Interface Library headers.
</para>

View file

@ -7,6 +7,8 @@ user-defined units.
<!-- ##### SECTION Long_Description ##### -->
<para>
Provides a collection of predefined units and functions for creating
user-defined units.
</para>

View file

@ -13,7 +13,7 @@ provide it here.
<!-- ##### SECTION See_Also ##### -->
<para>
g_strescape()
</para>
<!-- ##### FUNCTION gimp_strescape ##### -->

View file

@ -6,6 +6,7 @@ Utilities to set up and manipulate vectors.
<!-- ##### SECTION Long_Description ##### -->
<para>
Utilities to set up and manipulate vectors.
</para>

View file

@ -2,16 +2,19 @@
gimpwire
<!-- ##### SECTION Short_Description ##### -->
The lowlevel I/O protocol used for communication between GIMP and
it's plug-ins.
<!-- ##### SECTION Long_Description ##### -->
<para>
The lowlevel I/O protocol used for communication between GIMP and
it's plug-ins.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#libgimp-gimpprotocol
</para>
<!-- ##### STRUCT WireMessage ##### -->

View file

@ -96,16 +96,16 @@ parasiteF
<!-- ##### SECTION ./tmpl/color_selector.sgml:Short_Description ##### -->
<!-- ##### SECTION ./tmpl/parasiteF.sgml:Long_Description ##### -->
<para>
</para>
<!-- ##### SECTION ./tmpl/color_selector.sgml:Short_Description ##### -->
<!-- ##### SECTION ./tmpl/parasiteio.sgml:See_Also ##### -->
<para>

View file

@ -243,8 +243,8 @@ struct _GParam
/* The main procedure that should be called with the
* 'argc' and 'argv' that are passed to "main".
*/
int gimp_main (int argc,
char *argv[]);
gint gimp_main (gint argc,
gchar *argv[]);
/* Forcefully causes the gimp library to exit and
* close down its connection to main gimp application.
@ -277,7 +277,7 @@ guint32 gimp_get_data_size (gchar * id);
* is NULL, the message displayed in the progress window will
* be the name of the plug-in.
*/
void gimp_progress_init (char *message);
void gimp_progress_init (gchar *message);
/* Update the progress bar. If the progress bar has not been
* initialized then it will be automatically initialized as if
@ -525,11 +525,11 @@ void gimp_image_attach_new_parasite (gint32 image_ID,
void gimp_image_parasite_detach (gint32 image_ID,
const gchar *name);
void gimp_image_set_resolution (gint32 image_ID,
double xresolution,
double yresolution);
gdouble xresolution,
gdouble yresolution);
void gimp_image_get_resolution (gint32 image_ID,
double *xresolution,
double *yresolution);
gdouble *xresolution,
gdouble *yresolution);
void gimp_image_set_unit (gint32 image_ID,
GimpUnit unit);
GimpUnit gimp_image_get_unit (gint32 image_ID);
@ -611,36 +611,36 @@ void gimp_layer_scale (gint32 layer_ID,
void gimp_layer_translate (gint32 layer_ID,
gint offset_x,
gint offset_y);
gint gimp_layer_is_floating_selection (gint32 layer_ID);
gboolean gimp_layer_is_floating_selection (gint32 layer_ID);
gint32 gimp_layer_get_image_id (gint32 layer_ID);
gint32 gimp_layer_get_mask_id (gint32 layer_ID);
gint gimp_layer_get_apply_mask (gint32 layer_ID);
gint gimp_layer_get_edit_mask (gint32 layer_ID);
gboolean gimp_layer_get_apply_mask (gint32 layer_ID);
gboolean gimp_layer_get_edit_mask (gint32 layer_ID);
GLayerMode gimp_layer_get_mode (gint32 layer_ID);
char* gimp_layer_get_name (gint32 layer_ID);
gchar * gimp_layer_get_name (gint32 layer_ID);
gdouble gimp_layer_get_opacity (gint32 layer_ID);
gint gimp_layer_get_preserve_transparency (gint32 layer_ID);
gboolean gimp_layer_get_preserve_transparency (gint32 layer_ID);
gint gimp_layer_get_show_mask (gint32 layer_ID);
gint gimp_layer_get_visible (gint32 layer_ID);
void gimp_layer_set_apply_mask (gint32 layer_ID,
gint apply_mask);
gboolean apply_mask);
void gimp_layer_set_edit_mask (gint32 layer_ID,
gint edit_mask);
gboolean edit_mask);
void gimp_layer_set_mode (gint32 layer_ID,
GLayerMode mode);
void gimp_layer_set_name (gint32 layer_ID,
char *name);
gchar *name);
void gimp_layer_set_offsets (gint32 layer_ID,
gint offset_x,
gint offset_y);
void gimp_layer_set_opacity (gint32 layer_ID,
gdouble opacity);
void gimp_layer_set_preserve_transparency (gint32 layer_ID,
gint preserve_transparency);
gboolean preserve_transparency);
void gimp_layer_set_show_mask (gint32 layer_ID,
gint show_mask);
gboolean show_mask);
void gimp_layer_set_visible (gint32 layer_ID,
gint visible);
gboolean visible);
gint32 gimp_layer_get_tattoo (gint32 layer_ID);
@ -697,7 +697,7 @@ void gimp_drawable_update (gint32 drawable_ID,
guint width,
guint height);
void gimp_drawable_merge_shadow (gint32 drawable_ID,
gint undoable);
gboolean undoable);
gint32 gimp_drawable_image_id (gint32 drawable_ID);
gchar * gimp_drawable_name (gint32 drawable_ID);
guint gimp_drawable_width (gint32 drawable_ID);
@ -723,7 +723,7 @@ void gimp_drawable_offsets (gint32 drawable_ID,
void gimp_drawable_fill (gint32 drawable_ID,
GimpFillType fill_type);
void gimp_drawable_set_name (gint32 drawable_ID,
char *name);
gchar *name);
void gimp_drawable_set_visible (gint32 drawable_ID,
gint visible);
GTile * gimp_drawable_get_tile (GDrawable *drawable,
@ -744,7 +744,7 @@ void gimp_drawable_attach_new_parasite (gint32 drawable,
gint size,
const gpointer data);
void gimp_drawable_parasite_detach (gint32 drawable,
const char *name);
const gchar *name);
guchar * gimp_drawable_get_thumbnail_data (gint32 drawable_ID,
gint *width,
gint *height,
@ -790,60 +790,60 @@ guint gimp_tile_height (void);
void gimp_pixel_rgn_init (GPixelRgn *pr,
GDrawable *drawable,
int x,
int y,
int width,
int height,
int dirty,
int shadow);
gint x,
gint y,
gint width,
gint height,
gint dirty,
gint shadow);
void gimp_pixel_rgn_resize (GPixelRgn *pr,
int x,
int y,
int width,
int height);
gint x,
gint y,
gint width,
gint height);
void gimp_pixel_rgn_get_pixel (GPixelRgn *pr,
guchar *buf,
int x,
int y);
gint x,
gint y);
void gimp_pixel_rgn_get_row (GPixelRgn *pr,
guchar *buf,
int x,
int y,
int width);
gint x,
gint y,
gint width);
void gimp_pixel_rgn_get_col (GPixelRgn *pr,
guchar *buf,
int x,
int y,
int height);
gint x,
gint y,
gint height);
void gimp_pixel_rgn_get_rect (GPixelRgn *pr,
guchar *buf,
int x,
int y,
int width,
int height);
gint x,
gint y,
gint width,
gint height);
void gimp_pixel_rgn_set_pixel (GPixelRgn *pr,
guchar *buf,
int x,
int y);
gint x,
gint y);
void gimp_pixel_rgn_set_row (GPixelRgn *pr,
guchar *buf,
int x,
int y,
int width);
gint x,
gint y,
gint width);
void gimp_pixel_rgn_set_col (GPixelRgn *pr,
guchar *buf,
int x,
int y,
int height);
gint x,
gint y,
gint height);
void gimp_pixel_rgn_set_rect (GPixelRgn *pr,
guchar *buf,
int x,
int y,
int width,
int height);
gpointer gimp_pixel_rgns_register (int nrgns,
gint x,
gint y,
gint width,
gint height);
gpointer gimp_pixel_rgns_register (gint nrgns,
...);
gpointer gimp_pixel_rgns_register2(int nrgns,
gpointer gimp_pixel_rgns_register2 (gint nrgns,
GPixelRgn **prs);
gpointer gimp_pixel_rgns_process (gpointer pri_ptr);
@ -871,7 +871,7 @@ void gimp_palette_set_foreground (guchar red,
gchar ** gimp_gradients_get_list (gint *num_gradients);
gchar * gimp_gradients_get_active (void);
void gimp_gradients_set_active (char *name);
void gimp_gradients_set_active (gchar *name);
gdouble * gimp_gradients_sample_uniform (gint num_samples);
gdouble * gimp_gradients_sample_custom (gint num_samples,
gdouble *positions);
@ -894,7 +894,6 @@ void gimp_parasite_detach (const gchar *name);
void gimp_help (gchar *prog_name,
gchar *help_data);
void gimp_plugin_help_register (gchar *help_path);
/****************************************

View file

@ -62,14 +62,15 @@ struct _GimpColorDisplayMethods
GimpColorDisplayConfigureCancel cancel;
};
/*
* The following two functions are implemted and exported by gimp/app
/* The following two functions are implemted and exported by gimp/app
* but need to be marked for it here too ...
*/
G_MODULE_EXPORT
gboolean gimp_color_display_register (const char *name,
gboolean gimp_color_display_register (const gchar *name,
GimpColorDisplayMethods *methods);
G_MODULE_EXPORT
gboolean gimp_color_display_unregister (const char *name);
gboolean gimp_color_display_unregister (const gchar *name);
#endif /* __GIMP_COLOR_DISPLAY_H__ */

View file

@ -21,89 +21,55 @@
#ifndef __COLOR_SELECTOR_H__
#define __COLOR_SELECTOR_H__
/********************************/
/* color selector registration */
/* For information look at the html documentation */
/* A function of this type should be called by the color selector each
* time the user modifies the selected color. */
typedef void (*GimpColorSelector_Callback)(void *data, int r, int g, int b);
typedef void (* GimpColorSelector_Callback) (gpointer data,
gint r,
gint g,
gint b);
/* A function of this type is called to create a new instance of the
* color selector. The new selector should set its current color to
* the RGB triple given (each component is in the range 0 - 255
* inclusive, with white at 255,255,255 and black at 0,0,0).
*
* The selector should call "cb" with argument "data" each time the
* user modifies the selected color.
*
* The selector must return a GtkWidget which implements the color
* selection UI. The selector can optionally return "selector_data",
* an opaque pointer which will be passed in to subsequent invokations
* on the selector. */
typedef GtkWidget * (*GimpColorSelector_NewFunc)(int r, int g, int b,
typedef GtkWidget * (* GimpColorSelector_NewFunc) (gint r,
gint g,
gint b,
GimpColorSelector_Callback cb,
void *data,
void **selector_data);
gpointer data,
gpointer *selector_data);
/* A function of this type is called when the color selector is no
* longer required. This function should not free widgets that are
* containted within the UI widget returned by new(), since they are
* destroyed on behalf of the selector by the caller of this
* function. */
typedef void (*GimpColorSelector_FreeFunc)(void *selector_data);
typedef void (* GimpColorSelector_FreeFunc) (gpointer selector_data);
/* A function of this type is called to change the selector's current
* color. The required color is specified as in the new() function.
* If the "set_current" parameter is FALSE, then only the old color
* should be set - if "set_current" is TRUE, both the old color and
* the current color should be set to the RGB triple given. This
* function merely gives a hint to the color selector; the selector
* can choose to ignore this information. */
typedef void (*GimpColorSelector_SetColorFunc)(void *selector_data,
int r, int g, int b,
int set_current);
typedef void (* GimpColorSelector_SetColorFunc) (gpointer selector_data,
gint r,
gint g,
gint b,
gboolean set_current);
typedef struct _GimpColorSelectorMethods GimpColorSelectorMethods;
struct _GimpColorSelectorMethods {
struct _GimpColorSelectorMethods
{
GimpColorSelector_NewFunc new;
GimpColorSelector_FreeFunc free;
GimpColorSelector_SetColorFunc setcolor;
};
typedef void *GimpColorSelectorID;
typedef gpointer GimpColorSelectorID;
#ifndef __COLOR_NOTEBOOK_C__ /* Bypass when compiling the source for
* these functions. */
#ifndef __COLOR_NOTEBOOK_C__
/* Register a color selector. Returns an identifier for the color
* selector on success, or NULL if the name is already in use. Both
* the name and method table are internalised, so may be freed after
* this call. */
GimpColorSelectorID gimp_color_selector_register (const char *name,
const char *help_page,
/* Bypass when compiling the source for these functions.
*/
GimpColorSelectorID gimp_color_selector_register (const gchar *name,
const gchar *help_page,
GimpColorSelectorMethods *methods);
/* Remove the selector "id" from active service. New instances of the
* selector will not be created, but existing ones are allowed to
* continue. If "callback" is non-NULL, it will be called once all
* instances have finished. The callback could be used to unload
* dynamiclly loaded code, for example.
*
* Returns TRUE on success, FALSE if "id" was not found. */
typedef void (* GimpColorSelectorFinishedCB) (gpointer finished_data);
gboolean gimp_color_selector_unregister (GimpColorSelectorID id,
void (*callback)(void *data),
void *data);
GimpColorSelectorFinishedCB finished_cb,
gpointer finished_data);
#endif /* !__COLOR_NOTEBOOK_C__ */
#endif /* __COLOR_SELECTOR_H__ */

View file

@ -23,70 +23,58 @@
#include <gmodule.h>
/* For information look at the html documentation */
typedef enum {
typedef enum
{
GIMP_MODULE_OK,
GIMP_MODULE_UNLOAD
} GimpModuleStatus;
typedef struct _GimpModuleInfo GimpModuleInfo;
typedef struct {
void *shutdown_data;
const char *purpose;
const char *author;
const char *version;
const char *copyright;
const char *date;
} GimpModuleInfo;
struct _GimpModuleInfo
{
gpointer shutdown_data;
const gchar *purpose;
const gchar *author;
const gchar *version;
const gchar *copyright;
const gchar *date;
};
/* Module initialization */
/* GIMP modules should G_MODULE_EXPORT a function named "module_init"
* of the following type: */
typedef GimpModuleStatus (GimpModuleInitFunc) (GimpModuleInfo **);
typedef GimpModuleStatus (* GimpModuleInitFunc) (GimpModuleInfo **module_info);
#ifndef MODULE_COMPILATION /* On Win32 this declaration clashes with
* the definition (which uses G_MODULE_EXPORT)
* and thus should be bypassed when compiling
* the module itself.
#ifndef MODULE_COMPILATION
/* On Win32 this declaration clashes with the definition
* (which uses G_MODULE_EXPORT) and thus should be bypassed
* when compiling the module itself.
*/
GimpModuleInitFunc module_init;
#endif
/* This function is called by the GIMP at startup, and should return
* either GIMP_MODULE_OK if it sucessfully initialised or
* GIMP_MODULE_UNLOAD if the module failed to hook whatever functions
* it wanted. GIMP_MODULE_UNLOAD causes the module to be closed, so
* the module must not have registered any internal functions or given
* out pointers to its data to anyone.
*
* If the module returns GIMP_MODULE_OK, it should also return a
* GimpModuleInfo structure describing itself.
#endif /* ! MODULE_COMPILATION */
/* Module unload */
typedef void (* GimpModuleCompletedCB) (gpointer completed_data);
typedef void (* GimpModuleUnloadFunc) (gpointer shutdown_data,
GimpModuleCompletedCB completed_cb,
gpointer completed_data);
#ifndef MODULE_COMPILATION
/* The same as for module_init.
*/
/* If GIMP modules want to allow themselves to be unloaded, they
* should G_MODULE_EXPORT a function named "module_unload" with the
* following type: */
typedef void (GimpModuleUnloadFunc) (void *shutdown_data,
void (*completed_cb)(void *),
void *completed_data);
#ifndef MODULE_COMPILATION /* The same as for module_init */
GimpModuleUnloadFunc module_unload;
#endif
/* GIMP calls this unload request function to ask a module to
* prepare itself to be unloaded. It is called with the value of
* shutdown_data supplied in the GimpModuleInfo struct. The module
* should ensure that none of its code or data are being used, and
* then call the supplied "completed_cb" callback function with the
* data provided. Typically the shutdown request function will queue
* de-registration activities then return. Only when the
* de-registration has finished should the completed_cb be invoked. */
#endif /* ! MODULE_COMPILATION */
#endif /* __GIMPMODULE_H__ */

View file

@ -96,8 +96,8 @@ gimp_unit_get_number_of_units (void)
* gimp_unit_get_number_of_built_in_units:
*
* Returns the number of #GimpUnit's which are hardcoded in the unit system
* (UNIT_INCH, UNIT_MM, UNIT_POINT, UNIT_PICA and the two "pseudo units"
* UNIT_PIXEL and UNIT_PERCENT).
* (UNIT_INCH, UNIT_MM, UNIT_POINT, UNIT_PICA and the two "pseudo unit"
* UNIT_PIXEL).
*
* Returns: The number of built-in units.
*