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.
This commit is contained in:
Michael Natterer 2016-06-05 22:36:52 +02:00
parent 372a985d2b
commit 741be87d0f
6 changed files with 107 additions and 48 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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__ */

View File

@ -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);
}