Commit d68b730a authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/core/core-enums.h more enum cleanup (ChannelOps this time).

2002-03-18  Sven Neumann  <sven@gimp.org>

	* app/core/core-enums.h
	* app/core/core-types.h: more enum cleanup (ChannelOps this time).

	* app/core/gimpchannel.[ch]
	* app/core/gimpimage-mask-select.[ch]
	* app/gui/channels-commands.c
	* app/gui/vectors-commands.c
	* app/tools/gimpbezierselecttool.c
	* app/tools/tools-types.h
	* app/widgets/gimpchannellistview.[ch]
	* tools/pdbgen/pdb/channel.pdb
	* tools/pdbgen/pdb/selection.pdb
	* tools/pdbgen/pdb/selection_tools.pdb: changed accordingly.

	* app/pdb/channel_cmds.c
	* app/pdb/selection_cmds.c
	* app/pdb/selection_tools_cmds.c
	* libgimp/gimpenums.h
	* plug-ins/script-fu/script-fu-constants.c
	* tools/pdbgen/enums.pl: regenerated.
parent f85c711c
2002-03-18 Sven Neumann <sven@gimp.org>
* app/core/core-enums.h
* app/core/core-types.h: more enum cleanup (ChannelOps this time).
* app/core/gimpchannel.[ch]
* app/core/gimpimage-mask-select.[ch]
* app/gui/channels-commands.c
* app/gui/vectors-commands.c
* app/tools/gimpbezierselecttool.c
* app/tools/tools-types.h
* app/widgets/gimpchannellistview.[ch]
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/selection.pdb
* tools/pdbgen/pdb/selection_tools.pdb: changed accordingly.
* app/pdb/channel_cmds.c
* app/pdb/selection_cmds.c
* app/pdb/selection_tools_cmds.c
* libgimp/gimpenums.h
* plug-ins/script-fu/script-fu-constants.c
* tools/pdbgen/enums.pl: regenerated.
2002-03-18 Sven Neumann <sven@gimp.org>
* app/core/core-enums.h
......
......@@ -133,9 +133,9 @@ channels_delete_channel_cmd_callback (GtkWidget *widget,
}
static void
channels_channel_to_sel (GtkWidget *widget,
gpointer data,
ChannelOps op)
channels_channel_to_sel (GtkWidget *widget,
gpointer data,
GimpChannelOps op)
{
GimpImage *gimage;
GimpChannel *active_channel;
......@@ -153,28 +153,28 @@ void
channels_channel_to_sel_cmd_callback (GtkWidget *widget,
gpointer data)
{
channels_channel_to_sel (widget, data, CHANNEL_OP_REPLACE);
channels_channel_to_sel (widget, data, GIMP_CHANNEL_OP_REPLACE);
}
void
channels_add_channel_to_sel_cmd_callback (GtkWidget *widget,
gpointer data)
{
channels_channel_to_sel (widget, data, CHANNEL_OP_ADD);
channels_channel_to_sel (widget, data, GIMP_CHANNEL_OP_ADD);
}
void
channels_sub_channel_from_sel_cmd_callback (GtkWidget *widget,
gpointer data)
{
channels_channel_to_sel (widget, data, CHANNEL_OP_SUBTRACT);
channels_channel_to_sel (widget, data, GIMP_CHANNEL_OP_SUBTRACT);
}
void
channels_intersect_channel_with_sel_cmd_callback (GtkWidget *widget,
gpointer data)
{
channels_channel_to_sel (widget, data, CHANNEL_OP_INTERSECT);
channels_channel_to_sel (widget, data, GIMP_CHANNEL_OP_INTERSECT);
}
void
......
......@@ -137,9 +137,9 @@ vectors_delete_vectors_cmd_callback (GtkWidget *widget,
}
static void
vectors_vectors_to_sel (GtkWidget *widget,
gpointer data,
ChannelOps op)
vectors_vectors_to_sel (GtkWidget *widget,
gpointer data,
GimpChannelOps op)
{
GimpImage *gimage;
GimpVectors *active_vectors;
......@@ -157,28 +157,28 @@ void
vectors_vectors_to_sel_cmd_callback (GtkWidget *widget,
gpointer data)
{
vectors_vectors_to_sel (widget, data, CHANNEL_OP_REPLACE);
vectors_vectors_to_sel (widget, data, GIMP_CHANNEL_OP_REPLACE);
}
void
vectors_add_vectors_to_sel_cmd_callback (GtkWidget *widget,
gpointer data)
{
vectors_vectors_to_sel (widget, data, CHANNEL_OP_ADD);
vectors_vectors_to_sel (widget, data, GIMP_CHANNEL_OP_ADD);
}
void
vectors_sub_vectors_from_sel_cmd_callback (GtkWidget *widget,
gpointer data)
{
vectors_vectors_to_sel (widget, data, CHANNEL_OP_SUBTRACT);
vectors_vectors_to_sel (widget, data, GIMP_CHANNEL_OP_SUBTRACT);
}
void
vectors_intersect_vectors_with_sel_cmd_callback (GtkWidget *widget,
gpointer data)
{
vectors_vectors_to_sel (widget, data, CHANNEL_OP_INTERSECT);
vectors_vectors_to_sel (widget, data, GIMP_CHANNEL_OP_INTERSECT);
}
void
......
......@@ -163,6 +163,14 @@ typedef enum /*< skip >*/
GIMP_PATTERN_BUCKET_FILL
} GimpBucketFillMode;
typedef enum /*< skip >*/
{
GIMP_CHANNEL_OP_ADD,
GIMP_CHANNEL_OP_SUBTRACT,
GIMP_CHANNEL_OP_REPLACE,
GIMP_CHANNEL_OP_INTERSECT
} GimpChannelOps;
typedef enum /*< skip >*/
{
GIMP_MAKE_PALETTE,
......
......@@ -50,15 +50,6 @@ typedef enum /*< pdb-skip >*/
ORIENTATION_VERTICAL
} InternalOrientationType;
/* Selection Boolean operations */
typedef enum
{
CHANNEL_OP_ADD,
CHANNEL_OP_SUBTRACT,
CHANNEL_OP_REPLACE,
CHANNEL_OP_INTERSECT
} ChannelOps;
typedef enum
{
OFFSET_BACKGROUND,
......
......@@ -827,12 +827,12 @@ gimp_channel_sub_segment (GimpChannel *mask,
}
void
gimp_channel_combine_rect (GimpChannel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h)
gimp_channel_combine_rect (GimpChannel *mask,
GimpChannelOps op,
gint x,
gint y,
gint w,
gint h)
{
gint x2, y2;
PixelRegion maskPR;
......@@ -853,14 +853,16 @@ gimp_channel_combine_rect (GimpChannel *mask,
pixel_region_init (&maskPR, GIMP_DRAWABLE (mask)->tiles,
x, y, x2 - x, y2 - y, TRUE);
if (op == CHANNEL_OP_ADD || op == CHANNEL_OP_REPLACE)
if (op == GIMP_CHANNEL_OP_ADD || op == GIMP_CHANNEL_OP_REPLACE)
color = 255;
else
color = 0;
color_region (&maskPR, &color);
/* Determine new boundary */
if (mask->bounds_known && (op == CHANNEL_OP_ADD) && !mask->empty)
if (mask->bounds_known && (op == GIMP_CHANNEL_OP_ADD) && !mask->empty)
{
if (x < mask->x1)
mask->x1 = x;
......@@ -871,7 +873,7 @@ gimp_channel_combine_rect (GimpChannel *mask,
if ((y + h) > mask->y2)
mask->y2 = (y + h);
}
else if (op == CHANNEL_OP_REPLACE || mask->empty)
else if (op == GIMP_CHANNEL_OP_REPLACE || mask->empty)
{
mask->empty = FALSE;
mask->x1 = x;
......@@ -889,13 +891,13 @@ gimp_channel_combine_rect (GimpChannel *mask,
}
void
gimp_channel_combine_ellipse (GimpChannel *mask,
ChannelOps op,
gint x,
gint y,
gint w,
gint h,
gboolean antialias)
gimp_channel_combine_ellipse (GimpChannel *mask,
GimpChannelOps op,
gint x,
gint y,
gint w,
gint h,
gboolean antialias)
{
gint i, j;
gint x0, x1, x2;
......@@ -935,11 +937,11 @@ gimp_channel_combine_ellipse (GimpChannel *mask,
switch (op)
{
case CHANNEL_OP_ADD:
case CHANNEL_OP_REPLACE:
case GIMP_CHANNEL_OP_ADD:
case GIMP_CHANNEL_OP_REPLACE:
gimp_channel_add_segment (mask, x1, i, (x2 - x1), 255);
break;
case CHANNEL_OP_SUBTRACT:
case GIMP_CHANNEL_OP_SUBTRACT:
gimp_channel_sub_segment (mask, x1, i, (x2 - x1), 255);
break;
default:
......@@ -979,11 +981,11 @@ gimp_channel_combine_ellipse (GimpChannel *mask,
{
switch (op)
{
case CHANNEL_OP_ADD:
case CHANNEL_OP_REPLACE:
case GIMP_CHANNEL_OP_ADD:
case GIMP_CHANNEL_OP_REPLACE:
gimp_channel_add_segment (mask, x0, i, j - x0, last);
break;
case CHANNEL_OP_SUBTRACT:
case GIMP_CHANNEL_OP_SUBTRACT:
gimp_channel_sub_segment (mask, x0, i, j - x0, last);
break;
default:
......@@ -1005,12 +1007,19 @@ gimp_channel_combine_ellipse (GimpChannel *mask,
if (last)
{
if (op == CHANNEL_OP_ADD || op == CHANNEL_OP_REPLACE)
gimp_channel_add_segment (mask, x0, i, j - x0, last);
else if (op == CHANNEL_OP_SUBTRACT)
gimp_channel_sub_segment (mask, x0, i, j - x0, last);
else
g_warning ("Only ADD, REPLACE, and SUBTRACT are valid for channel_combine!");
switch (op)
{
case GIMP_CHANNEL_OP_ADD:
case GIMP_CHANNEL_OP_REPLACE:
gimp_channel_add_segment (mask, x0, i, j - x0, last);
break;
case GIMP_CHANNEL_OP_SUBTRACT:
gimp_channel_sub_segment (mask, x0, i, j - x0, last);
break;
default:
g_warning ("Only ADD, REPLACE, and SUBTRACT are valid for channel_combine!");
break;
}
}
}
......@@ -1018,7 +1027,7 @@ gimp_channel_combine_ellipse (GimpChannel *mask,
}
/* Determine new boundary */
if (mask->bounds_known && (op == CHANNEL_OP_ADD) && !mask->empty)
if (mask->bounds_known && (op == GIMP_CHANNEL_OP_ADD) && !mask->empty)
{
if (x < mask->x1)
mask->x1 = x;
......@@ -1029,7 +1038,7 @@ gimp_channel_combine_ellipse (GimpChannel *mask,
if ((y + h) > mask->y2)
mask->y2 = (y + h);
}
else if (op == CHANNEL_OP_REPLACE || mask->empty)
else if (op == GIMP_CHANNEL_OP_REPLACE || mask->empty)
{
mask->empty = FALSE;
mask->x1 = x;
......@@ -1120,11 +1129,11 @@ gimp_channel_combine_sub_region_intersect (gpointer unused,
}
void
gimp_channel_combine_mask (GimpChannel *mask,
GimpChannel *add_on,
ChannelOps op,
gint off_x,
gint off_y)
gimp_channel_combine_mask (GimpChannel *mask,
GimpChannel *add_on,
GimpChannelOps op,
gint off_x,
gint off_y)
{
PixelRegion srcPR, destPR;
gint x1, y1, x2, y2;
......@@ -1149,18 +1158,18 @@ gimp_channel_combine_mask (GimpChannel *mask,
switch (op)
{
case CHANNEL_OP_ADD:
case CHANNEL_OP_REPLACE:
case GIMP_CHANNEL_OP_ADD:
case GIMP_CHANNEL_OP_REPLACE:
pixel_regions_process_parallel ((p_func)
gimp_channel_combine_sub_region_add,
NULL, 2, &srcPR, &destPR);
break;
case CHANNEL_OP_SUBTRACT:
case GIMP_CHANNEL_OP_SUBTRACT:
pixel_regions_process_parallel ((p_func)
gimp_channel_combine_sub_region_sub,
NULL, 2, &srcPR, &destPR);
break;
case CHANNEL_OP_INTERSECT:
case GIMP_CHANNEL_OP_INTERSECT:
pixel_regions_process_parallel ((p_func)
gimp_channel_combine_sub_region_intersect,
NULL, 2, &srcPR, &destPR);
......
......@@ -132,13 +132,13 @@ void gimp_channel_sub_segment (GimpChannel *mask,
gint width,
gint value);
void gimp_channel_combine_rect (GimpChannel *mask,
ChannelOps op,
GimpChannelOps op,
gint x,
gint y,
gint w,
gint h);
void gimp_channel_combine_ellipse (GimpChannel *mask,
ChannelOps op,
GimpChannelOps op,
gint x,
gint y,
gint w,
......@@ -146,7 +146,7 @@ void gimp_channel_combine_ellipse (GimpChannel *mask,
gboolean antialias);
void gimp_channel_combine_mask (GimpChannel *mask,
GimpChannel *add_on,
ChannelOps op,
GimpChannelOps op,
gint off_x,
gint off_y);
......
......@@ -34,20 +34,20 @@
void
gimp_image_mask_select_rectangle (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
ChannelOps op,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
gimp_image_mask_select_rectangle (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
GimpChannelOps op,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* if applicable, replace the current selection */
if (op == CHANNEL_OP_REPLACE)
if (op == GIMP_CHANNEL_OP_REPLACE)
gimp_image_mask_clear (gimage);
else
gimp_image_mask_undo (gimage);
......@@ -55,12 +55,12 @@ gimp_image_mask_select_rectangle (GimpImage *gimage,
/* if feathering for rect, make a new mask with the
* rectangle and feather that with the old mask
*/
if (feather || op == CHANNEL_OP_INTERSECT)
if (feather || op == GIMP_CHANNEL_OP_INTERSECT)
{
GimpChannel *mask;
mask = gimp_channel_new_mask (gimage, gimage->width, gimage->height);
gimp_channel_combine_rect (mask, CHANNEL_OP_ADD, x, y, w, h);
gimp_channel_combine_rect (mask, GIMP_CHANNEL_OP_ADD, x, y, w, h);
if (feather)
gimp_channel_feather (mask,
......@@ -78,21 +78,21 @@ gimp_image_mask_select_rectangle (GimpImage *gimage,
}
void
gimp_image_mask_select_ellipse (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
ChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
gimp_image_mask_select_ellipse (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* if applicable, replace the current selection */
if (op == CHANNEL_OP_REPLACE)
if (op == GIMP_CHANNEL_OP_REPLACE)
gimp_image_mask_clear (gimage);
else
gimp_image_mask_undo (gimage);
......@@ -100,12 +100,13 @@ gimp_image_mask_select_ellipse (GimpImage *gimage,
/* if feathering for rect, make a new mask with the
* rectangle and feather that with the old mask
*/
if (feather || op == CHANNEL_OP_INTERSECT)
if (feather || op == GIMP_CHANNEL_OP_INTERSECT)
{
GimpChannel *mask;
mask = gimp_channel_new_mask (gimage, gimage->width, gimage->height);
gimp_channel_combine_ellipse (mask, CHANNEL_OP_ADD, x, y, w, h, antialias);
gimp_channel_combine_ellipse (mask, GIMP_CHANNEL_OP_ADD,
x, y, w, h, antialias);
if (feather)
gimp_channel_feather (mask,
......@@ -124,14 +125,14 @@ gimp_image_mask_select_ellipse (GimpImage *gimage,
}
void
gimp_image_mask_select_polygon (GimpImage *gimage,
gint n_points,
GimpVector2 *points,
ChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
gimp_image_mask_select_polygon (GimpImage *gimage,
gint n_points,
GimpVector2 *points,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
GimpScanConvert *scan_convert;
GimpChannel *mask;
......@@ -141,7 +142,7 @@ gimp_image_mask_select_polygon (GimpImage *gimage,
/* if applicable, replace the current selection
* or insure that a floating selection is anchored down...
*/
if (op == CHANNEL_OP_REPLACE)
if (op == GIMP_CHANNEL_OP_REPLACE)
gimp_image_mask_clear (gimage);
else
gimp_image_mask_undo (gimage);
......@@ -173,13 +174,13 @@ gimp_image_mask_select_polygon (GimpImage *gimage,
}
void
gimp_image_mask_select_vectors (GimpImage *gimage,
GimpVectors *vectors,
ChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
gimp_image_mask_select_vectors (GimpImage *gimage,
GimpVectors *vectors,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
GimpStroke *stroke;
GimpCoords *coords = NULL;
......@@ -230,20 +231,20 @@ gimp_image_mask_select_vectors (GimpImage *gimage,
}
void
gimp_image_mask_select_channel (GimpImage *gimage,
GimpChannel *channel,
gint offset_x,
gint offset_y,
ChannelOps op,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
gimp_image_mask_select_channel (GimpImage *gimage,
GimpChannel *channel,
gint offset_x,
gint offset_y,
GimpChannelOps op,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (GIMP_IS_CHANNEL (channel));
/* if applicable, replace the current selection */
if (op == CHANNEL_OP_REPLACE)
if (op == GIMP_CHANNEL_OP_REPLACE)
gimp_image_mask_clear (gimage);
else
gimp_image_mask_undo (gimage);
......@@ -259,18 +260,18 @@ gimp_image_mask_select_channel (GimpImage *gimage,
}
void
gimp_image_mask_select_fuzzy (GimpImage *gimage,
GimpDrawable *drawable,
gboolean sample_merged,
gint x,
gint y,
gint threshold,
gboolean select_transparent,
ChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
gimp_image_mask_select_fuzzy (GimpImage *gimage,
GimpDrawable *drawable,
gboolean sample_merged,
gint x,
gint y,
gint threshold,
gboolean select_transparent,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
GimpChannel *mask;
gint mask_x;
......@@ -309,17 +310,17 @@ gimp_image_mask_select_fuzzy (GimpImage *gimage,
}
void
gimp_image_mask_select_by_color (GimpImage *gimage,
GimpDrawable *drawable,
gboolean sample_merged,
const GimpRGB *color,
gint threshold,
gboolean select_transparent,
ChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
gimp_image_mask_select_by_color (GimpImage *gimage,
GimpDrawable *drawable,
gboolean sample_merged,
const GimpRGB *color,
gint threshold,
gboolean select_transparent,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
GimpChannel *mask;
gint mask_x;
......
......@@ -20,77 +20,77 @@
#define __GIMP_IMAGE_MASK_SELECT_H__
void gimp_image_mask_select_rectangle (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
ChannelOps op,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
void gimp_image_mask_select_rectangle (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
GimpChannelOps op,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
void gimp_image_mask_select_ellipse (GimpImage *gimage,
gint x,
gint y,
gint w,