[gimp] app: don't let display color management settings affect file import
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: don't let display color management settings affect file import
- Date: Sun, 5 Jun 2016 20:40:02 +0000 (UTC)
commit 741be87d0f9ff88cac6baaeda21710d48944c876
Author: Michael Natterer <mitch gimp org>
Date: Sun Jun 5 22:36:52 2016 +0200
app: don't let display color management settings affect file import
gimp_image_import_color_profile(): get the intent and bpc settings
from the profile import dialog instead of asking the global
GimpColorConfig.
app/core/gimp-gui.c | 16 ++++--
app/core/gimp-gui.h | 4 ++
app/core/gimpimage-color-profile.c | 27 +++-------
app/dialogs/color-profile-import-dialog.c | 78 ++++++++++++++++++++++++-----
app/dialogs/color-profile-import-dialog.h | 12 +++--
app/gui/gui-vtable.c | 18 +++++--
6 files changed, 107 insertions(+), 48 deletions(-)
---
diff --git a/app/core/gimp-gui.c b/app/core/gimp-gui.c
index 2988ce6..189910f 100644
--- a/app/core/gimp-gui.c
+++ b/app/core/gimp-gui.c
@@ -521,11 +521,13 @@ gimp_get_mount_operation (Gimp *gimp,
}
GimpColorProfilePolicy
-gimp_query_profile_policy (Gimp *gimp,
- GimpImage *image,
- GimpContext *context,
- GimpColorProfile **dest_profile,
- gboolean *dont_ask)
+gimp_query_profile_policy (Gimp *gimp,
+ GimpImage *image,
+ GimpContext *context,
+ GimpColorProfile **dest_profile,
+ GimpColorRenderingIntent *intent,
+ gboolean *bpc,
+ gboolean *dont_ask)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), GIMP_COLOR_PROFILE_POLICY_KEEP);
g_return_val_if_fail (GIMP_IS_IMAGE (image), GIMP_COLOR_PROFILE_POLICY_KEEP);
@@ -534,7 +536,9 @@ gimp_query_profile_policy (Gimp *gimp,
if (gimp->gui.query_profile_policy)
return gimp->gui.query_profile_policy (gimp, image, context,
- dest_profile, dont_ask);
+ dest_profile,
+ intent, bpc,
+ dont_ask);
return GIMP_COLOR_PROFILE_POLICY_KEEP;
}
diff --git a/app/core/gimp-gui.h b/app/core/gimp-gui.h
index a485093..6118765 100644
--- a/app/core/gimp-gui.h
+++ b/app/core/gimp-gui.h
@@ -103,6 +103,8 @@ struct _GimpGui
GimpImage *image,
GimpContext *context,
GimpColorProfile **dest_profile,
+ GimpColorRenderingIntent *intent,
+ gboolean *bpc,
gboolean *dont_ask);
};
@@ -192,6 +194,8 @@ GimpColorProfilePolicy
GimpImage *image,
GimpContext *context,
GimpColorProfile **dest_profile,
+ GimpColorRenderingIntent *intent,
+ gboolean *bpc,
gboolean *dont_ask);
diff --git a/app/core/gimpimage-color-profile.c b/app/core/gimpimage-color-profile.c
index 39daa4f..8a7138a 100644
--- a/app/core/gimpimage-color-profile.c
+++ b/app/core/gimpimage-color-profile.c
@@ -443,10 +443,14 @@ gimp_image_import_color_profile (GimpImage *image,
if (gimp_image_get_is_color_managed (image) &&
gimp_image_get_color_profile (image))
{
- GimpColorProfilePolicy policy;
- GimpColorProfile *dest_profile = NULL;
+ GimpColorProfilePolicy policy;
+ GimpColorProfile *dest_profile = NULL;
+ GimpColorRenderingIntent intent;
+ gboolean bpc;
policy = image->gimp->config->color_profile_policy;
+ intent = GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC;
+ bpc = TRUE;
if (policy == GIMP_COLOR_PROFILE_POLICY_ASK)
{
@@ -455,7 +459,9 @@ gimp_image_import_color_profile (GimpImage *image,
gboolean dont_ask = FALSE;
policy = gimp_query_profile_policy (image->gimp, image, context,
- &dest_profile, &dont_ask);
+ &dest_profile,
+ &intent, &bpc,
+ &dont_ask);
if (dont_ask)
{
@@ -472,21 +478,6 @@ gimp_image_import_color_profile (GimpImage *image,
if (policy == GIMP_COLOR_PROFILE_POLICY_CONVERT)
{
- GimpColorConfig *config;
- GimpColorRenderingIntent intent;
- gboolean bpc;
-
- config = image->gimp->config->color_management;
-
- if (! dest_profile)
- {
- dest_profile = gimp_image_get_builtin_color_profile (image);
- g_object_ref (dest_profile);
- }
-
- intent = config->display_intent;
- bpc = (intent == GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC);
-
gimp_image_convert_color_profile (image, dest_profile,
intent, bpc,
progress, NULL);
diff --git a/app/dialogs/color-profile-import-dialog.c b/app/dialogs/color-profile-import-dialog.c
index 051e12a..0269959 100644
--- a/app/dialogs/color-profile-import-dialog.c
+++ b/app/dialogs/color-profile-import-dialog.c
@@ -49,17 +49,22 @@
/* public functions */
GimpColorProfilePolicy
-color_profile_import_dialog_run (GimpImage *image,
- GimpContext *context,
- GtkWidget *parent,
- GimpColorProfile **dest_profile,
- gboolean *dont_ask)
+color_profile_import_dialog_run (GimpImage *image,
+ GimpContext *context,
+ GtkWidget *parent,
+ GimpColorProfile **dest_profile,
+ GimpColorRenderingIntent *intent,
+ gboolean *bpc,
+ gboolean *dont_ask)
{
GtkWidget *dialog;
GtkWidget *main_vbox;
+ GtkWidget *vbox;
GtkWidget *frame;
GtkWidget *label;
- GtkWidget *toggle;
+ GtkWidget *intent_combo;
+ GtkWidget *bpc_toggle;
+ GtkWidget *dont_ask_toggle;
GimpColorProfile *src_profile;
GimpColorProfilePolicy policy;
const gchar *title;
@@ -133,12 +138,54 @@ color_profile_import_dialog_run (GimpImage *image,
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_widget_show (label);
+ if (intent && bpc)
+ {
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0);
+ gtk_widget_show (vbox);
+ }
+ else
+ {
+ vbox = main_vbox;
+ }
+
+ if (intent)
+ {
+ GtkWidget *hbox;
+
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+ gtk_widget_show (hbox);
+
+ label = gtk_label_new_with_mnemonic (_("_Rendering Intent:"));
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ intent_combo = gimp_enum_combo_box_new (GIMP_TYPE_COLOR_RENDERING_INTENT);
+ gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (intent_combo),
+ *intent);
+ gtk_box_pack_start (GTK_BOX (hbox), intent_combo, TRUE, TRUE, 0);
+ gtk_widget_show (intent_combo);
+
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), intent_combo);
+ }
+
+ if (bpc)
+ {
+ bpc_toggle =
+ gtk_check_button_new_with_mnemonic (_("_Black Point Compensation"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bpc_toggle), *bpc);
+ gtk_box_pack_start (GTK_BOX (vbox), bpc_toggle, FALSE, FALSE, 0);
+ gtk_widget_show (bpc_toggle);
+ }
+
if (dont_ask)
{
- toggle = gtk_check_button_new_with_mnemonic (_("_Don't ask me again"));
- gtk_box_pack_end (GTK_BOX (main_vbox), toggle, FALSE, FALSE, 0);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), FALSE);
- gtk_widget_show (toggle);
+ dont_ask_toggle =
+ gtk_check_button_new_with_mnemonic (_("_Don't ask me again"));
+ gtk_box_pack_end (GTK_BOX (main_vbox), dont_ask_toggle, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dont_ask_toggle), FALSE);
+ gtk_widget_show (dont_ask_toggle);
}
switch (gtk_dialog_run (GTK_DIALOG (dialog)))
@@ -153,10 +200,15 @@ color_profile_import_dialog_run (GimpImage *image,
break;
}
+ if (intent)
+ gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (intent_combo),
+ (gint *) intent);
+
+ if (bpc)
+ *bpc = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (bpc_toggle));
+
if (dont_ask)
- {
- *dont_ask = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle));
- }
+ *dont_ask = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dont_ask_toggle));
gtk_widget_destroy (dialog);
diff --git a/app/dialogs/color-profile-import-dialog.h b/app/dialogs/color-profile-import-dialog.h
index 0daa880..52732e4 100644
--- a/app/dialogs/color-profile-import-dialog.h
+++ b/app/dialogs/color-profile-import-dialog.h
@@ -23,11 +23,13 @@
GimpColorProfilePolicy
- color_profile_import_dialog_run (GimpImage *image,
- GimpContext *context,
- GtkWidget *parent,
- GimpColorProfile **dest_profile,
- gboolean *dont_ask);
+ color_profile_import_dialog_run (GimpImage *image,
+ GimpContext *context,
+ GtkWidget *parent,
+ GimpColorProfile **dest_profile,
+ GimpColorRenderingIntent *intent,
+ gboolean *bpc,
+ gboolean *dont_ask);
#endif /* __COLOR_PROFILE_IMPORT_DIALOG_H__ */
diff --git a/app/gui/gui-vtable.c b/app/gui/gui-vtable.c
index 25f3e2c..97d4c50 100644
--- a/app/gui/gui-vtable.c
+++ b/app/gui/gui-vtable.c
@@ -155,6 +155,8 @@ static GimpColorProfilePolicy
GimpImage *image,
GimpContext *context,
GimpColorProfile **dest_profile,
+ GimpColorRenderingIntent *intent,
+ gboolean *bpc,
gboolean *dont_ask);
@@ -771,12 +773,16 @@ gui_get_mount_operation (Gimp *gimp,
}
static GimpColorProfilePolicy
-gui_query_profile_policy (Gimp *gimp,
- GimpImage *image,
- GimpContext *context,
- GimpColorProfile **dest_profile,
- gboolean *dont_ask)
+gui_query_profile_policy (Gimp *gimp,
+ GimpImage *image,
+ GimpContext *context,
+ GimpColorProfile **dest_profile,
+ GimpColorRenderingIntent *intent,
+ gboolean *bpc,
+ gboolean *dont_ask)
{
return color_profile_import_dialog_run (image, context, NULL,
- dest_profile, dont_ask);
+ dest_profile,
+ intent, bpc,
+ dont_ask);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]