Commit 2ad84fff 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-04-30  Michael Natterer  <mitch@gimp.org>

	* plug-ins/common/[a-g]*.c: use gimp_ui_init(). Minor cleanups like
	reordering includes consistently and removing trailing commas from
	enums and param defs.
parent 2cf9841c
2000-04-30 Michael Natterer <mitch@gimp.org>
* plug-ins/common/[a-g]*.c: use gimp_ui_init(). Minor cleanups like
reordering includes consistently and removing trailing commas from
enums and param defs.
2000-04-30 Michael Natterer <mitch@gimp.org>
 
* gimprc.in
......
......@@ -82,11 +82,11 @@ query (void)
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_STRING, "filename", "Filename to load image from" },
{ PARAM_STRING, "raw_filename", "Name entered" },
{ PARAM_STRING, "palette_filename", "Filename to load palette from" },
{ PARAM_STRING, "palette_filename", "Filename to load palette from" }
};
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) /
......@@ -103,8 +103,6 @@ query (void)
};
static gint nsave_args = sizeof (save_args) / sizeof (save_args[0]);
INIT_I18N();
gimp_install_procedure ("file_cel_load",
"Loads files in KISS CEL file format",
"This plug-in loads individual KISS cell files.",
......@@ -606,15 +604,9 @@ palette_ok (GtkWidget *widget,
static void
palette_dialog (gchar *title)
{
gchar **argv;
gint argc = 1;
GtkWidget *dialog;
argv = g_new (gchar *, 1);
argv[0] = g_strdup ("CEL file-filter");
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc ());
gimp_ui_init ("CEL", FALSE);
dialog = gtk_file_selection_new (title);
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
......
......@@ -454,15 +454,20 @@ query (void)
{ PARAM_INT32, "run_mode", "Interactive, non-interactive"},
{ PARAM_IMAGE, "image", "Input image (not used)"},
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
{ PARAM_STRING, "parameter_file_name", "The name of parameter file. CML_explorer makes an image with its settings." },
{ PARAM_STRING, "parameter_file_name", "The name of parameter file. CML_explorer makes an image with its settings." }
};
static gint nargs = sizeof (args) / sizeof (args[0]);
gimp_install_procedure (PLUG_IN_NAME,
"Make an image of Coupled-Map Lattice",
"Make an image of Coupled-Map Lattice (CML). CML is a kind of Cellula Automata on continuous (value) domain. In RUN_NONINTERACTIVE, the name of a prameter file is passed as the 4th arg. You can control CML_explorer via parameter file.",
"Make an image of Coupled-Map Lattice (CML). CML is "
"a kind of Cellula Automata on continuous (value) "
"domain. In RUN_NONINTERACTIVE, the name of a "
"prameter file is passed as the 4th arg. You can "
"control CML_explorer via parameter file.",
/* Or do you want to call me with over 50 args? */
"Shuji Narazaki (narazaki@InetQ.or.jp); http://www.inetq.or.jp/~narazaki/TheGIMP/",
"Shuji Narazaki (narazaki@InetQ.or.jp); "
"http://www.inetq.or.jp/~narazaki/TheGIMP/",
"Shuji Narazaki",
"1997",
N_("<Image>/Filters/Render/Pattern/CML Explorer..."),
......@@ -1158,27 +1163,8 @@ CML_explorer_dialog (void)
GtkWidget *pframe;
GtkWidget *hseparator;
GtkWidget *button;
guchar *color_cube;
gchar **argv;
gint argc;
argc = 1;
argv = g_new (gchar *, 1);
argv[0] = g_strdup (SHORT_NAME);
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc ());
gdk_set_use_xshm (gimp_use_xshm ());
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 (SHORT_NAME, TRUE);
dlg = gimp_dialog_new (_("Coupled-Map-Lattice Explorer"), "cml_explorer",
gimp_plugin_help_func, "filters/cml_explorer.html",
......
......@@ -32,7 +32,6 @@ static void run (gchar *name,
GParam *param,
gint *nreturn_vals,
GParam **return_vals);
static void init_gtk (void);
static gboolean aa_savable (gint32 drawable_ID);
static gboolean save_aa (gint output_type,
gchar *filename,
......@@ -84,8 +83,6 @@ query (void)
};
static gint nsave_args = sizeof(save_args) / sizeof(save_args[0]);
INIT_I18N();
gimp_install_procedure ("file_aa_save",
"Saves files in various text formats",
"Saves files in various text formats",
......@@ -158,7 +155,7 @@ run (gchar *name,
case RUN_INTERACTIVE:
case RUN_WITH_LAST_VALS:
INIT_I18N_UI();
init_gtk ();
gimp_ui_init ("aa", FALSE);
export = gimp_export_image (&image_ID, &drawable_ID, "AA",
(CAN_HANDLE_GRAY |
CAN_HANDLE_ALPHA));
......@@ -331,20 +328,6 @@ aa_savable (gint32 drawable_ID)
* User Interface dialog thingie.
*/
static void
init_gtk (void)
{
gchar **argv;
gint argc;
argc = 1;
argv = g_new (gchar *, 1);
argv[0] = g_strdup ("aa");
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc ());
}
static gint
type_dialog (int selected)
{
......
......@@ -139,12 +139,10 @@ query (void)
{ PARAM_IMAGE, "image", "Input image"},
{ PARAM_DRAWABLE, "drawable", "Input drawable (not used)"},
{ PARAM_INT32, "link-afteer-alignment", "Link the visible layers after alignment"},
{ PARAM_INT32, "use-bottom", "use the bottom layer as the base of alignment"},
{ PARAM_INT32, "use-bottom", "use the bottom layer as the base of alignment"}
};
static gint nargs = sizeof (args) / sizeof (args[0]);
INIT_I18N();
gimp_install_procedure (PLUG_IN_NAME,
"Align visible layers",
"Align visible layers",
......@@ -416,17 +414,10 @@ align_layers_dialog (void)
GtkWidget *optionmenu;
GtkWidget *toggle;
GtkObject *adj;
gchar **argv;
gint argc;
argc = 1;
argv = g_new (gchar *, 1);
argv[0] = g_strdup (PLUG_IN_NAME);
gimp_ui_init (SHORT_NAME, FALSE);
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc ());
dlg = gimp_dialog_new (_("Align Visible Layers"), "align_layers",
dlg = gimp_dialog_new (_("Align Visible Layers"), SHORT_NAME,
gimp_plugin_help_func, "filters/align_layers.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
......
......@@ -197,75 +197,65 @@ static int is_ms_tag (const char *str,
GPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
run, /* run_proc */
};
/* Global widgets'n'stuff */
guchar* preview_data;
static guchar *preview_data;
#ifdef RAPH_IS_HOME
static GtkWidget* drawing_area = NULL;
static GtkWidget* shape_drawing_area = NULL;
guchar* shape_drawing_area_data = NULL;
guchar* drawing_area_data = NULL;
static GtkWidget *drawing_area = NULL;
static GtkWidget *shape_drawing_area = NULL;
static guchar *shape_drawing_area_data = NULL;
static guchar *drawing_area_data = NULL;
#else
static GtkPreview* preview = NULL;
#endif
GtkProgressBar* progress;
guint width,height;
guchar* preview_alpha1_data;
guchar* preview_alpha2_data;
gint32 image_id;
gint32 total_frames;
guint frame_number;
gint32* layers;
GDrawable* drawable;
gboolean playing = FALSE;
int timer = 0;
GImageType imagetype;
guchar* palette;
gint ncolours;
GtkWidget *psbutton;
static GtkProgressBar *progress;
static guint width, height;
static guchar *preview_alpha1_data;
static guchar *preview_alpha2_data;
static gint32 image_id;
static gint32 total_frames;
static guint frame_number;
static gint32 *layers;
static GDrawable *drawable;
static gboolean playing = FALSE;
static gint timer = 0;
static GImageType imagetype;
static guchar *palette;
static gint ncolours;
static GtkWidget *psbutton;
/* for shaping */
gchar *shape_preview_mask;
GtkWidget *shape_window;
static gchar *shape_preview_mask;
static GtkWidget *shape_window;
#ifdef RAPH_IS_HOME
#else
GtkWidget *shape_fixed;
GtkPreview *shape_preview;
GdkPixmap *shape_pixmap;
static GtkWidget *shape_fixed;
static GtkPreview *shape_preview;
static GdkPixmap *shape_pixmap;
#endif
typedef struct _cursoroffset {gint x,y;} CursorOffset;
gint shaping = 0;
static GdkWindow *root_win = NULL;
static gint shaping = 0;
static GdkWindow *root_win = NULL;
MAIN()
MAIN ()
static void
query (void)
{
static GParamDef args[] =
{
{PARAM_INT32, "run_mode", "Interactive, non-interactive"},
{PARAM_IMAGE, "image", "Input image"},
{PARAM_DRAWABLE, "drawable", "Input drawable (unused)"},
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_IMAGE, "image", "Input image" },
{ PARAM_DRAWABLE, "drawable", "Input drawable (unused)" }
};
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_animationplay",
"This plugin allows you to preview a GIMP layer-based animation.",
......@@ -276,8 +266,8 @@ query (void)
N_("<Image>/Filters/Animation/Animation Playback..."),
"RGB*, INDEXED*, GRAY*",
PROC_PLUG_IN,
nargs, nreturn_vals,
args, return_vals);
nargs, 0,
args, NULL);
}
static void
......@@ -653,9 +643,6 @@ static void
build_dialog (GImageType basetype,
char *imagename)
{
gchar** argv;
gint argc;
gchar* windowname;
CursorOffset* icon_pos;
GtkAdjustment *adj;
......@@ -670,34 +657,7 @@ build_dialog (GImageType basetype,
GtkWidget* eventbox;
GdkCursor* cursor;
#ifndef RAPH_IS_HOME
guchar* color_cube;
#endif
argc = 1;
argv = g_new (gchar *, 1);
argv[0] = g_strdup ("animationplay");
gtk_init (&argc, &argv);
#ifdef RAPH_IS_HOME
gdk_rgb_init ();
#endif
gtk_rc_parse (gimp_gtkrc ());
gdk_set_use_xshm (gimp_use_xshm ());
#ifdef RAPH_IS_HOME
gtk_widget_set_default_visual (gdk_rgb_get_visual());
gtk_widget_set_default_colormap (gdk_rgb_get_cmap());
#else
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 ());
#endif
gimp_ui_init ("animationplay", TRUE);
windowname = g_strconcat (_("Animation Playback: "), imagename, NULL);
......
......@@ -55,14 +55,16 @@
* User interface
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "config.h"
#include "libgimp/gimp.h"
#include "libgimp/stdplugins-intl.h"
#include <libgimp/gimp.h>
#include "libgimp/stdplugins-intl.h"
typedef enum
......@@ -75,12 +77,12 @@ typedef enum
/* Declare local functions. */
static void query(void);
static void run(char *name,
int nparams,
GParam * param,
int *nreturn_vals,
GParam ** return_vals);
static void query (void);
static void run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals);
static gint32 do_optimizations (GRunModeType run_mode);
......@@ -102,84 +104,82 @@ static int is_ms_tag (const char *str,
GPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
run, /* run_proc */
};
/* Global widgets'n'stuff */
guint width,height;
gint32 image_id;
gint32 new_image_id;
gint32 total_frames;
guint frame_number;
gint32* layers;
GDrawable* drawable;
gboolean playing = FALSE;
GImageType imagetype;
GDrawableType drawabletype_alpha;
guchar pixelstep;
guchar* palette;
gint ncolours;
gboolean optimize;
MAIN()
static void query()
static guint width,height;
static gint32 image_id;
static gint32 new_image_id;
static gint32 total_frames;
static gint32 *layers;
static GDrawable *drawable;
static GImageType imagetype;
static GDrawableType drawabletype_alpha;
static guchar pixelstep;
static guchar *palette;
static gint ncolours;
static gboolean optimize;
MAIN ()
static void
query (void)
{
static GParamDef args[] =
{
{PARAM_INT32, "run_mode", "Interactive, non-interactive"},
{PARAM_IMAGE, "image", "Input image"},
{PARAM_DRAWABLE, "drawable", "Input drawable (unused)"},
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_IMAGE, "image", "Input image" },
{ PARAM_DRAWABLE, "drawable", "Input drawable (unused)" }
};
static GParamDef return_args[] =
{
{PARAM_IMAGE, "result", "Resulting image"},
{ PARAM_IMAGE, "result", "Resulting image" }
};
static int nargs = sizeof(args) / sizeof(args[0]);
static int nreturn_args = sizeof(return_args) / sizeof(return_args[0]);
INIT_I18N();
gimp_install_procedure("plug_in_animationoptimize",
"This plugin applies various optimizations to"
" a GIMP layer-based animation.",
"",
"Adam D. Moss <adam@gimp.org>",
"Adam D. Moss <adam@gimp.org>",
"1997-98",
N_("<Image>/Filters/Animation/Animation Optimize"),
"RGB*, INDEXED*, GRAY*",
PROC_PLUG_IN,
nargs, nreturn_args,
args, return_args);
gimp_install_procedure("plug_in_animationunoptimize",
"This plugin 'simplifies' a GIMP layer-based"
" animation that has been AnimationOptimized. This"
" makes the animation much easier to work with if,"
" for example, the optimized version is all you"
" have.",
"",
"Adam D. Moss <adam@gimp.org>",
"Adam D. Moss <adam@gimp.org>",
"1997-98",
N_("<Image>/Filters/Animation/Animation UnOptimize"),
"RGB*, INDEXED*, GRAY*",
PROC_PLUG_IN,
nargs, nreturn_args,
args, return_args);
static gint nargs = sizeof (args) / sizeof (args[0]);
static gint nreturn_args = sizeof (return_args) / sizeof (return_args[0]);
gimp_install_procedure ("plug_in_animationoptimize",
"This plugin applies various optimizations to"
" a GIMP layer-based animation.",
"",
"Adam D. Moss <adam@gimp.org>",
"Adam D. Moss <adam@gimp.org>",
"1997-98",
N_("<Image>/Filters/Animation/Animation Optimize"),
"RGB*, INDEXED*, GRAY*",
PROC_PLUG_IN,
nargs, nreturn_args,
args, return_args);
gimp_install_procedure ("plug_in_animationunoptimize",
"This plugin 'simplifies' a GIMP layer-based"
" animation that has been AnimationOptimized. This"
" makes the animation much easier to work with if,"
" for example, the optimized version is all you"
" have.",
"",
"Adam D. Moss <adam@gimp.org>",
"Adam D. Moss <adam@gimp.org>",
"1997-98",
N_("<Image>/Filters/Animation/Animation UnOptimize"),
"RGB*, INDEXED*, GRAY*",
PROC_PLUG_IN,
nargs, nreturn_args,
args, return_args);
}
static void run(char *name, int n_params, GParam * param, int *nreturn_vals,
GParam ** return_vals)
static void
run (gchar *name,
gint n_params,
GParam *param,
gint *nreturn_vals,
GParam **return_vals)
{
static GParam values[2];
GRunModeType run_mode;
......@@ -282,22 +282,22 @@ do_optimizations(GRunModeType run_mode)
frame_sizebytes = width * height * pixelstep;
this_frame = g_malloc(frame_sizebytes);
last_frame = g_malloc(frame_sizebytes);
opti_frame = g_malloc(frame_sizebytes);
this_frame = g_malloc (frame_sizebytes);
last_frame = g_malloc (frame_sizebytes);
opti_frame = g_malloc (frame_sizebytes);
total_alpha(this_frame, width*height, pixelstep);
total_alpha(last_frame, width*height, pixelstep);
total_alpha (this_frame, width*height, pixelstep);
total_alpha (last_frame, width*height, pixelstep);
new_image_id = gimp_image_new(width, height, imagetype);
if (imagetype == INDEXED)
{
palette = gimp_image_get_cmap(image_id, &ncolours);
gimp_image_set_cmap(new_image_id, palette, ncolours);
palette = gimp_image_get_cmap (image_id, &ncolours);
gimp_image_set_cmap (new_image_id, palette, ncolours);
}
if ( (this_frame == NULL) || (last_frame == NULL) || (opti_frame == NULL) )
if ((this_frame == NULL) || (last_frame == NULL) || (opti_frame == NULL))
g_error(_("Not enough memory to allocate buffers for optimization.\n"));
for (this_frame_num=0; this_frame_num<total_frames; this_frame_num++)
......@@ -317,17 +317,17 @@ do_optimizations(GRunModeType run_mode)
/* Image has been closed/etc since we got the layer list? */
/* FIXME - How do we tell if a gimp_drawable_get() fails? */
if (gimp_drawable_width(drawable->id)==0)
if (gimp_drawable_width (drawable->id) == 0)
{
gimp_quit();
gimp_quit ();
}
this_delay = get_frame_duration (this_frame_num);
dispose = get_frame_disposal (this_frame_num);
if (dispose==DISPOSE_REPLACE)
if (dispose == DISPOSE_REPLACE)
{
total_alpha(this_frame, width*height, pixelstep);
total_alpha (this_frame, width * height, pixelstep);
}
/* only get a new 'raw' drawable-data buffer if this and
......@@ -335,20 +335,19 @@ do_optimizations(GRunModeType run_mode)
if ((rawwidth*rawheight*rawbpp)
!=
((gimp_drawable_width(drawable->id)*
gimp_drawable_height(drawable->id)*
gimp_drawable_bpp(drawable->id))))
((gimp_drawable_width (drawable->id)*
gimp_drawable_height (drawable->id)*
gimp_drawable_bpp (drawable->id))))
{
if (rawframe != NULL) g_free(rawframe);
rawframe = g_malloc((gimp_drawable_width(drawable->id)) *
(gimp_drawable_height(drawable->id)) *
(gimp_drawable_bpp(drawable->id)));
if (rawframe != NULL) g_free (rawframe);
rawframe = g_malloc ((gimp_drawable_width (drawable->id)) *
(gimp_drawable_height (drawable->id)) *
(gimp_drawable_bpp (drawable->id)));