[goffice] Allow filled plots to be displayed behind the grids. [#632310]



commit 79c5fbc4fbd3c60af32bf64733d19957d00fc084
Author: Jean Brefort <jean brefort normalesup org>
Date:   Tue Oct 26 10:35:45 2010 +0200

    Allow filled plots to be displayed behind the grids. [#632310]

 ChangeLog                                   |   37 +++++++++
 NEWS                                        |    2 +
 goffice/utils/go-pattern.c                  |    2 +
 plugins/plot_barcol/Makefile.am             |    5 +-
 plugins/plot_barcol/gog-area-prefs.ui       |   24 ++++++
 plugins/plot_barcol/gog-barcol-prefs.c      |   13 +++
 plugins/plot_barcol/gog-barcol-prefs.ui     |   20 +++++-
 plugins/plot_barcol/gog-barcol.c            |   17 ++++-
 plugins/plot_barcol/gog-dropbar.c           |   96 ++++++++++++++++++++++-
 plugins/plot_barcol/gog-line.c              |   95 ++++++++++++++++++++++-
 plugins/plot_distrib/gog-boxplot-prefs.ui   |   20 +++++-
 plugins/plot_distrib/gog-boxplot.c          |   28 +++++++
 plugins/plot_distrib/gog-histogram-prefs.ui |   18 ++++-
 plugins/plot_distrib/gog-histogram.c        |   31 +++++++-
 plugins/plot_radar/Makefile.am              |    2 +-
 plugins/plot_radar/gog-polar-prefs.ui       |   24 ++++++
 plugins/plot_radar/gog-radar.c              |  111 +++++++++++++++++++++++++-
 plugins/plot_xy/gog-xy-prefs.ui             |   24 ++++++
 po/ChangeLog                                |    6 +-
 po/POTFILES.in                              |    2 +
 20 files changed, 555 insertions(+), 22 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2920abe..3899d50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2010-10-26  Jean Brefort  <jean brefort normalesup org>
+
+	* goffice/utils/go-pattern.c (go_pattern_create_cairo_pattern): enclose
+	direct drawing between cairo_surface_flush and cairo_surface_mark_dirty
+	calls, making patterns work with cairo-1.10.
+	* plugins/plot_barcol/Makefile.am: allow all filled plots to be displayed
+	under the grid. [#632310]
+	* plugins/plot_barcol/gog-area-prefs.ui: ditto.
+	* plugins/plot_barcol/gog-barcol-prefs.c (display_before_grid_cb),
+	(gog_barcol_plot_pref): ditto.
+	* plugins/plot_barcol/gog-barcol-prefs.ui: ditto.
+	* plugins/plot_barcol/gog-barcol.c (gog_barcol_plot_set_property),
+	(gog_barcol_plot_get_property), (gog_barcol_plot_class_init): ditto.
+	* plugins/plot_barcol/gog-dropbar.c (gog_dropbar_set_property),
+	(gog_dropbar_get_property), (display_before_grid_cb),
+	(gog_dropbar_populate_editor), (gog_dropbar_plot_class_init): ditto.
+	* plugins/plot_barcol/gog-line.c (gog_area_plot_set_property),
+	(gog_area_plot_get_property), (display_before_grid_cb),
+	(gog_area_plot_populate_editor), (gog_area_plot_class_init): ditto.
+	* plugins/plot_distrib/gog-boxplot-prefs.ui: ditto.
+	* plugins/plot_distrib/gog-boxplot.c (display_before_grid_cb),
+	(gog_box_plot_pref), (gog_box_plot_set_property),
+	(gog_box_plot_get_property), (gog_box_plot_class_init):
+	* plugins/plot_distrib/gog-histogram-prefs.ui: ditto.
+	* plugins/plot_distrib/gog-histogram.c
+	(gog_histogram_plot_get_property),
+	(gog_histogram_plot_set_property), (display_before_grid_cb),
+	(gog_histogram_plot_populate_editor),
+	(gog_histogram_plot_class_init): ditto.
+	* plugins/plot_radar/Makefile.am: ditto.
+	* plugins/plot_radar/gog-polar-prefs.ui: ditto.
+	* plugins/plot_radar/gog-radar.c (gog_polar_area_set_property),
+	(gog_polar_area_get_property), (display_before_grid_cb),
+	(gog_polar_area_populate_editor), (gog_radar_area_plot_class_init),
+	(gog_polar_plot_class_init): ditto.
+	* plugins/plot_xy/gog-xy-prefs.ui: ditto.
+
 2010-10-23  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/graph/goffice-graph.h: allow rendering of grids above plots.
diff --git a/NEWS b/NEWS
index 59411c0..67937d0 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ Andreas
 	
 Jean:
 	* Fixed sorting with accentuated characters. [#631504]
+	* Allow filled plots to be displayed behind the grids. [#632310]
+	* Fixed patterns with cairo-1.10.
 
 Morten:
 	* Fix GOImage-vs-cairo lifecycle issue.
diff --git a/goffice/utils/go-pattern.c b/goffice/utils/go-pattern.c
index a6e5b54..7bfc39a 100644
--- a/goffice/utils/go-pattern.c
+++ b/goffice/utils/go-pattern.c
@@ -261,6 +261,7 @@ go_pattern_create_cairo_pattern (GOPattern const *pattern, cairo_t *cr)
 		pattern_data = go_pattern_get_pattern (pattern);
 
 		cr_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 8, 8);
+		cairo_surface_flush (cr_surface); /* documentation says this one must be called */
 		stride = cairo_image_surface_get_stride (cr_surface);
 		iter = cairo_image_surface_get_data (cr_surface);
 
@@ -279,6 +280,7 @@ go_pattern_create_cairo_pattern (GOPattern const *pattern, cairo_t *cr)
 				iter += stride - 32;
 			}
 		}
+		cairo_surface_mark_dirty (cr_surface);
 
 		cr_pattern = cairo_pattern_create_for_surface (cr_surface);
 		cairo_pattern_set_extend (cr_pattern, CAIRO_EXTEND_REPEAT);
diff --git a/plugins/plot_barcol/Makefile.am b/plugins/plot_barcol/Makefile.am
index 8e338ee..0207b1f 100644
--- a/plugins/plot_barcol/Makefile.am
+++ b/plugins/plot_barcol/Makefile.am
@@ -23,7 +23,10 @@ xml_DATA = $(xml_in_files:.xml.in=.xml)
 @INTLTOOL_XML_RULE@
 
 if WITH_GTK
-dist_ui_DATA = gog-barcol-prefs.ui gog-minmax-prefs.ui
+dist_ui_DATA =	\
+	gog-barcol-prefs.ui	\
+	gog-minmax-prefs.ui	\
+	gog-area-prefs.ui
 barcol_la_SOURCES += gog-barcol-prefs.c
 endif
 
diff --git a/plugins/plot_barcol/gog-area-prefs.ui b/plugins/plot_barcol/gog-area-prefs.ui
new file mode 100644
index 0000000..21b8df5
--- /dev/null
+++ b/plugins/plot_barcol/gog-area-prefs.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<interface>
+  <!-- interface-requires gtk+ 2.12 -->
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkTable" id="gog-area-prefs">
+    <property name="visible">True</property>
+    <property name="column_spacing">12</property>
+    <property name="row_spacing">6</property>
+    <child>
+      <object class="GtkCheckButton" id="before-grid">
+        <property name="label" translatable="yes">_Display the grids above the plot</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="use_underline">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="x_options"></property>
+        <property name="y_options"></property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/plugins/plot_barcol/gog-barcol-prefs.c b/plugins/plot_barcol/gog-barcol-prefs.c
index d999caf..0df2be2 100644
--- a/plugins/plot_barcol/gog-barcol-prefs.c
+++ b/plugins/plot_barcol/gog-barcol-prefs.c
@@ -39,6 +39,12 @@ cb_overlap_changed (GtkAdjustment *adj, GObject *barcol)
 	g_object_set (barcol, "overlap-percentage", (int) gtk_adjustment_get_value (adj), NULL);
 }
 
+static void
+display_before_grid_cb (GtkToggleButton *btn, GObject *obj)
+{
+	g_object_set (obj, "before-grid", gtk_toggle_button_get_active (btn), NULL);
+}
+
 GtkWidget *
 gog_barcol_plot_pref (GogBarColPlot *barcol, GOCmdContext *cc)
 {
@@ -64,6 +70,13 @@ gog_barcol_plot_pref (GogBarColPlot *barcol, GOCmdContext *cc)
 		"value_changed",
 		G_CALLBACK (cb_overlap_changed), barcol);
 
+	w = go_gtk_builder_get_widget (gui, "before-grid");
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w),
+			(GOG_PLOT (barcol))->rendering_order == GOG_PLOT_RENDERING_BEFORE_GRID);
+	g_signal_connect (G_OBJECT (w),
+		"toggled",
+		G_CALLBACK (display_before_grid_cb), barcol);
+
 	w = GTK_WIDGET (g_object_ref (gtk_builder_get_object (gui, "gog_barcol_prefs")));
 	g_object_unref (gui);
 
