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> 2000-05-27 Sven Neumann <sven@gimp.org>
* app/color_select.c: use spinbuttons in the GIMP * app/color_select.c: use spinbuttons in the GIMP

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,9 +17,9 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __MODULE_DB_H__ #ifndef __MODULE_DB_H__
/* Load any modules we find on the module-path set in the gimprc */ /* Load any modules we find on the module-path set in the gimprc */
void module_db_init (void); 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> 2000-05-27 Michael Natterer <mitch@gimp.org>
* libgimp/*: lotsa files removed/added/changed to reflect the * libgimp/*: lotsa files removed/added/changed to reflect the

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,61 +2,91 @@
gimpcolorselector gimpcolorselector
<!-- ##### SECTION Short_Description ##### --> <!-- ##### SECTION Short_Description ##### -->
Functions and definitiions for creating a pluggable GIMP
color selector module.
<!-- ##### SECTION Long_Description ##### --> <!-- ##### SECTION Long_Description ##### -->
<para> <para>
Functions and definitiions for creating a pluggable GIMP
color selector module.
</para> </para>
<!-- ##### SECTION See_Also ##### --> <!-- ##### SECTION See_Also ##### -->
<para> <para>
#GModule
</para>
<para>
#libgimp-gimpmodule
</para> </para>
<!-- ##### USER_FUNCTION GimpColorSelector_Callback ##### --> <!-- ##### USER_FUNCTION GimpColorSelector_Callback ##### -->
<para> <para>
A function of this type should be called by the color selector each
time the user modifies the selected color.
</para> </para>
@data: @data: The @data passed to the #GimpColorSelector_NewFunc function.
@r: @r: The new color's red component.
@g: @g: The new color's green component.
@b: @b: The new color's blue component.
<!-- ##### USER_FUNCTION GimpColorSelector_NewFunc ##### --> <!-- ##### USER_FUNCTION GimpColorSelector_NewFunc ##### -->
<para> <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> </para>
@r: @r: The red component of intitial color.
@g: @g: The green component of intitial color.
@b: @b: The blue component of intitial color.
@cb: @cb: The function to call each time the user modifies the selected color.
@data: @data: The @data to pass to @cb.
@selector_data: @selector_data: An optional data pointer which will be passed in to subsequent invokations on the selector.
@Returns: @Returns: A #GtkWidget which implements the color selection UI.
<!-- ##### USER_FUNCTION GimpColorSelector_FreeFunc ##### --> <!-- ##### USER_FUNCTION GimpColorSelector_FreeFunc ##### -->
<para> <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> </para>
@selector_data: @selector_data: The @selector_data pointer returned by the #GimpColorSelector_NewFunc function.
<!-- ##### USER_FUNCTION GimpColorSelector_SetColorFunc ##### --> <!-- ##### USER_FUNCTION GimpColorSelector_SetColorFunc ##### -->
<para> <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> </para>
@selector_data: @selector_data: The @selector_data pointer returned by the #GimpColorSelector_NewFunc function.
@r: @r: The new color's red component.
@g: @g: The new color's green component.
@b: @b: The new color's blue component.
@set_current: @set_current: Set the current color.
<!-- ##### STRUCT GimpColorSelectorMethods ##### --> <!-- ##### STRUCT GimpColorSelectorMethods ##### -->
@ -73,23 +103,40 @@ gimpcolorselector
<!-- ##### FUNCTION gimp_color_selector_register ##### --> <!-- ##### FUNCTION gimp_color_selector_register ##### -->
<para> <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> </para>
@name: @name: The color selector's name.
@help_page: @help_page: The help page.
@methods: @methods: The color selector's methods.
@Returns: @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 ##### --> <!-- ##### FUNCTION gimp_color_selector_unregister ##### -->
<para> <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> </para>
@id: @id: The @id as returned by gimp_color_selector_register().
@callback: @finished_cb: Optional callback which will be called once all instances have finished.
@data: @finished_data: The @finished_data which will be passed to @finished_cb.
@Returns: @Returns: #TRUE on success, #FALSE if @id was not found.

View File

@ -2,10 +2,14 @@
gimpcolorspace gimpcolorspace
<!-- ##### SECTION Short_Description ##### --> <!-- ##### SECTION Short_Description ##### -->
Utility functions which convert colors between different color models.
<!-- ##### SECTION Long_Description ##### --> <!-- ##### SECTION Long_Description ##### -->
<para> <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> </para>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,16 +2,17 @@
gimpmodule gimpmodule
<!-- ##### SECTION Short_Description ##### --> <!-- ##### SECTION Short_Description ##### -->
Common definitions for creating a pluggable GIMP module.
<!-- ##### SECTION Long_Description ##### --> <!-- ##### SECTION Long_Description ##### -->
<para> <para>
Common definitions for creating a pluggable GIMP module.
</para> </para>
<!-- ##### SECTION See_Also ##### --> <!-- ##### SECTION See_Also ##### -->
<para> <para>
#GModule
</para> </para>
<!-- ##### ENUM GimpModuleStatus ##### --> <!-- ##### ENUM GimpModuleStatus ##### -->
@ -26,3 +27,59 @@ gimpmodule
</para> </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 gimpparasite
<!-- ##### SECTION Short_Description ##### --> <!-- ##### SECTION Short_Description ##### -->
Arbitrary pieces of data which can be attached to various GIMP objects.
<!-- ##### SECTION Long_Description ##### --> <!-- ##### SECTION Long_Description ##### -->
<para> <para>
Arbitrary pieces of data which can be attached to various GIMP objects.
</para> </para>
<!-- ##### SECTION See_Also ##### --> <!-- ##### SECTION See_Also ##### -->
<para> <para>
gimp_image_parasite_attach(), gimp_drawable_parasite_attach(),
gimp_parasite_attach() and their related functions.
</para> </para>
<!-- ##### STRUCT GimpParasite ##### --> <!-- ##### STRUCT GimpParasite ##### -->

View File

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

View File

@ -6,13 +6,25 @@ Widget which creates a #GtkPixmap from XPM data.
<!-- ##### SECTION Long_Description ##### --> <!-- ##### SECTION Long_Description ##### -->
<para> <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> </para>
<!-- ##### SECTION See_Also ##### --> <!-- ##### SECTION See_Also ##### -->
<para> <para>
gimp_pixmap_button_new() gimp_pixmap_button_new()
</para> </para>
<para>
#GtkPixmap
</para>
<!-- ##### STRUCT GimpPixmap ##### --> <!-- ##### STRUCT GimpPixmap ##### -->
<para> <para>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -62,14 +62,15 @@ struct _GimpColorDisplayMethods
GimpColorDisplayConfigureCancel cancel; 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 ... * but need to be marked for it here too ...
*/ */
G_MODULE_EXPORT G_MODULE_EXPORT
gboolean gimp_color_display_register (const char *name, gboolean gimp_color_display_register (const gchar *name,
GimpColorDisplayMethods *methods); GimpColorDisplayMethods *methods);
G_MODULE_EXPORT G_MODULE_EXPORT
gboolean gimp_color_display_unregister (const char *name); gboolean gimp_color_display_unregister (const gchar *name);
#endif /* __GIMP_COLOR_DISPLAY_H__ */ #endif /* __GIMP_COLOR_DISPLAY_H__ */

