Commit d4cdc5cc authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

plug-ins/helpbrowser/helpbrowser.c plug-ins/ifscompose/ifscompose.c

2000-08-23  Sven Neumann  <sven@gimp.org>

	* plug-ins/helpbrowser/helpbrowser.c
	* plug-ins/ifscompose/ifscompose.c
	* plug-ins/imagemap/imap_main.c
	* plug-ins/imagemap/imap_preview.[ch]
	* plug-ins/maze/handy.c
	* plug-ins/maze/maze.c
	* plug-ins/maze/maze_face.c
	* plug-ins/mosaic/mosaic.c
	* plug-ins/pagecurl/pagecurl.c: removed COMPAT_CRUFT
parent 84e1b954
2000-08-23 Sven Neumann <sven@gimp.org>
* plug-ins/helpbrowser/helpbrowser.c
* plug-ins/ifscompose/ifscompose.c
* plug-ins/imagemap/imap_main.c
* plug-ins/imagemap/imap_preview.[ch]
* plug-ins/maze/handy.c
* plug-ins/maze/maze.c
* plug-ins/maze/maze_face.c
* plug-ins/mosaic/mosaic.c
* plug-ins/pagecurl/pagecurl.c: removed COMPAT_CRUFT
2000-08-23 Sven Neumann <sven@gimp.org>
* plug-ins/common/threshold_alpha.c: avoid floating point exception
......
This diff is collapsed.
......@@ -178,13 +178,13 @@ static guint n_help_dnd_targets = (sizeof (help_dnd_target_table) /
/* GIMP plugin stuff */
static void query (void);
static void run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals);
static void run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
GPlugInInfo PLUG_IN_INFO =
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
......@@ -547,10 +547,10 @@ xmhtml_activate (GtkWidget *html,
/* try to call netscape through the web_browser interface */
return_vals = gimp_run_procedure ("extension_web_browser",
&nreturn_vals,
PARAM_INT32, RUN_NONINTERACTIVE,
PARAM_STRING, cbs->href,
PARAM_INT32, FALSE,
PARAM_END);
GIMP_PDB_INT32, GIMP_RUN_NONINTERACTIVE,
GIMP_PDB_STRING, cbs->href,
GIMP_PDB_INT32, FALSE,
GIMP_PDB_END);
gimp_destroy_params (return_vals, nreturn_vals);
break;
}
......@@ -997,14 +997,14 @@ idle_load_page (gpointer data)
}
static void
run_temp_proc (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals)
run_temp_proc (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GParam values[1];
GStatusType status = STATUS_SUCCESS;
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gchar *help_path;
gchar *locale;
gchar *help_file;
......@@ -1051,7 +1051,7 @@ run_temp_proc (gchar *name,
*nreturn_vals = 1;
*return_vals = values;
values[0].type = PARAM_STATUS;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
}
......@@ -1074,12 +1074,12 @@ input_callback (GIOChannel *channel,
static void
install_temp_proc (void)
{
static GParamDef args[] =
static GimpParamDef args[] =
{
{ PARAM_STRING, "help_path", "" },
{ PARAM_STRING, "locale", "Langusge to use" },
{ PARAM_STRING, "help_file", "Path of a local document to open. "
"Can be relative to GIMP_HELP_PATH." }
{ GIMP_PDB_STRING, "help_path", "" },
{ GIMP_PDB_STRING, "locale", "Langusge to use" },
{ GIMP_PDB_STRING, "help_file", "Path of a local document to open. "
"Can be relative to GIMP_HELP_PATH." }
};
static gint nargs = sizeof (args) / sizeof (args[0]);
......@@ -1092,7 +1092,7 @@ install_temp_proc (void)
"1999",
NULL,
"",
PROC_TEMPORARY,
GIMP_TEMPORARY,
nargs, 0,
args, NULL,
run_temp_proc);
......@@ -1122,13 +1122,13 @@ MAIN ()
static void
query (void)
{
static GParamDef args[] =
static GimpParamDef args[] =
{
{ PARAM_INT32, "run_mode", "Interactive" },
{ PARAM_STRING, "help_path", "" },
{ PARAM_STRING, "locale", "Language to use" },
{ PARAM_STRING, "help_file", "Path of a local document to open. "
"Can be relative to GIMP_HELP_PATH." }
{ GIMP_PDB_INT32, "run_mode", "Interactive" },
{ GIMP_PDB_STRING, "help_path", "" },
{ GIMP_PDB_STRING, "locale", "Language to use" },
{ GIMP_PDB_STRING, "help_file", "Path of a local document to open. "
"Can be relative to GIMP_HELP_PATH." }
};
static gint nargs = sizeof (args) / sizeof (args[0]);
......@@ -1142,28 +1142,28 @@ query (void)
"1999",
NULL,
"",
PROC_EXTENSION,
GIMP_EXTENSION,
nargs, 0,
args, NULL);
}
static void
run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals)
run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GParam values[1];
GRunModeType run_mode;
GStatusType status = STATUS_SUCCESS;
static GimpParam values[1];
GimpRunModeType run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gchar *help_path = NULL;
gchar *locale = NULL;
gchar *help_file = NULL;
run_mode = param[0].data.d_int32;
values[0].type = PARAM_STATUS;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
*nreturn_vals = 1;
......@@ -1175,9 +1175,9 @@ run (gchar *name,
{
switch (run_mode)
{
case RUN_INTERACTIVE:
case RUN_NONINTERACTIVE:
case RUN_WITH_LAST_VALS:
case GIMP_RUN_INTERACTIVE:
case GIMP_RUN_NONINTERACTIVE:
case GIMP_RUN_WITH_LAST_VALS:
/* set default values */
help_path = g_strconcat (gimp_data_directory(), G_DIR_SEPARATOR_S,
GIMP_HELP_PREFIX, NULL);
......@@ -1208,16 +1208,16 @@ run (gchar *name,
break;
default:
status = STATUS_CALLING_ERROR;
status = GIMP_PDB_CALLING_ERROR;
break;
}
if (status == STATUS_SUCCESS)
if (status == GIMP_PDB_SUCCESS)
{
if (!open_url (help_path, locale, help_file))
values[0].data.d_status = STATUS_EXECUTION_ERROR;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
else
values[0].data.d_status = STATUS_SUCCESS;
values[0].data.d_status = GIMP_PDB_SUCCESS;
g_free (help_path);
g_free (locale);
......@@ -1227,5 +1227,5 @@ run (gchar *name,
values[0].data.d_status = status;
}
else
values[0].data.d_status = STATUS_CALLING_ERROR;
values[0].data.d_status = GIMP_PDB_CALLING_ERROR;
}
......@@ -177,7 +177,7 @@ typedef struct
AffElementVals current_vals;
gint auto_preview;
gint in_update; /* true if we're currently in
gboolean in_update; /* true if we're currently in
update_values() - don't do anything
on updates */
} IfsDialog;
......@@ -190,14 +190,14 @@ typedef struct
/* Declare local functions.
*/
static void query (void);
static void run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals);
static void run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
/* user interface functions */
static gint ifs_compose_dialog (GDrawable *drawable);
static gint ifs_compose_dialog (GimpDrawable *drawable);
static void ifs_options_dialog (void);
static GtkWidget *ifs_compose_trans_page (void);
static GtkWidget *ifs_compose_color_page (void);
......@@ -229,42 +229,47 @@ static void undo_exchange (gint el);
static void undo (void);
static void redo (void);
static void recompute_center (int save_undo);
static void recompute_center_cb (GtkWidget *, gpointer);
static void recompute_center (gboolean save_undo);
static void recompute_center_cb (GtkWidget *widget,
gpointer data);
static void ifs_compose (GDrawable *drawable);
static void ifs_compose (GimpDrawable *drawable);
static void color_map_set_preview_color (GtkWidget *preview,
IfsColor *color);
static ColorMap *color_map_create (gchar *name,IfsColor *orig_color,
IfsColor *data, gint fixed_point);
static void color_map_color_changed_cb (GtkWidget *widget,
ColorMap *color_map);
static void color_map_update (ColorMap *color_map);
static void color_map_set_preview_color (GtkWidget *preview,
IfsColor *color);
static ColorMap *color_map_create (gchar *name,
IfsColor *orig_color,
IfsColor *data,
gint fixed_point);
static void color_map_color_changed_cb (GtkWidget *widget,
ColorMap *color_map);
static void color_map_update (ColorMap *color_map);
/* interface functions */
static void simple_color_toggled (GtkWidget *widget,gpointer data);
static void simple_color_set_sensitive (void);
static void val_changed_update (void);
static ValuePair *value_pair_create (gpointer data,
gdouble lower, gdouble upper,
gboolean create_scale, ValuePairType type);
static void value_pair_update (ValuePair *value_pair);
static void value_pair_entry_callback (GtkWidget *w,
ValuePair *value_pair);
static void value_pair_destroy_callback (GtkWidget *widget,
ValuePair *value_pair);
static void value_pair_button_release (GtkWidget *widget,
GdkEventButton *event,
gpointer data);
static void value_pair_scale_callback (GtkAdjustment *adjustment,
ValuePair *value_pair);
static void auto_preview_callback (GtkWidget *widget, gpointer data);
static void design_op_callback (GtkWidget *widget, gpointer data);
static void design_op_update_callback (GtkWidget *widget, gpointer data);
static void flip_check_button_callback (GtkWidget *widget, gpointer data);
static gint preview_idle_render (void);
static void simple_color_toggled (GtkWidget *widget,gpointer data);
static void simple_color_set_sensitive (void);
static void val_changed_update (void);
static ValuePair *value_pair_create (gpointer data,
gdouble lower,
gdouble upper,
gboolean create_scale,
ValuePairType type);
static void value_pair_update (ValuePair *value_pair);
static void value_pair_entry_callback (GtkWidget *w,
ValuePair *value_pair);
static void value_pair_destroy_callback (GtkWidget *widget,
ValuePair *value_pair);
static void value_pair_button_release (GtkWidget *widget,
GdkEventButton *event,
gpointer data);
static void value_pair_scale_callback (GtkAdjustment *adjustment,
ValuePair *value_pair);
static void auto_preview_callback (GtkWidget *widget, gpointer data);
static void design_op_callback (GtkWidget *widget, gpointer data);
static void design_op_update_callback (GtkWidget *widget, gpointer data);
static void flip_check_button_callback (GtkWidget *widget, gpointer data);
static gint preview_idle_render (void);
static void ifs_compose_set_defaults (void);
static void ifs_compose_defaults_callback (GtkWidget *widget,
......@@ -316,7 +321,7 @@ static IfsComposeInterface ifscint =
FALSE, /* run */
};
GPlugInInfo PLUG_IN_INFO =
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
......@@ -330,14 +335,14 @@ MAIN ()
static void
query (void)
{
static GParamDef args[] =
static GimpParamDef args[] =
{
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_IMAGE, "image", "Input image" },
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
};
static GParamDef *return_vals = NULL;
static GimpParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
static int nreturn_vals = 0;
......@@ -346,40 +351,40 @@ query (void)
gimp_install_procedure ("plug_in_ifs_compose",
"Create an Iterated Function System Fractal",
"Interactively create an Iterated Function System fractal."
"Use the window on the upper left to adjust the component"
"transformations of the fractal. The operation that is performed"
"is selected by the buttons underneath the window, or from a"
"menu popped up by the right mouse button. The fractal will be"
"rendered with a transparent background if the current image has"
"a transparent background.",
"Interactively create an Iterated Function System fractal. "
"Use the window on the upper left to adjust the component "
"transformations of the fractal. The operation that is performed "
"is selected by the buttons underneath the window, or from a "
"menu popped up by the right mouse button. The fractal will be "
"rendered with a transparent background if the current image has "
"a transparent background.",
"Owen Taylor",
"Owen Taylor",
"1997",
N_("<Image>/Filters/Render/Nature/IfsCompose..."),
"RGB*, GRAY*",
PROC_PLUG_IN,
GIMP_PLUGIN,
nargs, nreturn_vals,
args, return_vals);
}
static void
run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals)
run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GParam values[1];
GDrawable *active_drawable;
GRunModeType run_mode;
GStatusType status = STATUS_SUCCESS;
GimpParasite *parasite = NULL;
gboolean found_parasite;
static GimpParam values[1];
GimpDrawable *active_drawable;
GimpRunModeType run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpParasite *parasite = NULL;
gboolean found_parasite;
run_mode = param[0].data.d_int32;
values[0].type = PARAM_STATUS;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
*nreturn_vals = 1;
......@@ -394,7 +399,7 @@ run (gchar *name,
switch (run_mode)
{
case RUN_INTERACTIVE:
case GIMP_RUN_INTERACTIVE:
/* Possibly retrieve data; first look for a parasite -
* if not found, fall back to global values
*/
......@@ -429,14 +434,14 @@ run (gchar *name,
return;
break;
case RUN_NONINTERACTIVE:
case GIMP_RUN_NONINTERACTIVE:
/* Make sure all the arguments are there! */
status = STATUS_CALLING_ERROR;
status = GIMP_PDB_CALLING_ERROR;
break;
case RUN_WITH_LAST_VALS:
case GIMP_RUN_WITH_LAST_VALS:
/* Possibly retrieve data */
status = STATUS_CALLING_ERROR;
status = GIMP_PDB_CALLING_ERROR;
/* gimp_get_data ("plug_in_ifs_compose", &mvals); */
break;
......@@ -445,7 +450,7 @@ run (gchar *name,
}
/* Render the fractal */
if ((status == STATUS_SUCCESS) &&
if ((status == GIMP_PDB_SUCCESS) &&
(gimp_drawable_is_rgb (active_drawable->id) ||
gimp_drawable_is_gray (active_drawable->id)))
{
......@@ -457,13 +462,13 @@ run (gchar *name,
ifs_compose (active_drawable);
/* If the run mode is interactive, flush the displays */
if (run_mode != RUN_NONINTERACTIVE)
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();
/* Store data for next invocation - both globally and
* as a parasite on this layer
*/
if (run_mode == RUN_INTERACTIVE)
if (run_mode == GIMP_RUN_INTERACTIVE)
{
gchar *str = ifsvals_stringify (&ifsvals, elements);
GimpParasite *parasite;
......@@ -479,9 +484,9 @@ run (gchar *name,
g_free (str);
}
}
else if (status == STATUS_SUCCESS)
else if (status == GIMP_PDB_SUCCESS)
{
status = STATUS_EXECUTION_ERROR;
status = GIMP_PDB_EXECUTION_ERROR;
}
values[0].data.d_status = status;
......@@ -611,8 +616,8 @@ ifs_compose_color_page (void)
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *label;
GSList *group = NULL;
IfsColor color;
GSList *group = NULL;
IfsColor color;
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
......@@ -721,7 +726,7 @@ ifs_compose_color_page (void)
}
static gint
ifs_compose_dialog (GDrawable *drawable)
ifs_compose_dialog (GimpDrawable *drawable)
{
GtkWidget *dlg;
GtkWidget *label;
......@@ -1104,7 +1109,7 @@ design_area_create (GtkWidget *window,
static void
design_op_menu_create (GtkWidget *window)
{
GtkWidget *menu_item;
GtkWidget *menu_item;
GtkAccelGroup *accel_group;
ifsDesign->op_menu = gtk_menu_new();
......@@ -1316,10 +1321,10 @@ ifs_options_dialog (void)
}
static void
ifs_compose (GDrawable *drawable)
ifs_compose (GimpDrawable *drawable)
{
gint i,j;
GDrawableType type = gimp_drawable_type(drawable->id);
GimpImageType type = gimp_drawable_type (drawable->id);
gchar *buffer;
gint width = drawable->width;
......@@ -1349,7 +1354,7 @@ ifs_compose (GDrawable *drawable)
guchar *dest;
guchar *destrow;
guchar maskval;
GPixelRgn dest_rgn;
GimpPixelRgn dest_rgn;
gint progress;
gint max_progress;
......@@ -1430,27 +1435,27 @@ ifs_compose (GDrawable *drawable)
/* and store it */
switch (type)
{
case GRAY_IMAGE:
case GIMP_GRAY_IMAGE:
*dest++ = (mtot*(rtot+btot+gtot)+
(255-mtot)*(rc+gc+bc))/(3*255);
break;
case GRAYA_IMAGE:
case GIMP_GRAYA_IMAGE:
*dest++ = (rtot+btot+gtot)/3;
*dest++ = mtot;
break;
case RGB_IMAGE:
case GIMP_RGB_IMAGE:
*dest++ = (mtot*rtot + (255-mtot)*rc)/255;
*dest++ = (mtot*gtot + (255-mtot)*gc)/255;
*dest++ = (mtot*btot + (255-mtot)*bc)/255;
break;
case RGBA_IMAGE:
case GIMP_RGBA_IMAGE:
*dest++ = rtot;
*dest++ = gtot;
*dest++ = btot;
*dest++ = mtot;
break;
case INDEXED_IMAGE:
case INDEXEDA_IMAGE:
case GIMP_INDEXED_IMAGE:
case GIMP_INDEXEDA_IMAGE:
g_error("Indexed images not supported by IfsCompose");
break;
}
......@@ -1576,7 +1581,7 @@ static gint
design_area_configure (GtkWidget *widget,
GdkEventConfigure *event)
{
int i;
gint i;
gdouble width = widget->allocation.width;
gdouble height = widget->allocation.height;
......@@ -2342,32 +2347,32 @@ design_op_update_callback (GtkWidget *widget,
switch (op)
{
case OP_TRANSLATE:
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ifsD->move_button),
TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(ifsD->move_button),
TRUE);
break;
case OP_ROTATE:
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ifsD->rotate_button),
TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(ifsD->rotate_button),
TRUE);
break;
case OP_STRETCH:
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ifsD->stretch_button),
TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(ifsD->stretch_button),
TRUE);
break;
}
}
}
static void
recompute_center_cb (GtkWidget *w,
recompute_center_cb (GtkWidget *widget,
gpointer data)
{
recompute_center(TRUE);
recompute_center (TRUE);
}
static void
recompute_center (int save_undo)
recompute_center (gboolean save_undo)
{
int i;
gint i;
gdouble x,y;
gdouble center_x = 0.0;
gdouble center_y = 0.0;
......
......@@ -108,12 +108,12 @@ static gpointer _button_press_param;
static void query (void);
static void run (char *name,
int nparams,
GParam * param,
GimpParam * param,
int *nreturn_vals,
GParam ** return_vals);
static gint dialog(GDrawable *drawable);
GimpParam ** return_vals);
static gint dialog(GimpDrawable *drawable);
GPlugInInfo PLUG_IN_INFO = {
GimpPlugInInfo PLUG_IN_INFO = {
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
......@@ -127,12 +127,12 @@ MAIN ()
static void query()
{
static GParamDef args[] = {
{PARAM_INT32, "run_mode", "Interactive"},
{PARAM_IMAGE, "image", "Input image (unused)"},
{PARAM_DRAWABLE, "drawable", "Input drawable"},
static GimpParamDef args[] = {
{GIMP_PDB_INT32, "run_mode", "Interactive"},
{GIMP_PDB_IMAGE, "image", "Input image (unused)"},
{GIMP_PDB_DRAWABLE, "drawable", "Input drawable"},
};
static GParamDef *return_vals = NULL;
static GimpParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
static int nreturn_vals = 0;
......@@ -144,19 +144,19 @@ static void query()
"1998-1999",
N_("<Image>/Filters/Web/ImageMap..."),
"RGB*, GRAY*, INDEXED*",
PROC_PLUG_IN,
GIMP_PLUGIN,
nargs, nreturn_vals,
args, return_vals);
}
static void
run(char *name, int n_params, GParam *param, int *nreturn_vals,
GParam **return_vals)
run(char *name, int n_params, GimpParam *param, int *nreturn_vals,
GimpParam **return_vals)
{
static GParam values[1];
GDrawable *drawable;
GRunModeType run_mode;
GStatusType status = STATUS_SUCCESS;
static GimpParam values[1];
GimpDrawable *drawable;
GimpRunModeType run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
INIT_I18N_UI();
......@@ -171,20 +171,20 @@ run(char *name, int n_params, GParam *param, int *nreturn_vals,
_map_info.color = gimp_drawable_is_rgb(drawable->id);
run_mode = (GRunModeType) param[0].data.d_int32;
run_mode = (GimpRunModeType) param[0].data.d_int32;
if (run_mode == RUN_INTERACTIVE) {
if (run_mode == GIMP_RUN_INTERACTIVE) {
if (!dialog(drawable)) {
/* The dialog was closed, or something similarly evil happened. */
status = STATUS_EXECUTION_ERROR;
status = GIMP_PDB_EXECUTION_ERROR;
}
}
if (status == STATUS_SUCCESS) {
if (status == GIMP_PDB_SUCCESS) {