Commit a7b2c160 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Cleaned up my "To Selection" cleanup:

2003-08-27  Michael Natterer  <mitch@gimp.org>

	Cleaned up my "To Selection" cleanup:

	* app/gui/channels-commands.[ch]
	* app/gui/layers-commands.[ch]
	* app/gui/vectors-commands.[ch]: removed the separate
	cmd_callbacks for REPLACE,ADD,SUBTRACT,INTERSECT and pass the
	operation as "guint action" to the callback.

	* app/gui/channels-menu.c
	* app/gui/image-menu.c
	* app/gui/layers-menu.c
	* app/gui/vectors-menu.c: changed accordingly.
parent 08bd7a19
2003-08-27 Michael Natterer <mitch@gimp.org>
Cleaned up my "To Selection" cleanup:
* app/gui/channels-commands.[ch]
* app/gui/layers-commands.[ch]
* app/gui/vectors-commands.[ch]: removed the separate
cmd_callbacks for REPLACE,ADD,SUBTRACT,INTERSECT and pass the
operation as "guint action" to the callback.
* app/gui/channels-menu.c
* app/gui/image-menu.c
* app/gui/layers-menu.c
* app/gui/vectors-menu.c: changed accordingly.
2003-08-27 Simon Budig <simon@gimp.org>
* app/vectors/gimpstroke.[ch]
......@@ -178,12 +178,15 @@ channels_delete_cmd_callback (GtkWidget *widget,
gimp_image_flush (gimage);
}
static void
channels_channel_to_selection (GtkWidget *widget,
gpointer data,
GimpChannelOps op)
void
channels_to_selection_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpImage *gimage;
GimpChannelOps op;
GimpImage *gimage;
op = (GimpChannelOps) action;
if (GIMP_IS_COMPONENT_EDITOR (data))
{
......@@ -208,34 +211,6 @@ channels_channel_to_selection (GtkWidget *widget,
gimp_image_flush (gimage);
}
void
channels_selection_replace_cmd_callback (GtkWidget *widget,
gpointer data)
{
channels_channel_to_selection (widget, data, GIMP_CHANNEL_OP_REPLACE);
}
void
channels_selection_add_cmd_callback (GtkWidget *widget,
gpointer data)
{
channels_channel_to_selection (widget, data, GIMP_CHANNEL_OP_ADD);
}
void
channels_selection_sub_cmd_callback (GtkWidget *widget,
gpointer data)
{
channels_channel_to_selection (widget, data, GIMP_CHANNEL_OP_SUBTRACT);
}
void
channels_selection_intersect_cmd_callback (GtkWidget *widget,
gpointer data)
{
channels_channel_to_selection (widget, data, GIMP_CHANNEL_OP_INTERSECT);
}
void
channels_edit_attributes_cmd_callback (GtkWidget *widget,
gpointer data)
......
......@@ -20,31 +20,26 @@
#define __CHANNELS_COMMANDS_H__
void channels_new_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_raise_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_lower_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_duplicate_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_delete_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_selection_replace_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_selection_add_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_selection_sub_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_selection_intersect_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_edit_attributes_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_new_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_raise_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_lower_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_duplicate_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_delete_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_to_selection_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void channels_edit_attributes_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_new_channel_query (GimpImage *gimage,
GimpChannel *template,
gboolean interactive);
void channels_edit_channel_query (GimpChannel *channel);
void channels_new_channel_query (GimpImage *gimage,
GimpChannel *template,
gboolean interactive);
void channels_edit_channel_query (GimpChannel *channel);
#endif /* __CHANNELS_COMMANDS_H__ */
......@@ -407,16 +407,19 @@ layers_mask_delete_cmd_callback (GtkWidget *widget,
}
}
static void
layers_mask_to_selection (GtkWidget *widget,
gpointer data,
GimpChannelOps op)
void
layers_mask_to_selection_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpImage *gimage;
GimpLayer *active_layer;
GimpLayerMask *mask;
GimpChannelOps op;
GimpImage *gimage;
GimpLayer *active_layer;
GimpLayerMask *mask;
return_if_no_layer (gimage, active_layer, data);
op = (GimpChannelOps) action;
mask = gimp_layer_get_mask (active_layer);
if (mask)
......@@ -434,34 +437,6 @@ layers_mask_to_selection (GtkWidget *widget,
}
}
void
layers_mask_selection_replace_cmd_callback (GtkWidget *widget,
gpointer data)
{
layers_mask_to_selection (widget, data, GIMP_CHANNEL_OP_REPLACE);
}
void
layers_mask_selection_add_cmd_callback (GtkWidget *widget,
gpointer data)
{
layers_mask_to_selection (widget, data, GIMP_CHANNEL_OP_ADD);
}
void
layers_mask_selection_sub_cmd_callback (GtkWidget *widget,
gpointer data)
{
layers_mask_to_selection (widget, data, GIMP_CHANNEL_OP_SUBTRACT);
}
void
layers_mask_selection_intersect_cmd_callback (GtkWidget *widget,
gpointer data)
{
layers_mask_to_selection (widget, data, GIMP_CHANNEL_OP_INTERSECT);
}
void
layers_alpha_add_cmd_callback (GtkWidget *widget,
gpointer data)
......@@ -477,15 +452,18 @@ layers_alpha_add_cmd_callback (GtkWidget *widget,
}
}
static void
layers_alpha_to_selection (GtkWidget *widget,
gpointer data,
GimpChannelOps op)
void
layers_alpha_to_selection_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpImage *gimage;
GimpLayer *active_layer;
GimpChannelOps op;
GimpImage *gimage;
GimpLayer *active_layer;
return_if_no_layer (gimage, active_layer, data);
op = (GimpChannelOps) action;
if (gimp_drawable_has_alpha (GIMP_DRAWABLE (active_layer)))
{
gimp_image_mask_select_alpha (gimage, active_layer,
......@@ -494,34 +472,6 @@ layers_alpha_to_selection (GtkWidget *widget,
}
}
void
layers_alpha_selection_replace_cmd_callback (GtkWidget *widget,
gpointer data)
{
layers_alpha_to_selection (widget, data, GIMP_CHANNEL_OP_REPLACE);
}
void
layers_alpha_selection_add_cmd_callback (GtkWidget *widget,
gpointer data)
{
layers_alpha_to_selection (widget, data, GIMP_CHANNEL_OP_ADD);
}
void
layers_alpha_selection_sub_cmd_callback (GtkWidget *widget,
gpointer data)
{
layers_alpha_to_selection (widget, data, GIMP_CHANNEL_OP_SUBTRACT);
}
void
layers_alpha_selection_intersect_cmd_callback (GtkWidget *widget,
gpointer data)
{
layers_alpha_to_selection (widget, data, GIMP_CHANNEL_OP_INTERSECT);
}
void
layers_edit_attributes_cmd_callback (GtkWidget *widget,
gpointer data)
......
......@@ -20,77 +20,67 @@
#define __LAYERS_COMMANDS_H__
void layers_select_previous_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_select_next_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_select_top_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_select_bottom_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_select_previous_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_select_next_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_select_top_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_select_bottom_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_raise_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_lower_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_raise_to_top_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_lower_to_bottom_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_raise_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_lower_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_raise_to_top_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_lower_to_bottom_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_new_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_duplicate_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_anchor_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_merge_down_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_delete_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_new_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_duplicate_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_anchor_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_merge_down_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_delete_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_resize_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_resize_to_image_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_scale_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_crop_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_resize_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_resize_to_image_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_scale_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_crop_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_add_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_apply_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_delete_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_selection_replace_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_selection_add_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_selection_sub_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_selection_intersect_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_add_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_apply_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_delete_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_to_selection_cmd_callback (GtkWidget *widet,
gpointer data,
guint action);
void layers_alpha_add_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_alpha_selection_replace_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_alpha_selection_add_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_alpha_selection_sub_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_alpha_selection_intersect_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_alpha_add_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_alpha_to_selection_cmd_callback (GtkWidget *widet,
gpointer data,
guint action);
void layers_edit_attributes_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_edit_attributes_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_new_layer_query (GimpImage *gimage,
GimpLayer *template,
gboolean interactive);
void layers_edit_layer_query (GimpLayer *layer);
void layers_new_layer_query (GimpImage *gimage,
GimpLayer *template,
gboolean interactive);
void layers_edit_layer_query (GimpLayer *layer);
#endif /* __LAYERS_COMMANDS_H__ */
......@@ -145,15 +145,18 @@ vectors_delete_cmd_callback (GtkWidget *widget,
gimp_image_flush (gimage);
}
static void
vectors_vectors_to_selection (GtkWidget *widget,
gpointer data,
GimpChannelOps op)
void
vectors_to_selection_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpImage *gimage;
GimpVectors *active_vectors;
GimpChannelOps op;
GimpImage *gimage;
GimpVectors *active_vectors;
return_if_no_vectors (gimage, active_vectors, data);
op = (GimpChannelOps) action;
gimp_image_mask_select_vectors (gimage,
active_vectors,
op,
......@@ -162,34 +165,6 @@ vectors_vectors_to_selection (GtkWidget *widget,
gimp_image_flush (gimage);
}
void
vectors_selection_replace_cmd_callback (GtkWidget *widget,
gpointer data)
{
vectors_vectors_to_selection (widget, data, GIMP_CHANNEL_OP_REPLACE);
}
void
vectors_selection_add_cmd_callback (GtkWidget *widget,
gpointer data)
{
vectors_vectors_to_selection (widget, data, GIMP_CHANNEL_OP_ADD);
}
void
vectors_selection_sub_cmd_callback (GtkWidget *widget,
gpointer data)
{
vectors_vectors_to_selection (widget, data, GIMP_CHANNEL_OP_SUBTRACT);
}
void
vectors_selection_intersect_cmd_callback (GtkWidget *widget,
gpointer data)
{
vectors_vectors_to_selection (widget, data, GIMP_CHANNEL_OP_INTERSECT);
}
void
vectors_selection_to_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
......
......@@ -30,14 +30,9 @@ void vectors_duplicate_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_delete_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_selection_replace_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_selection_add_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_selection_sub_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_selection_intersect_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_to_selection_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void vectors_selection_to_vectors_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_stroke_cmd_callback (GtkWidget *widget,
......
......@@ -178,12 +178,15 @@ channels_delete_cmd_callback (GtkWidget *widget,
gimp_image_flush (gimage);
}
static void
channels_channel_to_selection (GtkWidget *widget,
gpointer data,
GimpChannelOps op)
void
channels_to_selection_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpImage *gimage;
GimpChannelOps op;
GimpImage *gimage;
op = (GimpChannelOps) action;
if (GIMP_IS_COMPONENT_EDITOR (data))
{
......@@ -208,34 +211,6 @@ channels_channel_to_selection (GtkWidget *widget,
gimp_image_flush (gimage);
}
void
channels_selection_replace_cmd_callback (GtkWidget *widget,
gpointer data)
{
channels_channel_to_selection (widget, data, GIMP_CHANNEL_OP_REPLACE);
}
void
channels_selection_add_cmd_callback (GtkWidget *widget,
gpointer data)
{
channels_channel_to_selection (widget, data, GIMP_CHANNEL_OP_ADD);
}
void
channels_selection_sub_cmd_callback (GtkWidget *widget,
gpointer data)
{
channels_channel_to_selection (widget, data, GIMP_CHANNEL_OP_SUBTRACT);
}
void
channels_selection_intersect_cmd_callback (GtkWidget *widget,
gpointer data)
{
channels_channel_to_selection (widget, data, GIMP_CHANNEL_OP_INTERSECT);
}
void
channels_edit_attributes_cmd_callback (GtkWidget *widget,
gpointer data)
......
......@@ -20,31 +20,26 @@
#define __CHANNELS_COMMANDS_H__
void channels_new_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_raise_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_lower_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_duplicate_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_delete_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_selection_replace_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_selection_add_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_selection_sub_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_selection_intersect_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_edit_attributes_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_new_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_raise_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_lower_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_duplicate_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_delete_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_to_selection_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void channels_edit_attributes_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_new_channel_query (GimpImage *gimage,
GimpChannel *template,
gboolean interactive);
void channels_edit_channel_query (GimpChannel *channel);
void channels_new_channel_query (GimpImage *gimage,
GimpChannel *template,
gboolean interactive);
void channels_edit_channel_query (GimpChannel *channel);
#endif /* __CHANNELS_COMMANDS_H__ */
......@@ -70,22 +70,22 @@ GimpItemFactoryEntry channels_menu_entries[] =
MENU_SEPARATOR ("/---"),
{ { N_("/Channel to Sele_ction"), "<control>S",
channels_selection_replace_cmd_callback, 0,
channels_to_selection_cmd_callback, GIMP_CHANNEL_OP_REPLACE,
"<StockItem>", GIMP_STOCK_SELECTION_REPLACE },
NULL,
GIMP_HELP_CHANNEL_SELECTION_REPLACE, NULL },
{ { N_("/_Add to Selection"), NULL,
channels_selection_add_cmd_callback, 0,
channels_to_selection_cmd_callback, GIMP_CHANNEL_OP_ADD,
"<StockItem>", GIMP_STOCK_SELECTION_ADD },
NULL,
GIMP_HELP_CHANNEL_SELECTION_ADD, NULL },
{ { N_("/_Subtract from Selection"), NULL,
channels_selection_sub_cmd_callback, 0,
channels_to_selection_cmd_callback, GIMP_CHANNEL_OP_SUBTRACT,
"<StockItem>", GIMP_STOCK_SELECTION_SUBTRACT },
NULL,
GIMP_HELP_CHANNEL_SELECTION_SUBTRACT, NULL },
{ { N_("/_Intersect with Selection"), NULL,
channels_selection_intersect_cmd_callback, 0,
channels_to_selection_cmd_callback, GIMP_CHANNEL_OP_INTERSECT,
"<StockItem>", GIMP_STOCK_SELECTION_INTERSECT },
NULL,
GIMP_HELP_CHANNEL_SELECTION_INTERSECT, NULL },
......
......@@ -755,22 +755,22 @@ GimpItemFactoryEntry image_menu_entries[] =
MENU_SEPARATOR ("/Layer/Mask/---"),
{ { N_("/Layer/Mask/_Mask to Selection"), NULL,
layers_mask_selection_replace_cmd_callback, 0,
layers_mask_to_selection_cmd_callback, GIMP_CHANNEL_OP_REPLACE,
"<StockItem>", GIMP_STOCK_SELECTION_REPLACE },
NULL,
GIMP_HELP_LAYER_MASK_SELECTION_REPLACE, NULL },
{ { N_("/Layer/Mask/_Add to Selection"), NULL,
layers_mask_selection_add_cmd_callback, 0,
layers_mask_to_selection_cmd_callback, GIMP_CHANNEL_OP_ADD,
"<StockItem>", GIMP_STOCK_SELECTION_ADD },
NULL,
GIMP_HELP_LAYER_MASK_SELECTION_ADD, NULL },
{ { N_("/Layer/Mask/_Subtract from Selection"), NULL,
layers_mask_selection_sub_cmd_callback, 0,
layers_mask_to_selection_cmd_callback, GIMP_CHANNEL_OP_SUBTRACT,
"<StockItem>", GIMP_STOCK_SELECTION_SUBTRACT },
NULL,
GIMP_HELP_LAYER_MASK_SELECTION_SUBTRACT, NULL },
{ { N_("/Layer/Mask/_Intersect with Selection"), NULL,
layers_mask_selection_intersect_cmd_callback, 0,
layers_mask_to_selection_cmd_callback, GIMP_CHANNEL_OP_INTERSECT,
"<StockItem>", GIMP_STOCK_SELECTION_INTERSECT },
NULL,
GIMP_HELP_LAYER_MASK_SELECTION_INTERSECT, NULL },
......@@ -787,22 +787,22 @@ GimpItemFactoryEntry image_menu_entries[] =
MENU_SEPARATOR ("/Layer/Transparency/---"),
{ { N_("/Layer/Transparency/Al_pha to Selection"), NULL,
layers_alpha_selection_replace_cmd_callback, 0,
layers_alpha_to_selection_cmd_callback, GIMP_CHANNEL_OP_REPLACE,
"<StockItem>", GIMP_STOCK_SELECTION_REPLACE },
NULL,
GIMP_HELP_LAYER_ALPHA_SELECTION_REPLACE, NULL },
{ { N_("/Layer/Transparency/A_dd to Selection"), NULL,