View File

@ -21,89 +21,55 @@
#ifndef __COLOR_SELECTOR_H__ #ifndef __COLOR_SELECTOR_H__
#define __COLOR_SELECTOR_H__ #define __COLOR_SELECTOR_H__
/* For information look at the html documentation */
/********************************/
/* color selector registration */
/* A function of this type should be called by the color selector each typedef void (* GimpColorSelector_Callback) (gpointer data,
* time the user modifies the selected color. */ gint r,
typedef void (*GimpColorSelector_Callback)(void *data, int r, int g, int b); gint g,
gint b);
typedef GtkWidget * (* GimpColorSelector_NewFunc) (gint r,
/* A function of this type is called to create a new instance of the gint g,
* color selector. The new selector should set its current color to gint b,
* 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,
GimpColorSelector_Callback cb, GimpColorSelector_Callback cb,
void *data, gpointer data,
void **selector_data); gpointer *selector_data);
/* A function of this type is called when the color selector is no typedef void (* GimpColorSelector_FreeFunc) (gpointer selector_data);
* 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);
/* A function of this type is called to change the selector's current typedef void (* GimpColorSelector_SetColorFunc) (gpointer selector_data,
* color. The required color is specified as in the new() function. gint r,
* If the "set_current" parameter is FALSE, then only the old color gint g,
* should be set - if "set_current" is TRUE, both the old color and gint b,
* the current color should be set to the RGB triple given. This gboolean set_current);
* 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 struct _GimpColorSelectorMethods GimpColorSelectorMethods; typedef struct _GimpColorSelectorMethods GimpColorSelectorMethods;
struct _GimpColorSelectorMethods { struct _GimpColorSelectorMethods
{
GimpColorSelector_NewFunc new; GimpColorSelector_NewFunc new;
GimpColorSelector_FreeFunc free; GimpColorSelector_FreeFunc free;
GimpColorSelector_SetColorFunc setcolor; GimpColorSelector_SetColorFunc setcolor;
}; };
typedef void *GimpColorSelectorID; typedef gpointer GimpColorSelectorID;
#ifndef __COLOR_NOTEBOOK_C__ /* Bypass when compiling the source for #ifndef __COLOR_NOTEBOOK_C__
* these functions. */
/* Register a color selector. Returns an identifier for the color /* Bypass when compiling the source for these functions.
* 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 GimpColorSelectorID gimp_color_selector_register (const gchar *name,
* this call. */ const gchar *help_page,
GimpColorSelectorID gimp_color_selector_register (const char *name,
const char *help_page,
GimpColorSelectorMethods *methods); GimpColorSelectorMethods *methods);
/* Remove the selector "id" from active service. New instances of the typedef void (* GimpColorSelectorFinishedCB) (gpointer finished_data);
* 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. */
gboolean gimp_color_selector_unregister (GimpColorSelectorID id, gboolean gimp_color_selector_unregister (GimpColorSelectorID id,
void (*callback)(void *data), GimpColorSelectorFinishedCB finished_cb,
void *data); gpointer finished_data);
#endif /* !__COLOR_NOTEBOOK_C__ */ #endif /* !__COLOR_NOTEBOOK_C__ */
#endif /* __COLOR_SELECTOR_H__ */ #endif /* __COLOR_SELECTOR_H__ */

