Commit a2877847 authored by Michael Natterer's avatar Michael Natterer 😴

Bug 320447 - fast switching between "color managed display" and "softproof"

Add rendering intent, black point compensation and gammut warning menu
items to View -> Color Management. They set the respective values of
the active color management mode, so both "color managed display" and
"print simulation" are almost completely configurable per-display
now. Setting the simulation profile is still missing.
parent a942b771
......@@ -162,6 +162,21 @@ static const GimpToggleActionEntry view_toggle_actions[] =
TRUE,
GIMP_HELP_VIEW_DOT_FOR_DOT },
{ "view-color-management-black-point-compensation", NULL,
NC_("view-action", "_Black Point Compensation"), NULL,
NC_("view-action", "Use black point compentation"),
G_CALLBACK (view_color_management_bpc_cmd_callback),
TRUE,
GIMP_HELP_VIEW_COLOR_MANAGEMENT },
{ "view-color-management-gamut-check", NULL,
NC_("view-action", "_Mark Out Of Gamut Colors"), NULL,
NC_("view-action", "When softproofing, mark colors which cannot "
"be represented in the target color space"),
G_CALLBACK (view_color_management_gamut_check_cmd_callback),
FALSE,
GIMP_HELP_VIEW_COLOR_MANAGEMENT },
{ "view-show-selection", NULL,
NC_("view-action", "Show _Selection"), "<primary>T",
NC_("view-action", "Display the selection outline"),
......@@ -490,6 +505,33 @@ static const GimpRadioActionEntry view_color_management_mode_actions[] =
GIMP_HELP_VIEW_COLOR_MANAGEMENT }
};
static const GimpRadioActionEntry view_color_management_intent_actions[] =
{
{ "view-color-management-intent-perceptual", NULL,
NC_("view-action", "_Perceptual"), NULL,
NC_("view-action", "Rendering intent is percptual"),
GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
GIMP_HELP_VIEW_COLOR_MANAGEMENT },
{ "view-color-management-intent-relative-colorimetric", NULL,
NC_("view-action", "_Relative Colorimetric"), NULL,
NC_("view-action", "Rendering intent is relative colorimetic"),
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC,
GIMP_HELP_VIEW_COLOR_MANAGEMENT },
{ "view-color-management-intent-saturation", NULL,
NC_("view-action", "_Saturation"), NULL,
NC_("view-action", "Rendering intent is saturation"),
GIMP_COLOR_RENDERING_INTENT_SATURATION,
GIMP_HELP_VIEW_COLOR_MANAGEMENT },
{ "view-color-management-intent-absolute-colorimetric", NULL,
NC_("view-action", "_Absolute Colorimetric"), NULL,
NC_("view-action", "Rendering intent is absolute colorimetic"),
GIMP_COLOR_RENDERING_INTENT_ABSOLUTE_COLORIMETRIC,
GIMP_HELP_VIEW_COLOR_MANAGEMENT }
};
static const GimpEnumActionEntry view_padding_color_actions[] =
{
{ "view-padding-color-theme", NULL,
......@@ -647,6 +689,13 @@ view_actions_setup (GimpActionGroup *group)
GIMP_COLOR_MANAGEMENT_DISPLAY,
G_CALLBACK (view_color_management_mode_cmd_callback));
gimp_action_group_add_radio_actions (group, "view-action",
view_color_management_intent_actions,
G_N_ELEMENTS (view_color_management_intent_actions),
NULL,
GIMP_COLOR_MANAGEMENT_DISPLAY,
G_CALLBACK (view_color_management_intent_cmd_callback));
gimp_action_group_add_enum_actions (group, "view-padding-color",
view_padding_color_actions,
G_N_ELEMENTS (view_padding_color_actions),
......@@ -703,11 +752,15 @@ view_actions_update (GimpActionGroup *group,
gboolean revert_enabled = FALSE; /* able to revert zoom? */
gboolean flip_horizontally = FALSE;
gboolean flip_vertically = FALSE;
gboolean cm = FALSE;
gboolean sp = FALSE;
if (display)
{
GimpImageWindow *window;
const gchar *action = NULL;
GimpImageWindow *window;
GimpColorRenderingIntent intent = GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL;
gboolean bpc = TRUE;
const gchar *action = NULL;
image = gimp_display_get_image (display);
shell = gimp_display_get_shell (display);
......@@ -735,13 +788,51 @@ view_actions_update (GimpActionGroup *group,
case GIMP_COLOR_MANAGEMENT_DISPLAY:
action = "view-color-management-mode-display";
intent = color_config->display_intent;
bpc = color_config->display_use_black_point_compensation;
cm = TRUE;
break;
case GIMP_COLOR_MANAGEMENT_SOFTPROOF:
action = "view-color-management-mode-softproof";
intent = color_config->simulation_intent;
bpc = color_config->simulation_use_black_point_compensation;
cm = TRUE;
sp = TRUE;
break;
}
gimp_action_group_set_action_active (group, action, TRUE);
switch (intent)
{
case GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL:
action = "view-color-management-intent-perceptual";
break;
case GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC:
action = "view-color-management-intent-relative-colorimetric";
break;
case GIMP_COLOR_RENDERING_INTENT_SATURATION:
action = "view-color-management-intent-saturation";
break;
case GIMP_COLOR_RENDERING_INTENT_ABSOLUTE_COLORIMETRIC:
action = "view-color-management-intent-absolute-colorimetric";
break;
}
gimp_action_group_set_action_active (group, action, TRUE);
gimp_action_group_set_action_active (group,
"view-color-management-black-point-compensation",
bpc);
gimp_action_group_set_action_active (group,
"view-color-management-gamut-check",
color_config->simulation_gamut_check);
}
#define SET_ACTIVE(action,condition) \
......@@ -825,10 +916,16 @@ view_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("view-navigation-window", image);
SET_SENSITIVE ("view-display-filters", image);
SET_SENSITIVE ("view-color-management-mode-off", image);
SET_SENSITIVE ("view-color-management-mode-display", image);
SET_SENSITIVE ("view-color-management-mode-softproof", image);
SET_SENSITIVE ("view-color-management-reset", image);
SET_SENSITIVE ("view-color-management-mode-off", image);
SET_SENSITIVE ("view-color-management-mode-display", image);
SET_SENSITIVE ("view-color-management-mode-softproof", image);
SET_SENSITIVE ("view-color-management-intent-perceptual", cm);
SET_SENSITIVE ("view-color-management-intent-relative-colorimetric", cm);
SET_SENSITIVE ("view-color-management-intent-saturation", cm);
SET_SENSITIVE ("view-color-management-intent-absolute-colorimetric", cm);
SET_SENSITIVE ("view-color-management-black-point-compensation", cm);
SET_SENSITIVE ("view-color-management-gamut-check", sp);
SET_SENSITIVE ("view-color-management-reset", image);
SET_SENSITIVE ("view-show-selection", image);
SET_ACTIVE ("view-show-selection", display && options->show_selection);
......
......@@ -527,6 +527,109 @@ view_color_management_mode_cmd_callback (GtkAction *action,
}
}
void
view_color_management_intent_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data)
{
GimpDisplayShell *shell;
GimpColorConfig *color_config;
GimpColorRenderingIntent value;
return_if_no_shell (shell, data);
color_config = gimp_display_shell_get_color_config (shell);
value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
switch (color_config->mode)
{
case GIMP_COLOR_MANAGEMENT_DISPLAY:
if (value != color_config->display_intent)
{
g_object_set (color_config,
"display-rendering-intent", value,
NULL);
shell->color_config_set = TRUE;
}
break;
case GIMP_COLOR_MANAGEMENT_SOFTPROOF:
if (value != color_config->simulation_intent)
{
g_object_set (color_config,
"simulation-rendering-intent", value,
NULL);
shell->color_config_set = TRUE;
}
break;
default:
break;
}
}
void
view_color_management_bpc_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplayShell *shell;
GimpColorConfig *color_config;
gboolean active;
return_if_no_shell (shell, data);
color_config = gimp_display_shell_get_color_config (shell);
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
switch (color_config->mode)
{
case GIMP_COLOR_MANAGEMENT_DISPLAY:
if (active != color_config->display_use_black_point_compensation)
{
g_object_set (color_config,
"display-use-black-point-compensation", active,
NULL);
shell->color_config_set = TRUE;
}
break;
case GIMP_COLOR_MANAGEMENT_SOFTPROOF:
if (active != color_config->simulation_use_black_point_compensation)
{
g_object_set (color_config,
"simulation-use-black-point-compensation", active,
NULL);
shell->color_config_set = TRUE;
}
break;
default:
break;
}
}
void
view_color_management_gamut_check_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplayShell *shell;
GimpColorConfig *color_config;
gboolean active;
return_if_no_shell (shell, data);
color_config = gimp_display_shell_get_color_config (shell);
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (active != color_config->simulation_gamut_check)
{
g_object_set (color_config,
"simulation-gamut-check", active,
NULL);
shell->color_config_set = TRUE;
}
}
void
view_toggle_selection_cmd_callback (GtkAction *action,
gpointer data)
......
......@@ -74,6 +74,14 @@ void view_color_management_reset_cmd_callback (GtkAction *action,
void view_color_management_mode_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data);
void view_color_management_intent_cmd_callback(GtkAction *action,
GtkAction *current,
gpointer data);
void view_color_management_bpc_cmd_callback (GtkAction *action,
gpointer data);
void view_color_management_gamut_check_cmd_callback
(GtkAction *action,
gpointer data);
void view_toggle_selection_cmd_callback (GtkAction *action,
gpointer data);
......
......@@ -1126,7 +1126,12 @@ gimp_display_shell_color_config_notify_handler (GObject *config,
{
gboolean copy = TRUE;
if (! strcmp (param_spec->name, "mode"))
if (! strcmp (param_spec->name, "mode") ||
! strcmp (param_spec->name, "display-rendering-intent") ||
! strcmp (param_spec->name, "display-use-black-point-compensation") ||
! strcmp (param_spec->name, "simulation-rendering-intent") ||
! strcmp (param_spec->name, "simulation-use-black-point-compensation") ||
! strcmp (param_spec->name, "simulation-gamut-check"))
{
if (shell->color_config_set)
copy = FALSE;
......
......@@ -250,25 +250,83 @@ gimp_display_shell_color_config_notify (GimpColorConfig *config,
const GParamSpec *pspec,
GimpDisplayShell *shell)
{
if (! strcmp (pspec->name, "mode"))
if (! strcmp (pspec->name, "mode") ||
! strcmp (pspec->name, "display-rendering-intent") ||
! strcmp (pspec->name, "display-use-black-point-compensation") ||
! strcmp (pspec->name, "simulation-rendering-intent") ||
! strcmp (pspec->name, "simulation-use-black-point-compensation") ||
! strcmp (pspec->name, "simulation-gamut-check"))
{
const gchar *action = NULL;
GimpColorRenderingIntent intent = GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL;
gboolean managed = TRUE;
gboolean bpc = TRUE;
const gchar *action = NULL;
#define SET_SENSITIVE(action, sensitive) \
gimp_display_shell_set_action_sensitive (shell, action, sensitive);
#define SET_ACTIVE(action, active) \
gimp_display_shell_set_action_active (shell, action, active);
switch (config->mode)
{
case GIMP_COLOR_MANAGEMENT_OFF:
action = "view-color-management-mode-off";
action = "view-color-management-mode-off";
managed = FALSE;
break;
case GIMP_COLOR_MANAGEMENT_DISPLAY:
action = "view-color-management-mode-display";
intent = config->display_intent;
bpc = config->display_use_black_point_compensation;
break;
case GIMP_COLOR_MANAGEMENT_SOFTPROOF:
action = "view-color-management-mode-softproof";
intent = config->simulation_intent;
bpc = config->simulation_use_black_point_compensation;
break;
}
gimp_display_shell_set_action_active (shell, action, TRUE);
SET_ACTIVE (action, TRUE);
switch (intent)
{
case GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL:
action = "view-color-management-intent-perceptual";
break;
case GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC:
action = "view-color-management-intent-relative-colorimetric";
break;
case GIMP_COLOR_RENDERING_INTENT_SATURATION:
action = "view-color-management-intent-saturation";
break;
case GIMP_COLOR_RENDERING_INTENT_ABSOLUTE_COLORIMETRIC:
action = "view-color-management-intent-absolute-colorimetric";
break;
}
SET_SENSITIVE ("view-color-management-intent-perceptual",
managed);
SET_SENSITIVE ("view-color-management-intent-relative-colorimetric",
managed);
SET_SENSITIVE ("view-color-management-intent-saturation",
managed);
SET_SENSITIVE ("view-color-management-intent-absolute-colorimetric",
managed);
SET_ACTIVE (action, TRUE);
SET_SENSITIVE ("view-color-management-black-point-compensation", managed);
SET_ACTIVE ("view-color-management-black-point-compensation", bpc);
SET_SENSITIVE ("view-color-management-gamut-check",
config->mode == GIMP_COLOR_MANAGEMENT_SOFTPROOF);
SET_ACTIVE ("view-color-management-gamut-check",
config->simulation_gamut_check);
}
gimp_color_managed_profile_changed (GIMP_COLOR_MANAGED (shell));
......
......@@ -306,6 +306,14 @@
<menuitem action="view-color-management-mode-display" />
<menuitem action="view-color-management-mode-softproof" />
<separator />
<menuitem action="view-color-management-intent-perceptual" />
<menuitem action="view-color-management-intent-relative-colorimetric" />
<menuitem action="view-color-management-intent-saturation" />
<menuitem action="view-color-management-intent-absolute-colorimetric" />
<separator />
<menuitem action="view-color-management-black-point-compensation" />
<menuitem action="view-color-management-gamut-check" />
<separator />
<menuitem action="view-color-management-reset" />
</menu>
<separator />
......
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