Commit 23f31d84 authored by Adrian Likins's avatar Adrian Likins
Browse files

More non-interactive fixes for plugins.

	(most were just expecting wrong number of arguments,
	while some never even attempted a non-interactive mode)

-adrian
parent 4e2056a4
Fri Jan 30 11:48:04 EST 1998 Adrian Likins <adrian@gimp.org>
* More plugin non-interactive fixes:
DigitalSignature, hot, sinus, smooth_palette
Thu Jan 29 19:25:52 EST 1998 Adrian Likins <adrian@gimp.org>
* fixed the non-iteractive modes for plugins:
......
......@@ -180,11 +180,11 @@ run(char *name,
if (nparams != 10)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
wvals.mode = param[3].data.d_int8;
strncpy (wvals.signature,param[4].data.d_string, 50);
strncpy (wvals.email,param[5].data.d_string, 30);
strncpy (wvals.homepage,param[6].data.d_string, 50);
strncpy (wvals.date,param[7].data.d_string, 20);
wvals.mode = param[7].data.d_int8;
strncpy (wvals.signature,param[3].data.d_string, 50);
strncpy (wvals.email,param[4].data.d_string, 30);
strncpy (wvals.homepage,param[5].data.d_string, 50);
strncpy (wvals.date,param[6].data.d_string, 20);
wvals.signature[49]='\0';
wvals.email[29]='\0';
wvals.homepage[49]='\0';
......
......@@ -196,7 +196,7 @@ query(void){
{ PARAM_INT32, "action", "The action to perform" },
{ PARAM_INT32, "new_layerp", "Create a new layer iff True" },
};
static int nargs = 3;
static gint nargs = sizeof (args) / sizeof (args[0]);
static GParamDef *rets = NULL;
static int nrets = 0;
......@@ -257,12 +257,13 @@ run(char *name, int nparam, GParam *param,
case RUN_NONINTERACTIVE:
/* XXX: add code here for non-interactive running */
if (nparam != 3) {
if (nparam != 6) {
rvals[0].data.d_status = STATUS_CALLING_ERROR;
break;
}
args.mode = param[3].data.d_drawable;
args.action = param[4].data.d_drawable;
args.mode = param[3].data.d_int32;
args.action = param[4].data.d_int32;
args.new_layerp = param[5].data.d_int32;
if (pluginCore(&args)==-1) {
rvals[0].data.d_status = STATUS_EXECUTION_ERROR;
......
......@@ -61,6 +61,10 @@ static void query()
{PARAM_INT32, "run_mode", "Interactive, non-interactive"},
{PARAM_IMAGE, "image", "Input image (unused)"},
{PARAM_DRAWABLE, "drawable", "Input drawable"},
{PARAM_INT32, "width", "Width"},
{PARAM_INT32, "height", "Height"},
{PARAM_INT32, "ntries", "Search Time"},
{PARAM_INT32, "show_image","Show Image?"},
};
static GParamDef *return_vals = NULL;
static int nargs = sizeof(args) / sizeof(args[0]);
......@@ -85,11 +89,13 @@ static struct {
gint height;
gint ntries;
gint try_size;
gint show_image;
} config = {
256,
64,
50,
10000
10000,
1
};
......@@ -122,7 +128,19 @@ run (char *name,
break;
case RUN_NONINTERACTIVE:
status = STATUS_CALLING_ERROR;
if (nparams != 7)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
{
config.width = param[3].data.d_int32;
config.height = param[4].data.d_int32;
config.ntries = param[5].data.d_int32;
config.show_image = (param[6].data.d_int32) ? TRUE : FALSE;
}
if (status == STATUS_SUCCESS &&
((config.width <= 0) || (config.height <= 0) || config.ntries <= 0))
status = STATUS_CALLING_ERROR;
break;
case RUN_WITH_LAST_VALS:
......@@ -142,7 +160,7 @@ run (char *name,
values[1].data.d_image = doit(drawable, &values[2].data.d_layer);
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_smooth_palette", &config, sizeof (config));
if (run_mode != RUN_NONINTERACTIVE)
if (config.show_image)
gimp_display_new (values[1].data.d_image);
} else
status = STATUS_EXECUTION_ERROR;
......
......@@ -196,7 +196,7 @@ query(void){
{ PARAM_INT32, "action", "The action to perform" },
{ PARAM_INT32, "new_layerp", "Create a new layer iff True" },
};
static int nargs = 3;
static gint nargs = sizeof (args) / sizeof (args[0]);
static GParamDef *rets = NULL;
static int nrets = 0;
......@@ -257,12 +257,13 @@ run(char *name, int nparam, GParam *param,
case RUN_NONINTERACTIVE:
/* XXX: add code here for non-interactive running */
if (nparam != 3) {
if (nparam != 6) {
rvals[0].data.d_status = STATUS_CALLING_ERROR;
break;
}
args.mode = param[3].data.d_drawable;
args.action = param[4].data.d_drawable;
args.mode = param[3].data.d_int32;
args.action = param[4].data.d_int32;
args.new_layerp = param[5].data.d_int32;
if (pluginCore(&args)==-1) {
rvals[0].data.d_status = STATUS_EXECUTION_ERROR;
......
......@@ -210,7 +210,7 @@ static void run (gchar *name,
case RUN_NONINTERACTIVE:
/* Make sure all the arguments are there! */
if (nparams != 16)
if (nparams != 14)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
{
......
......@@ -61,6 +61,10 @@ static void query()
{PARAM_INT32, "run_mode", "Interactive, non-interactive"},
{PARAM_IMAGE, "image", "Input image (unused)"},
{PARAM_DRAWABLE, "drawable", "Input drawable"},
{PARAM_INT32, "width", "Width"},
{PARAM_INT32, "height", "Height"},
{PARAM_INT32, "ntries", "Search Time"},
{PARAM_INT32, "show_image","Show Image?"},
};
static GParamDef *return_vals = NULL;
static int nargs = sizeof(args) / sizeof(args[0]);
......@@ -85,11 +89,13 @@ static struct {
gint height;
gint ntries;
gint try_size;
gint show_image;
} config = {
256,
64,
50,
10000
10000,
1
};
......@@ -122,7 +128,19 @@ run (char *name,
break;
case RUN_NONINTERACTIVE:
status = STATUS_CALLING_ERROR;
if (nparams != 7)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
{
config.width = param[3].data.d_int32;
config.height = param[4].data.d_int32;
config.ntries = param[5].data.d_int32;
config.show_image = (param[6].data.d_int32) ? TRUE : FALSE;
}
if (status == STATUS_SUCCESS &&
((config.width <= 0) || (config.height <= 0) || config.ntries <= 0))
status = STATUS_CALLING_ERROR;
break;
case RUN_WITH_LAST_VALS:
......@@ -142,7 +160,7 @@ run (char *name,
values[1].data.d_image = doit(drawable, &values[2].data.d_layer);
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_smooth_palette", &config, sizeof (config));
if (run_mode != RUN_NONINTERACTIVE)
if (config.show_image)
gimp_display_new (values[1].data.d_image);
} else
status = STATUS_EXECUTION_ERROR;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment