mirror of https://github.com/GNOME/gimp.git
Bug 320447 - fast switching between "color managed display" and "softproof"
Add a SELECT_SOFTPROOF_PROFILE mode to the color profile dialog and use it to select a profile from a newly added "Soft-Proofing Profile..." menu item in view -> color management.
This commit is contained in:
parent
a898f22cce
commit
beb3279bf2
|
@ -146,6 +146,12 @@ static const GimpActionEntry view_actions[] =
|
|||
G_CALLBACK (view_color_management_reset_cmd_callback),
|
||||
GIMP_HELP_VIEW_COLOR_MANAGEMENT },
|
||||
|
||||
{ "view-softproof-profile", NULL,
|
||||
NC_("view-action", "Soft-_Proofing Profile..."), NULL,
|
||||
NC_("view-action", "Set the soft-proofing profile"),
|
||||
G_CALLBACK (view_softproof_profile_cmd_callback),
|
||||
GIMP_HELP_VIEW_COLOR_MANAGEMENT },
|
||||
|
||||
{ "view-shrink-wrap", "zoom-fit-best",
|
||||
NC_("view-action", "Shrink _Wrap"), "<primary>J",
|
||||
NC_("view-action", "Reduce the image window to the size of the image display"),
|
||||
|
@ -967,6 +973,7 @@ view_actions_update (GimpActionGroup *group,
|
|||
SET_SENSITIVE ("view-display-intent-absolute-colorimetric", cm);
|
||||
SET_SENSITIVE ("view-display-black-point-compensation", cm);
|
||||
SET_ACTIVE ("view-display-black-point-compensation", d_bpc);
|
||||
SET_SENSITIVE ("view-softproof-profile", sp);
|
||||
SET_SENSITIVE ("view-softproof-intent-perceptual", sp);
|
||||
SET_SENSITIVE ("view-softproof-intent-relative-colorimetric", sp);
|
||||
SET_SENSITIVE ("view-softproof-intent-saturation", sp);
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "display/gimpdisplayshell-close.h"
|
||||
#include "display/gimpimagewindow.h"
|
||||
|
||||
#include "dialogs/color-profile-dialog.h"
|
||||
#include "dialogs/dialogs.h"
|
||||
|
||||
#include "actions.h"
|
||||
|
@ -75,10 +76,17 @@
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void view_padding_color_dialog_update (GimpColorDialog *dialog,
|
||||
const GimpRGB *color,
|
||||
GimpColorDialogState state,
|
||||
GimpDisplayShell *shell);
|
||||
static void view_softproof_profile_callback (GtkWidget *dialog,
|
||||
GimpImage *image,
|
||||
GimpColorProfile *new_profile,
|
||||
GFile *new_file,
|
||||
GimpColorRenderingIntent intent,
|
||||
gboolean bpc,
|
||||
gpointer user_data);
|
||||
static void view_padding_color_dialog_update (GimpColorDialog *dialog,
|
||||
const GimpRGB *color,
|
||||
GimpColorDialogState state,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
@ -624,6 +632,47 @@ view_display_bpc_cmd_callback (GtkAction *action,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_softproof_profile_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpDisplayShell *shell;
|
||||
GimpColorConfig *color_config;
|
||||
GtkWidget *dialog;
|
||||
return_if_no_image (image, data);
|
||||
return_if_no_shell (shell, data);
|
||||
|
||||
color_config = gimp_display_shell_get_color_config (shell);
|
||||
|
||||
#define SOFTPROOF_PROFILE_DIALOG_KEY "gimp-softproof-profile-dialog"
|
||||
|
||||
dialog = dialogs_get_dialog (G_OBJECT (shell), SOFTPROOF_PROFILE_DIALOG_KEY);
|
||||
|
||||
if (! dialog)
|
||||
{
|
||||
GimpColorProfile *current_profile;
|
||||
|
||||
current_profile = gimp_color_config_get_simulation_color_profile (color_config,
|
||||
NULL);
|
||||
|
||||
dialog = color_profile_dialog_new (COLOR_PROFILE_DIALOG_SELECT_SOFTPROOF_PROFILE,
|
||||
image,
|
||||
action_data_get_context (data),
|
||||
GTK_WIDGET (shell),
|
||||
current_profile,
|
||||
NULL,
|
||||
0, 0,
|
||||
view_softproof_profile_callback,
|
||||
shell);
|
||||
|
||||
dialogs_attach_dialog (G_OBJECT (shell),
|
||||
SOFTPROOF_PROFILE_DIALOG_KEY, dialog);
|
||||
}
|
||||
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
void
|
||||
view_softproof_intent_cmd_callback (GtkAction *action,
|
||||
GtkAction *current,
|
||||
|
@ -1029,6 +1078,32 @@ view_fullscreen_cmd_callback (GtkAction *action,
|
|||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
view_softproof_profile_callback (GtkWidget *dialog,
|
||||
GimpImage *image,
|
||||
GimpColorProfile *new_profile,
|
||||
GFile *new_file,
|
||||
GimpColorRenderingIntent intent,
|
||||
gboolean bpc,
|
||||
gpointer user_data)
|
||||
{
|
||||
GimpDisplayShell *shell = user_data;
|
||||
GimpColorConfig *color_config;
|
||||
gchar *path = NULL;
|
||||
|
||||
color_config = gimp_display_shell_get_color_config (shell);
|
||||
|
||||
if (new_file)
|
||||
path = g_file_get_path (new_file);
|
||||
|
||||
g_object_set (color_config,
|
||||
"printer-profile", path,
|
||||
NULL);
|
||||
shell->color_config_set = TRUE;
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
view_padding_color_dialog_update (GimpColorDialog *dialog,
|
||||
const GimpRGB *color,
|
||||
|
|
|
@ -81,6 +81,8 @@ void view_display_intent_cmd_callback (GtkAction *action,
|
|||
gpointer data);
|
||||
void view_display_bpc_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void view_softproof_profile_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void view_softproof_intent_cmd_callback (GtkAction *action,
|
||||
GtkAction *current,
|
||||
gpointer data);
|
||||
|
|
|
@ -194,6 +194,24 @@ color_profile_dialog_new (ColorProfileDialogType dialog_type,
|
|||
dest_label = _("Convert to");
|
||||
break;
|
||||
|
||||
case COLOR_PROFILE_DIALOG_SELECT_SOFTPROOF_PROFILE:
|
||||
dialog =
|
||||
gimp_viewable_dialog_new (GIMP_VIEWABLE (image), context,
|
||||
_("Soft-Proof Profile"),
|
||||
"gimp-select-softproof-profile",
|
||||
GTK_STOCK_PRINT,
|
||||
_("Select Soft-Proof Profile"),
|
||||
parent,
|
||||
gimp_standard_help_func,
|
||||
GIMP_HELP_VIEW_COLOR_MANAGEMENT,
|
||||
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
_("_Select"), GTK_RESPONSE_OK,
|
||||
|
||||
NULL);
|
||||
dest_label = _("New Color Profile");
|
||||
break;
|
||||
|
||||
default:
|
||||
g_return_val_if_reached (NULL);
|
||||
}
|
||||
|
@ -304,49 +322,58 @@ color_profile_dialog_new (ColorProfileDialogType dialog_type,
|
|||
static GtkWidget *
|
||||
color_profile_combo_box_new (ProfileDialog *private)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GtkWidget *combo;
|
||||
GtkWidget *chooser;
|
||||
gchar *history;
|
||||
GimpImageBaseType base_type;
|
||||
GimpPrecision precision;
|
||||
GError *error = NULL;
|
||||
GtkListStore *store;
|
||||
GtkWidget *combo;
|
||||
GtkWidget *chooser;
|
||||
gchar *history;
|
||||
|
||||
history = gimp_personal_rc_file ("profilerc");
|
||||
store = gimp_color_profile_store_new (history);
|
||||
g_free (history);
|
||||
|
||||
switch (private->dialog_type)
|
||||
if (private->default_profile)
|
||||
{
|
||||
case COLOR_PROFILE_DIALOG_ASSIGN_PROFILE:
|
||||
case COLOR_PROFILE_DIALOG_CONVERT_TO_PROFILE:
|
||||
base_type = gimp_image_get_base_type (private->image);
|
||||
break;
|
||||
GimpImageBaseType base_type;
|
||||
GimpPrecision precision;
|
||||
GError *error = NULL;
|
||||
|
||||
case COLOR_PROFILE_DIALOG_CONVERT_TO_RGB:
|
||||
base_type = GIMP_RGB;
|
||||
break;
|
||||
switch (private->dialog_type)
|
||||
{
|
||||
case COLOR_PROFILE_DIALOG_ASSIGN_PROFILE:
|
||||
case COLOR_PROFILE_DIALOG_CONVERT_TO_PROFILE:
|
||||
base_type = gimp_image_get_base_type (private->image);
|
||||
break;
|
||||
|
||||
case COLOR_PROFILE_DIALOG_CONVERT_TO_GRAY:
|
||||
base_type = GIMP_GRAY;
|
||||
break;
|
||||
case COLOR_PROFILE_DIALOG_CONVERT_TO_RGB:
|
||||
base_type = GIMP_RGB;
|
||||
break;
|
||||
|
||||
default:
|
||||
g_return_val_if_reached (NULL);
|
||||
case COLOR_PROFILE_DIALOG_CONVERT_TO_GRAY:
|
||||
base_type = GIMP_GRAY;
|
||||
break;
|
||||
|
||||
default:
|
||||
g_return_val_if_reached (NULL);
|
||||
}
|
||||
|
||||
precision = gimp_image_get_precision (private->image);
|
||||
|
||||
if (! gimp_color_profile_store_add_defaults (GIMP_COLOR_PROFILE_STORE (store),
|
||||
private->config,
|
||||
base_type,
|
||||
precision,
|
||||
&error))
|
||||
{
|
||||
gimp_message (private->image->gimp, G_OBJECT (private->dialog),
|
||||
GIMP_MESSAGE_ERROR,
|
||||
"%s", error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
}
|
||||
|
||||
precision = gimp_image_get_precision (private->image);
|
||||
|
||||
if (! gimp_color_profile_store_add_defaults (GIMP_COLOR_PROFILE_STORE (store),
|
||||
private->config,
|
||||
base_type,
|
||||
precision,
|
||||
&error))
|
||||
else
|
||||
{
|
||||
gimp_message (private->image->gimp, G_OBJECT (private->dialog),
|
||||
GIMP_MESSAGE_ERROR,
|
||||
"%s", error->message);
|
||||
g_clear_error (&error);
|
||||
gimp_color_profile_store_add_file (GIMP_COLOR_PROFILE_STORE (store),
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
chooser =
|
||||
|
@ -445,7 +472,7 @@ color_profile_dest_changed (GtkWidget *combo,
|
|||
else
|
||||
{
|
||||
gimp_color_profile_view_set_error (GIMP_COLOR_PROFILE_VIEW (private->dest_view),
|
||||
_("None"));
|
||||
C_("profile", "None"));
|
||||
}
|
||||
|
||||
if (dest_profile)
|
||||
|
|
|
@ -27,7 +27,8 @@ typedef enum
|
|||
COLOR_PROFILE_DIALOG_ASSIGN_PROFILE,
|
||||
COLOR_PROFILE_DIALOG_CONVERT_TO_PROFILE,
|
||||
COLOR_PROFILE_DIALOG_CONVERT_TO_RGB,
|
||||
COLOR_PROFILE_DIALOG_CONVERT_TO_GRAY
|
||||
COLOR_PROFILE_DIALOG_CONVERT_TO_GRAY,
|
||||
COLOR_PROFILE_DIALOG_SELECT_SOFTPROOF_PROFILE
|
||||
} ColorProfileDialogType;
|
||||
|
||||
|
||||
|
|
|
@ -1129,6 +1129,7 @@ gimp_display_shell_color_config_notify_handler (GObject *config,
|
|||
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, "printer-profile") ||
|
||||
! strcmp (param_spec->name, "simulation-rendering-intent") ||
|
||||
! strcmp (param_spec->name, "simulation-use-black-point-compensation") ||
|
||||
! strcmp (param_spec->name, "simulation-gamut-check"))
|
||||
|
|
|
@ -272,6 +272,8 @@ gimp_display_shell_color_config_notify (GimpColorConfig *config,
|
|||
SET_ACTIVE ("view-display-black-point-compensation",
|
||||
gimp_color_config_get_display_bpc (config));
|
||||
|
||||
SET_SENSITIVE ("view-softproof-profile", softproof);
|
||||
|
||||
switch (gimp_color_config_get_simulation_intent (config))
|
||||
{
|
||||
case GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL:
|
||||
|
|
|
@ -1604,10 +1604,11 @@ gimp_prop_profile_combo_box_new (GObject *config,
|
|||
GtkWidget *combo;
|
||||
GFile *file = NULL;
|
||||
|
||||
param_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (config),
|
||||
property_name);
|
||||
param_spec = find_param_spec (config, property_name, G_STRFUNC);
|
||||
if (! param_spec)
|
||||
return NULL;
|
||||
|
||||
if (param_spec && G_IS_PARAM_SPEC_STRING (param_spec))
|
||||
if (G_IS_PARAM_SPEC_STRING (param_spec))
|
||||
{
|
||||
param_spec = check_param_spec_w (config, property_name,
|
||||
G_TYPE_PARAM_STRING, G_STRFUNC);
|
||||
|
|
|
@ -229,15 +229,29 @@ gimp_icon_button_new (const gchar *icon_name,
|
|||
GtkWidget *
|
||||
gimp_color_profile_label_new (GimpColorProfile *profile)
|
||||
{
|
||||
GtkWidget *expander;
|
||||
GtkWidget *view;
|
||||
GtkWidget *expander;
|
||||
GtkWidget *view;
|
||||
const gchar *label;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile), NULL);
|
||||
g_return_val_if_fail (profile == NULL ||
|
||||
GIMP_IS_COLOR_PROFILE (profile), NULL);
|
||||
|
||||
expander = gtk_expander_new (gimp_color_profile_get_label (profile));
|
||||
if (profile)
|
||||
label = gimp_color_profile_get_label (profile);
|
||||
else
|
||||
label = C_("profile", "None");
|
||||
|
||||
expander = gtk_expander_new (label);
|
||||
|
||||
view = gimp_color_profile_view_new ();
|
||||
gimp_color_profile_view_set_profile (GIMP_COLOR_PROFILE_VIEW (view), profile);
|
||||
|
||||
if (profile)
|
||||
gimp_color_profile_view_set_profile (GIMP_COLOR_PROFILE_VIEW (view),
|
||||
profile);
|
||||
else
|
||||
gimp_color_profile_view_set_error (GIMP_COLOR_PROFILE_VIEW (view),
|
||||
C_("profile", "None"));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (expander), view);
|
||||
gtk_widget_show (view);
|
||||
|
||||
|
|
|
@ -313,6 +313,7 @@
|
|||
</menu>
|
||||
<menuitem action="view-display-black-point-compensation" />
|
||||
<separator />
|
||||
<menuitem action="view-softproof-profile" />
|
||||
<menu action="view-softproof-intent-menu" name="Softproof Rendering Intent">
|
||||
<menuitem action="view-softproof-intent-perceptual" />
|
||||
<menuitem action="view-softproof-intent-relative-colorimetric" />
|
||||
|
|
Loading…
Reference in New Issue