gimp/plug-ins/common/spread.c

413 lines
13 KiB
C
Raw Normal View History

1997-11-25 06:05:25 +08:00
/* Spread --- image filter plug-in for The Gimp image manipulation program
* Copyright (C) 1997 Brian Degenhardt and Federico Mena Quintero
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1997-11-25 06:05:25 +08:00
*
*/
Cleaned up the remaining libgimp API issues: 2004-03-12 Michael Natterer <mitch@gimp.org> Cleaned up the remaining libgimp API issues: * libgimp/gimppixelfetcher.[ch] (enum GimpPixelFetcherEdgeMode): added new enum value GIMP_PIXEL_FETCHER_EDGE_BACKGROUND so we can actually use the bg_color feature of the GimpPixelFetcher. (gimp_pixel_fetcher_new): added "gboolean shadow" parameter because it must not change while the GimpPixelFetcher exists. (gimp_pixel_fetcher_set_shadow): removed. (gimp_pixel_fetcher_set_bg_color): added "GimpRGB *color" parameter and don't call gimp_palette_get_foreground(). (gimp_pixel_fetcher_get_pixel): handle BACKGROUND mode. Cleaned up the function. (gimp_get_bg_guchar) (gimp_get_fg_guchar): removed these functions... * libgimp/gimpdrawable.[ch]: ...and added gimp_drawable_get_color_uchar() instead. * libgimp/gimp.def * plug-ins/common/blinds.c * plug-ins/common/checkerboard.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/displace.c * plug-ins/common/edge.c * plug-ins/common/illusion.c * plug-ins/common/mblur.c * plug-ins/common/mosaic.c * plug-ins/common/plasma.c * plug-ins/common/polar.c * plug-ins/common/ripple.c * plug-ins/common/shift.c * plug-ins/common/spread.c * plug-ins/common/tileit.c * plug-ins/common/whirlpinch.c * plug-ins/gflare/gflare.c * plug-ins/libgimpoldpreview/gimpoldpreview.c: changed accordingly. (Didn't test the changed plug-ins because I wanted to get this API change into CVS as soon as possible)
2004-03-13 06:46:25 +08:00
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc 1999-09-01 Tor Lillqvist <tml@iki.fi> * app/appenv.h * libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc from app/appenv.h here, so plug-ins can use them, too. Remove some commented-out old stuff in appenv.h. * libgimp/gimp.h: Include gimpmath.h. * libgimp/gimp.c (gimp_main): Win32: Don't install signal handlers, we can't do anything useful in the handler ourselves anyway (it would be nice to print out a backtrace, but that seems pretty hard to do, even if not impossible). Let Windows inform the user about the crash. If the plug-in was compiled with MSVC, and the user also has it, she is offered a chance to start the debugger automatically anyway. * app/*several*.c: Include gimpmath.h for G_PI etc. Don't include <math.h>, as gimpmath.h includes it. * plug-ins/*/*many*.c: Include config.h. Don't include <math.h>. Remove all the duplicated definitions of G_PI and rint(). Use RINT() instead of rint(). * app/app_procs.[ch]: app_exit() takes a gboolean. * app/batch.c * app/commands.c * app/interface.c: Call app_exit() with FALSE or TRUE. * app/main.c (on_error): Call gimp_fatal_error. (main): Don't install any signal handler on Win32 here, either. * app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format the message and call MessageBox with it. g_on_error_query doesn't do anything useful on Win32, and printf'ing a message to stdout or stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
#include "config.h"
1997-11-25 06:05:25 +08:00
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "libgimp/stdplugins-intl.h"
1997-11-25 06:05:25 +08:00
changed "Number of Colors" to "Max Number of Colors" to clarify what this 2002-09-06 Michael Natterer <mitch@gimp.org> * app/gui/convert-dialog.c: changed "Number of Colors" to "Max Number of Colors" to clarify what this parameter does. (fixes #92194). * app/gui/menus.c: use GIMP_STOCK_INFO for "View/Info Window". Specify spibutton sizes in chars, not pixels (eek) all over the place. Also removed explicit sizes where the GtkSpinButton default size does not disturbe tabular widget layouts. * libgimpwidgets/gimpwidgets.c: removed the hardcoded width of 75 pixels in gimp_spin_button_new(). Changed gimp_scale_entry_new() and gimp_coordinates_new() to interpret their "spinbutton_width" parameters as chars if < 16, and as pixels otherwise. This gives reasonable results and doesn't cause unchanged plug-ins to suddenly have spinbuttons of dozens of chars width :) * libgimpwidgets/gimpsizeentry.c: added the same heuristic here. * libgimpwidgets/gimpquerybox.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpposterizetool.c * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpbrusheditor.c * app/widgets/gimpbrushfactoryview.c * app/widgets/gimppaletteeditor.c: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/common/AlienMap.c * plug-ins/common/AlienMap2.c * plug-ins/common/CML_explorer.c * plug-ins/common/bumpmap.c * plug-ins/common/checkerboard.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/depthmerge.c * plug-ins/common/despeckle.c * plug-ins/common/diffraction.c * plug-ins/common/emboss.c * plug-ins/common/film.c * plug-ins/common/flarefx.c * plug-ins/common/fractaltrace.c * plug-ins/common/gauss_iir.c * plug-ins/common/gauss_rle.c * plug-ins/common/glasstile.c * plug-ins/common/grid.c * plug-ins/common/illusion.c * plug-ins/common/iwarp.c * plug-ins/common/jigsaw.c * plug-ins/common/lic.c * plug-ins/common/max_rgb.c * plug-ins/common/mblur.c * plug-ins/common/newsprint.c * plug-ins/common/nova.c * plug-ins/common/pixelize.c * plug-ins/common/sample_colorize.c * plug-ins/common/scatter_hsv.c * plug-ins/common/shift.c * plug-ins/common/sinus.c * plug-ins/common/sparkle.c * plug-ins/common/spread.c * plug-ins/common/tile.c * plug-ins/common/tileit.c * plug-ins/common/unsharp.c * plug-ins/common/vpropagate.c * plug-ins/common/waves.c * plug-ins/common/whirlpinch.c * plug-ins/gflare/gflare.c * plug-ins/mosaic/mosaic.c * plug-ins/rcm/rcm_dialog.c: changed accordingly, which involves removals of gtk_widget_set_size_request(spinbutton), removal of lots of explicit spinbutton sizes in gimp_scale_entry_new(), and adding of new ones because GtkSpinButton's auto-size trashed tabular layouts. Lots of cleanup & indentation while browsing the plug-ins' code. Changed spacings, moved toggle buttons into frame titles, use stock items, stuff...
2002-09-07 04:44:47 +08:00
#define TILE_CACHE_SIZE 16
2000-01-11 23:48:00 +08:00
typedef struct
{
gdouble spread_amount_x;
gdouble spread_amount_y;
gboolean preview;
1997-11-25 06:05:25 +08:00
} SpreadValues;
/* Declare local functions.
*/
static void query (void);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static void spread (GimpDrawable *drawable);
1997-11-25 06:05:25 +08:00
static void spread_preview_update (GimpPreview *preview,
GtkWidget *size);
static gboolean spread_dialog (gint32 image_ID,
GimpDrawable *drawable);
1997-11-25 06:05:25 +08:00
/***** Local vars *****/
GimpPlugInInfo PLUG_IN_INFO =
1997-11-25 06:05:25 +08:00
{
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
1997-11-25 06:05:25 +08:00
};
static SpreadValues spvals =
{
5, /* horizontal spread amount */
5, /* vertical spread amount */
TRUE /* preview */
1997-11-25 06:05:25 +08:00
};
/***** Functions *****/
MAIN ()
static void
2000-01-11 23:48:00 +08:00
query (void)
1997-11-25 06:05:25 +08:00
{
static GimpParamDef args[] =
1997-11-25 06:05:25 +08:00
{
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image (unused)" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
{ GIMP_PDB_FLOAT, "spread_amount_x",
"Horizontal spread amount (0 <= spread_amount_x <= 200)" },
{ GIMP_PDB_FLOAT, "spread_amount_y",
"Vertical spread amount (0 <= spread_amount_y <= 200)" }
1997-11-25 06:05:25 +08:00
};
1997-11-25 06:05:25 +08:00
gimp_install_procedure ("plug_in_spread",
"Spread the contents of the specified drawable",
"Spreads the pixels of the specified drawable. "
"Pixels are randomly moved to another location whose "
"distance varies from the original by the horizontal "
"and vertical spread amounts ",
"Spencer Kimball and Peter Mattis, ported by Brian "
"Degenhardt and Federico Mena Quintero",
"Federico Mena Quintero and Brian Degenhardt",
"1997",
N_("Sp_read..."),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_spread", "<Image>/Filters/Noise");
1997-11-25 06:05:25 +08:00
}
static void
run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
1997-11-25 06:05:25 +08:00
{
static GimpParam values[1];
gint32 image_ID;
GimpDrawable *drawable;
GimpRunMode run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
1997-11-25 06:05:25 +08:00
run_mode = param[0].data.d_int32;
INIT_I18N ();
2000-01-26 07:11:20 +08:00
/* Get the specified image and drawable */
image_ID = param[1].data.d_image;
1997-11-25 06:05:25 +08:00
drawable = gimp_drawable_get (param[2].data.d_drawable);
*nreturn_vals = 1;
*return_vals = values;
1997-11-25 06:05:25 +08:00
values[0].type = GIMP_PDB_STATUS;
1997-11-25 06:05:25 +08:00
values[0].data.d_status = status;
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
1997-11-25 06:05:25 +08:00
/* Possibly retrieve data */
gimp_get_data ("plug_in_spread", &spvals);
/* First acquire information with a dialog */
if (! spread_dialog (image_ID, drawable))
return;
1997-11-25 06:05:25 +08:00
break;
case GIMP_RUN_NONINTERACTIVE:
1997-11-25 06:05:25 +08:00
/* Make sure all the arguments are there! */
if (nparams != 5)
{
status = GIMP_PDB_CALLING_ERROR;
}
else
{
spvals.spread_amount_x= param[3].data.d_float;
1997-11-25 06:05:25 +08:00
spvals.spread_amount_y = param[4].data.d_float;
}
if ((status == GIMP_PDB_SUCCESS) &&
(spvals.spread_amount_x < 0 || spvals.spread_amount_x > 200) &&
1997-11-25 06:05:25 +08:00
(spvals.spread_amount_y < 0 || spvals.spread_amount_y > 200))
status = GIMP_PDB_CALLING_ERROR;
1997-11-25 06:05:25 +08:00
break;
case GIMP_RUN_WITH_LAST_VALS:
1997-11-25 06:05:25 +08:00
/* Possibly retrieve data */
gimp_get_data ("plug_in_spread", &spvals);
break;
default:
break;
}
if (status == GIMP_PDB_SUCCESS)
1997-11-25 06:05:25 +08:00
{
/* Make sure that the drawable is gray or RGB color */
if (gimp_drawable_is_rgb (drawable->drawable_id) ||
gimp_drawable_is_gray (drawable->drawable_id))
{
gimp_progress_init (_("Spreading..."));
1997-11-25 06:05:25 +08:00
/* set the tile cache size */
gimp_tile_cache_ntiles (TILE_CACHE_SIZE);
1997-11-25 06:05:25 +08:00
/* run the spread effect */
spread (drawable);
1997-11-25 06:05:25 +08:00
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();
1997-11-25 06:05:25 +08:00
/* Store data */
if (run_mode == GIMP_RUN_INTERACTIVE)
gimp_set_data ("plug_in_spread", &spvals, sizeof (SpreadValues));
}
1997-11-25 06:05:25 +08:00
else
{
/* gimp_message ("spread: cannot operate on indexed color images"); */
status = GIMP_PDB_EXECUTION_ERROR;
}
1997-11-25 06:05:25 +08:00
}
values[0].data.d_status = status;
gimp_drawable_detach (drawable);
}
typedef struct
{
GimpPixelFetcher *pft;
GRand *gr;
gint x_amount;
gint y_amount;
gint width;
gint height;
2004-05-09 04:33:28 +08:00
} SpreadParam_t;
/* Spread the image. This is done by going through every pixel
in the source image and swapping it with some other random
pixel. The random pixel is located within an ellipse that is
as high as the spread_amount_y parameter and as wide as the
spread_amount_x parameter. This is done by randomly selecting
an angle and then multiplying the sine of the angle to a random
number whose range is between -spread_amount_x/2 and spread_amount_x/2.
The y coordinate is found by multiplying the cosine of the angle
to the random value generated from spread_amount_y. The reason
that the spread is done this way is to make the end product more
random looking. To see a result of this, compare spreading a
square with gimp 0.54 to spreading a square with this filter.
The corners are less sharp with this algorithm.
*/
1997-11-25 06:05:25 +08:00
static void
spread_func (gint x,
gint y,
guchar *dest,
gint bpp,
gpointer data)
1997-11-25 06:05:25 +08:00
{
2004-05-09 04:33:28 +08:00
SpreadParam_t *param = (SpreadParam_t*) data;
gdouble angle;
gint xdist, ydist;
gint xi, yi;
1997-11-25 06:05:25 +08:00
2004-05-09 04:33:28 +08:00
/* get random angle, x distance, and y distance */
xdist = (param->x_amount > 0
? g_rand_int_range (param->gr, -param->x_amount, param->x_amount)
: 0);
ydist = (param->y_amount > 0
? g_rand_int_range (param->gr, -param->y_amount, param->y_amount)
: 0);
2004-05-09 04:33:28 +08:00
angle = g_rand_double_range (param->gr, -G_PI, G_PI);
xi = x + floor (sin (angle) * xdist);
yi = y + floor (cos (angle) * ydist);
/* Only displace the pixel if it's within the bounds of the image. */
2004-05-09 04:33:28 +08:00
if (xi >= 0 && xi < param->width && yi >= 0 && yi < param->height)
{
gimp_pixel_fetcher_get_pixel (param->pft, xi, yi, dest);
2002-12-16 04:31:07 +08:00
}
2004-05-09 04:33:28 +08:00
else /* Else just copy it */
{
gimp_pixel_fetcher_get_pixel (param->pft, x, y, dest);
}
}
1997-11-25 06:05:25 +08:00
2004-05-09 04:33:28 +08:00
static void
spread (GimpDrawable *drawable)
{
GimpRgnIterator *iter;
SpreadParam_t param;
param.pft = gimp_pixel_fetcher_new (drawable, FALSE);
param.gr = g_rand_new ();
2004-05-09 04:33:28 +08:00
param.x_amount = (spvals.spread_amount_x + 1) / 2;
param.y_amount = (spvals.spread_amount_y + 1) / 2;
param.width = drawable->width;
param.height = drawable->height;
2004-05-09 04:33:28 +08:00
iter = gimp_rgn_iterator_new (drawable, 0);
2004-05-09 04:33:28 +08:00
gimp_rgn_iterator_dest (iter, spread_func, &param);
gimp_rgn_iterator_free (iter);
2004-07-28 17:45:53 +08:00
g_rand_free (param.gr);
2002-12-16 04:31:07 +08:00
}
1997-11-25 06:05:25 +08:00
static void
spread_preview_update (GimpPreview *preview,
GtkWidget *size)
{
GimpDrawable *drawable;
SpreadParam_t param;
gint x, y, bpp;
guchar *buffer, *dest;
gint x_off, y_off;
gint width, height;
drawable =
gimp_drawable_preview_get_drawable (GIMP_DRAWABLE_PREVIEW (preview));
param.pft = gimp_pixel_fetcher_new (drawable, FALSE);
param.gr = g_rand_new ();
param.x_amount = (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size),
0) + 1) / 2;
param.y_amount = (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size),
1) + 1) / 2;
param.width = drawable->width;
param.height = drawable->height;
gimp_preview_get_size (preview, &width, &height);
bpp = drawable->bpp;
dest = buffer = g_new (guchar, width * height * bpp);
gimp_preview_get_position (preview, &x_off, &y_off);
for (y = 0 ; y < height ; y++)
for (x = 0 ; x < width ; x++)
{
spread_func (x + x_off, y + y_off, dest, bpp, &param);
dest += bpp;
}
gimp_preview_draw_buffer (preview, buffer, width * bpp);
g_free (buffer);
g_rand_free (param.gr);
}
static gboolean
spread_dialog (gint32 image_ID,
GimpDrawable *drawable)
1997-11-25 06:05:25 +08:00
{
GtkWidget *dialog;
GtkWidget *main_vbox;
GtkWidget *preview;
1997-11-25 06:05:25 +08:00
GtkWidget *frame;
2000-01-26 07:11:20 +08:00
GtkWidget *size;
GimpUnit unit;
2000-01-26 07:11:20 +08:00
gdouble xres;
gdouble yres;
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
gboolean run;
1997-11-25 06:05:25 +08:00
gimp_ui_init ("spread", FALSE);
1997-11-25 06:05:25 +08:00
dialog = gimp_dialog_new (_("Spread"), "spread",
NULL, 0,
gimp_standard_help_func, "plug-in-spread",
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
1997-11-25 06:05:25 +08:00
NULL);
main_vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox);
gtk_widget_show (main_vbox);
preview = gimp_drawable_preview_new (drawable, &spvals.preview);
gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
gtk_widget_show (preview);
2004-05-09 04:33:28 +08:00
frame = gimp_frame_new (_("Spread Amount"));
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
gtk_widget_show (frame);
2000-01-26 07:11:20 +08:00
/* Get the image resolution and unit */
gimp_image_get_resolution (image_ID, &xres, &yres);
unit = gimp_image_get_unit (image_ID);
1997-11-25 06:05:25 +08:00
/* sizeentries */
changed "Number of Colors" to "Max Number of Colors" to clarify what this 2002-09-06 Michael Natterer <mitch@gimp.org> * app/gui/convert-dialog.c: changed "Number of Colors" to "Max Number of Colors" to clarify what this parameter does. (fixes #92194). * app/gui/menus.c: use GIMP_STOCK_INFO for "View/Info Window". Specify spibutton sizes in chars, not pixels (eek) all over the place. Also removed explicit sizes where the GtkSpinButton default size does not disturbe tabular widget layouts. * libgimpwidgets/gimpwidgets.c: removed the hardcoded width of 75 pixels in gimp_spin_button_new(). Changed gimp_scale_entry_new() and gimp_coordinates_new() to interpret their "spinbutton_width" parameters as chars if < 16, and as pixels otherwise. This gives reasonable results and doesn't cause unchanged plug-ins to suddenly have spinbuttons of dozens of chars width :) * libgimpwidgets/gimpsizeentry.c: added the same heuristic here. * libgimpwidgets/gimpquerybox.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpdodgeburntool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpposterizetool.c * app/tools/gimpsmudgetool.c * app/tools/gimptexttool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpbrusheditor.c * app/widgets/gimpbrushfactoryview.c * app/widgets/gimppaletteeditor.c: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/common/AlienMap.c * plug-ins/common/AlienMap2.c * plug-ins/common/CML_explorer.c * plug-ins/common/bumpmap.c * plug-ins/common/checkerboard.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/depthmerge.c * plug-ins/common/despeckle.c * plug-ins/common/diffraction.c * plug-ins/common/emboss.c * plug-ins/common/film.c * plug-ins/common/flarefx.c * plug-ins/common/fractaltrace.c * plug-ins/common/gauss_iir.c * plug-ins/common/gauss_rle.c * plug-ins/common/glasstile.c * plug-ins/common/grid.c * plug-ins/common/illusion.c * plug-ins/common/iwarp.c * plug-ins/common/jigsaw.c * plug-ins/common/lic.c * plug-ins/common/max_rgb.c * plug-ins/common/mblur.c * plug-ins/common/newsprint.c * plug-ins/common/nova.c * plug-ins/common/pixelize.c * plug-ins/common/sample_colorize.c * plug-ins/common/scatter_hsv.c * plug-ins/common/shift.c * plug-ins/common/sinus.c * plug-ins/common/sparkle.c * plug-ins/common/spread.c * plug-ins/common/tile.c * plug-ins/common/tileit.c * plug-ins/common/unsharp.c * plug-ins/common/vpropagate.c * plug-ins/common/waves.c * plug-ins/common/whirlpinch.c * plug-ins/gflare/gflare.c * plug-ins/mosaic/mosaic.c * plug-ins/rcm/rcm_dialog.c: changed accordingly, which involves removals of gtk_widget_set_size_request(spinbutton), removal of lots of explicit spinbutton sizes in gimp_scale_entry_new(), and adding of new ones because GtkSpinButton's auto-size trashed tabular layouts. Lots of cleanup & indentation while browsing the plug-ins' code. Changed spacings, moved toggle buttons into frame titles, use stock items, stuff...
2002-09-07 04:44:47 +08:00
size = gimp_coordinates_new (unit, "%a", TRUE, FALSE, -1,
GIMP_SIZE_ENTRY_UPDATE_SIZE,
2000-01-26 07:11:20 +08:00
spvals.spread_amount_x == spvals.spread_amount_y,
FALSE,
_("_Horizontal:"), spvals.spread_amount_x, xres,
0, MAX (drawable->width, drawable->height),
0, 0,
2000-01-26 07:11:20 +08:00
_("_Vertical:"), spvals.spread_amount_y, yres,
0, MAX (drawable->width, drawable->height),
0, 0);
2000-01-26 07:11:20 +08:00
gtk_container_add (GTK_CONTAINER (frame), size);
gtk_widget_show (size);
g_signal_connect (preview, "invalidated",
G_CALLBACK (spread_preview_update),
size);
g_signal_connect_swapped (size, "refval_changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
gtk_widget_show (dialog);
1997-11-25 06:05:25 +08:00
spread_preview_update (GIMP_PREVIEW (preview), size);
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
1997-11-25 06:05:25 +08:00
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
if (run)
{
spvals.spread_amount_x =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size), 0);
spvals.spread_amount_y =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size), 1);
}
gtk_widget_destroy (dialog);
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
return run;
}