diff --git a/plugins/plot_barcol/gog-barcol-prefs.ui b/plugins/plot_barcol/gog-barcol-prefs.ui
index 35038b2..bc7effb 100644
--- a/plugins/plot_barcol/gog-barcol-prefs.ui
+++ b/plugins/plot_barcol/gog-barcol-prefs.ui
@@ -1,5 +1,6 @@
 <?xml version="1.0"?>
 <interface>
+  <!-- interface-requires gtk+ 2.12 -->
   <!-- interface-naming-policy toplevel-contextual -->
   <object class="GtkAdjustment" id="adjustment1">
     <property name="upper">500</property>
@@ -15,7 +16,7 @@
   <object class="GtkTable" id="gog_barcol_prefs">
     <property name="visible">True</property>
     <property name="border_width">12</property>
-    <property name="n_rows">2</property>
+    <property name="n_rows">3</property>
     <property name="n_columns">3</property>
     <property name="column_spacing">12</property>
     <property name="row_spacing">6</property>
@@ -112,5 +113,22 @@
         <property name="y_options"></property>
       </packing>
     </child>
+    <child>
+      <object class="GtkCheckButton" id="before-grid">
+        <property name="label" translatable="yes">_Display the grids above the plot</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="use_underline">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="right_attach">3</property>
+        <property name="top_attach">2</property>
+        <property name="bottom_attach">3</property>
+        <property name="x_options"></property>
+        <property name="y_options"></property>
+      </packing>
+    </child>
   </object>
 </interface>
