correct test for restoring old foundry in callback (from Trent Piepho)

* app/text_tool.c: correct test for restoring old foundry in
callback (from Trent Piepho)

* plug-ins/gauss_iir/gauss_iir.c
* plug-ins/gauss_rle/gauss_rle.c: better test for bad values,
put fix in gauss_rle too

-Yosh
This commit is contained in:
Manish Singh 1998-09-21 09:08:54 +00:00
parent e955084e57
commit 34d938f582
8 changed files with 168 additions and 131 deletions

View File

@ -1,3 +1,12 @@
Mon Sep 21 02:05:50 PDT 1998 Manish Singh <yosh@gimp.org>
* app/text_tool.c: correct test for restoring old foundry in
callback (from Trent Piepho)
* plug-ins/gauss_iir/gauss_iir.c
* plug-ins/gauss_rle/gauss_rle.c: better test for bad values,
put fix in gauss_rle too
Sun Sep 20 15:52:21 PDT 1998 Manish Singh <yosh@gimp.org>
* Upgraded to libtool 1.2b

View File

@ -794,7 +794,7 @@ text_foundry_callback (GtkWidget *w,
the_text_tool->foundry = (long) client_data;
text_validate_combo (the_text_tool, 0);
if (text_load_font (the_text_tool))
if (!text_load_font (the_text_tool))
the_text_tool->foundry = old_value;
}

View File

@ -794,7 +794,7 @@ text_foundry_callback (GtkWidget *w,
the_text_tool->foundry = (long) client_data;
text_validate_combo (the_text_tool, 0);
if (text_load_font (the_text_tool))
if (!text_load_font (the_text_tool))
the_text_tool->foundry = old_value;
}

View File

@ -794,7 +794,7 @@ text_foundry_callback (GtkWidget *w,
the_text_tool->foundry = (long) client_data;
text_validate_combo (the_text_tool, 0);
if (text_load_font (the_text_tool))
if (!text_load_font (the_text_tool))
the_text_tool->foundry = old_value;
}

View File

