update the configuration dialog when then color configuration is changed.

2006-11-03  Sven Neumann  <sven@gimp.org>

	* modules/cdisplay_lcms.c: update the configuration dialog when
	then color configuration is changed.

	* plug-ins/common/lcms.c: be even more robust.
This commit is contained in:
Sven Neumann 2006-11-03 22:26:39 +00:00 committed by Sven Neumann
parent 0e4f794f46
commit 099bb0a811
3 changed files with 130 additions and 50 deletions

View File

@ -1,3 +1,10 @@
2006-11-03 Sven Neumann <sven@gimp.org>
* modules/cdisplay_lcms.c: update the configuration dialog when
then color configuration is changed.
* plug-ins/common/lcms.c: be even more robust.
2006-11-03 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcoloreditor.c

View File

@ -99,7 +99,16 @@ static void cdisplay_lcms_attach_labelled (GtkTable *table,
gint row,
const gchar *text,
GtkWidget *widget,
gboolean tooltip);
static void cdisplay_lcms_label_set_text (GtkLabel *label,
const gchar *text,
const gchar *tooltip);
static void cdisplay_lcms_update_profile_label (CdisplayLcms *lcms,
const gchar *name);
static void cdisplay_lcms_notify_profile (GObject *config,
GParamSpec *pspec,
CdisplayLcms *lcms);
static const GimpModuleInfo cdisplay_lcms_info =
{
@ -268,9 +277,7 @@ cdisplay_lcms_configure (GimpColorDisplay *display)
GtkWidget *vbox;
GtkWidget *hint;
GtkWidget *table;
cmsHPROFILE profile;
const gchar *name;
const gchar *info;
GtkWidget *label;
gint row = 0;
if (! config)
@ -294,37 +301,32 @@ cdisplay_lcms_configure (GimpColorDisplay *display)
cdisplay_lcms_attach_labelled (GTK_TABLE (table), row++,
_("Mode of operation:"),
gimp_prop_enum_label_new (config, "mode"),
NULL);
/* FIXME: need to update label with config changes */
profile = cdisplay_lcms_get_rgb_profile (lcms);
cdisplay_lcms_profile_get_info (profile, &name, &info);
if (profile)
cmsCloseProfile (profile);
FALSE);
label = gtk_label_new (NULL);
g_object_set_data (G_OBJECT (lcms), "rgb-profile", label);
cdisplay_lcms_attach_labelled (GTK_TABLE (table), row++,
_("RGB workspace profile:"),
gtk_label_new (name), info);
/* FIXME: need to update label with config changes */
profile = cdisplay_lcms_get_display_profile (lcms);
cdisplay_lcms_profile_get_info (profile, &name, &info);
if (profile)
cmsCloseProfile (profile);
_("RGB working space profile:"),
label, TRUE);
cdisplay_lcms_update_profile_label (lcms, "rgb-profile");
label = gtk_label_new (NULL);
g_object_set_data (G_OBJECT (lcms), "display-profile", label);
cdisplay_lcms_attach_labelled (GTK_TABLE (table), row++,
_("Monitor profile:"),
gtk_label_new (name), info);
/* FIXME: need to update label with config changes */
profile = cdisplay_lcms_get_printer_profile (lcms);
cdisplay_lcms_profile_get_info (profile, &name, &info);
if (profile)
cmsCloseProfile (profile);
label, TRUE);
cdisplay_lcms_update_profile_label (lcms, "display-profile");
label = gtk_label_new (NULL);
g_object_set_data (G_OBJECT (lcms), "printer-profile", label);
cdisplay_lcms_attach_labelled (GTK_TABLE (table), row++,
_("Print simulation profile:"),
gtk_label_new (name), info);
label, TRUE);
cdisplay_lcms_update_profile_label (lcms, "printer-profile");
g_signal_connect_object (config, "notify",
G_CALLBACK (cdisplay_lcms_notify_profile),
lcms, 0);
return vbox;
}
@ -507,36 +509,33 @@ cdisplay_lcms_attach_labelled (GtkTable *table,
gint row,
const gchar *text,
GtkWidget *widget,
const gchar *tooltip)
gboolean tooltip)
{
GtkWidget *label;
GtkWidget *ebox = NULL;
GtkWidget *hbox;
if (text)
{
GtkWidget *label;
label = g_object_new (GTK_TYPE_LABEL,
"label", text,
"xalign", 1.0,
"yalign", 0.5,
NULL);
label = g_object_new (GTK_TYPE_LABEL,
"label", text,
"xalign", 1.0,
"yalign", 0.5,
NULL);
gimp_label_set_attributes (GTK_LABEL (label),
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
-1);
gtk_table_attach (table, label, 0, 1, row, row + 1,
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);
}
gimp_label_set_attributes (GTK_LABEL (label),
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
-1);
gtk_table_attach (table, label, 0, 1, row, row + 1,
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);
if (tooltip)
{
ebox = gtk_event_box_new ();
gtk_table_attach (table, ebox, 1, 2, row, row + 1,
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
gimp_help_set_help_data (ebox, tooltip, NULL);
gtk_widget_show (ebox);
g_object_set_data (G_OBJECT (label), "tooltip-widget", ebox);
}
hbox = gtk_hbox_new (FALSE, 0);
@ -552,3 +551,64 @@ cdisplay_lcms_attach_labelled (GtkTable *table,
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
}
static void
cdisplay_lcms_label_set_text (GtkLabel *label,
const gchar *text,
const gchar *tooltip)
{
GtkWidget *tooltip_widget;
gtk_label_set_text (label, text);
tooltip_widget = g_object_get_data (G_OBJECT (label), "tooltip-widget");
if (tooltip_widget)
gimp_help_set_help_data (tooltip_widget, tooltip, NULL);
}
static void
cdisplay_lcms_update_profile_label (CdisplayLcms *lcms,
const gchar *name)
{
GtkWidget *label;
cmsHPROFILE profile = NULL;
const gchar *text;
const gchar *tooltip;
label = g_object_get_data (G_OBJECT (lcms), name);
if (! label)
return;
if (strcmp (name, "rgb-profile") == 0)
{
profile = cdisplay_lcms_get_rgb_profile (lcms);
}
else if (g_str_has_prefix (name, "display-profile"))
{
profile = cdisplay_lcms_get_display_profile (lcms);
}
else if (strcmp (name, "printer-profile") == 0)
{
profile = cdisplay_lcms_get_printer_profile (lcms);
}
else
{
g_return_if_reached ();
}
cdisplay_lcms_profile_get_info (profile, &text, &tooltip);
cdisplay_lcms_label_set_text (GTK_LABEL (label), text, tooltip);
if (profile)
cmsCloseProfile (profile);
}
static void
cdisplay_lcms_notify_profile (GObject *config,
GParamSpec *pspec,
CdisplayLcms *lcms)
{
cdisplay_lcms_update_profile_label (lcms, pspec->name);
}

View File

@ -669,9 +669,16 @@ lcms_image_transform_rgb (gint32 image,
last_format = format;
}
lcms_drawable_transform (drawable, transform,
(gdouble) i / num_layers,
(gdouble) (i + 1) / num_layers);
if (transform)
{
lcms_drawable_transform (drawable, transform,
(gdouble) i / num_layers,
(gdouble) (i + 1) / num_layers);
}
else
{
g_warning ("cmsCreateTransform() failed!");
}
gimp_drawable_detach (drawable);
}
@ -697,9 +704,15 @@ lcms_image_transform_indexed (gint32 image,
dest_profile, TYPE_RGB_8,
INTENT_PERCEPTUAL, 0);
cmsDoTransform (transform, cmap, cmap, num_colors);
cmsDeleteTransform(transform);
if (transform)
{
cmsDoTransform (transform, cmap, cmap, num_colors);
cmsDeleteTransform(transform);
}
else
{
g_warning ("cmsCreateTransform() failed!");
}
gimp_image_set_colormap (image, cmap, num_colors);
}