modules/cdisplay_colorblind.c modules/cdisplay_gamma.c
2005-02-05 Sven Neumann <sven@gimp.org> * modules/cdisplay_colorblind.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/cdisplay_proof.c: ported all ColorDisplay modules to GimpConfig.
This commit is contained in:

committed by
Sven Neumann

parent
3e7c5ff976
commit
d44700a1d1
@ -1,3 +1,11 @@
|
||||
2005-02-05 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* modules/cdisplay_colorblind.c
|
||||
* modules/cdisplay_gamma.c
|
||||
* modules/cdisplay_highcontrast.c
|
||||
* modules/cdisplay_proof.c: ported all ColorDisplay modules to
|
||||
GimpConfig.
|
||||
|
||||
2005-02-05 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* modules/Makefile.am: link ColorDisplay modules with libgimpconfig.
|
||||
|
@ -253,7 +253,7 @@ cdisplay_colorblind_class_init (CdisplayColorblindClass *klass)
|
||||
"deficiency", NULL,
|
||||
CDISPLAY_TYPE_COLORBLIND_DEFICIENCY,
|
||||
DEFAULT_DEFICIENCY,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||
0);
|
||||
|
||||
display_class->name = _("Color Deficient Vision");
|
||||
display_class->help_id = "gimp-colordisplay-colorblind";
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
#include "libgimpmodule/gimpmodule.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
@ -51,7 +52,6 @@ struct _CdisplayGamma
|
||||
guchar lookup[256];
|
||||
|
||||
GtkWidget *hbox;
|
||||
GtkObject *adjustment;
|
||||
};
|
||||
|
||||
struct _CdisplayGammaClass
|
||||
@ -95,8 +95,6 @@ static void cdisplay_gamma_configure_reset (GimpColorDisplay *display);
|
||||
|
||||
static void cdisplay_gamma_set_gamma (CdisplayGamma *gamma,
|
||||
gdouble value);
|
||||
static void cdisplay_gamma_adj_callback (GtkAdjustment *adj,
|
||||
CdisplayGamma *gamma);
|
||||
|
||||
|
||||
static const GimpModuleInfo cdisplay_gamma_info =
|
||||
@ -145,11 +143,20 @@ cdisplay_gamma_get_type (GTypeModule *module)
|
||||
NULL /* instance_init */
|
||||
};
|
||||
|
||||
static const GInterfaceInfo display_iface_info =
|
||||
{
|
||||
NULL, /* iface_init */
|
||||
NULL, /* iface_finalize */
|
||||
NULL /* iface_data */
|
||||
};
|
||||
|
||||
cdisplay_gamma_type =
|
||||
g_type_module_register_type (module,
|
||||
GIMP_TYPE_COLOR_DISPLAY,
|
||||
"CdisplayGamma",
|
||||
&display_info, 0);
|
||||
g_type_add_interface_static (cdisplay_gamma_type,
|
||||
GIMP_TYPE_CONFIG, &display_iface_info);
|
||||
}
|
||||
|
||||
return cdisplay_gamma_type;
|
||||
@ -167,13 +174,10 @@ cdisplay_gamma_class_init (CdisplayGammaClass *klass)
|
||||
object_class->get_property = cdisplay_gamma_get_property;
|
||||
object_class->set_property = cdisplay_gamma_set_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_GAMMA,
|
||||
g_param_spec_double ("gamma", NULL, NULL,
|
||||
0.01, 10.0,
|
||||
DEFAULT_GAMMA,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
GIMP_MODULE_PARAM_SERIALIZE));
|
||||
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_GAMMA,
|
||||
"gamma", NULL,
|
||||
0.01, 10.0, DEFAULT_GAMMA,
|
||||
0);
|
||||
|
||||
display_class->name = _("Gamma");
|
||||
display_class->help_id = "gimp-colordisplay-gamma";
|
||||
@ -237,16 +241,7 @@ cdisplay_gamma_set_property (GObject *object,
|
||||
static GimpColorDisplay *
|
||||
cdisplay_gamma_clone (GimpColorDisplay *display)
|
||||
{
|
||||
CdisplayGamma *gamma = CDISPLAY_GAMMA (display);
|
||||
CdisplayGamma *copy;
|
||||
|
||||
copy = CDISPLAY_GAMMA (gimp_color_display_new (G_TYPE_FROM_INSTANCE (gamma)));
|
||||
|
||||
copy->gamma = gamma->gamma;
|
||||
|
||||
memcpy (copy->lookup, gamma->lookup, sizeof (guchar) * 256);
|
||||
|
||||
return GIMP_COLOR_DISPLAY (copy);
|
||||
return GIMP_COLOR_DISPLAY (gimp_config_duplicate (GIMP_CONFIG (display)));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -290,47 +285,26 @@ static void
|
||||
cdisplay_gamma_load_state (GimpColorDisplay *display,
|
||||
GimpParasite *state)
|
||||
{
|
||||
gdouble value;
|
||||
|
||||
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
memcpy (&value, gimp_parasite_data (state), sizeof (gdouble));
|
||||
#else
|
||||
{
|
||||
guint32 buf[2];
|
||||
const guint32 *data;
|
||||
|
||||
data = gimp_parasite_data (state);
|
||||
|
||||
buf[0] = g_ntohl (data[1]);
|
||||
buf[1] = g_ntohl (data[0]);
|
||||
|
||||
memcpy (&value, buf, sizeof (gdouble));
|
||||
}
|
||||
#endif
|
||||
|
||||
cdisplay_gamma_set_gamma (CDISPLAY_GAMMA (display), value);
|
||||
gimp_config_deserialize_string (GIMP_CONFIG (display),
|
||||
gimp_parasite_data (state),
|
||||
gimp_parasite_data_size (state),
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
static GimpParasite *
|
||||
cdisplay_gamma_save_state (GimpColorDisplay *display)
|
||||
{
|
||||
CdisplayGamma *gamma = CDISPLAY_GAMMA (display);
|
||||
guint32 buf[2];
|
||||
GimpParasite *parasite;
|
||||
gchar *str;
|
||||
|
||||
memcpy (buf, &gamma->gamma, sizeof (double));
|
||||
str = gimp_config_serialize_to_string (GIMP_CONFIG (display), NULL);
|
||||
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
{
|
||||
guint32 tmp;
|
||||
parasite = gimp_parasite_new ("Display/Gamma",
|
||||
GIMP_PARASITE_PERSISTENT,
|
||||
strlen (str) + 1, str);
|
||||
g_free (str);
|
||||
|
||||
tmp = g_htonl (buf[0]);
|
||||
buf[0] = g_htonl (buf[1]);
|
||||
buf[1] = tmp;
|
||||
}
|
||||
#endif
|
||||
|
||||
return gimp_parasite_new ("Display/Gamma", GIMP_PARASITE_PERSISTENT,
|
||||
sizeof (double), &buf);
|
||||
return parasite;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
@ -353,29 +327,20 @@ cdisplay_gamma_configure (GimpColorDisplay *display)
|
||||
gtk_box_pack_start (GTK_BOX (gamma->hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
spinbutton = gimp_spin_button_new (&gamma->adjustment,
|
||||
gamma->gamma, 0.01, 10.0, 0.01, 0.1, 0.0,
|
||||
0.1, 3);
|
||||
spinbutton = gimp_prop_spin_button_new (G_OBJECT (gamma), "gamma",
|
||||
0.1, 1.0, 3);
|
||||
gtk_box_pack_start (GTK_BOX (gamma->hbox), spinbutton, FALSE, FALSE, 0);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
|
||||
|
||||
g_signal_connect (gamma->adjustment, "value_changed",
|
||||
G_CALLBACK (cdisplay_gamma_adj_callback),
|
||||
gamma);
|
||||
|
||||
return gamma->hbox;
|
||||
}
|
||||
|
||||
static void
|
||||
cdisplay_gamma_configure_reset (GimpColorDisplay *display)
|
||||
{
|
||||
CdisplayGamma *gamma = CDISPLAY_GAMMA (display);
|
||||
|
||||
if (gamma->adjustment)
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (gamma->adjustment),
|
||||
DEFAULT_GAMMA);
|
||||
gimp_config_reset (GIMP_CONFIG (display));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -403,10 +368,3 @@ cdisplay_gamma_set_gamma (CdisplayGamma *gamma,
|
||||
gimp_color_display_changed (GIMP_COLOR_DISPLAY (gamma));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cdisplay_gamma_adj_callback (GtkAdjustment *adj,
|
||||
CdisplayGamma *gamma)
|
||||
{
|
||||
cdisplay_gamma_set_gamma (gamma, adj->value);
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
#include "libgimpmodule/gimpmodule.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
@ -51,7 +52,6 @@ struct _CdisplayContrast
|
||||
guchar lookup[256];
|
||||
|
||||
GtkWidget *hbox;
|
||||
GtkObject *adjustment;
|
||||
};
|
||||
|
||||
struct _CdisplayContrastClass
|
||||
@ -95,8 +95,6 @@ static void cdisplay_contrast_configure_reset (GimpColorDisplay *display);
|
||||
|
||||
static void cdisplay_contrast_set_contrast (CdisplayContrast *contrast,
|
||||
gdouble value);
|
||||
static void cdisplay_contrast_adj_callback (GtkAdjustment *adj,
|
||||
CdisplayContrast *contrast);
|
||||
|
||||
|
||||
static const GimpModuleInfo cdisplay_contrast_info =
|
||||
@ -145,11 +143,20 @@ cdisplay_contrast_get_type (GTypeModule *module)
|
||||
NULL /* instance_init */
|
||||
};
|
||||
|
||||
static const GInterfaceInfo display_iface_info =
|
||||
{
|
||||
NULL, /* iface_init */
|
||||
NULL, /* iface_finalize */
|
||||
NULL /* iface_data */
|
||||
};
|
||||
|
||||
cdisplay_contrast_type =
|
||||
g_type_module_register_type (module,
|
||||
GIMP_TYPE_COLOR_DISPLAY,
|
||||
"CdisplayContrast",
|
||||
&display_info, 0);
|
||||
g_type_add_interface_static (cdisplay_contrast_type,
|
||||
GIMP_TYPE_CONFIG, &display_iface_info);
|
||||
}
|
||||
|
||||
return cdisplay_contrast_type;
|
||||
@ -167,13 +174,10 @@ cdisplay_contrast_class_init (CdisplayContrastClass *klass)
|
||||
object_class->get_property = cdisplay_contrast_get_property;
|
||||
object_class->set_property = cdisplay_contrast_set_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_CONTRAST,
|
||||
g_param_spec_double ("contrast", NULL, NULL,
|
||||
0.01, 10.0,
|
||||
DEFAULT_CONTRAST,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
GIMP_MODULE_PARAM_SERIALIZE));
|
||||
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CONTRAST,
|
||||
"contrast", NULL,
|
||||
0.01, 10.0, DEFAULT_CONTRAST,
|
||||
0);
|
||||
|
||||
display_class->name = _("Contrast");
|
||||
display_class->help_id = "gimp-colordisplay-contrast";
|
||||
@ -237,16 +241,7 @@ cdisplay_contrast_set_property (GObject *object,
|
||||
static GimpColorDisplay *
|
||||
cdisplay_contrast_clone (GimpColorDisplay *display)
|
||||
{
|
||||
CdisplayContrast *contrast = CDISPLAY_CONTRAST (display);
|
||||
CdisplayContrast *copy;
|
||||
|
||||
copy = CDISPLAY_CONTRAST (gimp_color_display_new (G_TYPE_FROM_INSTANCE (contrast)));
|
||||
|
||||
copy->contrast = contrast->contrast;
|
||||
|
||||
memcpy (copy->lookup, contrast->lookup, sizeof (guchar) * 256);
|
||||
|
||||
return GIMP_COLOR_DISPLAY (copy);
|
||||
return GIMP_COLOR_DISPLAY (gimp_config_duplicate (GIMP_CONFIG (display)));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -290,47 +285,26 @@ static void
|
||||
cdisplay_contrast_load_state (GimpColorDisplay *display,
|
||||
GimpParasite *state)
|
||||
{
|
||||
gdouble value;
|
||||
|
||||
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
memcpy (&value, gimp_parasite_data (state), sizeof (gdouble));
|
||||
#else
|
||||
{
|
||||
guint32 buf[2];
|
||||
const guint32 *data;
|
||||
|
||||
data = gimp_parasite_data (state);
|
||||
|
||||
buf[0] = g_ntohl (data[1]);
|
||||
buf[1] = g_ntohl (data[0]);
|
||||
|
||||
memcpy (&value, buf, sizeof (gdouble));
|
||||
}
|
||||
#endif
|
||||
|
||||
cdisplay_contrast_set_contrast (CDISPLAY_CONTRAST (display), value);
|
||||
gimp_config_deserialize_string (GIMP_CONFIG (display),
|
||||
gimp_parasite_data (state),
|
||||
gimp_parasite_data_size (state),
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
static GimpParasite *
|
||||
cdisplay_contrast_save_state (GimpColorDisplay *display)
|
||||
{
|
||||
CdisplayContrast *contrast = CDISPLAY_CONTRAST (display);
|
||||
guint32 buf[2];
|
||||
GimpParasite *parasite;
|
||||
gchar *str;
|
||||
|
||||
memcpy (buf, &contrast->contrast, sizeof (double));
|
||||
str = gimp_config_serialize_to_string (GIMP_CONFIG (display), NULL);
|
||||
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
{
|
||||
guint32 tmp;
|
||||
parasite = gimp_parasite_new ("Display/Contrast",
|
||||
GIMP_PARASITE_PERSISTENT,
|
||||
strlen (str) + 1, str);
|
||||
g_free (str);
|
||||
|
||||
tmp = g_htonl (buf[0]);
|
||||
buf[0] = g_htonl (buf[1]);
|
||||
buf[1] = tmp;
|
||||
}
|
||||
#endif
|
||||
|
||||
return gimp_parasite_new ("Display/Contrast", GIMP_PARASITE_PERSISTENT,
|
||||
sizeof (double), &buf);
|
||||
return parasite;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
@ -353,30 +327,20 @@ cdisplay_contrast_configure (GimpColorDisplay *display)
|
||||
gtk_box_pack_start (GTK_BOX (contrast->hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
spinbutton = gimp_spin_button_new (&contrast->adjustment,
|
||||
contrast->contrast,
|
||||
0.01, 10.0, 0.01, 0.1, 0.0,
|
||||
0.1, 3);
|
||||
spinbutton = gimp_prop_spin_button_new (G_OBJECT (contrast), "contrast",
|
||||
0.1, 1.0, 3);
|
||||
gtk_box_pack_start (GTK_BOX (contrast->hbox), spinbutton, FALSE, FALSE, 0);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
|
||||
|
||||
g_signal_connect (contrast->adjustment, "value_changed",
|
||||
G_CALLBACK (cdisplay_contrast_adj_callback),
|
||||
contrast);
|
||||
|
||||
return contrast->hbox;
|
||||
}
|
||||
|
||||
static void
|
||||
cdisplay_contrast_configure_reset (GimpColorDisplay *display)
|
||||
{
|
||||
CdisplayContrast *contrast = CDISPLAY_CONTRAST (display);
|
||||
|
||||
if (contrast->adjustment)
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (contrast->adjustment),
|
||||
DEFAULT_CONTRAST);
|
||||
gimp_config_reset (GIMP_CONFIG (display));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -402,10 +366,3 @@ cdisplay_contrast_set_contrast (CdisplayContrast *contrast,
|
||||
gimp_color_display_changed (GIMP_COLOR_DISPLAY (contrast));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cdisplay_contrast_adj_callback (GtkAdjustment *adj,
|
||||
CdisplayContrast *contrast)
|
||||
{
|
||||
cdisplay_contrast_set_contrast (contrast, adj->value);
|
||||
}
|
||||
|
@ -29,9 +29,10 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
#include "libgimpmodule/gimpmodule.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
||||
#include "libgimp/libgimp-intl.h"
|
||||
|
||||
@ -83,8 +84,6 @@ struct _CdisplayProof
|
||||
cmsHTRANSFORM transform;
|
||||
|
||||
GtkWidget *table;
|
||||
GtkWidget *combo;
|
||||
GtkWidget *toggle;
|
||||
};
|
||||
|
||||
struct _CdisplayProofClass
|
||||
@ -133,13 +132,6 @@ static void cdisplay_proof_configure_reset (GimpColorDisplay *disp
|
||||
|
||||
static void cdisplay_proof_changed (GimpColorDisplay *display);
|
||||
|
||||
static void proof_intent_callback (GtkWidget *widget,
|
||||
CdisplayProof *proof);
|
||||
static void proof_bpc_callback (GtkWidget *widget,
|
||||
CdisplayProof *proof);
|
||||
static void proof_file_callback (GtkWidget *widget,
|
||||
CdisplayProof *proof);
|
||||
|
||||
|
||||
static const GimpModuleInfo cdisplay_proof_info =
|
||||
{
|
||||
@ -189,9 +181,18 @@ cdisplay_proof_get_type (GTypeModule *module)
|
||||
(GInstanceInitFunc) cdisplay_proof_init,
|
||||
};
|
||||
|
||||
cdisplay_proof_type =
|
||||
static const GInterfaceInfo display_iface_info =
|
||||
{
|
||||
NULL, /* iface_init */
|
||||
NULL, /* iface_finalize */
|
||||
NULL /* iface_data */
|
||||
};
|
||||
|
||||
cdisplay_proof_type =
|
||||
g_type_module_register_type (module, GIMP_TYPE_COLOR_DISPLAY,
|
||||
"CdisplayProof", &display_info, 0);
|
||||
g_type_add_interface_static (cdisplay_proof_type,
|
||||
GIMP_TYPE_CONFIG, &display_iface_info);
|
||||
}
|
||||
|
||||
return cdisplay_proof_type;
|
||||
@ -226,27 +227,18 @@ cdisplay_proof_class_init (CdisplayProofClass *klass)
|
||||
object_class->get_property = cdisplay_proof_get_property;
|
||||
object_class->set_property = cdisplay_proof_set_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_INTENT,
|
||||
g_param_spec_enum ("intent", NULL, NULL,
|
||||
CDISPLAY_TYPE_PROOF_INTENT,
|
||||
INTENT_PERCEPTUAL,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
GIMP_MODULE_PARAM_SERIALIZE));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_BPC,
|
||||
g_param_spec_boolean ("black-point-compensation", NULL, NULL,
|
||||
FALSE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
GIMP_MODULE_PARAM_SERIALIZE));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_PROFILE,
|
||||
g_param_spec_string ("profile", NULL, NULL,
|
||||
NULL,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
GIMP_MODULE_PARAM_SERIALIZE));
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_INTENT,
|
||||
"intent", NULL,
|
||||
CDISPLAY_TYPE_PROOF_INTENT, INTENT_PERCEPTUAL,
|
||||
0);
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_BPC,
|
||||
"black-point-compensation", NULL,
|
||||
FALSE,
|
||||
0);
|
||||
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PROFILE,
|
||||
"profile", NULL,
|
||||
GIMP_CONFIG_PATH_FILE, NULL,
|
||||
0);
|
||||
|
||||
display_class->name = _("Color Proof");
|
||||
display_class->help_id = "gimp-colordisplay-proof";
|
||||
@ -355,15 +347,7 @@ cdisplay_proof_set_property (GObject *object,
|
||||
static GimpColorDisplay *
|
||||
cdisplay_proof_clone (GimpColorDisplay *display)
|
||||
{
|
||||
CdisplayProof *proof = CDISPLAY_PROOF (display);
|
||||
CdisplayProof *copy;
|
||||
|
||||
copy = CDISPLAY_PROOF (gimp_color_display_new (G_TYPE_FROM_INSTANCE (proof)));
|
||||
copy->intent = proof->intent;
|
||||
copy->bpc = proof->bpc;
|
||||
copy->profile = g_strdup (proof->profile);
|
||||
|
||||
return GIMP_COLOR_DISPLAY (copy);
|
||||
return GIMP_COLOR_DISPLAY (gimp_config_duplicate (GIMP_CONFIG (display)));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -391,53 +375,35 @@ static void
|
||||
cdisplay_proof_load_state (GimpColorDisplay *display,
|
||||
GimpParasite *state)
|
||||
{
|
||||
CdisplayProof *proof = CDISPLAY_PROOF (display);
|
||||
const gchar *str;
|
||||
|
||||
str = gimp_parasite_data (state);
|
||||
|
||||
if (str[gimp_parasite_data_size (state) - 1] == '\0')
|
||||
{
|
||||
gchar **tokens = g_strsplit (str, ",", 3);
|
||||
|
||||
if (tokens[0] && tokens[1] && tokens[2])
|
||||
{
|
||||
g_object_set (proof,
|
||||
"intent", atoi (tokens[0]),
|
||||
"black-point-compensation", atoi (tokens[1]),
|
||||
"profile", tokens[2],
|
||||
NULL);
|
||||
}
|
||||
|
||||
g_strfreev (tokens);
|
||||
}
|
||||
gimp_config_deserialize_string (GIMP_CONFIG (display),
|
||||
gimp_parasite_data (state),
|
||||
gimp_parasite_data_size (state),
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
static GimpParasite *
|
||||
cdisplay_proof_save_state (GimpColorDisplay *display)
|
||||
{
|
||||
CdisplayProof *proof = CDISPLAY_PROOF (display);
|
||||
GimpParasite *state;
|
||||
gchar *str;
|
||||
GimpParasite *parasite;
|
||||
gchar *str;
|
||||
|
||||
str = g_strdup_printf ("%d,%d,%s",
|
||||
proof->intent,
|
||||
proof->bpc,
|
||||
proof->profile ? proof->profile : "");
|
||||
|
||||
state = gimp_parasite_new ("Display/Proof", GIMP_PARASITE_PERSISTENT,
|
||||
strlen (str) + 1, str);
|
||||
str = gimp_config_serialize_to_string (GIMP_CONFIG (display), NULL);
|
||||
|
||||
parasite = gimp_parasite_new ("Display/Proof",
|
||||
GIMP_PARASITE_PERSISTENT,
|
||||
strlen (str) + 1, str);
|
||||
g_free (str);
|
||||
|
||||
return state;
|
||||
return parasite;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
cdisplay_proof_configure (GimpColorDisplay *display)
|
||||
{
|
||||
CdisplayProof *proof = CDISPLAY_PROOF (display);
|
||||
GtkWidget *combo;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *toggle;
|
||||
|
||||
if (proof->table)
|
||||
gtk_widget_destroy (proof->table);
|
||||
@ -450,38 +416,24 @@ cdisplay_proof_configure (GimpColorDisplay *display)
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&proof->table);
|
||||
|
||||
proof->combo = gimp_enum_combo_box_new (CDISPLAY_TYPE_PROOF_INTENT);
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (proof->combo),
|
||||
proof->intent);
|
||||
|
||||
g_signal_connect (proof->combo, "changed",
|
||||
G_CALLBACK (proof_intent_callback),
|
||||
proof);
|
||||
combo = gimp_prop_enum_combo_box_new (G_OBJECT (proof), "intent", 0, 0);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (proof->table), 0, 0,
|
||||
_("_Intent:"), 0.0, 0.5,
|
||||
proof->combo, 1, FALSE);
|
||||
combo, 1, FALSE);
|
||||
|
||||
entry = gimp_file_entry_new (_("Choose an ICC Color Profile"),
|
||||
proof->profile, FALSE, FALSE);
|
||||
entry = gimp_prop_file_entry_new (G_OBJECT (proof), "profile",
|
||||
_("Choose an ICC Color Profile"),
|
||||
FALSE, FALSE);
|
||||
gimp_table_attach_aligned (GTK_TABLE (proof->table), 0, 1,
|
||||
_("_Profile:"), 0.0, 0.5,
|
||||
entry, 1, FALSE);
|
||||
|
||||
g_signal_connect (entry, "filename-changed",
|
||||
G_CALLBACK (proof_file_callback),
|
||||
proof);
|
||||
|
||||
proof->toggle =
|
||||
gtk_check_button_new_with_mnemonic (_("_Black Point Compensation"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (proof->toggle), proof->bpc);
|
||||
gtk_table_attach_defaults (GTK_TABLE (proof->table),
|
||||
proof->toggle, 1, 2, 2, 3);
|
||||
gtk_widget_show (proof->toggle);
|
||||
|
||||
g_signal_connect (proof->toggle, "clicked",
|
||||
G_CALLBACK (proof_bpc_callback),
|
||||
proof);
|
||||
toggle = gimp_prop_check_button_new (G_OBJECT (proof),
|
||||
"black-point-compensation",
|
||||
_("_Black Point Compensation"));
|
||||
gtk_table_attach_defaults (GTK_TABLE (proof->table), toggle, 1, 2, 2, 3);
|
||||
gtk_widget_show (toggle);
|
||||
|
||||
return proof->table;
|
||||
}
|
||||
@ -489,20 +441,7 @@ cdisplay_proof_configure (GimpColorDisplay *display)
|
||||
static void
|
||||
cdisplay_proof_configure_reset (GimpColorDisplay *display)
|
||||
{
|
||||
CdisplayProof *proof = CDISPLAY_PROOF (display);
|
||||
|
||||
g_object_set (proof,
|
||||
"intent", INTENT_PERCEPTUAL,
|
||||
"black-point-compensation", FALSE,
|
||||
NULL);
|
||||
|
||||
if (proof->table)
|
||||
{
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (proof->combo),
|
||||
proof->intent);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (proof->toggle),
|
||||
proof->bpc);
|
||||
}
|
||||
gimp_config_reset (GIMP_CONFIG (display));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -545,42 +484,3 @@ cdisplay_proof_changed (GimpColorDisplay *display)
|
||||
|
||||
cmsCloseProfile (rgbProfile);
|
||||
}
|
||||
|
||||
static void
|
||||
proof_intent_callback (GtkWidget *widget,
|
||||
CdisplayProof *proof)
|
||||
{
|
||||
gint value;
|
||||
|
||||
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value);
|
||||
|
||||
g_object_set (proof,
|
||||
"intent", value,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
proof_bpc_callback (GtkWidget *widget,
|
||||
CdisplayProof *proof)
|
||||
{
|
||||
gboolean value;
|
||||
|
||||
gimp_toggle_button_update (widget, &value);
|
||||
|
||||
g_object_set (proof,
|
||||
"black-point-compensation", value,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
proof_file_callback (GtkWidget *widget,
|
||||
CdisplayProof *proof)
|
||||
{
|
||||
gchar *filename = gimp_file_entry_get_filename (GIMP_FILE_ENTRY (widget));
|
||||
|
||||
g_object_set (proof,
|
||||
"profile", filename,
|
||||
NULL);
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
|
Reference in New Issue
Block a user