@ -178,8 +178,7 @@ run (gchar *name,
bvals.horizontal = (param[4].data.d_int32) ? TRUE : FALSE;
bvals.vertical = (param[5].data.d_int32) ? TRUE : FALSE;
}
if (status == STATUS_SUCCESS &&
(bvals.radius < 1.0))
if (status == STATUS_SUCCESS && (bvals.radius < 1.0))
status = STATUS_CALLING_ERROR;
break;
@ -192,40 +191,50 @@ run (gchar *name,
break;
}
/* Get the specified drawable */
drawable = gimp_drawable_get (param[2].data.d_drawable);
/* Make sure that the drawable is gray or RGB color */
if (gimp_drawable_color (drawable->id) || gimp_drawable_gray (drawable->id))
if (!(bvals.horizontal || bvals.vertical))
{
gimp_progress_init ("IIR Gaussian Blur");
/* set the tile cache size so that the gaussian blur works well */
gimp_tile_cache_ntiles (2 * (MAX (drawable->width, drawable->height) /
gimp_tile_width () + 1));
radius = fabs (bvals.radius) + 1.0;
std_dev = sqrt (-(radius * radius) / (2 * log (1.0 / 255.0)));
/* run the gaussian blur */
gauss_iir (drawable, bvals.horizontal, bvals.vertical, std_dev);
if (run_mode != RUN_NONINTERACTIVE)
gimp_displays_flush ();
/* Store data */
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_gauss_iir", &bvals, sizeof (BlurValues));
gimp_message ("gauss_iir: you must specify either horizontal or vertical (or both)");
status = STATUS_CALLING_ERROR;
}
else
if (status == STATUS_SUCCESS)
{
/* gimp_message ("gauss_iir: cannot operate on indexed color images"); */
status = STATUS_EXECUTION_ERROR;
/* Get the specified drawable */
drawable = gimp_drawable_get (param[2].data.d_drawable);
/* Make sure that the drawable is gray or RGB color */
if (gimp_drawable_color (drawable->id) ||
gimp_drawable_gray (drawable->id))
{
gimp_progress_init ("IIR Gaussian Blur");
/* set the tile cache size so that the gaussian blur works well */
gimp_tile_cache_ntiles (2 * (MAX (drawable->width, drawable->height) /
gimp_tile_width () + 1));
radius = fabs (bvals.radius) + 1.0;
std_dev = sqrt (-(radius * radius) / (2 * log (1.0 / 255.0)));
/* run the gaussian blur */
gauss_iir (drawable, bvals.horizontal, bvals.vertical, std_dev);
if (run_mode != RUN_NONINTERACTIVE)
gimp_displays_flush ();
/* Store data */
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_gauss_iir", &bvals, sizeof (BlurValues));
}
else
{
gimp_message ("gauss_iir: cannot operate on indexed color images");
status = STATUS_EXECUTION_ERROR;
}
gimp_drawable_detach (drawable);
}
values[0].data.d_status = status;
gimp_drawable_detach (drawable);
}
static gint
@ -394,11 +403,6 @@ gauss_iir (GDrawable *drawable,
guchar *guc_tmp1, *guc_tmp2;
gint *gi_tmp1, *gi_tmp2;
/* Take care of the case that neither horizontal nor vertical is selected */
if (!(horz || vert)) {
return;
}
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
width = (x2 - x1);

View File

@ -182,40 +182,50 @@ run (gchar *name,
break;
}
/* Get the specified drawable */
drawable = gimp_drawable_get (param[2].data.d_drawable);
/* Make sure that the drawable is gray or RGB color */
if (gimp_drawable_color (drawable->id) || gimp_drawable_gray (drawable->id))
if (!(bvals.horizontal || bvals.vertical))
{
gimp_progress_init ("RLE Gaussian Blur");
/* set the tile cache size so that the gaussian blur works well */
gimp_tile_cache_ntiles (2 * (MAX (drawable->width, drawable->height) /
gimp_tile_width () + 1));
radius = fabs (bvals.radius) + 1.0;
std_dev = sqrt (-(radius * radius) / (2 * log (1.0 / 255.0)));
/* run the gaussian blur */
gauss_rle (drawable, bvals.horizontal, bvals.vertical, std_dev);
if (run_mode != RUN_NONINTERACTIVE)
gimp_displays_flush ();
/* Store data */
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_gauss_rle", &bvals, sizeof (BlurValues));
gimp_message ("gauss_rle: you must specify either horizontal or vertical (or both)");
status = STATUS_CALLING_ERROR;
}
else
if (status == STATUS_SUCCESS)
{
/* gimp_message ("gauss_rle: cannot operate on indexed color images"); */
status = STATUS_EXECUTION_ERROR;
}
/* Get the specified drawable */
drawable = gimp_drawable_get (param[2].data.d_drawable);
/* Make sure that the drawable is gray or RGB color */
if (gimp_drawable_color (drawable->id) ||
gimp_drawable_gray (drawable->id))
{
gimp_progress_init ("RLE Gaussian Blur");
/* set the tile cache size so that the gaussian blur works well */
gimp_tile_cache_ntiles (2 * (MAX (drawable->width, drawable->height) /
gimp_tile_width () + 1));
radius = fabs (bvals.radius) + 1.0;
std_dev = sqrt (-(radius * radius) / (2 * log (1.0 / 255.0)));
/* run the gaussian blur */
gauss_rle (drawable, bvals.horizontal, bvals.vertical, std_dev);
if (run_mode != RUN_NONINTERACTIVE)
gimp_displays_flush ();
/* Store data */
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_gauss_rle", &bvals, sizeof (BlurValues));
}
else
{
gimp_message ("gauss_rle: cannot operate on indexed color images");
status = STATUS_EXECUTION_ERROR;
}
gimp_drawable_detach (drawable);
}
values[0].data.d_status = status;
gimp_drawable_detach (drawable);
}
static gint

View File

