[gnome-color-manager] Add a TRC curve to the profile display



commit 759f3914b5e95e10fb002ada06216566a8afa342
Author: Richard Hughes <richard hughsie com>
Date:   Thu Dec 10 09:50:25 2009 +0000

    Add a TRC curve to the profile display

 data/gcm-prefs.ui |   55 ++++++++++++++++++++++++++++++++++++++++++----------
 src/gcm-clut.c    |    1 -
 src/gcm-prefs.c   |   28 +++++++++++++++++++++++++++
 3 files changed, 72 insertions(+), 12 deletions(-)
---
diff --git a/data/gcm-prefs.ui b/data/gcm-prefs.ui
index 734d020..0c95045 100644
--- a/data/gcm-prefs.ui
+++ b/data/gcm-prefs.ui
@@ -1075,7 +1075,7 @@
                                     <child>
                                       <object class="GtkLabel" id="label_cie_title">
                                         <property name="visible">True</property>
-                                        <property name="label" translatable="yes" comments="Section heading for device profile settings">CIE Diagram:</property>
+                                        <property name="label" translatable="yes" comments="Section heading for CIE and TRC graphs">Profile Graphs:</property>
                                         <attributes>
                                           <attribute name="weight" value="bold"/>
                                         </attributes>
@@ -1096,24 +1096,57 @@
                                     <property name="visible">True</property>
                                     <property name="left_padding">12</property>
                                     <child>
-                                      <object class="GtkAspectFrame" id="aspectframe1">
+                                      <object class="GtkHBox" id="hbox47">
                                         <property name="visible">True</property>
-                                        <property name="label_xalign">0</property>
-                                        <property name="shadow_type">none</property>
                                         <child>
-                                          <object class="GtkHBox" id="hbox_cie_widget">
+                                          <object class="GtkAspectFrame" id="aspectframe1">
                                             <property name="visible">True</property>
+                                            <property name="label_xalign">0</property>
+                                            <property name="shadow_type">none</property>
                                             <child>
-                                              <object class="GtkLabel" id="label3">
+                                              <object class="GtkHBox" id="hbox_cie_widget">
                                                 <property name="visible">True</property>
+                                                <child>
+                                                  <object class="GtkLabel" id="label3">
+                                                    <property name="visible">True</property>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">False</property>
+                                                    <property name="position">0</property>
+                                                  </packing>
+                                                </child>
+                                              </object>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="position">0</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkAspectFrame" id="aspectframe2">
+                                            <property name="visible">True</property>
+                                            <property name="label_xalign">0</property>
+                                            <property name="shadow_type">none</property>
+                                            <child>
+                                              <object class="GtkHBox" id="hbox_trc_widget">
+                                                <property name="visible">True</property>
+                                                <child>
+                                                  <object class="GtkLabel" id="label6">
+                                                    <property name="visible">True</property>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">False</property>
+                                                    <property name="position">0</property>
+                                                  </packing>
+                                                </child>
                                               </object>
-                                              <packing>
-                                                <property name="expand">False</property>
-                                                <property name="fill">False</property>
-                                                <property name="position">0</property>
-                                              </packing>
                                             </child>
                                           </object>
+                                          <packing>
+                                            <property name="position">1</property>
+                                          </packing>
                                         </child>
                                       </object>
                                     </child>
diff --git a/src/gcm-clut.c b/src/gcm-clut.c
index 0deae8c..2eb7960 100644
--- a/src/gcm-clut.c
+++ b/src/gcm-clut.c
@@ -163,7 +163,6 @@ gcm_clut_get_array (GcmClut *clut)
 	gfloat custom_gamma;
 
 	g_return_val_if_fail (GCM_IS_CLUT (clut), FALSE);
-	g_return_val_if_fail (clut->priv->size != 0, FALSE);
 	g_return_val_if_fail (clut->priv->gamma != 0, FALSE);
 
 	min = clut->priv->brightness / 100.0f;
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 2e01ab7..9141b36 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -40,6 +40,7 @@
 #include "gcm-client.h"
 #include "gcm-xyz.h"
 #include "gcm-cie-widget.h"
+#include "gcm-trc-widget.h"
 
 static GtkBuilder *builder = NULL;
 static GtkListStore *list_store_devices = NULL;
@@ -53,6 +54,7 @@ static GcmClient *gcm_client = NULL;
 static gboolean setting_up_device = FALSE;
 static GtkWidget *info_bar = NULL;
 static GtkWidget *cie_widget = NULL;
+static GtkWidget *trc_widget = NULL;
 static guint loading_refcount = 0;
 static GConfClient *gconf_client = NULL;
 
@@ -1411,6 +1413,7 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
 	GtkTreeIter iter;
 	GtkWidget *widget;
 	GcmProfile *profile;
+	GcmClut *clut;
 	GcmXyz *white;
 	GcmXyz *red;
 	GcmXyz *green;
@@ -1463,6 +1466,22 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
 		      "blue", blue,
 		      NULL);
 
+	/* get CLUT for profile */
+	clut = gcm_profile_generate (profile, 256);
+	g_object_get (clut,
+		      "size", &size,
+		      NULL);
+
+	/* only show if there is useful information */
+	if (size > 0) {
+		g_object_set (trc_widget,
+			      "clut", clut,
+			      NULL);
+		gtk_widget_show (trc_widget);
+	} else {
+		gtk_widget_hide (trc_widget);
+	}
+
 	/* ensure showing */
 	gtk_widget_show (cie_widget);
 
@@ -1554,6 +1573,7 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
 	g_object_unref (red);
 	g_object_unref (green);
 	g_object_unref (blue);
+	g_object_unref (clut);
 	g_free (size_text);
 	g_free (filename);
 	g_free (basename);
@@ -2506,13 +2526,21 @@ main (int argc, char **argv)
 	gtk_box_pack_start (GTK_BOX(widget), cie_widget, TRUE, TRUE, 0);
 	gtk_box_reorder_child (GTK_BOX(widget), cie_widget, 0);
 
+	/* use trc widget */
+	trc_widget = gcm_trc_widget_new ();
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_trc_widget"));
+	gtk_box_pack_start (GTK_BOX(widget), trc_widget, TRUE, TRUE, 0);
+	gtk_box_reorder_child (GTK_BOX(widget), trc_widget, 0);
+
 	/* do we set a default size to make the window larger? */
 	screen = gdk_screen_get_default ();
 	if (gdk_screen_get_width (screen) < 1024 ||
 	    gdk_screen_get_height (screen) < 768) {
 		gtk_widget_set_size_request (cie_widget, 50, 50);
+		gtk_widget_set_size_request (trc_widget, 50, 50);
 	} else {
 		gtk_widget_set_size_request (cie_widget, 200, 200);
+		gtk_widget_set_size_request (trc_widget, 200, 200);
 	}
 
 	/* use infobar */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]