use radio items for the Image mode as suggested in bug #344871.
2006-06-14 Sven Neumann <sven@gimp.org> * app/actions/image-actions.c: use radio items for the Image mode as suggested in bug #344871. * app/actions/image-commands.[ch] (image_convert_cmd_callback): changed accordingly.
This commit is contained in:

committed by
Sven Neumann

parent
940998a946
commit
ab22402033
@ -1,3 +1,11 @@
|
||||
2006-06-14 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/actions/image-actions.c: use radio items for the Image mode
|
||||
as suggested in bug #344871.
|
||||
|
||||
* app/actions/image-commands.[ch] (image_convert_cmd_callback):
|
||||
changed accordingly.
|
||||
|
||||
2006-06-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* tools/pdbgen/pdb/[many].pdb: in help texts, refer to other
|
||||
|
@ -141,25 +141,22 @@ static const GimpActionEntry image_actions[] =
|
||||
GIMP_HELP_IMAGE_PROPERTIES }
|
||||
};
|
||||
|
||||
static const GimpEnumActionEntry image_convert_actions[] =
|
||||
static const GimpRadioActionEntry image_convert_actions[] =
|
||||
{
|
||||
{ "image-convert-rgb", GIMP_STOCK_CONVERT_RGB,
|
||||
N_("_RGB"), NULL,
|
||||
N_("Convert the image to the RGB colorspace"),
|
||||
GIMP_RGB, FALSE,
|
||||
GIMP_HELP_IMAGE_CONVERT_RGB },
|
||||
GIMP_RGB, GIMP_HELP_IMAGE_CONVERT_RGB },
|
||||
|
||||
{ "image-convert-grayscale", GIMP_STOCK_CONVERT_GRAYSCALE,
|
||||
N_("_Grayscale"), NULL,
|
||||
N_("Convert the image to grayscale"),
|
||||
GIMP_GRAY, FALSE,
|
||||
GIMP_HELP_IMAGE_CONVERT_GRAYSCALE },
|
||||
GIMP_GRAY, GIMP_HELP_IMAGE_CONVERT_GRAYSCALE },
|
||||
|
||||
{ "image-convert-indexed", GIMP_STOCK_CONVERT_INDEXED,
|
||||
N_("_Indexed..."), NULL,
|
||||
N_("Convert the image to indexed colors"),
|
||||
GIMP_INDEXED, FALSE,
|
||||
GIMP_HELP_IMAGE_CONVERT_INDEXED }
|
||||
GIMP_INDEXED, GIMP_HELP_IMAGE_CONVERT_INDEXED }
|
||||
};
|
||||
|
||||
static const GimpEnumActionEntry image_flip_actions[] =
|
||||
@ -212,10 +209,11 @@ image_actions_setup (GimpActionGroup *group)
|
||||
"image-new-from-image");
|
||||
gtk_action_set_accel_path (action, "<Actions>/image/image-new");
|
||||
|
||||
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_radio_actions (group,
|
||||
image_convert_actions,
|
||||
G_N_ELEMENTS (image_convert_actions),
|
||||
NULL, 0,
|
||||
G_CALLBACK (image_convert_cmd_callback));
|
||||
|
||||
gimp_action_group_add_enum_actions (group,
|
||||
image_flip_actions,
|
||||
@ -257,12 +255,14 @@ image_actions_update (GimpActionGroup *group,
|
||||
sel = ! gimp_channel_is_empty (gimp_image_get_mask (image));
|
||||
}
|
||||
|
||||
#define SET_ACTIVE(action,condition) \
|
||||
gimp_action_group_set_action_active (group, action, (condition) != 0)
|
||||
#define SET_SENSITIVE(action,condition) \
|
||||
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
|
||||
|
||||
SET_SENSITIVE ("image-convert-rgb", image && ! is_rgb);
|
||||
SET_SENSITIVE ("image-convert-grayscale", image && ! is_gray);
|
||||
SET_SENSITIVE ("image-convert-indexed", image && ! is_indexed);
|
||||
SET_ACTIVE ("image-convert-rgb", image && is_rgb);
|
||||
SET_ACTIVE ("image-convert-grayscale", image && is_gray);
|
||||
SET_ACTIVE ("image-convert-indexed", image && is_indexed);
|
||||
|
||||
SET_SENSITIVE ("image-flip-horizontal", image);
|
||||
SET_SENSITIVE ("image-flip-vertical", image);
|
||||
|
@ -148,22 +148,27 @@ image_new_from_image_cmd_callback (GtkAction *action,
|
||||
|
||||
void
|
||||
image_convert_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
GtkAction *current,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GtkWidget *widget;
|
||||
GimpDisplay *display;
|
||||
GimpImage *image;
|
||||
GtkWidget *widget;
|
||||
GimpDisplay *display;
|
||||
GimpImageBaseType value;
|
||||
return_if_no_image (image, data);
|
||||
return_if_no_widget (widget, data);
|
||||
return_if_no_display (display, data);
|
||||
|
||||
switch ((GimpImageBaseType) value)
|
||||
value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
|
||||
|
||||
if (value == gimp_image_base_type (image))
|
||||
return;
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case GIMP_RGB:
|
||||
case GIMP_GRAY:
|
||||
gimp_image_convert (image, (GimpImageBaseType) value,
|
||||
0, 0, FALSE, FALSE, 0, NULL, NULL);
|
||||
gimp_image_convert (image, value, 0, 0, FALSE, FALSE, 0, NULL, NULL);
|
||||
gimp_image_flush (image);
|
||||
break;
|
||||
|
||||
|
@ -26,7 +26,7 @@ void image_new_from_image_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void image_convert_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
GtkAction *current,
|
||||
gpointer data);
|
||||
|
||||
void image_resize_cmd_callback (GtkAction *action,
|
||||
|
Reference in New Issue
Block a user