[gnome-color-manager] Ask the user for the target whitepoint when creating a profile
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Ask the user for the target whitepoint when creating a profile
- Date: Tue, 28 Jun 2011 20:53:31 +0000 (UTC)
commit d525b0208c19d25d87c8b1055674526adfec2a0d
Author: Richard Hughes <richard hughsie com>
Date: Tue Jun 28 19:16:50 2011 +0100
Ask the user for the target whitepoint when creating a profile
src/gcm-calibrate-argyll.c | 4 ++
src/gcm-calibrate-main.c | 98 ++++++++++++++++++++++++++++++++++++++++++++
src/gcm-calibrate.c | 14 ++++++-
3 files changed, 115 insertions(+), 1 deletions(-)
---
diff --git a/src/gcm-calibrate-argyll.c b/src/gcm-calibrate-argyll.c
index f97d188..70d9af5 100644
--- a/src/gcm-calibrate-argyll.c
+++ b/src/gcm-calibrate-argyll.c
@@ -404,10 +404,12 @@ gcm_calibrate_argyll_display_neutralise (GcmCalibrateArgyll *calibrate_argyll, G
gchar *basename = NULL;
const gchar *output_name;
guint display;
+ guint target_whitepoint;
/* get shared data */
g_object_get (calibrate_argyll,
"basename", &basename,
+ "target-whitepoint", &target_whitepoint,
NULL);
/* get correct name of the command */
@@ -447,6 +449,8 @@ gcm_calibrate_argyll_display_neutralise (GcmCalibrateArgyll *calibrate_argyll, G
g_ptr_array_add (array, g_strdup ("-v"));
g_ptr_array_add (array, g_strdup ("-ql"));
g_ptr_array_add (array, g_strdup ("-m"));
+ if (target_whitepoint > 0)
+ g_ptr_array_add (array, g_strdup_printf ("-t%i", target_whitepoint));
g_ptr_array_add (array, g_strdup_printf ("-d%i", display));
g_ptr_array_add (array, g_strdup_printf ("-y%c", kind));
g_ptr_array_add (array, g_strdup ("-P 0.5,0.5,1.2"));
diff --git a/src/gcm-calibrate-main.c b/src/gcm-calibrate-main.c
index c2ace38..1f610cb 100644
--- a/src/gcm-calibrate-main.c
+++ b/src/gcm-calibrate-main.c
@@ -40,6 +40,7 @@
typedef enum {
GCM_CALIBRATE_PAGE_INTRO,
GCM_CALIBRATE_PAGE_DISPLAY_KIND,
+ GCM_CALIBRATE_PAGE_DISPLAY_TEMPERATURE,
GCM_CALIBRATE_PAGE_DISPLAY_CONFIG,
GCM_CALIBRATE_PAGE_INSTALL_ARGYLLCMS,
GCM_CALIBRATE_PAGE_INSTALL_TARGETS,
@@ -1313,6 +1314,102 @@ gcm_calib_setup_page_display_kind (GcmCalibratePriv *calib)
}
static void
+gcm_calib_display_temp_toggled_cb (GtkToggleButton *togglebutton,
+ GcmCalibratePriv *calib)
+{
+ guint display_temp;
+ if (!gtk_toggle_button_get_active (togglebutton))
+ return;
+ display_temp = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (togglebutton),
+ "GcmCalib::display-temp"));
+ g_object_set (calib->calibrate,
+ "target-whitepoint", display_temp,
+ NULL);
+}
+
+/**
+ * gcm_calib_setup_page_display_temp:
+ **/
+static void
+gcm_calib_setup_page_display_temp (GcmCalibratePriv *calib)
+{
+ GtkWidget *vbox;
+ GtkWidget *content;
+ GtkWidget *widget;
+ GSList *list;
+ GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
+
+ /* TRANSLATORS: this is the page title */
+ vbox = gcm_calib_add_page_title (calib, _("Choose your display target white point"));
+
+ /* main contents */
+ content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
+
+ /* TRANSLATORS: this is intro page text */
+ gcm_calib_add_page_para (content, _("Most displays should be calibrated to a CIE D65 illuminant for general usage."));
+
+ widget = gtk_radio_button_new_with_label (NULL, _("CIE D50 (Printing and publishing)"));
+ g_object_set_data (G_OBJECT (widget),
+ "GcmCalib::display-temp",
+ GUINT_TO_POINTER (5000));
+ g_signal_connect (widget, "toggled",
+ G_CALLBACK (gcm_calib_display_temp_toggled_cb), calib);
+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
+
+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
+ widget = gtk_radio_button_new_with_label (list, _("CIE D55"));
+ g_object_set_data (G_OBJECT (widget),
+ "GcmCalib::display-temp",
+ GUINT_TO_POINTER (5500));
+ g_signal_connect (widget, "toggled",
+ G_CALLBACK (gcm_calib_display_temp_toggled_cb), calib);
+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
+
+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
+ widget = gtk_radio_button_new_with_label (list, _("CIE D65 (Photography and graphics)"));
+ g_object_set_data (G_OBJECT (widget),
+ "GcmCalib::display-temp",
+ GUINT_TO_POINTER (6500));
+ g_signal_connect (widget, "toggled",
+ G_CALLBACK (gcm_calib_display_temp_toggled_cb), calib);
+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+
+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
+ widget = gtk_radio_button_new_with_label (list, _("CIE D75"));
+ g_object_set_data (G_OBJECT (widget),
+ "GcmCalib::display-temp",
+ GUINT_TO_POINTER (7500));
+ g_signal_connect (widget, "toggled",
+ G_CALLBACK (gcm_calib_display_temp_toggled_cb), calib);
+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
+
+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
+ widget = gtk_radio_button_new_with_label (list, _("Native (Already set manually)"));
+ g_object_set_data (G_OBJECT (widget),
+ "GcmCalib::display-temp",
+ GUINT_TO_POINTER (0));
+ g_signal_connect (widget, "toggled",
+ G_CALLBACK (gcm_calib_display_temp_toggled_cb), calib);
+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
+
+ /* add to assistant */
+ gtk_assistant_append_page (assistant, vbox);
+ gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
+ /* TRANSLATORS: this is the calibration wizard page title */
+ gtk_assistant_set_page_title (assistant, vbox, _("Choose Display Whitepoint"));
+ gtk_assistant_set_page_complete (assistant, vbox, FALSE);
+ g_ptr_array_add (calib->pages, vbox);
+ g_object_set_data (G_OBJECT (vbox),
+ "GcmCalibrateMain::Index",
+ GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_DISPLAY_TEMPERATURE));
+
+ /* show page */
+ gtk_widget_show_all (vbox);
+}
+
+static void
gcm_calib_print_kind_toggled_cb (GtkToggleButton *togglebutton,
GcmCalibratePriv *calib)
{
@@ -1653,6 +1750,7 @@ gcm_calib_add_pages (GcmCalibratePriv *calib)
gcm_calib_setup_page_display_kind (calib);
else
calib->display_kind = GCM_CALIBRATE_DEVICE_KIND_LCD;
+ gcm_calib_setup_page_display_temp (calib);
} else if (calib->device_kind == CD_DEVICE_KIND_PRINTER) {
gcm_calib_setup_page_print_kind (calib);
} else {
diff --git a/src/gcm-calibrate.c b/src/gcm-calibrate.c
index ab1761d..6828fad 100644
--- a/src/gcm-calibrate.c
+++ b/src/gcm-calibrate.c
@@ -38,12 +38,12 @@ struct _GcmCalibratePrivate
gchar *serial;
gchar *device;
gchar *working_path;
+ guint target_whitepoint;
GtkWidget *content_widget;
GPtrArray *old_message;
GPtrArray *old_title;
};
-
enum {
PROP_0,
PROP_BASENAME,
@@ -64,6 +64,7 @@ enum {
PROP_WORKING_PATH,
PROP_PRECISION,
PROP_XYZ,
+ PROP_TARGET_WHITEPOINT,
PROP_LAST
};
@@ -932,6 +933,9 @@ gcm_calibrate_get_property (GObject *object, guint prop_id, GValue *value, GPara
case PROP_XYZ:
g_value_set_boxed (value, g_boxed_copy (CD_TYPE_COLOR_XYZ, priv->xyz));
break;
+ case PROP_TARGET_WHITEPOINT:
+ g_value_set_uint (value, priv->target_whitepoint);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1008,6 +1012,9 @@ gcm_calibrate_set_property (GObject *object, guint prop_id, const GValue *value,
cd_color_xyz_free (priv->xyz);
priv->xyz = g_boxed_copy (CD_TYPE_COLOR_XYZ, value);
break;
+ case PROP_TARGET_WHITEPOINT:
+ priv->target_whitepoint = g_value_get_uint (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1116,6 +1123,11 @@ gcm_calibrate_class_init (GcmCalibrateClass *klass)
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_XYZ, pspec);
+ pspec = g_param_spec_uint ("target-whitepoint", NULL, NULL,
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (object_class, PROP_TARGET_WHITEPOINT, pspec);
+
signals[SIGNAL_TITLE_CHANGED] =
g_signal_new ("title-changed",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]