show the names of the color profiles that are used.
2005-06-25 Sven Neumann <sven@gimp.org> * modules/cdisplay_lcms.c (cdisplay_lcms_configure): show the names of the color profiles that are used.
This commit is contained in:

committed by
Sven Neumann

parent
de642dd10f
commit
bc53cbb1d4
@ -1,3 +1,8 @@
|
|||||||
|
2005-06-25 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* modules/cdisplay_lcms.c (cdisplay_lcms_configure): show the names
|
||||||
|
of the color profiles that are used.
|
||||||
|
|
||||||
2005-06-24 Tor Lillqvist <tml@novell.com>
|
2005-06-24 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
* app/display/gimpcanvas.h: Add new GimpCanvasStyle value,
|
* app/display/gimpcanvas.h: Add new GimpCanvasStyle value,
|
||||||
|
@ -89,8 +89,9 @@ static void cdisplay_lcms_changed (GimpColorDisplay *display);
|
|||||||
static void cdisplay_lcms_set_config (CdisplayLcms *lcms,
|
static void cdisplay_lcms_set_config (CdisplayLcms *lcms,
|
||||||
GimpColorConfig *config);
|
GimpColorConfig *config);
|
||||||
|
|
||||||
static cmsHPROFILE cdisplay_lcms_get_display_profile (CdisplayLcms *lcms,
|
static cmsHPROFILE cdisplay_lcms_get_rgb_profile (CdisplayLcms *lcms);
|
||||||
GimpColorConfig *config);
|
static cmsHPROFILE cdisplay_lcms_get_display_profile (CdisplayLcms *lcms);
|
||||||
|
static cmsHPROFILE cdisplay_lcms_get_printer_profile (CdisplayLcms *lcms);
|
||||||
|
|
||||||
|
|
||||||
static const GimpModuleInfo cdisplay_lcms_info =
|
static const GimpModuleInfo cdisplay_lcms_info =
|
||||||
@ -228,6 +229,23 @@ cdisplay_lcms_set_property (GObject *object,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline const gchar *
|
||||||
|
cdisplay_lcms_profile_get_name (cmsHPROFILE profile)
|
||||||
|
{
|
||||||
|
if (profile)
|
||||||
|
{
|
||||||
|
const gchar *name = cmsTakeProductName (profile);
|
||||||
|
|
||||||
|
if (g_utf8_validate (name, -1, NULL))
|
||||||
|
return name;
|
||||||
|
else
|
||||||
|
return _("(invalid UTF-8 string)");
|
||||||
|
}
|
||||||
|
|
||||||
|
return _("None");
|
||||||
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
cdisplay_lcms_configure (GimpColorDisplay *display)
|
cdisplay_lcms_configure (GimpColorDisplay *display)
|
||||||
{
|
{
|
||||||
@ -238,6 +256,8 @@ cdisplay_lcms_configure (GimpColorDisplay *display)
|
|||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *image;
|
GtkWidget *image;
|
||||||
GtkWidget *table;
|
GtkWidget *table;
|
||||||
|
cmsHPROFILE profile;
|
||||||
|
const gchar *name;
|
||||||
gint row = 0;
|
gint row = 0;
|
||||||
|
|
||||||
vbox = gtk_vbox_new (FALSE, 12);
|
vbox = gtk_vbox_new (FALSE, 12);
|
||||||
@ -251,7 +271,7 @@ cdisplay_lcms_configure (GimpColorDisplay *display)
|
|||||||
gtk_widget_show (image);
|
gtk_widget_show (image);
|
||||||
|
|
||||||
label = g_object_new (GTK_TYPE_LABEL,
|
label = g_object_new (GTK_TYPE_LABEL,
|
||||||
"label", _("This module takes its configuration "
|
"label", _("This filter takes its configuration "
|
||||||
"from the <i>Color Management</i> "
|
"from the <i>Color Management</i> "
|
||||||
"section in the Preferences dialog."),
|
"section in the Preferences dialog."),
|
||||||
"use-markup", TRUE,
|
"use-markup", TRUE,
|
||||||
@ -266,6 +286,7 @@ cdisplay_lcms_configure (GimpColorDisplay *display)
|
|||||||
|
|
||||||
table = gtk_table_new (5, 2, FALSE);
|
table = gtk_table_new (5, 2, FALSE);
|
||||||
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
||||||
|
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 12);
|
||||||
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
@ -274,30 +295,39 @@ cdisplay_lcms_configure (GimpColorDisplay *display)
|
|||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
|
||||||
_("Mode of operation:"),
|
_("Mode of operation:"),
|
||||||
0.0, 0.5, label, 1, TRUE);
|
0.0, 0.5, label, 1, TRUE);
|
||||||
{
|
|
||||||
static const struct
|
|
||||||
{
|
|
||||||
const gchar *text;
|
|
||||||
const gchar *property_name;
|
|
||||||
}
|
|
||||||
profiles[] =
|
|
||||||
{
|
|
||||||
{ N_("RGB profile:"), "rgb-profile" },
|
|
||||||
{ N_("CMYK profile:"), "cmyk-profile" },
|
|
||||||
{ N_("Monitor profile:"), "display-profile" },
|
|
||||||
{ N_("Print simulation profile:"), "printer-profile" }
|
|
||||||
};
|
|
||||||
|
|
||||||
gint i;
|
/* FIXME: need to update label with config changes */
|
||||||
|
profile = cdisplay_lcms_get_rgb_profile (lcms);
|
||||||
|
name = cdisplay_lcms_profile_get_name (profile);
|
||||||
|
if (profile)
|
||||||
|
cmsCloseProfile (profile);
|
||||||
|
|
||||||
for (i = 0, row = 3; i < G_N_ELEMENTS (profiles); i++, row++)
|
label = gtk_label_new (name);
|
||||||
{
|
|
||||||
label = gimp_prop_label_new (config, profiles[i].property_name);
|
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
|
||||||
profiles[i].text,
|
_("RGB workspace profile:"),
|
||||||
|
0.0, 0.5, label, 1, TRUE);
|
||||||
|
|
||||||
|
/* FIXME: need to update label with config changes */
|
||||||
|
profile = cdisplay_lcms_get_display_profile (lcms);
|
||||||
|
name = cdisplay_lcms_profile_get_name (profile);
|
||||||
|
if (profile)
|
||||||
|
cmsCloseProfile (profile);
|
||||||
|
|
||||||
|
label = gtk_label_new (name);
|
||||||
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
|
||||||
|
_("Monitor profile:"),
|
||||||
|
0.0, 0.5, label, 1, TRUE);
|
||||||
|
|
||||||
|
/* FIXME: need to update label with config changes */
|
||||||
|
profile = cdisplay_lcms_get_printer_profile (lcms);
|
||||||
|
name = cdisplay_lcms_profile_get_name (profile);
|
||||||
|
if (profile)
|
||||||
|
cmsCloseProfile (profile);
|
||||||
|
|
||||||
|
label = gtk_label_new (name);
|
||||||
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
|
||||||
|
_("Print simulation profile:"),
|
||||||
0.0, 0.5, label, 1, TRUE);
|
0.0, 0.5, label, 1, TRUE);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return vbox;
|
return vbox;
|
||||||
}
|
}
|
||||||
@ -348,16 +378,13 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case GIMP_COLOR_MANAGEMENT_SOFTPROOF:
|
case GIMP_COLOR_MANAGEMENT_SOFTPROOF:
|
||||||
if (config->printer_profile)
|
proof_profile = cdisplay_lcms_get_printer_profile (lcms);
|
||||||
proof_profile = cmsOpenProfileFromFile (config->printer_profile, "r");
|
|
||||||
|
|
||||||
/* fallthru */
|
/* fallthru */
|
||||||
|
|
||||||
case GIMP_COLOR_MANAGEMENT_DISPLAY:
|
case GIMP_COLOR_MANAGEMENT_DISPLAY:
|
||||||
/* this should be taken from the image */
|
src_profile = cdisplay_lcms_get_rgb_profile (lcms);
|
||||||
src_profile = cmsCreate_sRGBProfile ();
|
dest_profile = cdisplay_lcms_get_display_profile (lcms);
|
||||||
|
|
||||||
dest_profile = cdisplay_lcms_get_display_profile (lcms, config);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,11 +442,24 @@ cdisplay_lcms_set_config (CdisplayLcms *lcms,
|
|||||||
gimp_color_display_changed (GIMP_COLOR_DISPLAY (lcms));
|
gimp_color_display_changed (GIMP_COLOR_DISPLAY (lcms));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cmsHPROFILE
|
||||||
|
cdisplay_lcms_get_rgb_profile (CdisplayLcms *lcms)
|
||||||
|
{
|
||||||
|
GimpColorConfig *config = lcms->config;
|
||||||
|
|
||||||
|
/* this should be taken from the image */
|
||||||
|
|
||||||
|
if (config->rgb_profile)
|
||||||
|
return cmsOpenProfileFromFile (config->rgb_profile, "r");
|
||||||
|
|
||||||
|
return cmsCreate_sRGBProfile ();
|
||||||
|
}
|
||||||
|
|
||||||
static cmsHPROFILE
|
static cmsHPROFILE
|
||||||
cdisplay_lcms_get_display_profile (CdisplayLcms *lcms,
|
cdisplay_lcms_get_display_profile (CdisplayLcms *lcms)
|
||||||
GimpColorConfig *config)
|
|
||||||
{
|
{
|
||||||
|
GimpColorConfig *config = lcms->config;
|
||||||
|
|
||||||
#if defined (GDK_WINDOWING_X11)
|
#if defined (GDK_WINDOWING_X11)
|
||||||
if (config->display_profile_from_gdk)
|
if (config->display_profile_from_gdk)
|
||||||
{
|
{
|
||||||
@ -442,14 +482,6 @@ cdisplay_lcms_get_display_profile (CdisplayLcms *lcms,
|
|||||||
|
|
||||||
g_free (data);
|
g_free (data);
|
||||||
|
|
||||||
if (profile)
|
|
||||||
{
|
|
||||||
const gchar *name = cmsTakeProductName (profile);
|
|
||||||
|
|
||||||
g_printerr ("obtained ICC profile from X server: %s\n",
|
|
||||||
name ? name : "<untitled>");
|
|
||||||
}
|
|
||||||
|
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -460,3 +492,14 @@ cdisplay_lcms_get_display_profile (CdisplayLcms *lcms,
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cmsHPROFILE
|
||||||
|
cdisplay_lcms_get_printer_profile (CdisplayLcms *lcms)
|
||||||
|
{
|
||||||
|
GimpColorConfig *config = lcms->config;
|
||||||
|
|
||||||
|
if (config->printer_profile)
|
||||||
|
return cmsOpenProfileFromFile (config->printer_profile, "r");
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user