@ -178,8 +178,7 @@ run (gchar *name,
bvals.horizontal = (param[4].data.d_int32) ? TRUE : FALSE;
bvals.vertical = (param[5].data.d_int32) ? TRUE : FALSE;
}
if (status == STATUS_SUCCESS &&
(bvals.radius < 1.0))
if (status == STATUS_SUCCESS && (bvals.radius < 1.0))
status = STATUS_CALLING_ERROR;
break;
@ -192,40 +191,50 @@ run (gchar *name,
break;
}
/* Get the specified drawable */
drawable = gimp_drawable_get (param[2].data.d_drawable);
/* Make sure that the drawable is gray or RGB color */
if (gimp_drawable_color (drawable->id) || gimp_drawable_gray (drawable->id))
if (!(bvals.horizontal || bvals.vertical))
{
gimp_progress_init ("IIR Gaussian Blur");
/* set the tile cache size so that the gaussian blur works well */
gimp_tile_cache_ntiles (2 * (MAX (drawable->width, drawable->height) /
gimp_tile_width () + 1));
radius = fabs (bvals.radius) + 1.0;
std_dev = sqrt (-(radius * radius) / (2 * log (1.0 / 255.0)));
/* run the gaussian blur */
gauss_iir (drawable, bvals.horizontal, bvals.vertical, std_dev);
if (run_mode != RUN_NONINTERACTIVE)
gimp_displays_flush ();
/* Store data */
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_gauss_iir", &bvals, sizeof (BlurValues));
gimp_message ("gauss_iir: you must specify either horizontal or vertical (or both)");
status = STATUS_CALLING_ERROR;
}
else
if (status == STATUS_SUCCESS)
{
/* gimp_message ("gauss_iir: cannot operate on indexed color images"); */
status = STATUS_EXECUTION_ERROR;
/* Get the specified drawable */
drawable = gimp_drawable_get (param[2].data.d_drawable);
/* Make sure that the drawable is gray or RGB color */
if (gimp_drawable_color (drawable->id) ||
gimp_drawable_gray (drawable->id))
{
gimp_progress_init ("IIR Gaussian Blur");
/* set the tile cache size so that the gaussian blur works well */
gimp_tile_cache_ntiles (2 * (MAX (drawable->width, drawable->height) /
gimp_tile_width () + 1));
radius = fabs (bvals.radius) + 1.0;
std_dev = sqrt (-(radius * radius) / (2 * log (1.0 / 255.0)));
/* run the gaussian blur */
gauss_iir (drawable, bvals.horizontal, bvals.vertical, std_dev);
if (run_mode != RUN_NONINTERACTIVE)
gimp_displays_flush ();
/* Store data */
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_gauss_iir", &bvals, sizeof (BlurValues));
}
else
{
gimp_message ("gauss_iir: cannot operate on indexed color images");
status = STATUS_EXECUTION_ERROR;
}
gimp_drawable_detach (drawable);
}
values[0].data.d_status = status;
gimp_drawable_detach (drawable);
}
static gint
@ -394,11 +403,6 @@ gauss_iir (GDrawable *drawable,
guchar *guc_tmp1, *guc_tmp2;
gint *gi_tmp1, *gi_tmp2;
/* Take care of the case that neither horizontal nor vertical is selected */
if (!(horz || vert)) {
return;
}
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
width = (x2 - x1);

View File

@ -182,40 +182,50 @@ run (gchar *name,
break;
}
/* Get the specified drawable */
drawable = gimp_drawable_get (param[2].data.d_drawable);
/* Make sure that the drawable is gray or RGB color */
if (gimp_drawable_color (drawable->id) || gimp_drawable_gray (drawable->id))
if (!(bvals.horizontal || bvals.vertical))
{
gimp_progress_init ("RLE Gaussian Blur");
/* set the tile cache size so that the gaussian blur works well */
gimp_tile_cache_ntiles (2 * (MAX (drawable->width, drawable->height) /
gimp_tile_width () + 1));
radius = fabs (bvals.radius) + 1.0;
std_dev = sqrt (-(radius * radius) / (2 * log (1.0 / 255.0)));
/* run the gaussian blur */
gauss_rle (drawable, bvals.horizontal, bvals.vertical, std_dev);
if (run_mode != RUN_NONINTERACTIVE)
gimp_displays_flush ();
/* Store data */
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_gauss_rle", &bvals, sizeof (BlurValues));
gimp_message ("gauss_rle: you must specify either horizontal or vertical (or both)");
status = STATUS_CALLING_ERROR;
}
else
if (status == STATUS_SUCCESS)
{
/* gimp_message ("gauss_rle: cannot operate on indexed color images"); */
status = STATUS_EXECUTION_ERROR;
}
/* Get the specified drawable */
drawable = gimp_drawable_get (param[2].data.d_drawable);
/* Make sure that the drawable is gray or RGB color */
if (gimp_drawable_color (drawable->id) ||
gimp_drawable_gray (drawable->id))
{
gimp_progress_init ("RLE Gaussian Blur");
/* set the tile cache size so that the gaussian blur works well */
gimp_tile_cache_ntiles (2 * (MAX (drawable->width, drawable->height) /
gimp_tile_width () + 1));
radius = fabs (bvals.radius) + 1.0;
std_dev = sqrt (-(radius * radius) / (2 * log (1.0 / 255.0)));
/* run the gaussian blur */
gauss_rle (drawable, bvals.horizontal, bvals.vertical, std_dev);
if (run_mode != RUN_NONINTERACTIVE)
gimp_displays_flush ();
/* Store data */
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_gauss_rle", &bvals, sizeof (BlurValues));
}
else
{
gimp_message ("gauss_rle: cannot operate on indexed color images");
status = STATUS_EXECUTION_ERROR;
}
gimp_drawable_detach (drawable);
}
values[0].data.d_status = status;
gimp_drawable_detach (drawable);
}
static gint