View File

@ -23,70 +23,58 @@
#include <gmodule.h> #include <gmodule.h>
/* For information look at the html documentation */
typedef enum { typedef enum
{
GIMP_MODULE_OK, GIMP_MODULE_OK,
GIMP_MODULE_UNLOAD GIMP_MODULE_UNLOAD
} GimpModuleStatus; } GimpModuleStatus;
typedef struct _GimpModuleInfo GimpModuleInfo;
typedef struct { struct _GimpModuleInfo
void *shutdown_data; {
const char *purpose; gpointer shutdown_data;
const char *author;
const char *version; const gchar *purpose;
const char *copyright; const gchar *author;
const char *date; const gchar *version;
} GimpModuleInfo; const gchar *copyright;
const gchar *date;
};
/* Module initialization */
/* GIMP modules should G_MODULE_EXPORT a function named "module_init" typedef GimpModuleStatus (* GimpModuleInitFunc) (GimpModuleInfo **module_info);
* of the following type: */
typedef GimpModuleStatus (GimpModuleInitFunc) (GimpModuleInfo **);
#ifndef MODULE_COMPILATION /* On Win32 this declaration clashes with #ifndef MODULE_COMPILATION
* the definition (which uses G_MODULE_EXPORT)
* and thus should be bypassed when compiling /* On Win32 this declaration clashes with the definition
* the module itself. * (which uses G_MODULE_EXPORT) and thus should be bypassed
* when compiling the module itself.
*/ */
GimpModuleInitFunc module_init; GimpModuleInitFunc module_init;
#endif
/* This function is called by the GIMP at startup, and should return #endif /* ! MODULE_COMPILATION */
* 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 /* Module unload */
* the module must not have registered any internal functions or given
* out pointers to its data to anyone. typedef void (* GimpModuleCompletedCB) (gpointer completed_data);
*
* If the module returns GIMP_MODULE_OK, it should also return a typedef void (* GimpModuleUnloadFunc) (gpointer shutdown_data,
* GimpModuleInfo structure describing itself. 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; 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__ */ #endif /* __GIMPMODULE_H__ */

View File

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