Commit 58d17e70 authored by Michael Natterer's avatar Michael Natterer 😴

app: add Image -> Color Management -> Color Management Enabled

To enable/disable color management for the image.
parent e69bb901
...@@ -173,6 +173,16 @@ static const GimpActionEntry image_actions[] = ...@@ -173,6 +173,16 @@ static const GimpActionEntry image_actions[] =
GIMP_HELP_IMAGE_PROPERTIES } GIMP_HELP_IMAGE_PROPERTIES }
}; };
static const GimpToggleActionEntry image_toggle_actions[] =
{
{ "image-color-management-enabled", NULL,
NC_("image-action", "_Enable Color Management"), NULL,
NC_("image-action", "Whether the image is color managed"),
G_CALLBACK (image_color_management_enabled_cmd_callback),
TRUE,
GIMP_HELP_IMAGE_COLOR_MANAGEMENT_ENABLED }
};
static const GimpRadioActionEntry image_convert_base_type_actions[] = static const GimpRadioActionEntry image_convert_base_type_actions[] =
{ {
{ "image-convert-rgb", GIMP_STOCK_CONVERT_RGB, { "image-convert-rgb", GIMP_STOCK_CONVERT_RGB,
...@@ -289,6 +299,10 @@ image_actions_setup (GimpActionGroup *group) ...@@ -289,6 +299,10 @@ image_actions_setup (GimpActionGroup *group)
image_actions, image_actions,
G_N_ELEMENTS (image_actions)); G_N_ELEMENTS (image_actions));
gimp_action_group_add_toggle_actions (group, "image-action",
image_toggle_actions,
G_N_ELEMENTS (image_toggle_actions));
gimp_action_group_add_radio_actions (group, "image-convert-action", gimp_action_group_add_radio_actions (group, "image-convert-action",
image_convert_base_type_actions, image_convert_base_type_actions,
G_N_ELEMENTS (image_convert_base_type_actions), G_N_ELEMENTS (image_convert_base_type_actions),
...@@ -338,6 +352,7 @@ image_actions_update (GimpActionGroup *group, ...@@ -338,6 +352,7 @@ image_actions_update (GimpActionGroup *group,
gboolean lp = FALSE; gboolean lp = FALSE;
gboolean sel = FALSE; gboolean sel = FALSE;
gboolean groups = FALSE; gboolean groups = FALSE;
gboolean color_managed = FALSE;
gboolean profile = FALSE; gboolean profile = FALSE;
if (image) if (image)
...@@ -393,6 +408,7 @@ image_actions_update (GimpActionGroup *group, ...@@ -393,6 +408,7 @@ image_actions_update (GimpActionGroup *group,
groups = ! gimp_item_stack_is_flat (GIMP_ITEM_STACK (layers)); groups = ! gimp_item_stack_is_flat (GIMP_ITEM_STACK (layers));
color_managed = gimp_image_get_is_color_managed (image);
profile = (gimp_image_get_color_profile (image) != NULL); profile = (gimp_image_get_color_profile (image) != NULL);
} }
...@@ -400,6 +416,8 @@ image_actions_update (GimpActionGroup *group, ...@@ -400,6 +416,8 @@ image_actions_update (GimpActionGroup *group,
gimp_action_group_set_action_label (group, action, (label)) gimp_action_group_set_action_label (group, action, (label))
#define SET_SENSITIVE(action,condition) \ #define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0) gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
#define SET_ACTIVE(action,condition) \
gimp_action_group_set_action_active (group, action, (condition) != 0)
if (profile) if (profile)
{ {
...@@ -430,6 +448,9 @@ image_actions_update (GimpActionGroup *group, ...@@ -430,6 +448,9 @@ image_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("image-convert-gamma", image); SET_SENSITIVE ("image-convert-gamma", image);
SET_SENSITIVE ("image-convert-linear", image && !is_indexed); SET_SENSITIVE ("image-convert-linear", image && !is_indexed);
SET_SENSITIVE ("image-color-management-enabled", image);
SET_ACTIVE ("image-color-management-enabled", image && color_managed);
SET_SENSITIVE ("image-color-profile-assign", image); SET_SENSITIVE ("image-color-profile-assign", image);
SET_SENSITIVE ("image-color-profile-convert", image); SET_SENSITIVE ("image-color-profile-convert", image);
SET_SENSITIVE ("image-color-profile-discard", image && profile); SET_SENSITIVE ("image-color-profile-discard", image && profile);
...@@ -456,4 +477,5 @@ image_actions_update (GimpActionGroup *group, ...@@ -456,4 +477,5 @@ image_actions_update (GimpActionGroup *group,
#undef SET_LABEL #undef SET_LABEL
#undef SET_SENSITIVE #undef SET_SENSITIVE
#undef SET_ACTIVE
} }
...@@ -326,6 +326,23 @@ image_convert_gamma_cmd_callback (GtkAction *action, ...@@ -326,6 +326,23 @@ image_convert_gamma_cmd_callback (GtkAction *action,
gimp_image_flush (image); gimp_image_flush (image);
} }
void
image_color_management_enabled_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
gboolean enabled;
return_if_no_image (image, data);
enabled = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (enabled != gimp_image_get_is_color_managed (image))
{
gimp_image_set_is_color_managed (image, enabled, TRUE);
gimp_image_flush (image);
}
}
static void static void
image_profile_assign_dialog_unset (GimpImage *image) image_profile_assign_dialog_unset (GimpImage *image)
{ {
......
...@@ -32,6 +32,8 @@ void image_convert_gamma_cmd_callback (GtkAction *action, ...@@ -32,6 +32,8 @@ void image_convert_gamma_cmd_callback (GtkAction *action,
GtkAction *current, GtkAction *current,
gpointer data); gpointer data);
void image_color_management_enabled_cmd_callback (GtkAction *action,
gpointer data);
void image_color_profile_assign_cmd_callback (GtkAction *action, void image_color_profile_assign_cmd_callback (GtkAction *action,
gpointer data); gpointer data);
void image_color_profile_convert_cmd_callback (GtkAction *action, void image_color_profile_convert_cmd_callback (GtkAction *action,
......
...@@ -152,6 +152,7 @@ ...@@ -152,6 +152,7 @@
#define GIMP_HELP_IMAGE_DUPLICATE "gimp-image-duplicate" #define GIMP_HELP_IMAGE_DUPLICATE "gimp-image-duplicate"
#define GIMP_HELP_IMAGE_MERGE_LAYERS "gimp-image-merge-layers" #define GIMP_HELP_IMAGE_MERGE_LAYERS "gimp-image-merge-layers"
#define GIMP_HELP_IMAGE_FLATTEN "gimp-image-flatten" #define GIMP_HELP_IMAGE_FLATTEN "gimp-image-flatten"
#define GIMP_HELP_IMAGE_COLOR_MANAGEMENT_ENABLED "gimp-image-color-management-enabled"
#define GIMP_HELP_IMAGE_COLOR_PROFILE_ASSIGN "gimp-image-color-profile-assign" #define GIMP_HELP_IMAGE_COLOR_PROFILE_ASSIGN "gimp-image-color-profile-assign"
#define GIMP_HELP_IMAGE_COLOR_PROFILE_CONVERT "gimp-image-color-profile-convert" #define GIMP_HELP_IMAGE_COLOR_PROFILE_CONVERT "gimp-image-color-profile-convert"
#define GIMP_HELP_IMAGE_COLOR_PROFILE_DISCARD "gimp-image-color-profile-discard" #define GIMP_HELP_IMAGE_COLOR_PROFILE_DISCARD "gimp-image-color-profile-discard"
......
...@@ -352,6 +352,8 @@ ...@@ -352,6 +352,8 @@
<separator /> <separator />
</menu> </menu>
<menu action="image-color-management-menu" name="Color Management"> <menu action="image-color-management-menu" name="Color Management">
<menuitem action="image-color-management-enabled" />
<separator />
<menuitem action="image-color-profile-assign" /> <menuitem action="image-color-profile-assign" />
<menuitem action="image-color-profile-convert" /> <menuitem action="image-color-profile-convert" />
<menuitem action="image-color-profile-discard" /> <menuitem action="image-color-profile-discard" />
......
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