[gimp] app: remove the image's "Enable Color Management" toggle
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: remove the image's "Enable Color Management" toggle
- Date: Sun, 7 Oct 2018 14:26:04 +0000 (UTC)
commit c399b894a84a2fa3d87c0232793d1a64085f6b3b
Author: Michael Natterer <mitch gimp org>
Date: Sun Oct 7 16:16:21 2018 +0200
app: remove the image's "Enable Color Management" toggle
It was not doing anything right since space invasion. We now treat the
built-in sRGB profile like any other profile and never bypass
conversions based on some weird toggle.
Instead, introduce a "Use sRGB Profile" toggle which, when enabled,
hides whatever profile away so the image actually uses the built-in
sRGB profile.
This is different from discarding and then re-assigning the same
profile only by being faster and more convenient.
app/actions/image-actions.c | 43 ++++++------
app/actions/image-commands.c | 12 ++--
app/actions/image-commands.h | 2 +-
app/core/core-enums.c | 4 +-
app/core/core-enums.h | 2 +-
app/core/gimpimage-color-profile.c | 123 ++++++++++++++++++++++++++---------
app/core/gimpimage-color-profile.h | 11 +++-
app/core/gimpimage-duplicate.c | 8 +--
app/core/gimpimage-new.c | 6 --
app/core/gimpimage-private.h | 2 +-
app/core/gimpimage-undo-push.c | 6 +-
app/core/gimpimage-undo-push.h | 2 +-
app/core/gimpimage.c | 12 ++--
app/core/gimpimageundo.c | 18 ++---
app/core/gimpimageundo.h | 2 +-
app/core/gimplayer-new.c | 8 ---
app/core/gimplayer.c | 3 +-
app/core/gimptemplate.c | 49 +++++++-------
app/core/gimptemplate.h | 1 -
app/display/gimpdisplayshell-title.c | 20 ++----
app/widgets/gimphelp-ids.h | 2 +-
app/widgets/gimptemplateeditor.c | 8 ---
menus/image-menu.xml.in | 2 +-
23 files changed, 187 insertions(+), 159 deletions(-)
---
diff --git a/app/actions/image-actions.c b/app/actions/image-actions.c
index 3b13a62912..fc290e636f 100644
--- a/app/actions/image-actions.c
+++ b/app/actions/image-actions.c
@@ -177,14 +177,14 @@ static const GimpActionEntry image_actions[] =
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. Disabling "
- "color management is equivalent to assigning a built-in sRGB "
- "color profile. Better leave color management enabled."),
- G_CALLBACK (image_color_management_enabled_cmd_callback),
+ { "image-color-profile-use-srgb", NULL,
+ NC_("image-action", "Use _sRGB Profile"), NULL,
+ NC_("image-action", "Temporarily use an sRGB profile for the image. "
+ "This is the same as discarding the image's color profile, but "
+ "allows to easily restore the profile."),
+ G_CALLBACK (image_color_profile_use_srgb_cmd_callback),
TRUE,
- GIMP_HELP_IMAGE_COLOR_MANAGEMENT_ENABLED }
+ GIMP_HELP_IMAGE_COLOR_PROFILE_USE_SRGB }
};
static const GimpRadioActionEntry image_convert_base_type_actions[] =
@@ -349,16 +349,17 @@ 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 is_double = FALSE;
- gboolean aux = FALSE;
- gboolean lp = FALSE;
- gboolean sel = FALSE;
- gboolean groups = FALSE;
- gboolean color_managed = FALSE;
- gboolean profile = FALSE;
+ GimpImage *image = action_data_get_image (data);
+ gboolean is_indexed = FALSE;
+ gboolean is_u8_gamma = FALSE;
+ gboolean is_double = FALSE;
+ gboolean aux = FALSE;
+ gboolean lp = FALSE;
+ gboolean sel = FALSE;
+ gboolean groups = FALSE;
+ gboolean profile_srgb = FALSE;
+ gboolean profile_hidden = FALSE;
+ gboolean profile = FALSE;
if (image)
{
@@ -417,8 +418,8 @@ image_actions_update (GimpActionGroup *group,
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_srgb = gimp_image_get_use_srgb_profile (image, &profile_hidden);
+ profile = (gimp_image_get_color_profile (image) != NULL);
}
#define SET_LABEL(action,label) \
@@ -462,8 +463,8 @@ 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-use-srgb", image && (profile || profile_hidden));
+ SET_ACTIVE ("image-color-profile-use-srgb", image && profile_srgb);
SET_SENSITIVE ("image-color-profile-assign", image);
SET_SENSITIVE ("image-color-profile-convert", image);
diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c
index 4c79330670..bf1e4831d8 100644
--- a/app/actions/image-commands.c
+++ b/app/actions/image-commands.c
@@ -421,18 +421,18 @@ image_convert_trc_cmd_callback (GtkAction *action,
}
void
-image_color_management_enabled_cmd_callback (GtkAction *action,
- gpointer data)
+image_color_profile_use_srgb_cmd_callback (GtkAction *action,
+ gpointer data)
{
GimpImage *image;
- gboolean enabled;
+ gboolean use_srgb;
return_if_no_image (image, data);
- enabled = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ use_srgb = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- if (enabled != gimp_image_get_is_color_managed (image))
+ if (use_srgb != gimp_image_get_use_srgb_profile (image, NULL))
{
- gimp_image_set_is_color_managed (image, enabled, TRUE);
+ gimp_image_set_use_srgb_profile (image, use_srgb);
gimp_image_flush (image);
}
}
diff --git a/app/actions/image-commands.h b/app/actions/image-commands.h
index fc5ee4d4c0..a397657328 100644
--- a/app/actions/image-commands.h
+++ b/app/actions/image-commands.h
@@ -34,7 +34,7 @@ void image_convert_trc_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data);
-void image_color_management_enabled_cmd_callback (GtkAction *action,
+void image_color_profile_use_srgb_cmd_callback (GtkAction *action,
gpointer data);
void image_color_profile_assign_cmd_callback (GtkAction *action,
gpointer data);
diff --git a/app/core/core-enums.c b/app/core/core-enums.c
index 3561f06531..ff935015a9 100644
--- a/app/core/core-enums.c
+++ b/app/core/core-enums.c
@@ -1075,7 +1075,7 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_IMAGE_GRID, "GIMP_UNDO_IMAGE_GRID", "image-grid" },
{ GIMP_UNDO_IMAGE_METADATA, "GIMP_UNDO_IMAGE_METADATA", "image-metadata" },
{ GIMP_UNDO_IMAGE_COLORMAP, "GIMP_UNDO_IMAGE_COLORMAP", "image-colormap" },
- { GIMP_UNDO_IMAGE_COLOR_MANAGED, "GIMP_UNDO_IMAGE_COLOR_MANAGED", "image-color-managed" },
+ { GIMP_UNDO_IMAGE_HIDDEN_PROFILE, "GIMP_UNDO_IMAGE_HIDDEN_PROFILE", "image-hidden-profile" },
{ GIMP_UNDO_GUIDE, "GIMP_UNDO_GUIDE", "guide" },
{ GIMP_UNDO_SAMPLE_POINT, "GIMP_UNDO_SAMPLE_POINT", "sample-point" },
{ GIMP_UNDO_DRAWABLE, "GIMP_UNDO_DRAWABLE", "drawable" },
@@ -1174,7 +1174,7 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_IMAGE_GRID, NC_("undo-type", "Grid"), NULL },
{ GIMP_UNDO_IMAGE_METADATA, NC_("undo-type", "Change metadata"), NULL },
{ GIMP_UNDO_IMAGE_COLORMAP, NC_("undo-type", "Change indexed palette"), NULL },
- { GIMP_UNDO_IMAGE_COLOR_MANAGED, NC_("undo-type", "Change color managed state"), NULL },
+ { GIMP_UNDO_IMAGE_HIDDEN_PROFILE, NC_("undo-type", "Hide/Unhide color profile"), NULL },
{ GIMP_UNDO_GUIDE, NC_("undo-type", "Guide"), NULL },
{ GIMP_UNDO_SAMPLE_POINT, NC_("undo-type", "Sample Point"), NULL },
{ GIMP_UNDO_DRAWABLE, NC_("undo-type", "Layer/Channel"), NULL },
diff --git a/app/core/core-enums.h b/app/core/core-enums.h
index 8a53014198..fa0d72fd2b 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -510,7 +510,7 @@ typedef enum /*< pdb-skip >*/
GIMP_UNDO_IMAGE_GRID, /*< desc="Grid" >*/
GIMP_UNDO_IMAGE_METADATA, /*< desc="Change metadata" >*/
GIMP_UNDO_IMAGE_COLORMAP, /*< desc="Change indexed palette" >*/
- GIMP_UNDO_IMAGE_COLOR_MANAGED, /*< desc="Change color managed state" >*/
+ GIMP_UNDO_IMAGE_HIDDEN_PROFILE, /*< desc="Hide/Unhide color profile" >*/
GIMP_UNDO_GUIDE, /*< desc="Guide" >*/
GIMP_UNDO_SAMPLE_POINT, /*< desc="Sample Point" >*/
GIMP_UNDO_DRAWABLE, /*< desc="Layer/Channel" >*/
diff --git a/app/core/gimpimage-color-profile.c b/app/core/gimpimage-color-profile.c
index 1929c9b813..649650ad0e 100644
--- a/app/core/gimpimage-color-profile.c
+++ b/app/core/gimpimage-color-profile.c
@@ -77,34 +77,104 @@ static void gimp_image_create_color_transforms (GimpImage *ima
/* public functions */
gboolean
-gimp_image_get_is_color_managed (GimpImage *image)
+gimp_image_get_use_srgb_profile (GimpImage *image,
+ gboolean *hidden_profile)
{
+ GimpImagePrivate *private;
+
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
- return GIMP_IMAGE_GET_PRIVATE (image)->is_color_managed;
+ private = GIMP_IMAGE_GET_PRIVATE (image);
+
+ if (hidden_profile)
+ *hidden_profile = (private->hidden_profile != NULL);
+
+ return private->color_profile == NULL;
}
void
-gimp_image_set_is_color_managed (GimpImage *image,
- gboolean is_color_managed,
- gboolean push_undo)
+gimp_image_set_use_srgb_profile (GimpImage *image,
+ gboolean use_srgb)
{
GimpImagePrivate *private;
+ gboolean old_use_srgb;
g_return_if_fail (GIMP_IS_IMAGE (image));
private = GIMP_IMAGE_GET_PRIVATE (image);
- is_color_managed = is_color_managed ? TRUE : FALSE;
+ old_use_srgb = (private->color_profile == NULL);
+
+ use_srgb = use_srgb ? TRUE : FALSE;
+
+ if (use_srgb == old_use_srgb)
+ return;
- if (is_color_managed != private->is_color_managed)
+ if (use_srgb)
{
- if (push_undo)
- gimp_image_undo_push_image_color_managed (image, NULL);
+ GimpColorProfile *profile = gimp_image_get_color_profile (image);
+
+ if (profile)
+ {
+ gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_CONVERT,
+ _("Enable 'Use sRGB Profile'"));
- private->is_color_managed = is_color_managed;
+ g_object_ref (profile);
+ gimp_image_assign_color_profile (image, NULL, NULL, NULL);
+ _gimp_image_set_hidden_profile (image, profile, TRUE);
+ g_object_unref (profile);
- gimp_color_managed_profile_changed (GIMP_COLOR_MANAGED (image));
+ gimp_image_undo_group_end (image);
+ }
+ }
+ else
+ {
+ GimpColorProfile *hidden = _gimp_image_get_hidden_profile (image);
+
+ if (hidden)
+ {
+ gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_CONVERT,
+ _("Disable 'Use sRGB Profile'"));
+
+ g_object_ref (hidden);
+ gimp_image_assign_color_profile (image, hidden, NULL, NULL);
+ g_object_unref (hidden);
+
+ gimp_image_undo_group_end (image);
+ }
+ }
+}
+
+GimpColorProfile *
+_gimp_image_get_hidden_profile (GimpImage *image)
+{
+ GimpImagePrivate *private;
+
+ g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
+
+ private = GIMP_IMAGE_GET_PRIVATE (image);
+
+ return private->hidden_profile;
+}
+
+void
+_gimp_image_set_hidden_profile (GimpImage *image,
+ GimpColorProfile *profile,
+ gboolean push_undo)
+{
+ GimpImagePrivate *private;
+
+ g_return_if_fail (GIMP_IS_IMAGE (image));
+ g_return_if_fail (profile == NULL || GIMP_IS_COLOR_PROFILE (profile));
+
+ private = GIMP_IMAGE_GET_PRIVATE (image);
+
+ if (profile != private->hidden_profile)
+ {
+ if (push_undo)
+ gimp_image_undo_push_image_hidden_profile (image, NULL);
+
+ g_set_object (&private->hidden_profile, profile);
}
}
@@ -408,8 +478,7 @@ gimp_image_assign_color_profile (GimpImage *image,
_("Assign color profile") :
_("Discard color profile"));
- if (dest_profile)
- gimp_image_set_is_color_managed (image, TRUE, TRUE);
+ _gimp_image_set_hidden_profile (image, NULL, TRUE);
gimp_image_set_color_profile (image, dest_profile, NULL);
/* omg... */
@@ -457,7 +526,8 @@ gimp_image_convert_color_profile (GimpImage *image,
/* retain src_profile across gimp_image_set_color_profile() */
g_object_ref (src_profile);
- gimp_image_set_is_color_managed (image, TRUE, TRUE);
+ _gimp_image_set_hidden_profile (image, NULL, TRUE);
+
gimp_image_set_color_profile (image, dest_profile, NULL);
/* omg... */
gimp_image_parasite_detach (image, "icc-profile-name");
@@ -501,8 +571,7 @@ gimp_image_import_color_profile (GimpImage *image,
g_return_if_fail (GIMP_IS_CONTEXT (context));
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
- if (gimp_image_get_is_color_managed (image) &&
- gimp_image_get_color_profile (image))
+ if (gimp_image_get_color_profile (image))
{
GimpColorProfilePolicy policy;
GimpColorProfile *dest_profile = NULL;
@@ -565,10 +634,7 @@ gimp_image_get_color_transform_to_srgb_u8 (GimpImage *image)
gimp_image_create_color_transforms (image);
- if (private->is_color_managed)
- return private->transform_to_srgb_u8;
-
- return NULL;
+ return private->transform_to_srgb_u8;
}
GimpColorTransform *
@@ -582,10 +648,7 @@ gimp_image_get_color_transform_from_srgb_u8 (GimpImage *image)
gimp_image_create_color_transforms (image);
- if (private->is_color_managed)
- return private->transform_from_srgb_u8;
-
- return NULL;
+ return private->transform_from_srgb_u8;
}
GimpColorTransform *
@@ -599,10 +662,7 @@ gimp_image_get_color_transform_to_srgb_double (GimpImage *image)
gimp_image_create_color_transforms (image);
- if (private->is_color_managed)
- return private->transform_to_srgb_double;
-
- return NULL;
+ return private->transform_to_srgb_double;
}
GimpColorTransform *
@@ -616,10 +676,7 @@ gimp_image_get_color_transform_from_srgb_double (GimpImage *image)
gimp_image_create_color_transforms (image);
- if (private->is_color_managed)
- return private->transform_from_srgb_double;
-
- return NULL;
+ return private->transform_from_srgb_double;
}
void
@@ -687,6 +744,8 @@ _gimp_image_free_color_profile (GimpImage *image)
g_clear_object (&private->color_profile);
private->layer_space = NULL;
+ g_clear_object (&private->hidden_profile);
+
_gimp_image_free_color_transforms (image);
}
diff --git a/app/core/gimpimage-color-profile.h b/app/core/gimpimage-color-profile.h
index d6c9c599a9..863c41bda7 100644
--- a/app/core/gimpimage-color-profile.h
+++ b/app/core/gimpimage-color-profile.h
@@ -25,9 +25,14 @@
#define GIMP_ICC_PROFILE_PARASITE_NAME "icc-profile"
-gboolean gimp_image_get_is_color_managed (GimpImage *image);
-void gimp_image_set_is_color_managed (GimpImage *image,
- gboolean is_color_managed,
+gboolean gimp_image_get_use_srgb_profile (GimpImage *image,
+ gboolean *hidden_profile);
+void gimp_image_set_use_srgb_profile (GimpImage *image,
+ gboolean use_srgb);
+
+GimpColorProfile * _gimp_image_get_hidden_profile (GimpImage *image);
+void _gimp_image_set_hidden_profile (GimpImage *image,
+ GimpColorProfile *profile,
gboolean push_undo);
gboolean gimp_image_validate_icc_parasite (GimpImage *image,
diff --git a/app/core/gimpimage-duplicate.c b/app/core/gimpimage-duplicate.c
index abf280a7e9..ce8b70c9b6 100644
--- a/app/core/gimpimage-duplicate.c
+++ b/app/core/gimpimage-duplicate.c
@@ -524,9 +524,9 @@ static void
gimp_image_duplicate_color_profile (GimpImage *image,
GimpImage *new_image)
{
- GimpColorProfile *profile = gimp_image_get_color_profile (image);
- gboolean is_color_managed = gimp_image_get_is_color_managed (image);
+ GimpColorProfile *profile = gimp_image_get_color_profile (image);
+ GimpColorProfile *hidden = _gimp_image_get_hidden_profile (image);
- gimp_image_set_color_profile (new_image, profile, NULL);
- gimp_image_set_is_color_managed (new_image, is_color_managed, FALSE);
+ gimp_image_set_color_profile (new_image, profile, NULL);
+ _gimp_image_set_hidden_profile (new_image, hidden, FALSE);
}
diff --git a/app/core/gimpimage-new.c b/app/core/gimpimage-new.c
index 32635c30c3..d695e96ae0 100644
--- a/app/core/gimpimage-new.c
+++ b/app/core/gimpimage-new.c
@@ -129,9 +129,6 @@ gimp_image_new_from_template (Gimp *gimp,
gimp_template_get_resolution_y (template));
gimp_image_set_unit (image, gimp_template_get_resolution_unit (template));
- gimp_image_set_is_color_managed (image,
- gimp_template_get_color_managed (template),
- FALSE);
profile = gimp_template_get_color_profile (template);
gimp_image_set_color_profile (image, profile, NULL);
if (profile)
@@ -203,9 +200,6 @@ gimp_image_new_from_drawable (Gimp *gimp,
gimp_image_set_resolution (new_image, xres, yres);
gimp_image_set_unit (new_image, gimp_image_get_unit (image));
- gimp_image_set_is_color_managed (new_image,
- gimp_image_get_is_color_managed (image),
- FALSE);
profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (drawable));
gimp_image_set_color_profile (new_image, profile, NULL);
diff --git a/app/core/gimpimage-private.h b/app/core/gimpimage-private.h
index c1d35805ca..e444b4f639 100644
--- a/app/core/gimpimage-private.h
+++ b/app/core/gimpimage-private.h
@@ -55,9 +55,9 @@ struct _GimpImagePrivate
const Babl *babl_palette_rgb; /* palette's RGB Babl format */
const Babl *babl_palette_rgba; /* palette's RGBA Babl format */
- gboolean is_color_managed; /* is this image color managed */
GimpColorProfile *color_profile; /* image's color profile */
const Babl *layer_space; /* image's Babl layer space */
+ GimpColorProfile *hidden_profile; /* hidden by "use sRGB" */
/* Cached color transforms: from layer to sRGB u8 and double, and back */
gboolean color_transforms_created;
diff --git a/app/core/gimpimage-undo-push.c b/app/core/gimpimage-undo-push.c
index 18880586de..75a08d1f64 100644
--- a/app/core/gimpimage-undo-push.c
+++ b/app/core/gimpimage-undo-push.c
@@ -150,13 +150,13 @@ gimp_image_undo_push_image_colormap (GimpImage *image,
}
GimpUndo *
-gimp_image_undo_push_image_color_managed (GimpImage *image,
- const gchar *undo_desc)
+gimp_image_undo_push_image_hidden_profile (GimpImage *image,
+ const gchar *undo_desc)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
- GIMP_UNDO_IMAGE_COLOR_MANAGED, undo_desc,
+ GIMP_UNDO_IMAGE_HIDDEN_PROFILE, undo_desc,
GIMP_DIRTY_IMAGE,
NULL);
}
diff --git a/app/core/gimpimage-undo-push.h b/app/core/gimpimage-undo-push.h
index 0cbd19a357..6215b0d5c9 100644
--- a/app/core/gimpimage-undo-push.h
+++ b/app/core/gimpimage-undo-push.h
@@ -38,7 +38,7 @@ GimpUndo * gimp_image_undo_push_image_grid (GimpImage *image,
GimpGrid *grid);
GimpUndo * gimp_image_undo_push_image_colormap (GimpImage *image,
const gchar *undo_desc);
-GimpUndo * gimp_image_undo_push_image_color_managed (GimpImage *image,
+GimpUndo * gimp_image_undo_push_image_hidden_profile(GimpImage *image,
const gchar *undo_desc);
GimpUndo * gimp_image_undo_push_image_metadata (GimpImage *image,
const gchar *undo_desc);
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 566f0159d7..172a2c3e6a 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -724,8 +724,6 @@ gimp_image_init (GimpImage *image)
private->n_colors = 0;
private->palette = NULL;
- private->is_color_managed = TRUE;
-
private->metadata = NULL;
private->dirty = 1;
@@ -1057,8 +1055,7 @@ gimp_image_finalize (GObject *object)
if (private->colormap)
gimp_image_colormap_free (image);
- if (private->color_profile)
- _gimp_image_free_color_profile (image);
+ _gimp_image_free_color_profile (image);
g_clear_object (&private->metadata);
g_clear_object (&private->file);
@@ -1392,11 +1389,10 @@ gimp_image_color_managed_get_icc_profile (GimpColorManaged *managed,
static GimpColorProfile *
gimp_image_color_managed_get_color_profile (GimpColorManaged *managed)
{
- GimpImage *image = GIMP_IMAGE (managed);
- GimpColorProfile *profile = NULL;
+ GimpImage *image = GIMP_IMAGE (managed);
+ GimpColorProfile *profile;
- if (gimp_image_get_is_color_managed (image))
- profile = gimp_image_get_color_profile (image);
+ profile = gimp_image_get_color_profile (image);
if (! profile)
profile = gimp_image_get_builtin_color_profile (image);
diff --git a/app/core/gimpimageundo.c b/app/core/gimpimageundo.c
index 9103f53c74..fa940e10c7 100644
--- a/app/core/gimpimageundo.c
+++ b/app/core/gimpimageundo.c
@@ -188,8 +188,9 @@ gimp_image_undo_constructed (GObject *object)
GIMP_IMAGE_COLORMAP_SIZE);
break;
- case GIMP_UNDO_IMAGE_COLOR_MANAGED:
- image_undo->is_color_managed = gimp_image_get_is_color_managed (image);
+ case GIMP_UNDO_IMAGE_HIDDEN_PROFILE:
+ g_set_object (&image_undo->hidden_profile,
+ _gimp_image_get_hidden_profile (image));
break;
case GIMP_UNDO_IMAGE_METADATA:
@@ -472,14 +473,14 @@ gimp_image_undo_pop (GimpUndo *undo,
}
break;
- case GIMP_UNDO_IMAGE_COLOR_MANAGED:
+ case GIMP_UNDO_IMAGE_HIDDEN_PROFILE:
{
- gboolean is_color_managed;
+ GimpColorProfile *hidden_profile = NULL;
- is_color_managed = gimp_image_get_is_color_managed (image);
- gimp_image_set_is_color_managed (image, image_undo->is_color_managed,
- FALSE);
- image_undo->is_color_managed = is_color_managed;
+ g_set_object (&hidden_profile, _gimp_image_get_hidden_profile (image));
+ _gimp_image_set_hidden_profile (image, image_undo->hidden_profile,
+ FALSE);
+ image_undo->hidden_profile = hidden_profile;
}
break;
@@ -535,6 +536,7 @@ gimp_image_undo_free (GimpUndo *undo,
g_clear_object (&image_undo->grid);
g_clear_pointer (&image_undo->colormap, g_free);
+ g_clear_object (&image_undo->hidden_profile);
g_clear_object (&image_undo->metadata);
g_clear_pointer (&image_undo->parasite_name, g_free);
g_clear_pointer (&image_undo->parasite, gimp_parasite_free);
diff --git a/app/core/gimpimageundo.h b/app/core/gimpimageundo.h
index 0290b40274..9ee2c525d2 100644
--- a/app/core/gimpimageundo.h
+++ b/app/core/gimpimageundo.h
@@ -51,7 +51,7 @@ struct _GimpImageUndo
GimpGrid *grid;
gint num_colors;
guchar *colormap;
- gboolean is_color_managed;
+ GimpColorProfile *hidden_profile;
GimpMetadata *metadata;
gchar *parasite_name;
GimpParasite *parasite;
diff --git a/app/core/gimplayer-new.c b/app/core/gimplayer-new.c
index e83414fde8..f1807ba5e1 100644
--- a/app/core/gimplayer-new.c
+++ b/app/core/gimplayer-new.c
@@ -220,17 +220,9 @@ gimp_layer_new_convert_buffer (GimpLayer *layer,
GError **error)
{
GimpDrawable *drawable = GIMP_DRAWABLE (layer);
- GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
GeglBuffer *dest_buffer = gimp_drawable_get_buffer (drawable);
GimpColorProfile *dest_profile;
- if (! gimp_image_get_is_color_managed (image))
- {
- gimp_gegl_buffer_copy (src_buffer, NULL, GEGL_ABYSS_NONE,
- dest_buffer, NULL);
- return;
- }
-
if (! src_profile)
{
const Babl *src_format = gegl_buffer_get_format (src_buffer);
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 735bede7ee..a3b8eeeb13 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -992,8 +992,7 @@ gimp_layer_convert (GimpItem *item,
old_precision = gimp_drawable_get_precision (drawable);
new_precision = gimp_image_get_precision (dest_image);
- if (g_type_is_a (old_type, GIMP_TYPE_LAYER) &&
- gimp_image_get_is_color_managed (dest_image))
+ if (g_type_is_a (old_type, GIMP_TYPE_LAYER))
{
src_profile =
gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (item));
diff --git a/app/core/gimptemplate.c b/app/core/gimptemplate.c
index f903bb5b87..f3ff2e6e09 100644
--- a/app/core/gimptemplate.c
+++ b/app/core/gimptemplate.c
@@ -58,11 +58,13 @@ enum
PROP_COMPONENT_TYPE,
PROP_LINEAR,
PROP_TRC,
- PROP_COLOR_MANAGED,
PROP_COLOR_PROFILE,
PROP_FILL_TYPE,
PROP_COMMENT,
- PROP_FILENAME
+ PROP_FILENAME,
+
+ /* compat cruft */
+ PROP_COLOR_MANAGED
};
@@ -81,7 +83,6 @@ struct _GimpTemplatePrivate
GimpImageBaseType base_type;
GimpPrecision precision;
- gboolean color_managed;
GFile *color_profile;
GimpFillType fill_type;
@@ -209,16 +210,6 @@ gimp_template_class_init (GimpTemplateClass *klass)
G_PARAM_READWRITE |
GIMP_PARAM_STATIC_STRINGS));
- GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_COLOR_MANAGED,
- "color-managed",
- _("Color managed"),
- _("Whether the image is color managed. "
- "Disabling color management is equivalent to "
- "choosing a built-in sRGB profile. Better "
- "leave color management enabled."),
- TRUE,
- GIMP_PARAM_STATIC_STRINGS);
-
GIMP_CONFIG_PROP_OBJECT (object_class, PROP_COLOR_PROFILE,
"color-profile",
_("Color profile"),
@@ -246,6 +237,14 @@ gimp_template_class_init (GimpTemplateClass *klass)
NULL,
NULL,
GIMP_PARAM_STATIC_STRINGS);
+
+ /* compat cruft */
+ GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_COLOR_MANAGED,
+ "color-managed",
+ NULL, NULL,
+ FALSE,
+ GIMP_PARAM_STATIC_STRINGS |
+ GIMP_CONFIG_PARAM_IGNORE);
}
static void
@@ -313,9 +312,6 @@ gimp_template_set_property (GObject *object,
g_value_get_enum (value));
g_object_notify (object, "precision");
break;
- case PROP_COLOR_MANAGED:
- private->color_managed = g_value_get_boolean (value);
- break;
case PROP_COLOR_PROFILE:
if (private->color_profile)
g_object_unref (private->color_profile);
@@ -334,6 +330,11 @@ gimp_template_set_property (GObject *object,
g_free (private->filename);
private->filename = g_value_dup_string (value);
break;
+
+ case PROP_COLOR_MANAGED:
+ /* ignored */
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -380,9 +381,6 @@ gimp_template_get_property (GObject *object,
case PROP_TRC:
g_value_set_enum (value, gimp_babl_trc (private->precision));
break;
- case PROP_COLOR_MANAGED:
- g_value_set_boolean (value, private->color_managed);
- break;
case PROP_COLOR_PROFILE:
g_value_set_object (value, private->color_profile);
break;
@@ -395,6 +393,11 @@ gimp_template_get_property (GObject *object,
case PROP_FILENAME:
g_value_set_string (value, private->filename);
break;
+
+ case PROP_COLOR_MANAGED:
+ /* ignored */
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -551,14 +554,6 @@ gimp_template_get_precision (GimpTemplate *template)
return GET_PRIVATE (template)->precision;
}
-gboolean
-gimp_template_get_color_managed (GimpTemplate *template)
-{
- g_return_val_if_fail (GIMP_IS_TEMPLATE (template), FALSE);
-
- return GET_PRIVATE (template)->color_managed;
-}
-
GimpColorProfile *
gimp_template_get_color_profile (GimpTemplate *template)
{
diff --git a/app/core/gimptemplate.h b/app/core/gimptemplate.h
index 671a247d1c..d2bc35be9a 100644
--- a/app/core/gimptemplate.h
+++ b/app/core/gimptemplate.h
@@ -84,7 +84,6 @@ GimpUnit gimp_template_get_resolution_unit (GimpTemplate *template);
GimpImageBaseType gimp_template_get_base_type (GimpTemplate *template);
GimpPrecision gimp_template_get_precision (GimpTemplate *template);
-gboolean gimp_template_get_color_managed (GimpTemplate *template);
GimpColorProfile * gimp_template_get_color_profile (GimpTemplate *template);
GimpFillType gimp_template_get_fill_type (GimpTemplate *template);
diff --git a/app/display/gimpdisplayshell-title.c b/app/display/gimpdisplayshell-title.c
index 6ea69daa8f..9c51216f34 100644
--- a/app/display/gimpdisplayshell-title.c
+++ b/app/display/gimpdisplayshell-title.c
@@ -457,21 +457,15 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
break;
case 'o': /* image's color profile name */
- if (gimp_image_get_is_color_managed (image))
- {
- GimpColorManaged *managed = GIMP_COLOR_MANAGED (image);
- GimpColorProfile *profile;
+ {
+ GimpColorManaged *managed = GIMP_COLOR_MANAGED (image);
+ GimpColorProfile *profile;
- profile = gimp_color_managed_get_color_profile (managed);
+ profile = gimp_color_managed_get_color_profile (managed);
- i += print (title, title_len, i, "%s",
- gimp_color_profile_get_label (profile));
- }
- else
- {
- i += print (title, title_len, i, "%s",
- _("not color managed"));
- }
+ i += print (title, title_len, i, "%s",
+ gimp_color_profile_get_label (profile));
+ }
break;
case 'e': /* display's offsets in pixels */
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index 0a81534abc..4e998f1ede 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -157,10 +157,10 @@
#define GIMP_HELP_IMAGE_CROP "gimp-image-crop"
#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"
+#define GIMP_HELP_IMAGE_COLOR_PROFILE_USE_SRGB "gimp-image-color-profile-use-srgb"
#define GIMP_HELP_IMAGE_COLOR_PROFILE_SAVE "gimp-image-color-profile-save"
#define GIMP_HELP_IMAGE_COLOR_PROFILE_IMPORT "gimp-image-color-profile-import"
#define GIMP_HELP_IMAGE_GRID "gimp-image-grid"
diff --git a/app/widgets/gimptemplateeditor.c b/app/widgets/gimptemplateeditor.c
index e0c67d4559..a0268f61ed 100644
--- a/app/widgets/gimptemplateeditor.c
+++ b/app/widgets/gimptemplateeditor.c
@@ -154,7 +154,6 @@ gimp_template_editor_constructed (GObject *object)
GtkWidget *xres;
GtkWidget *yres;
GtkWidget *combo;
- GtkWidget *toggle;
GtkWidget *scrolled_window;
GtkWidget *text_view;
GtkTextBuffer *text_buffer;
@@ -407,13 +406,6 @@ gimp_template_editor_constructed (GObject *object)
_("_Gamma:"), 0.0, 0.5,
combo, 1);
- toggle = gimp_prop_check_button_new (G_OBJECT (template),
- "color-managed",
- _("Color _manage this image"));
- gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
- NULL, 0.0, 0.5,
- toggle, 1);
-
private->profile_combo =
gimp_prop_profile_combo_box_new (G_OBJECT (template),
"color-profile",
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 72a10bd47d..839c2e4904 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -383,7 +383,7 @@
<separator />
</menu>
<menu action="image-color-management-menu" name="Color Management">
- <menuitem action="image-color-management-enabled" />
+ <menuitem action="image-color-profile-use-srgb" />
<separator />
<menuitem action="image-color-profile-assign" />
<menuitem action="image-color-profile-convert" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]