Commit 63e5c047 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/actions/image-actions.c app/actions/image-commands.[ch]

2004-06-10  Michael Natterer  <mitch@gimp.org>

	* app/actions/image-actions.c
	* app/actions/image-commands.[ch]
	* app/actions/layers-actions.c
	* app/actions/layers-commands.[ch]: made the
	"image-convert-rgb/grayscale/indexed" and the
	"layers-mask-apply/delete" actions GimpEnumActions and merged
	their callbacks.
parent ee5eff31
2004-06-10 Michael Natterer <mitch@gimp.org>
* app/actions/image-actions.c
* app/actions/image-commands.[ch]
* app/actions/layers-actions.c
* app/actions/layers-commands.[ch]: made the
"image-convert-rgb/grayscale/indexed" and the
"layers-mask-apply/delete" actions GimpEnumActions and merged
their callbacks.
2004-06-10 Philip Lafleur <plafleur@cvs.gnome.org>
* app/gui/preferences-dialog.c: restored the 'Show Paint Tool
Cursor' option that was removed during clean-up.
Cursor' option that was removed during clean-up.
2004-06-10 Philip Lafleur <plafleur@cvs.gnome.org>
......
......@@ -67,21 +67,6 @@ static GimpActionEntry image_actions[] =
G_CALLBACK (image_new_from_image_cmd_callback),
GIMP_HELP_FILE_NEW },
{ "image-convert-rgb", GIMP_STOCK_CONVERT_RGB,
N_("_RGB"), NULL, NULL,
G_CALLBACK (image_convert_rgb_cmd_callback),
GIMP_HELP_IMAGE_CONVERT_RGB },
{ "image-convert-grayscale", GIMP_STOCK_CONVERT_GRAYSCALE,
N_("_Grayscale"), NULL, NULL,
G_CALLBACK (image_convert_grayscale_cmd_callback),
GIMP_HELP_IMAGE_CONVERT_GRAYSCALE },
{ "image-convert-indexed", GIMP_STOCK_CONVERT_INDEXED,
N_("_Indexed..."), NULL, NULL,
G_CALLBACK (image_convert_indexed_cmd_callback),
GIMP_HELP_IMAGE_CONVERT_INDEXED },
{ "image-resize", GIMP_STOCK_RESIZE,
N_("Can_vas Size..."), NULL, NULL,
G_CALLBACK (image_resize_cmd_callback),
......@@ -118,6 +103,24 @@ static GimpActionEntry image_actions[] =
GIMP_HELP_IMAGE_GRID }
};
static GimpEnumActionEntry image_convert_actions[] =
{
{ "image-convert-rgb", GIMP_STOCK_CONVERT_RGB,
N_("_RGB"), NULL, NULL,
GIMP_RGB,
GIMP_HELP_IMAGE_CONVERT_RGB },
{ "image-convert-grayscale", GIMP_STOCK_CONVERT_GRAYSCALE,
N_("_Grayscale"), NULL, NULL,
GIMP_GRAY,
GIMP_HELP_IMAGE_CONVERT_GRAYSCALE },
{ "image-convert-indexed", GIMP_STOCK_CONVERT_INDEXED,
N_("_Indexed..."), NULL, NULL,
GIMP_INDEXED,
GIMP_HELP_IMAGE_CONVERT_INDEXED }
};
static GimpEnumActionEntry image_flip_actions[] =
{
{ "image-flip-horizontal", GIMP_STOCK_FLIP_HORIZONTAL,
......@@ -158,6 +161,11 @@ image_actions_setup (GimpActionGroup *group)
image_actions,
G_N_ELEMENTS (image_actions));
gimp_action_group_add_enum_actions (group,
image_convert_actions,
G_N_ELEMENTS (image_convert_actions),
G_CALLBACK (image_convert_cmd_callback));
gimp_action_group_add_enum_actions (group,
image_flip_actions,
G_N_ELEMENTS (image_flip_actions),
......
......@@ -144,39 +144,28 @@ image_new_from_image_cmd_callback (GtkAction *action,
}
void
image_convert_rgb_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
gimp_image_convert (gimage, GIMP_RGB, 0, 0, FALSE, FALSE, 0, NULL);
gimp_image_flush (gimage);
}
void
image_convert_grayscale_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
return_if_no_image (gimage, data);
gimp_image_convert (gimage, GIMP_GRAY, 0, 0, FALSE, FALSE, 0, NULL);
gimp_image_flush (gimage);
}
void
image_convert_indexed_cmd_callback (GtkAction *action,
gpointer data)
image_convert_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpImage *gimage;
GtkWidget *widget;
GtkWidget *dialog;
return_if_no_image (gimage, data);
return_if_no_widget (widget, data);
dialog = convert_dialog_new (gimage, widget);
gtk_widget_show (dialog);
switch ((GimpImageBaseType) value)
{
case GIMP_RGB:
case GIMP_GRAY:
gimp_image_convert (gimage, (GimpImageBaseType) value,
0, 0, FALSE, FALSE, 0, NULL);
gimp_image_flush (gimage);
break;
case GIMP_INDEXED:
gtk_widget_show (convert_dialog_new (gimage, widget));
break;
}
}
void
......
......@@ -20,41 +20,38 @@
#define __IMAGE_COMMANDS_H__
void image_new_cmd_callback (GtkAction *action,
gpointer data);
void image_new_from_image_cmd_callback (GtkAction *action,
gpointer data);
void image_convert_rgb_cmd_callback (GtkAction *action,
gpointer data);
void image_convert_grayscale_cmd_callback (GtkAction *action,
gpointer data);
void image_convert_indexed_cmd_callback (GtkAction *action,
gpointer data);
void image_resize_cmd_callback (GtkAction *action,
gpointer data);
void image_scale_cmd_callback (GtkAction *action,
gpointer data);
void image_flip_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void image_rotate_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void image_crop_cmd_callback (GtkAction *action,
gpointer data);
void image_duplicate_cmd_callback (GtkAction *action,
gpointer data);
void image_merge_layers_cmd_callback (GtkAction *action,
gpointer data);
void image_flatten_image_cmd_callback (GtkAction *action,
gpointer data);
void image_configure_grid_cmd_callback (GtkAction *action,
gpointer data);
void image_new_cmd_callback (GtkAction *action,
gpointer data);
void image_new_from_image_cmd_callback (GtkAction *action,
gpointer data);
void image_convert_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void image_resize_cmd_callback (GtkAction *action,
gpointer data);
void image_scale_cmd_callback (GtkAction *action,
gpointer data);
void image_flip_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void image_rotate_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void image_crop_cmd_callback (GtkAction *action,
gpointer data);
void image_duplicate_cmd_callback (GtkAction *action,
gpointer data);
void image_merge_layers_cmd_callback (GtkAction *action,
gpointer data);
void image_flatten_image_cmd_callback (GtkAction *action,
gpointer data);
void image_configure_grid_cmd_callback (GtkAction *action,
gpointer data);
#endif /* __IMAGE_COMMANDS_H__ */
......@@ -170,20 +170,23 @@ static GimpActionEntry layers_actions[] =
G_CALLBACK (layers_mask_add_cmd_callback),
GIMP_HELP_LAYER_MASK_ADD },
{ "layers-alpha-add", GIMP_STOCK_TRANSPARENCY,
N_("Add Alpha C_hannel"), NULL, NULL,
G_CALLBACK (layers_alpha_add_cmd_callback),
GIMP_HELP_LAYER_ALPHA_ADD }
};
static GimpEnumActionEntry layers_mask_apply_actions[] =
{
{ "layers-mask-apply", NULL,
N_("Apply Layer _Mask"), NULL, NULL,
G_CALLBACK (layers_mask_apply_cmd_callback),
GIMP_MASK_APPLY,
GIMP_HELP_LAYER_MASK_APPLY },
{ "layers-mask-delete", GTK_STOCK_DELETE,
N_("Delete Layer Mas_k"), "", NULL,
G_CALLBACK (layers_mask_delete_cmd_callback),
GIMP_HELP_LAYER_MASK_DELETE },
{ "layers-alpha-add", GIMP_STOCK_TRANSPARENCY,
N_("Add Alpha C_hannel"), NULL, NULL,
G_CALLBACK (layers_alpha_add_cmd_callback),
GIMP_HELP_LAYER_ALPHA_ADD }
GIMP_MASK_DISCARD,
GIMP_HELP_LAYER_MASK_DELETE }
};
static GimpEnumActionEntry layers_mask_to_selection_actions[] =
......@@ -239,6 +242,11 @@ layers_actions_setup (GimpActionGroup *group)
layers_actions,
G_N_ELEMENTS (layers_actions));
gimp_action_group_add_enum_actions (group,
layers_mask_apply_actions,
G_N_ELEMENTS (layers_mask_apply_actions),
G_CALLBACK (layers_mask_apply_cmd_callback));
gimp_action_group_add_enum_actions (group,
layers_mask_to_selection_actions,
G_N_ELEMENTS (layers_mask_to_selection_actions),
......
......@@ -424,30 +424,19 @@ layers_mask_add_cmd_callback (GtkAction *action,
void
layers_mask_apply_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpImage *gimage;
GimpLayer *layer;
GimpImage *gimage;
GimpLayer *layer;
GimpMaskApplyMode mode;
return_if_no_layer (gimage, layer, data);
if (gimp_layer_get_mask (layer))
{
gimp_layer_apply_mask (layer, GIMP_MASK_APPLY, TRUE);
gimp_image_flush (gimage);
}
}
void
layers_mask_delete_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpLayer *layer;
return_if_no_layer (gimage, layer, data);
mode = (GimpMaskApplyMode) value;
if (gimp_layer_get_mask (layer))
{
gimp_layer_apply_mask (layer, GIMP_MASK_DISCARD, TRUE);
gimp_layer_apply_mask (layer, mode, TRUE);
gimp_image_flush (gimage);
}
}
......
......@@ -68,8 +68,7 @@ void layers_crop_cmd_callback (GtkAction *action,
void layers_mask_add_cmd_callback (GtkAction *action,
gpointer data);
void layers_mask_apply_cmd_callback (GtkAction *action,
gpointer data);
void layers_mask_delete_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void layers_mask_to_selection_cmd_callback (GtkAction *action,
gint value,
......
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