[gimp] app: add Image -> Color Management -> Color Management Enabled
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add Image -> Color Management -> Color Management Enabled
- Date: Sun, 8 May 2016 17:53:50 +0000 (UTC)
commit 58d17e70beac8da5d24ac08764e53a4e1476113b
Author: Michael Natterer <mitch gimp org>
Date: Sun May 8 19:27:29 2016 +0200
app: add Image -> Color Management -> Color Management Enabled
To enable/disable color management for the image.
app/actions/image-actions.c | 40 +++++++++++++----
app/actions/image-commands.c | 17 +++++++
app/actions/image-commands.h | 100 +++++++++++++++++++++--------------------
app/widgets/gimphelp-ids.h | 1 +
menus/image-menu.xml.in | 2 +
5 files changed, 102 insertions(+), 58 deletions(-)
---
diff --git a/app/actions/image-actions.c b/app/actions/image-actions.c
index 27d7bba..d0be003 100644
--- a/app/actions/image-actions.c
+++ b/app/actions/image-actions.c
@@ -173,6 +173,16 @@ static const GimpActionEntry image_actions[] =
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[] =
{
{ "image-convert-rgb", GIMP_STOCK_CONVERT_RGB,
@@ -289,6 +299,10 @@ image_actions_setup (GimpActionGroup *group)
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",
image_convert_base_type_actions,
G_N_ELEMENTS (image_convert_base_type_actions),
@@ -331,14 +345,15 @@ void
image_actions_update (GimpActionGroup *group,
gpointer data)
{
- GimpImage *image = action_data_get_image (data);
- gboolean is_indexed = FALSE;
- gboolean is_u8_gamma = FALSE;
- gboolean aux = FALSE;
- gboolean lp = FALSE;
- gboolean sel = FALSE;
- gboolean groups = FALSE;
- gboolean profile = FALSE;
+ GimpImage *image = action_data_get_image (data);
+ gboolean is_indexed = FALSE;
+ gboolean is_u8_gamma = FALSE;
+ gboolean aux = FALSE;
+ gboolean lp = FALSE;
+ gboolean sel = FALSE;
+ gboolean groups = FALSE;
+ gboolean color_managed = FALSE;
+ gboolean profile = FALSE;
if (image)
{
@@ -393,13 +408,16 @@ image_actions_update (GimpActionGroup *group,
groups = ! gimp_item_stack_is_flat (GIMP_ITEM_STACK (layers));
- profile = (gimp_image_get_color_profile (image) != NULL);
+ color_managed = gimp_image_get_is_color_managed (image);
+ profile = (gimp_image_get_color_profile (image) != NULL);
}
#define SET_LABEL(action,label) \
gimp_action_group_set_action_label (group, action, (label))
#define SET_SENSITIVE(action,condition) \
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)
{
@@ -430,6 +448,9 @@ image_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("image-convert-gamma", image);
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-convert", image);
SET_SENSITIVE ("image-color-profile-discard", image && profile);
@@ -456,4 +477,5 @@ image_actions_update (GimpActionGroup *group,
#undef SET_LABEL
#undef SET_SENSITIVE
+#undef SET_ACTIVE
}
diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c
index a8cc837..f97e909 100644
--- a/app/actions/image-commands.c
+++ b/app/actions/image-commands.c
@@ -326,6 +326,23 @@ image_convert_gamma_cmd_callback (GtkAction *action,
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
image_profile_assign_dialog_unset (GimpImage *image)
{
diff --git a/app/actions/image-commands.h b/app/actions/image-commands.h
index 5754e49..b57d41a 100644
--- a/app/actions/image-commands.h
+++ b/app/actions/image-commands.h
@@ -19,61 +19,63 @@
#define __IMAGE_COMMANDS_H__
-void image_new_cmd_callback (GtkAction *action,
- gpointer data);
+void image_new_cmd_callback (GtkAction *action,
+ gpointer data);
-void image_convert_base_type_cmd_callback (GtkAction *action,
- GtkAction *current,
- gpointer data);
-void image_convert_precision_cmd_callback (GtkAction *action,
- GtkAction *current,
- gpointer data);
-void image_convert_gamma_cmd_callback (GtkAction *action,
- GtkAction *current,
- gpointer data);
+void image_convert_base_type_cmd_callback (GtkAction *action,
+ GtkAction *current,
+ gpointer data);
+void image_convert_precision_cmd_callback (GtkAction *action,
+ GtkAction *current,
+ gpointer data);
+void image_convert_gamma_cmd_callback (GtkAction *action,
+ GtkAction *current,
+ gpointer data);
-void image_color_profile_assign_cmd_callback (GtkAction *action,
- gpointer data);
-void image_color_profile_convert_cmd_callback (GtkAction *action,
- gpointer data);
-void image_color_profile_discard_cmd_callback (GtkAction *action,
- gpointer data);
-void image_color_profile_save_cmd_callback (GtkAction *action,
- gpointer data);
+void image_color_management_enabled_cmd_callback (GtkAction *action,
+ gpointer data);
+void image_color_profile_assign_cmd_callback (GtkAction *action,
+ gpointer data);
+void image_color_profile_convert_cmd_callback (GtkAction *action,
+ gpointer data);
+void image_color_profile_discard_cmd_callback (GtkAction *action,
+ gpointer data);
+void image_color_profile_save_cmd_callback (GtkAction *action,
+ gpointer data);
-void image_resize_cmd_callback (GtkAction *action,
- gpointer data);
-void image_resize_to_layers_cmd_callback (GtkAction *action,
- gpointer data);
-void image_resize_to_selection_cmd_callback (GtkAction *action,
- gpointer data);
-void image_print_size_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_to_selection_cmd_callback (GtkAction *action,
- gpointer data);
-void image_crop_to_content_cmd_callback (GtkAction *action,
- gpointer data);
+void image_resize_cmd_callback (GtkAction *action,
+ gpointer data);
+void image_resize_to_layers_cmd_callback (GtkAction *action,
+ gpointer data);
+void image_resize_to_selection_cmd_callback (GtkAction *action,
+ gpointer data);
+void image_print_size_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_to_selection_cmd_callback (GtkAction *action,
+ gpointer data);
+void image_crop_to_content_cmd_callback (GtkAction *action,
+ gpointer data);
-void image_duplicate_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_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_properties_cmd_callback (GtkAction *action,
- gpointer data);
+void image_configure_grid_cmd_callback (GtkAction *action,
+ gpointer data);
+void image_properties_cmd_callback (GtkAction *action,
+ gpointer data);
#endif /* __IMAGE_COMMANDS_H__ */
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index 86687e9..6b05fe4 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -152,6 +152,7 @@
#define GIMP_HELP_IMAGE_DUPLICATE "gimp-image-duplicate"
#define GIMP_HELP_IMAGE_MERGE_LAYERS "gimp-image-merge-layers"
#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_CONVERT "gimp-image-color-profile-convert"
#define GIMP_HELP_IMAGE_COLOR_PROFILE_DISCARD "gimp-image-color-profile-discard"
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index cdc76a1..59aef67 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -352,6 +352,8 @@
<separator />
</menu>
<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-convert" />
<menuitem action="image-color-profile-discard" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]