Commit 7ea5afb4 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

use gimp_ui_init(). Minor cleanups like reordering includes consistently

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

	* plug-ins/common/[h-p]*.c: use gimp_ui_init(). Minor cleanups like
	reordering includes consistently and removing trailing commas from
	enums and param defs.
parent 6ba24da2
2000-05-01 Michael Natterer <mitch@gimp.org>
* plug-ins/common/[h-p]*.c: use gimp_ui_init(). Minor cleanups like
reordering includes consistently and removing trailing commas from
enums and param defs.
2000-05-01 Michael Natterer <mitch@gimp.org>
 
* libgimp/gimpsignal.[ch]
......
......@@ -29,6 +29,7 @@
#include "libgimp/stdplugins-intl.h"
/* Declare some local functions.
*/
static void query (void);
......@@ -37,7 +38,6 @@ static void run (gchar *name,
GParam *param,
gint *nreturn_vals,
GParam **return_vals);
static void init_gtk (void);
static gint save_image (gchar *filename,
gint32 image_ID,
gint32 drawable_ID);
......@@ -63,7 +63,7 @@ query (void)
{ PARAM_IMAGE, "image", "Input image" },
{ PARAM_DRAWABLE, "drawable", "Drawable to save" },
{ PARAM_STRING, "filename", "The name of the file to save the image in" },
{ PARAM_STRING, "raw_filename", "The name of the file to save the image in" },
{ PARAM_STRING, "raw_filename", "The name of the file to save the image in" }
};
static gint nsave_args = sizeof (save_args) / sizeof (save_args[0]);
......@@ -116,7 +116,7 @@ run (gchar *name,
case RUN_INTERACTIVE:
case RUN_WITH_LAST_VALS:
INIT_I18N_UI();
init_gtk ();
gimp_ui_init ("header", FALSE);
export = gimp_export_image (&image_ID, &drawable_ID, "Header",
(CAN_HANDLE_RGB |
CAN_HANDLE_INDEXED));
......@@ -146,20 +146,6 @@ run (gchar *name,
values[0].data.d_status = status;
}
static void
init_gtk (void)
{
gchar **argv;
gint argc;
argc = 1;
argv = g_new (gchar *, 1);
argv[0] = g_strdup ("header");
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc ());
}
static int
save_image (gchar *filename,
gint32 image_ID,
......
......@@ -77,6 +77,7 @@
#include "libgimp/stdplugins-intl.h"
struct Grgb
{
guint8 red;
......@@ -151,11 +152,11 @@ struct
#define SCALE 8192 /* scale factor: do floats with int math */
#define MAXPIX 255 /* white value */
gint tab[3][3][MAXPIX+1]; /* multiply lookup table */
gdouble chroma_lim; /* chroma limit */
gdouble compos_lim; /* composite amplitude limit */
glong ichroma_lim2; /* chroma limit squared (scaled integer) */
gint icompos_lim; /* composite amplitude limit (scaled integer) */
static gint tab[3][3][MAXPIX+1]; /* multiply lookup table */
static gdouble chroma_lim; /* chroma limit */
static gdouble compos_lim; /* composite amplitude limit */
static glong ichroma_lim2; /* chroma limit squared (scaled integer) */
static gint icompos_lim; /* composite amplitude limit (scaled integer) */
static void query (void);
static void run (gchar *name,
......@@ -197,10 +198,10 @@ static void build_tab (int m);
GPlugInInfo PLUG_IN_INFO =
{
NULL, /* init */
NULL, /* quit */
query, /* query */
run, /* run */
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
};
MAIN ()
......@@ -215,26 +216,26 @@ query (void)
{ PARAM_DRAWABLE, "drawable", "The Drawable" },
{ PARAM_INT32, "mode", "Mode -- NTSC/PAL" },
{ PARAM_INT32, "action", "The action to perform" },
{ PARAM_INT32, "new_layerp", "Create a new layer iff True" },
{ PARAM_INT32, "new_layerp", "Create a new layer iff True" }
};
static gint nargs = sizeof (args) / sizeof (args[0]);
static GParamDef *rets = NULL;
static int nrets = 0;
INIT_I18N();
gimp_install_procedure ("plug_in_hot",
"Look for hot NTSC or PAL pixels ",
"hot scans an image for pixels that will give unsave values of chrominance or composite signale amplitude when encoded into an NTSC or PAL signal. Three actions can be performed on these ``hot'' pixels. (0) reduce luminance, (1) reduce saturation, or (2) Blacken.",
"hot scans an image for pixels that will give unsave "
"values of chrominance or composite signale "
"amplitude when encoded into an NTSC or PAL signal. "
"Three actions can be performed on these ``hot'' "
"pixels. (0) reduce luminance, (1) reduce "
"saturation, or (2) Blacken.",
"Eric L. Hernes, Alan Wm Paeth",
"Eric L. Hernes",
"1997",
N_("<Image>/Filters/Colors/Hot..."),
"RGB",
PROC_PLUG_IN,
nargs, nrets,
args, rets);
nargs, 0,
args, NULL);
}
static void
......@@ -330,7 +331,7 @@ pluginCore (struct piArgs *argp)
gdouble pr, pg, pb;
gdouble py;
drw = gimp_drawable_get(argp->drawable);
drw = gimp_drawable_get (argp->drawable);
width = drw->width;
height = drw->height;
......@@ -577,15 +578,8 @@ pluginCoreIA (struct piArgs *argp)
GtkWidget *vbox;
GtkWidget *toggle;
GtkWidget *frame;
gchar **argv;
gint argc;
argc = 1;
argv = g_new (gchar *, 1);
argv[0] = g_strdup ("hot");
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc());
gimp_ui_init ("hot", FALSE);
dlg = gimp_dialog_new (_("Hot"), "hot",
gimp_plugin_help_func, "filters/hot.html",
......
......@@ -66,6 +66,7 @@
#include "libgimp/stdplugins-intl.h"
/* Declare local data types
*/
......@@ -88,7 +89,6 @@ static gint save_image (gchar *filename,
gint32 image_ID,
gint32 drawable_ID);
static void init_gtk (void);
/*
static gint save_dialog (void);
static void save_ok_callback (GtkWidget *widget,
......@@ -128,11 +128,11 @@ query (void)
{
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_STRING, "filename", "The name of the file to load" },
{ PARAM_STRING, "raw_filename", "The name of the file to load" },
{ PARAM_STRING, "raw_filename", "The name of the file to load" }
};
static GParamDef load_return_vals[] =
{
{ PARAM_IMAGE, "image", "Output image" },
{ PARAM_IMAGE, "image", "Output image" }
};
static gint nload_args = sizeof (load_args) / sizeof (load_args[0]);
static gint nload_return_vals = (sizeof (load_return_vals) /
......@@ -148,8 +148,6 @@ query (void)
};
static gint nsave_args = sizeof (save_args) / sizeof (save_args[0]);
INIT_I18N();
gimp_install_procedure ("file_hrz_load",
"loads files of the hrz file format",
"FIXME: write help for hrz_load",
......@@ -231,7 +229,7 @@ run (gchar *name,
case RUN_INTERACTIVE:
case RUN_WITH_LAST_VALS:
INIT_I18N_UI();
init_gtk ();
gimp_ui_init ("hrz", FALSE);
export = gimp_export_image (&image_ID, &drawable_ID, "HRZ",
(CAN_HANDLE_RGB |
CAN_HANDLE_GRAY));
......@@ -515,20 +513,6 @@ save_image (gchar *filename,
return TRUE;
}
static void
init_gtk (void)
{
gchar **argv;
gint argc;
argc = 1;
argv = g_new (gchar *, 1);
argv[0] = g_strdup ("hrz");
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc ());
}
/*********** Save dialog ************/
/*
static gint
......
......@@ -33,21 +33,21 @@
#include "libgimp/stdplugins-intl.h"
#define PLUG_IN_NAME "plug_in_illusion"
#define PLUG_IN_VERSION "v0.7 (Dec. 25 1997)"
/******************************************************************************/
static void query (void);
static void run (gchar *name,
gint nparam,
GParam *param,
gint *nreturn_vals,
GParam **return_vals);
static void query (void);
static void run (gchar *name,
gint nparam,
GParam *param,
gint *nreturn_vals,
GParam **return_vals);
static void filter (GDrawable *drawable);
static int dialog (void);
static void filter (GDrawable *drawable);
static gboolean dialog (void);
/******************************************************************************/
......@@ -93,7 +93,6 @@ MAIN ()
static void
query (void)
{
static int nargs = 4;
static GParamDef args[] =
{
{ PARAM_INT32, "run_mode", "interactive / non-interactive" },
......@@ -101,10 +100,7 @@ query (void)
{ PARAM_DRAWABLE, "drawable", "input drawable" },
{ PARAM_INT32, "division", "the number of divisions" }
};
static int nreturn_vals = 0;
static GParamDef *return_vals = NULL;
INIT_I18N();
static gint nargs = sizeof (args) / sizeof (args[0]);;
gimp_install_procedure (PLUG_IN_NAME,
"produce illusion",
......@@ -115,10 +111,8 @@ query (void)
N_("<Image>/Filters/Map/Illusion..."),
"RGB*, GRAY*",
PROC_PLUG_IN,
nargs,
nreturn_vals,
args,
return_vals);
nargs, 0,
args, NULL);
}
/******************************************************************************/
......@@ -279,7 +273,7 @@ filter (GDrawable *drawable)
/******************************************************************************/
static int dialog_status = FALSE;
static gboolean dialog_status = FALSE;
static void
dialog_ok_handler (GtkWidget *widget,
......@@ -292,7 +286,7 @@ dialog_ok_handler (GtkWidget *widget,
/******************************************************************************/
static int
static gboolean
dialog (void)
{
GtkWidget *window;
......@@ -301,15 +295,8 @@ dialog (void)
GtkWidget *spinbutton;
GtkObject *adj;
gint argc = 1;
gchar **argv = g_new (gchar *, 1);
argv[0] = g_strdup ("illusion");
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc ());
gimp_ui_init ("illusion", FALSE);
/* dialog window */
window = gimp_dialog_new (_("Illusion"), "illusion",
gimp_plugin_help_func, "filters/illusion.html",
GTK_WIN_POS_MOUSE,
......
......@@ -37,6 +37,7 @@
(thanks to Arthur Hagen for reporting it)
*/
#include "config.h"
#include <stdlib.h>
......@@ -50,6 +51,7 @@
#include "libgimp/stdplugins-intl.h"
#define MAX_PREVIEW_WIDTH 256
#define MAX_PREVIEW_HEIGHT 256
#define MAX_DEFORM_AREA_RADIUS 100
......@@ -96,7 +98,7 @@ static void run (gchar *name,
static void iwarp (void);
static void iwarp_frame (void);
static gint iwarp_dialog (void);
static gboolean iwarp_dialog (void);
static void iwarp_animate_dialog (GtkWidget *dlg,
GtkWidget *notebook);
......@@ -240,7 +242,7 @@ query (void)
{
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_IMAGE, "image", "Input image (unused)" },
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
{ PARAM_DRAWABLE, "drawable", "Input drawable" }
};
static gint nargs = sizeof (args) / sizeof (args[0]);
......@@ -1117,7 +1119,7 @@ iwarp_settings_dialog (GtkWidget *dlg,
gtk_label_new (_("Settings")));
}
static gint
static gboolean
iwarp_dialog (void)
{
GtkWidget *dlg;
......@@ -1126,24 +1128,8 @@ iwarp_dialog (void)
GtkWidget *abox;
GtkWidget *pframe;
GtkWidget *notebook;
guchar *color_cube;
gint argc;
gchar **argv;
argc = 1;
argv = g_new (gchar *, 1);
argv[0] = g_strdup ("iwarp");
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc ());
gtk_preview_set_gamma (gimp_gamma ());
gtk_preview_set_install_cmap (gimp_install_cmap ());
color_cube = gimp_color_cube ();
gtk_preview_set_color_cube (color_cube[0], color_cube[1],
color_cube[2], color_cube[3]);
gtk_widget_set_default_visual (gtk_preview_get_visual ());
gtk_widget_set_default_colormap (gtk_preview_get_cmap ());
gimp_ui_init ("iwarp", TRUE);
iwarp_init ();
......
......@@ -34,6 +34,7 @@
#include "libgimp/stdplugins-intl.h"
typedef enum {BEZIER_1, BEZIER_2} style_t;
typedef enum {LEFT, RIGHT, UP, DOWN} bump_t;
......@@ -138,7 +139,7 @@ static void check_config(gint width, gint height);
#define PLUG_IN_NAME "jigsaw"
#define PLUG_IN_NAME "jigsaw"
#define PLUG_IN_STORAGE "jigsaw-storage"
#define XFACTOR2 0.0833
......@@ -312,20 +313,16 @@ query (void)
{
static GParamDef args[] =
{
{ PARAM_INT32, "run_mode", "Interactive, Non-interactive, Last-Vals"},
{ PARAM_IMAGE, "image", "Input image"},
{ PARAM_DRAWABLE, "drawable", "Input drawable"},
{ PARAM_INT32, "x", "Number of tiles across > 0"},
{ PARAM_INT32, "y", "Number of tiles down > 0"},
{ PARAM_INT32, "style", "The style/shape of the jigsaw puzzle, 0 or 1"},
{ PARAM_INT32, "blend_lines", "Number of lines for shading bevels >= 0"},
{ PARAM_FLOAT, "blend_amount", "The power of the light highlights 0 =< 5"}
{ PARAM_INT32, "run_mode", "Interactive, Non-interactive, Last-Vals" },
{ PARAM_IMAGE, "image", "Input image" },
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
{ PARAM_INT32, "x", "Number of tiles across > 0" },
{ PARAM_INT32, "y", "Number of tiles down > 0" },
{ PARAM_INT32, "style", "The style/shape of the jigsaw puzzle, 0 or 1" },
{ PARAM_INT32, "blend_lines", "Number of lines for shading bevels >= 0" },
{ PARAM_FLOAT, "blend_amount", "The power of the light highlights 0 =< 5" }
};
static GParamDef *return_vals = NULL;
static gint nargs = sizeof(args) / sizeof(args[0]);
static gint nreturn_vals = 0;
INIT_I18N();
static gint nargs = sizeof (args) / sizeof (args[0]);
gimp_install_procedure ("plug_in_jigsaw",
"Renders a jigsaw puzzle look",
......@@ -336,8 +333,8 @@ query (void)
N_("<Image>/Filters/Render/Pattern/Jigsaw..."),
"RGB*",
PROC_PLUG_IN,
nargs, nreturn_vals,
args, return_vals);
nargs, 0,
args, NULL);
}
static void
......@@ -2296,18 +2293,9 @@ dialog_box (void)
GtkWidget *hbox;
GtkWidget *table;
GtkObject *adj;
gchar **argv;
gint argc;
argc = 1;
argv = g_new (gchar *, 1);
argv[0] = g_strdup (PLUG_IN_NAME);
gimp_ui_init ("jigsaw", FALSE);
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc ());
/* Create the dialog box */
dlg = gimp_dialog_new (_("Jigsaw"), "jigsaw",
gimp_plugin_help_func, "filters/jigsaw.html",
GTK_WIN_POS_MOUSE,
......
......@@ -126,6 +126,7 @@
* pretty obscure Win32 compilation issues.
*/
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -142,7 +143,6 @@
#include "libgimp/stdplugins-intl.h"
#include <signal.h>
#define SCALE_WIDTH 125
......@@ -229,7 +229,6 @@ static void add_menu_item (GtkWidget *menu,
guint op_no,
GtkSignalFunc callback);
static void init_gtk (void);
static gint save_dialog (void);
static void save_close_callback (GtkWidget *widget,
......@@ -289,11 +288,11 @@ query (void)
{
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_STRING, "filename", "The name of the file to load" },
{ PARAM_STRING, "raw_filename", "The name of the file to load" },
{ PARAM_STRING, "raw_filename", "The name of the file to load" }
};
static GParamDef load_return_vals[] =
{
{ PARAM_IMAGE, "image", "Output image" },
{ PARAM_IMAGE, "image", "Output image" }
};
static gint nload_args = sizeof (load_args) / sizeof (load_args[0]);
static gint nload_return_vals = (sizeof (load_return_vals) /
......@@ -318,8 +317,6 @@ query (void)
};
static gint nsave_args = sizeof (save_args) / sizeof (save_args[0]);
INIT_I18N();
gimp_install_procedure ("file_jpeg_load",
"loads files in the JPEG file format",
"loads files in the JPEG file format",
......@@ -409,7 +406,7 @@ run (gchar *name,
{
case RUN_INTERACTIVE:
case RUN_WITH_LAST_VALS:
init_gtk ();
gimp_ui_init ("jpeg", FALSE);
export = gimp_export_image (&image_ID, &drawable_ID, "JPEG",
(CAN_HANDLE_RGB |
CAN_HANDLE_GRAY));
......@@ -1554,20 +1551,6 @@ add_menu_item (GtkWidget *menu,
gtk_widget_show (menu_item);
}
static void
init_gtk (void)
{
gchar **argv;
gint argc;
argc = 1;
argv = g_new (gchar *, 1);
argv[0] = g_strdup ("jpeg");
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc ());
}
static gint
save_dialog (void)
{
......
......@@ -28,74 +28,78 @@
/* update 03/10/97
#ifdef MAX and MIN */
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "config.h"
#include "libgimp/gimp.h"
#include <libgimp/gimp.h>
#include "libgimp/stdplugins-intl.h"
/* Declare local functions.
*/
static void query (void);
static void run (char *name,
int nparams,
static void run (gchar *name,
gint nparams,
GParam *param,
int *nreturn_vals,
gint *nreturn_vals,
GParam **return_vals);
static void laplace (GDrawable *drawable);
static void laplace_prepare_row (GPixelRgn *pixel_rgn,
guchar *data,
int x,
int y,
int w);
guchar *data,
gint x,
gint y,
gint w);
GPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
};
MAIN ()
static void
query ()
query (void)
{
static GParamDef args[] =
{
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_IMAGE, "image", "Input image (unused)" },
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
{ PARAM_DRAWABLE, "drawable", "Input drawable" }
};
static GParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
static int nreturn_vals = 0;
INIT_I18N();
static gint nargs = sizeof (args) / sizeof (args[0]);
gimp_install_procedure ("plug_in_laplace",
"Edge Detection with Laplace Operation",
"This plugin creates one-pixel wide edges from the image, with the value proportional to the gradient. It uses the Laplace operator (a 3x3 kernel with -8 in the middle). The image has to be laplacered to get useful results, a gauss_iir with 1.5 - 5.0 depending on the noise in the image is best.",
"This plugin creates one-pixel wide edges from the "
"image, with the value proportional to the gradient. "
"It uses the Laplace operator (a 3x3 kernel with -8 "
"in the middle). The image has to be laplacered to "
"get useful results, a gauss_iir with 1.5 - 5.0 "
"depending on the noise in the image is best.",
"Thorsten Schnier",
"Thorsten Schnier",