diff --git a/plugins/plot_barcol/gog-barcol.c b/plugins/plot_barcol/gog-barcol.c
index 40945f9..5f9bca6 100644
--- a/plugins/plot_barcol/gog-barcol.c
+++ b/plugins/plot_barcol/gog-barcol.c
@@ -77,7 +77,8 @@ enum {
 	BARCOL_PROP_0,
 	BARCOL_PROP_GAP_PERCENTAGE,
 	BARCOL_PROP_OVERLAP_PERCENTAGE,
-	BARCOL_PROP_HORIZONTAL
+	BARCOL_PROP_HORIZONTAL,
+	BARCOL_PROP_FILL_BEFORE_GRID
 };
 
 static GogObjectClass *gog_barcol_parent_klass;
@@ -101,6 +102,11 @@ gog_barcol_plot_set_property (GObject *obj, guint param_id,
 	case BARCOL_PROP_HORIZONTAL:
 		barcol->horizontal = g_value_get_boolean (value);
 		break;
+	case BARCOL_PROP_FILL_BEFORE_GRID:
+		GOG_PLOT (obj)->rendering_order = (g_value_get_boolean (value))?
+						GOG_PLOT_RENDERING_BEFORE_GRID:
+						GOG_PLOT_RENDERING_LAST;
+		break;
 
 	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
 		 return; /* NOTE : RETURN */
@@ -124,6 +130,9 @@ gog_barcol_plot_get_property (GObject *obj, guint param_id,
 	case BARCOL_PROP_HORIZONTAL:
 		g_value_set_boolean (value, barcol->horizontal);
 		break;
+	case BARCOL_PROP_FILL_BEFORE_GRID:
+		g_value_set_boolean (value, GOG_PLOT (obj)->rendering_order == GOG_PLOT_RENDERING_BEFORE_GRID);
+		break;
 	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
 		 break;
 	}
@@ -257,6 +266,12 @@ gog_barcol_plot_class_init (GogPlot1_5dClass *gog_plot_1_5d_klass)
 			_("horizontal bars or vertical columns"),
 			FALSE,
 			GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
+	g_object_class_install_property (gobject_klass, BARCOL_PROP_FILL_BEFORE_GRID,
+		g_param_spec_boolean ("before-grid",
+			_("Displayed under the grids"),
+			_("Should the plot be displayed before the grids"),
+			FALSE,
+			GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
 
 	gog_object_klass->type_name	= gog_barcol_plot_type_name;
 #ifdef GOFFICE_WITH_GTK
diff --git a/plugins/plot_barcol/gog-dropbar.c b/plugins/plot_barcol/gog-dropbar.c
index d92822f..bf4de3c 100644
--- a/plugins/plot_barcol/gog-dropbar.c
+++ b/plugins/plot_barcol/gog-dropbar.c
@@ -35,6 +35,83 @@ static GogObjectClass *gog_dropbar_parent_klass;
 
 static GType gog_dropbar_view_get_type (void);
 
+enum {
+	DROPBAR_PROP_FILL_0,
+	DROPBAR_PROP_FILL_BEFORE_GRID
+};
+
+static void
+gog_dropbar_set_property (GObject *obj, guint param_id,
+		     GValue const *value, GParamSpec *pspec)
+{
+	GogPlot *plot = GOG_PLOT (obj);
+	switch (param_id) {
+	case DROPBAR_PROP_FILL_BEFORE_GRID:
+		plot->rendering_order = (g_value_get_boolean (value))?
+					 GOG_PLOT_RENDERING_BEFORE_GRID:
+					 GOG_PLOT_RENDERING_LAST;
+		gog_object_emit_changed (GOG_OBJECT (obj), FALSE);
+		break;
+	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
+		 break;
+	}
+}
+
+static void
+gog_dropbar_get_property (GObject *obj, guint param_id,
+		     GValue *value, GParamSpec *pspec)
+{
+	GogPlot *plot = GOG_PLOT (obj);
+
+	switch (param_id) {
+	case DROPBAR_PROP_FILL_BEFORE_GRID:
+		g_value_set_boolean (value, plot->rendering_order == GOG_PLOT_RENDERING_BEFORE_GRID);
+		break;
+	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
+		 break;
+	}
+}
+
+#ifdef GOFFICE_WITH_GTK
+static void
+display_before_grid_cb (GtkToggleButton *btn, GObject *obj)
+{
+	g_object_set (obj, "before-grid", gtk_toggle_button_get_active (btn), NULL);
+}
+#endif
+
+static void
+gog_dropbar_populate_editor (GogObject *obj,
+			     GOEditor *editor,
+                             GogDataAllocator *dalloc,
+                             GOCmdContext *cc)
+{
+#ifdef GOFFICE_WITH_GTK
+	GtkBuilder *gui;
+	char const *dir;
+	char *path;
+
+	dir = go_plugin_get_dir_name (go_plugins_get_plugin_by_id ("GOffice_plot_barcol"));
+	path = g_build_filename (dir, "gog-area-prefs.ui", NULL);
+	gui = go_gtk_builder_new (path, GETTEXT_PACKAGE, cc);
+	g_free (path);
+
+	if (gui != NULL) {
+		GtkWidget *w = go_gtk_builder_get_widget (gui, "before-grid");
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w),
+				(GOG_PLOT (obj))->rendering_order == GOG_PLOT_RENDERING_BEFORE_GRID);
+		g_signal_connect (G_OBJECT (w),
+			"toggled",
+			G_CALLBACK (display_before_grid_cb), obj);
+		w = go_gtk_builder_get_widget (gui, "gog-area-prefs");
+		go_editor_add_page (editor, w, _("Properties"));
+		g_object_unref (gui);
+	}
+
+#endif
+	gog_dropbar_parent_klass->populate_editor (obj, editor, dalloc, cc);
+};
+
 static char const *
 gog_dropbar_plot_type_name (G_GNUC_UNUSED GogObject const *item)
 {
@@ -45,14 +122,25 @@ gog_dropbar_plot_type_name (G_GNUC_UNUSED GogObject const *item)
 }
 
 static void
-gog_dropbar_plot_class_init (GogPlot1_5dClass *gog_plot_1_5d_klass)
+gog_dropbar_plot_class_init (GObjectClass *gobject_klass)
 {
-	GogObjectClass *gog_object_klass = (GogObjectClass *) gog_plot_1_5d_klass;
-	GogPlotClass   *plot_klass = (GogPlotClass *) gog_plot_1_5d_klass;
-	gog_dropbar_parent_klass = g_type_class_peek_parent (gog_plot_1_5d_klass);
+	GogPlot1_5dClass *gog_plot_1_5d_klass = (GogPlot1_5dClass *) gobject_klass;
+	GogObjectClass *gog_object_klass = (GogObjectClass *) gobject_klass;
+	GogPlotClass   *plot_klass = (GogPlotClass *) gobject_klass;
+	gog_dropbar_parent_klass = g_type_class_peek_parent (gobject_klass);
+
+	gobject_klass->set_property = gog_dropbar_set_property;
+	gobject_klass->get_property = gog_dropbar_get_property;
+	g_object_class_install_property (gobject_klass, DROPBAR_PROP_FILL_BEFORE_GRID,
+		g_param_spec_boolean ("before-grid",
+			_("Displayed under the grids"),
+			_("Should the plot be displayed before the grids"),
+			FALSE,
+			GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
 
 	gog_object_klass->type_name	= gog_dropbar_plot_type_name;
 	gog_object_klass->view_type	= gog_dropbar_view_get_type ();
+	gog_object_klass->populate_editor = gog_dropbar_populate_editor;
 
 	{
 		static GogSeriesDimDesc dimensions[] = {
diff --git a/plugins/plot_barcol/gog-line.c b/plugins/plot_barcol/gog-line.c
index 6542717..7803147 100644
--- a/plugins/plot_barcol/gog-line.c
+++ b/plugins/plot_barcol/gog-line.c
@@ -353,6 +353,85 @@ GSF_DYNAMIC_CLASS (GogLinePlot, gog_line_plot,
 
 /*****************************************************************************/
 
+static GogObjectClass *gog_area_plot_parent_klass;
+
+enum {
+	AREA_PROP_FILL_0,
+	AREA_PROP_FILL_BEFORE_GRID
+};
+
+static void
+gog_area_plot_set_property (GObject *obj, guint param_id,
+		     GValue const *value, GParamSpec *pspec)
+{
+	GogPlot *plot = GOG_PLOT (obj);
+	switch (param_id) {
+	case AREA_PROP_FILL_BEFORE_GRID:
+		plot->rendering_order = (g_value_get_boolean (value))?
+					 GOG_PLOT_RENDERING_BEFORE_GRID:
+					 GOG_PLOT_RENDERING_LAST;
+		gog_object_emit_changed (GOG_OBJECT (obj), FALSE);
+		break;
+	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
+		 break;
+	}
+}
+
+static void
+gog_area_plot_get_property (GObject *obj, guint param_id,
+		     GValue *value, GParamSpec *pspec)
+{
+	GogPlot *plot = GOG_PLOT (obj);
+
+	switch (param_id) {
+	case AREA_PROP_FILL_BEFORE_GRID:
+		g_value_set_boolean (value, plot->rendering_order == GOG_PLOT_RENDERING_BEFORE_GRID);
+		break;
+	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
+		 break;
+	}
+}
+
+#ifdef GOFFICE_WITH_GTK
+static void
+display_before_grid_cb (GtkToggleButton *btn, GObject *obj)
+{
+	g_object_set (obj, "before-grid", gtk_toggle_button_get_active (btn), NULL);
+}
+#endif
+
+static void
+gog_area_plot_populate_editor (GogObject *obj,
+			     GOEditor *editor,
+                             GogDataAllocator *dalloc,
+                             GOCmdContext *cc)
+{
+#ifdef GOFFICE_WITH_GTK
+	GtkBuilder *gui;
+	char const *dir;
+	char *path;
+
+	dir = go_plugin_get_dir_name (go_plugins_get_plugin_by_id ("GOffice_plot_barcol"));
+	path = g_build_filename (dir, "gog-area-prefs.ui", NULL);
+	gui = go_gtk_builder_new (path, GETTEXT_PACKAGE, cc);
+	g_free (path);
+
+	if (gui != NULL) {
+		GtkWidget *w = go_gtk_builder_get_widget (gui, "before-grid");
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w),
+				(GOG_PLOT (obj))->rendering_order == GOG_PLOT_RENDERING_BEFORE_GRID);
+		g_signal_connect (G_OBJECT (w),
+			"toggled",
+			G_CALLBACK (display_before_grid_cb), obj);
+		w = go_gtk_builder_get_widget (gui, "gog-area-prefs");
+		go_editor_add_page (editor, w, _("Properties"));
+		g_object_unref (gui);
+	}
+
+#endif
+	gog_area_plot_parent_klass->populate_editor (obj, editor, dalloc, cc);
+};
+
 static char const *
 gog_area_plot_type_name (G_GNUC_UNUSED GogObject const *item)
 {
@@ -364,13 +443,25 @@ gog_area_plot_type_name (G_GNUC_UNUSED GogObject const *item)
 }
 
 static void
-gog_area_plot_class_init (GogObjectClass *gog_klass)
+gog_area_plot_class_init (GObjectClass *gobject_klass)
 {
-	GogPlotClass *plot_klass = (GogPlotClass *) gog_klass;
+	GogObjectClass *gog_klass = (GogObjectClass *) gobject_klass;
+	GogPlotClass   *plot_klass = (GogPlotClass *) gobject_klass;
+	gog_area_plot_parent_klass = g_type_class_peek_parent (gobject_klass);
+
+	gobject_klass->set_property = gog_area_plot_set_property;
+	gobject_klass->get_property = gog_area_plot_get_property;
+	g_object_class_install_property (gobject_klass, AREA_PROP_FILL_BEFORE_GRID,
+		g_param_spec_boolean ("before-grid",
+			_("Displayed under the grids"),
+			_("Should the plot be displayed before the grids"),
+			FALSE,
+			GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
 
 	plot_klass->desc.series.style_fields = GO_STYLE_OUTLINE | GO_STYLE_FILL;
 	plot_klass->series_type = gog_series1_5d_get_type ();
 
+	gog_klass->populate_editor = gog_area_plot_populate_editor;
 	gog_klass->type_name	= gog_area_plot_type_name;
 }
 
diff --git a/plugins/plot_distrib/gog-boxplot-prefs.ui b/plugins/plot_distrib/gog-boxplot-prefs.ui
index 5b06c53..93850c7 100644
--- a/plugins/plot_distrib/gog-boxplot-prefs.ui
+++ b/plugins/plot_distrib/gog-boxplot-prefs.ui
@@ -1,5 +1,6 @@
 <?xml version="1.0"?>
 <interface>
+  <!-- interface-requires gtk+ 2.12 -->
   <!-- interface-naming-policy toplevel-contextual -->
   <object class="GtkAdjustment" id="adjustment1">
     <property name="upper">500</property>
@@ -29,7 +30,7 @@
   <object class="GtkTable" id="gog_box_plot_prefs">
     <property name="visible">True</property>
     <property name="border_width">12</property>
-    <property name="n_rows">4</property>
+    <property name="n_rows">5</property>
     <property name="n_columns">3</property>
     <property name="column_spacing">12</property>
     <property name="row_spacing">6</property>
@@ -175,5 +176,22 @@
         <property name="y_options"></property>
       </packing>
     </child>
+    <child>
+      <object class="GtkCheckButton" id="before-grid">
+        <property name="label" translatable="yes">_Display the grids above the plot</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="use_underline">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="right_attach">3</property>
+        <property name="top_attach">4</property>
+        <property name="bottom_attach">5</property>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options"></property>
+      </packing>
+    </child>
   </object>
 </interface>
diff --git a/plugins/plot_distrib/gog-boxplot.c b/plugins/plot_distrib/gog-boxplot.c
index 8a8788b..ed64281 100644
--- a/plugins/plot_distrib/gog-boxplot.c
+++ b/plugins/plot_distrib/gog-boxplot.c
@@ -101,6 +101,12 @@ cb_ratio_changed (GtkAdjustment *adj, GObject *boxplot)
 	g_object_set (boxplot, "radius-ratio", gtk_adjustment_get_value (adj) / 200., NULL);
 }
 
+static void
+display_before_grid_cb (GtkToggleButton *btn, GObject *obj)
+{
+	g_object_set (obj, "before-grid", gtk_toggle_button_get_active (btn), NULL);
+}
+
 static gpointer
 gog_box_plot_pref (GogObject *obj,
 		   GogDataAllocator *dalloc, GOCmdContext *cc)
@@ -145,6 +151,13 @@ gog_box_plot_pref (GogObject *obj,
 		gtk_widget_hide (w);
 	}
 
+	w = go_gtk_builder_get_widget (gui, "before-grid");
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w),
+			(GOG_PLOT (obj))->rendering_order == GOG_PLOT_RENDERING_BEFORE_GRID);
+	g_signal_connect (G_OBJECT (w),
+		"toggled",
+		G_CALLBACK (display_before_grid_cb), obj);
+
 	w = go_gtk_builder_get_widget (gui, "gog_box_plot_prefs");
 	g_object_set_data (G_OBJECT (w), "state", gui);
 	g_signal_connect_swapped (G_OBJECT (w), "destroy", G_CALLBACK (g_object_unref), gui);
@@ -171,6 +184,7 @@ enum {
 	BOX_PLOT_PROP_VERTICAL,
 	BOX_PLOT_PROP_OUTLIERS,
 	BOX_PLOT_PROP_RADIUS_RATIO,
+	BOX_PLOT_PROP_BEFORE_GRID
 };
 
 typedef struct {
@@ -220,6 +234,11 @@ gog_box_plot_set_property (GObject *obj, guint param_id,
 	case BOX_PLOT_PROP_RADIUS_RATIO:
 		boxplot->radius_ratio = g_value_get_double (value);
 		break;
+	case BOX_PLOT_PROP_BEFORE_GRID:
+		GOG_PLOT (obj)->rendering_order = (g_value_get_boolean (value))?
+						GOG_PLOT_RENDERING_BEFORE_GRID:
+						GOG_PLOT_RENDERING_LAST;
+		break;
 	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
 		return; /* NOTE : RETURN */
 	}
@@ -245,6 +264,9 @@ gog_box_plot_get_property (GObject *obj, guint param_id,
 	case BOX_PLOT_PROP_RADIUS_RATIO:
 		g_value_set_double (value, boxplot->radius_ratio);
 		break;
+	case BOX_PLOT_PROP_BEFORE_GRID:
+		g_value_set_boolean (value, GOG_PLOT (obj)->rendering_order == GOG_PLOT_RENDERING_BEFORE_GRID);
+		break;
 	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
 		break;
 	}
@@ -389,6 +411,12 @@ gog_box_plot_class_init (GogPlotClass *gog_plot_klass)
 			_("The ratio between the radius of the circles representing outliers and the rectangle width"),
 			0., 0.5, 0.125,
 			GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
+	g_object_class_install_property (gobject_klass, BOX_PLOT_PROP_BEFORE_GRID,
+		g_param_spec_boolean ("before-grid",
+			_("Displayed under the grids"),
+			_("Should the plot be displayed before the grids"),
+			FALSE,
+			GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
 
 	gog_object_klass->type_name	= gog_box_plot_type_name;
 	gog_object_klass->view_type	= gog_box_plot_view_get_type ();
diff --git a/plugins/plot_distrib/gog-histogram-prefs.ui b/plugins/plot_distrib/gog-histogram-prefs.ui
index 9afe9f7..987f2d6 100644
--- a/plugins/plot_distrib/gog-histogram-prefs.ui
+++ b/plugins/plot_distrib/gog-histogram-prefs.ui
@@ -5,7 +5,7 @@
   <object class="GtkTable" id="histogram-prefs">
     <property name="visible">True</property>
     <property name="border_width">12</property>
-    <property name="n_rows">2</property>
+    <property name="n_rows">3</property>
     <property name="column_spacing">12</property>
     <property name="row_spacing">6</property>
     <child>
@@ -38,5 +38,21 @@
         <property name="y_options"></property>
       </packing>
     </child>
+    <child>
+      <object class="GtkCheckButton" id="before-grid">
+        <property name="label" translatable="yes">_Display the grids above the plot</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="use_underline">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="top_attach">2</property>
+        <property name="bottom_attach">3</property>
+        <property name="x_options">GTK_FILL</property>
+        <property name="y_options"></property>
+      </packing>
+    </child>
   </object>
 </interface>
diff --git a/plugins/plot_distrib/gog-histogram.c b/plugins/plot_distrib/gog-histogram.c
index 8330399..3a0ba38 100644
--- a/plugins/plot_distrib/gog-histogram.c
+++ b/plugins/plot_distrib/gog-histogram.c
@@ -216,7 +216,8 @@ gog_histogram_plot_axis_get_bounds (GogPlot *plot, GogAxisType axis,
 enum {
 	HISTOGRAM_PROP_0,
 	HISTOGRAM_PROP_VERTICAL,
-	HISTOGRAM_PROP_CUMULATIVE
+	HISTOGRAM_PROP_CUMULATIVE,
+	HISTOGRAM_PROP_BEFORE_GRID
 };
 
 static void
@@ -231,6 +232,9 @@ gog_histogram_plot_get_property (GObject *obj, guint param_id,
 	case HISTOGRAM_PROP_CUMULATIVE:
 		g_value_set_boolean (value, model->cumulative);
 		break;
+	case HISTOGRAM_PROP_BEFORE_GRID:
+		g_value_set_boolean (value, GOG_PLOT (obj)->rendering_order == GOG_PLOT_RENDERING_BEFORE_GRID);
+		break;
 
 	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
 		 break;
@@ -257,6 +261,12 @@ gog_histogram_plot_set_property (GObject *obj, guint param_id,
 			gog_object_request_update (GOG_OBJECT (model));
 		}	
 		break;
+	case HISTOGRAM_PROP_BEFORE_GRID:
+		GOG_PLOT (obj)->rendering_order = (g_value_get_boolean (value))?
+						GOG_PLOT_RENDERING_BEFORE_GRID:
+						GOG_PLOT_RENDERING_LAST;
+		gog_object_emit_changed (GOG_OBJECT (obj), FALSE);
+		break;
 
 	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
 		 return; /* NOTE : RETURN */
@@ -287,6 +297,12 @@ cumulative_changed_cb (GtkToggleButton *btn, GogHistogramPlot *model)
 }
 
 static void
+display_before_grid_cb (GtkToggleButton *btn, GObject *obj)
+{
+	g_object_set (obj, "before-grid", gtk_toggle_button_get_active (btn), NULL);
+}
+
+static void
 gog_histogram_plot_populate_editor (GogObject *item,
 			      GOEditor *editor,
 			      G_GNUC_UNUSED GogDataAllocator *dalloc,
@@ -309,6 +325,13 @@ gog_histogram_plot_populate_editor (GogObject *item,
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), hist->cumulative);
 		g_signal_connect (w, "toggled", G_CALLBACK (cumulative_changed_cb), hist);
 
+		w = go_gtk_builder_get_widget (gui, "before-grid");
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w),
+				(GOG_PLOT (item))->rendering_order == GOG_PLOT_RENDERING_BEFORE_GRID);
+		g_signal_connect (G_OBJECT (w),
+			"toggled",
+			G_CALLBACK (display_before_grid_cb), item);
+
 		w = go_gtk_builder_get_widget (gui, "histogram-prefs");
 		go_editor_add_page (editor, w , _("Properties"));
 		g_object_unref (gui);
@@ -349,6 +372,12 @@ gog_histogram_plot_class_init (GogPlotClass *gog_plot_klass)
 			_("Use cumulated data"), 
 			FALSE,
 			GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
+	g_object_class_install_property (gobject_klass, HISTOGRAM_PROP_BEFORE_GRID,
+		g_param_spec_boolean ("before-grid",
+			_("Displayed under the grids"),
+			_("Should the plot be displayed before the grids"),
+			FALSE,
+			GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
 
 	gog_object_klass->type_name	= gog_histogram_plot_type_name;
 	gog_object_klass->view_type	= gog_histogram_plot_view_get_type ();
diff --git a/plugins/plot_radar/Makefile.am b/plugins/plot_radar/Makefile.am
index f37aead..192f9e5 100644
--- a/plugins/plot_radar/Makefile.am
+++ b/plugins/plot_radar/Makefile.am
@@ -13,7 +13,7 @@ radar_la_SOURCES = \
 xml_in_files = plugin.xml.in plot-types.xml.in
 xml_DATA = $(xml_in_files:.xml.in=.xml)
 
-ui_DATA = gog-color-polar-prefs.ui
+ui_DATA = gog-color-polar-prefs.ui gog-polar-prefs.ui
 
 @INTLTOOL_XML_RULE@
 
diff --git a/plugins/plot_radar/gog-polar-prefs.ui b/plugins/plot_radar/gog-polar-prefs.ui
new file mode 100644
index 0000000..4e99ec6
--- /dev/null
+++ b/plugins/plot_radar/gog-polar-prefs.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<interface>
+  <!-- interface-requires gtk+ 2.12 -->
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkTable" id="gog-polar-prefs">
+    <property name="visible">True</property>
+    <property name="column_spacing">12</property>
+    <property name="row_spacing">6</property>
+    <child>
+      <object class="GtkCheckButton" id="before-grid">
+        <property name="label" translatable="yes">_Display the grids above the plot</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="use_underline">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="x_options"></property>
+        <property name="y_options"></property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/plugins/plot_radar/gog-radar.c b/plugins/plot_radar/gog-radar.c
index ad15804..bdfacfb 100644
--- a/plugins/plot_radar/gog-radar.c
+++ b/plugins/plot_radar/gog-radar.c
@@ -339,6 +339,85 @@ GSF_DYNAMIC_CLASS (GogRadarPlot, gog_radar_plot,
 
 /*****************************************************************************/
 
+enum {
+	PLOT_PROP_FILL_0,
+	PLOT_PROP_FILL_BEFORE_GRID,
+};
+
+static void
+gog_polar_area_set_property (GObject *obj, guint param_id,
+		     GValue const *value, GParamSpec *pspec)
+{
+	GogPlot *plot = GOG_PLOT (obj);
+	switch (param_id) {
+	case PLOT_PROP_FILL_BEFORE_GRID:
+		plot->rendering_order = (g_value_get_boolean (value))?
+					 GOG_PLOT_RENDERING_BEFORE_GRID:
+					 GOG_PLOT_RENDERING_LAST;
+		gog_object_emit_changed (GOG_OBJECT (obj), FALSE);
+		break;
+	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
+		 break;
+	}
+}
+static void
+gog_polar_area_get_property (GObject *obj, guint param_id,
+		     GValue *value, GParamSpec *pspec)
+{
+	GogPlot *plot = GOG_PLOT (obj);
+
+	switch (param_id) {
+	case PLOT_PROP_FILL_BEFORE_GRID:
+		g_value_set_boolean (value, plot->rendering_order == GOG_PLOT_RENDERING_BEFORE_GRID);
+		break;
+	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
+		 break;
+	}
+}
+
+#ifdef GOFFICE_WITH_GTK
+static void
+display_before_grid_cb (GtkToggleButton *btn, GObject *obj)
+{
+	g_object_set (obj, "before-grid", gtk_toggle_button_get_active (btn), NULL);
+}
+#endif
+
+static void
+gog_polar_area_populate_editor (GogObject *obj,
+			     GOEditor *editor,
+                             GogDataAllocator *dalloc,
+                             GOCmdContext *cc)
+{
+#ifdef GOFFICE_WITH_GTK
+	GtkBuilder *gui;
+	char const *dir;
+	char *path;
+	GogObjectClass *gog_class = (GogObjectClass *) g_type_class_peek_parent (G_OBJECT_GET_CLASS (obj));
+
+	dir = go_plugin_get_dir_name (go_plugins_get_plugin_by_id ("GOffice_plot_radar"));
+	path = g_build_filename (dir, "gog-polar-prefs.ui", NULL);
+	gui = go_gtk_builder_new (path, GETTEXT_PACKAGE, cc);
+	g_free (path);
+
+	if (gui != NULL) {
+		GtkWidget *w = go_gtk_builder_get_widget (gui, "before-grid");
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w),
+				(GOG_PLOT (obj))->rendering_order == GOG_PLOT_RENDERING_BEFORE_GRID);
+		g_signal_connect (G_OBJECT (w),
+			"toggled",
+			G_CALLBACK (display_before_grid_cb), obj);
+		w = go_gtk_builder_get_widget (gui, "gog-polar-prefs");
+		go_editor_add_page (editor, w, _("Properties"));
+		g_object_unref (gui);
+	}
+
+#endif
+	gog_class->populate_editor (obj, editor, dalloc, cc);
+};
+
+/*****************************************************************************/
+
 #define GOG_TYPE_RADAR_AREA_PLOT  (gog_radar_area_plot_get_type ())
 #define GOG_RADAR_AREA_PLOT(o)	  (G_TYPE_CHECK_INSTANCE_CAST ((o), GOG_TYPE_RADAR_AREA_PLOT, GogRadarAreaPlot))
 #define GOG_IS_PLOT_RADAR_AREA(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_TYPE_RADAR_AREA_PLOT))
@@ -358,12 +437,23 @@ gog_radar_area_plot_type_name (G_GNUC_UNUSED GogObject const *item)
 	return N_("PlotRadarArea");
 }
 static void
-gog_radar_area_plot_class_init (GogObjectClass *gog_klass)
+gog_radar_area_plot_class_init (GObjectClass *obj_class)
 {
-	GogPlotClass *plot_klass = (GogPlotClass *) gog_klass;
+	GogObjectClass *gog_klass = (GogObjectClass *) obj_class;
+	GogPlotClass *plot_klass = (GogPlotClass *) obj_class;
+
+	obj_class->get_property = gog_polar_area_get_property;
+	obj_class->set_property = gog_polar_area_set_property;
+	g_object_class_install_property (obj_class, PLOT_PROP_FILL_BEFORE_GRID,
+		g_param_spec_boolean ("before-grid",
+			_("Displayed under the grids"),
+			_("Should the plot be displayed before the grids"),
+			FALSE,
+			GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
 
 	plot_klass->desc.series.style_fields = GO_STYLE_OUTLINE | GO_STYLE_FILL;
 
+	gog_klass->populate_editor = gog_polar_area_populate_editor;
 	gog_klass->type_name	= gog_radar_area_plot_type_name;
 }
 
@@ -418,12 +508,23 @@ gog_polar_plot_axis_get_bounds (GogPlot *plot, GogAxisType axis,
 }
 
 static void
-gog_polar_plot_class_init (GogPlotClass *gog_plot_klass)
+gog_polar_plot_class_init (GObjectClass *obj_class)
 {
-	GogObjectClass *gog_object_klass = (GogObjectClass *) gog_plot_klass;
+	GogObjectClass *gog_object_klass = (GogObjectClass *) obj_class;
+	GogPlotClass *gog_plot_klass = (GogPlotClass *) obj_class;
+
+	obj_class->get_property = gog_polar_area_get_property;
+	obj_class->set_property = gog_polar_area_set_property;
+	g_object_class_install_property (obj_class, PLOT_PROP_FILL_BEFORE_GRID,
+		g_param_spec_boolean ("before-grid",
+			_("Displayed under the grids"),
+			_("Should the plot be displayed before the grids"),
+			FALSE,
+			GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
 
 	/* Fill in GOGObject superclass values */
 	gog_object_klass->type_name	= gog_polar_plot_type_name;
+	gog_object_klass->populate_editor = gog_polar_area_populate_editor;
 
 	{
 		static GogSeriesDimDesc dimensions[] = {
@@ -449,7 +550,7 @@ gog_polar_plot_class_init (GogPlotClass *gog_plot_klass)
 			| GO_STYLE_INTERPOLATION;
 	}
 
-	gog_plot_klass->series_type = gog_polar_series_get_type();
+	gog_plot_klass->series_type = gog_polar_series_get_type ();
 	gog_plot_klass->axis_get_bounds	= gog_polar_plot_axis_get_bounds;
 }
 
diff --git a/plugins/plot_xy/gog-xy-prefs.ui b/plugins/plot_xy/gog-xy-prefs.ui
new file mode 100644
index 0000000..6bdd70c
--- /dev/null
+++ b/plugins/plot_xy/gog-xy-prefs.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<interface>
+  <!-- interface-requires gtk+ 2.12 -->
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkTable" id="gog-xy-prefs">
+    <property name="visible">True</property>
+    <property name="column_spacing">12</property>
+    <property name="row_spacing">6</property>
+    <child>
+      <object class="GtkCheckButton" id="before-grid">
+        <property name="label" translatable="yes">_Display the grids above the plot</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="use_underline">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="x_options"></property>
+        <property name="y_options"></property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/po/ChangeLog b/po/ChangeLog
index 4827769..e1e36f5 100644
--- a/po/ChangeLog
+++ b/po/ChangeLog
@@ -1,8 +1,6 @@
-2010-10-23  Jean Brefort  <jean brefort normalesup org>
+2010-10-26  Jean Brefort  <jean brefort normalesup org>
 
-	reviewed by: <delete if not using a buddy>
-
-	* POTFILES.in:
+	* POTFILES.in: add new ui files.
 
 2010-10-01  Morten Welinder <terra gnome org>
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7711429..9143163 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -250,6 +250,7 @@ goffice/utils/regutf8.c
 goffice/utils/regutf8.h
 plugins/plot_barcol/gog-1.5d.c
 plugins/plot_barcol/gog-1.5d.h
+[type: gettext/glade]plugins/plot_barcol/gog-area-prefs.ui
 plugins/plot_barcol/gog-barcol-prefs.c
 [type: gettext/glade]plugins/plot_barcol/gog-barcol-prefs.ui
 plugins/plot_barcol/gog-barcol.c
@@ -282,6 +283,7 @@ plugins/plot_pie/plugin.xml.in
 plugins/plot_radar/gog-radar.c
 plugins/plot_radar/gog-radar.h
 [type: gettext/glade]plugins/plot_radar/gog-color-polar-prefs.ui
+[type: gettext/glade]plugins/plot_radar/gog-polar-prefs.ui
 plugins/plot_radar/plot-types.xml.in
 plugins/plot_radar/plugin.xml.in
 plugins/plot_surface/gog-contour.c



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