Hi,

Le mardi 03 juillet 2007 à 22:18 +0200, Emmanuel Pacaud a écrit :
> During my recent work on graph fill support for xy and polar plots, it
> came clearly (at least for me:) ) that the interpolation property in
> GogStyle is out of place, and should be put in GogSeries. I'd like to do
> the move, but if I do that, that would mean a file format change, since
> GogStyle properties are handled differently than the other GogObjet
> properties. I guess it's not an issue for gnumeric, since we have not
> yet released a stable version that uses this property. But that would
> break other applications that already use the goffice 0.4 version (and
> use also the interpolation property, of course).

Here's the path that does the move. 

Any comments ?

        Emmanuel.
diff --git a/docs/reference/tmpl/gog-editor.sgml b/docs/reference/tmpl/gog-editor.sgml
index 1fc90fb..2742df2 100644
--- a/docs/reference/tmpl/gog-editor.sgml
+++ b/docs/reference/tmpl/gog-editor.sgml
@@ -24,6 +24,7 @@ Property editor build helper
 
 @store_page: 
 @pages: 
[EMAIL PROTECTED]: 
 
 <!-- ##### STRUCT GogEditorPage ##### -->
 <para>
diff --git a/docs/reference/tmpl/gog-plot.sgml b/docs/reference/tmpl/gog-plot.sgml
index 8149e76..9eb5ad4 100644
--- a/docs/reference/tmpl/gog-plot.sgml
+++ b/docs/reference/tmpl/gog-plot.sgml
@@ -28,6 +28,11 @@ Base class for plots
 
 </para>
 
+<!-- ##### ARG GogPlot:interpolation ##### -->
+<para>
+
+</para>
+
 <!-- ##### ARG GogPlot:plot-group ##### -->
 <para>
 
diff --git a/docs/reference/tmpl/gog-series.sgml b/docs/reference/tmpl/gog-series.sgml
index dc754c4..f500059 100644
--- a/docs/reference/tmpl/gog-series.sgml
+++ b/docs/reference/tmpl/gog-series.sgml
@@ -28,6 +28,11 @@ Set of plot data
 
 </para>
 
+<!-- ##### ARG GogSeries:interpolation ##### -->
+<para>
+
+</para>
+
 <!-- ##### STRUCT GogSeriesElement ##### -->
 <para>
 
diff --git a/goffice/graph/Makefile.am b/goffice/graph/Makefile.am
index a681d58..3917afb 100644
--- a/goffice/graph/Makefile.am
+++ b/goffice/graph/Makefile.am
@@ -96,7 +96,8 @@ dist_glade_DATA = \
 	gog-axis-prefs.glade		\
 	gog-error-bar-prefs.glade	\
 	gog-reg-curve-prefs.glade	\
-	gog-reg-eqn-prefs.glade
+	gog-reg-eqn-prefs.glade		\
+	gog-series-prefs.glade
 
 include $(top_srcdir)/goffice.mk
 
diff --git a/goffice/graph/gog-object.c b/goffice/graph/gog-object.c
index bc43fec..ea0094c 100644
--- a/goffice/graph/gog-object.c
+++ b/goffice/graph/gog-object.c
@@ -50,11 +50,22 @@ gog_editor_new (void)
 
 	editor->store_page = NULL;
 	editor->pages = NULL;
+	editor->extension_widgets = g_hash_table_new (g_str_hash, g_str_equal);
 
 	return editor;
 }
 
 void
+gog_editor_free (GogEditor *editor)
+{
+	g_slist_foreach (editor->pages, (GFunc) g_free, NULL);
+	g_slist_free (editor->pages);
+	g_hash_table_unref (editor->extension_widgets);
+
+	g_free (editor);
+}
+
+void
 gog_editor_add_page (GogEditor *editor, gpointer widget, char const *label)
 {
 	GogEditorPage *page;
@@ -77,6 +88,24 @@ gog_editor_set_store_page (GogEditor *editor, unsigned *store_page)
 }
 
 #ifdef GOFFICE_WITH_GTK
+
+void
+gog_editor_add_extension_widget (GogEditor *editor, GtkWidget *widget)
+{
+	g_return_if_fail (editor != NULL);
+	g_return_if_fail (GTK_IS_WIDGET (widget));
+
+	g_hash_table_insert (editor->extension_widgets, (char *) gtk_widget_get_name (widget), widget);
+}
+
+GtkWidget *
+gog_editor_get_extension_widget (GogEditor *editor, char const *name)
+{
+	g_return_val_if_fail (editor != NULL, NULL);
+
+	return g_hash_table_lookup (editor->extension_widgets, name);
+}
+
 static void
 cb_switch_page (G_GNUC_UNUSED GtkNotebook *n, G_GNUC_UNUSED GtkNotebookPage *p,
 		guint page_num, guint *store_page)
@@ -84,7 +113,7 @@ cb_switch_page (G_GNUC_UNUSED GtkNotebook *n, G_GNUC_UNUSED GtkNotebookPage *p,
 		*store_page = page_num;
 }
 
-gpointer
+GtkWidget *
 gog_editor_get_notebook (GogEditor *editor)
 {
 	GtkWidget *notebook;
@@ -121,16 +150,8 @@ gog_editor_get_notebook (GogEditor *editor)
 
 	return notebook;
 }
-#endif
 
-void
-gog_editor_free (GogEditor *editor)
-{
-	g_slist_foreach (editor->pages, (GFunc) g_free, NULL);
-	g_slist_free (editor->pages);
-
-	g_free (editor);
-}
+#endif
 
 typedef struct {
 	char const *label;
diff --git a/goffice/graph/gog-object.h b/goffice/graph/gog-object.h
index f1fed9b..241acfd 100644
--- a/goffice/graph/gog-object.h
+++ b/goffice/graph/gog-object.h
@@ -34,15 +34,21 @@ typedef struct {
 } GogEditorPage;
 
 typedef struct {
-	unsigned	*store_page;	/* pointer to a place for storing last edited page */
-	GSList		*pages;		/* GogEditorPage */
+	unsigned	*store_page;		/* pointer to a place for storing last edited page */
+	GSList		*pages;			/* GogEditorPage */
+	GHashTable	*extension_widgets;
 } GogEditor;
 
 GogEditor	*gog_editor_new 		 (void);
+void 		 gog_editor_free 		 (GogEditor *editor);
 void		 gog_editor_add_page 		 (GogEditor *editor, gpointer widget, char const *label);
+#ifdef GOFFICE_WITH_GTK
+#include <gtk/gtkwidget.h>
 void 		 gog_editor_set_store_page  	 (GogEditor *editor, unsigned *store_page);
-gpointer 	 gog_editor_get_notebook 	 (GogEditor *editor);
-void 		 gog_editor_free 		 (GogEditor *editor);
+void 		 gog_editor_add_extension_widget (GogEditor *editor, GtkWidget *widget);
+GtkWidget  	*gog_editor_get_extension_widget (GogEditor *editor, char const *name);
+GtkWidget 	*gog_editor_get_notebook 	 (GogEditor *editor);
+#endif
 
 typedef enum {
 	GOG_OBJECT_NAME_BY_ROLE	 = 1,
diff --git a/goffice/graph/gog-plot-impl.h b/goffice/graph/gog-plot-impl.h
index 5b2d206..7d51a8a 100644
--- a/goffice/graph/gog-plot-impl.h
+++ b/goffice/graph/gog-plot-impl.h
@@ -49,6 +49,8 @@ struct _GogPlot {
 	gchar		*plot_group;
 	char		*guru_hints;
 
+	GOLineInterpolation	interpolation;
+
 	GogAxis		*axis[GOG_AXIS_TYPES];
 
 	/* Usually a copy from the class but it's here to allow a GogPlotType to
diff --git a/goffice/graph/gog-plot.c b/goffice/graph/gog-plot.c
index 460de53..30daeec 100644
--- a/goffice/graph/gog-plot.c
+++ b/goffice/graph/gog-plot.c
@@ -56,6 +56,7 @@ enum {
 	PLOT_PROP_AXIS_X,
 	PLOT_PROP_AXIS_Y,
 	PLOT_PROP_GROUP,
+	PLOT_PROP_DEFAULT_INTERPOLATION,
 	PLOT_PROP_GURU_HINTS
 };
 
@@ -84,6 +85,7 @@ role_series_can_add (GogObject const *parent)
 	GogPlot *plot = GOG_PLOT (parent);
 	return g_slist_length (plot->series) < plot->desc.num_series_max;
 }
+
 static gboolean
 role_series_can_remove (GogObject const *child)
 {
@@ -113,6 +115,7 @@ role_series_post_add (GogObject *parent, GogObject *child)
 	/* Alias things so that dim -1 is valid */
 	series->values = g_new0 (GogDatasetElement, num_dim+1) + 1;
 	series->plot = plot;
+	series->interpolation = plot->interpolation;
 
 	/* if there are other series associated with the plot, and there are 
 	 * shared dimensions, clone them over.  */
@@ -438,6 +441,9 @@ gog_plot_set_property (GObject *obj, guint param_id,
 		plot->plot_group = (group)? g_strdup (g_value_get_string (value)): NULL;
 		break;
 	}
+	case PLOT_PROP_DEFAULT_INTERPOLATION:
+		plot->interpolation = go_line_interpolation_from_str (g_value_get_string (value));
+		break;
 	case PLOT_PROP_GURU_HINTS:
 		g_free (plot->guru_hints);
 		plot->guru_hints = g_strdup (g_value_get_string (value));
@@ -468,6 +474,9 @@ gog_plot_get_property (GObject *obj, guint param_id,
 	case PLOT_PROP_GROUP:
 		g_value_set_string (value, plot->plot_group);
 		break;
+	case PLOT_PROP_DEFAULT_INTERPOLATION:
+		g_value_set_string (value, go_line_interpolation_as_str (plot->interpolation));
+		break;
 	case PLOT_PROP_GURU_HINTS:
 		g_value_set_string (value, plot->guru_hints);
 		break;
@@ -546,6 +555,12 @@ gog_plot_class_init (GogObjectClass *gog_klass)
 			  "guru dialog"),
 			NULL, 
 			GSF_PARAM_STATIC | G_PARAM_READWRITE));
+        g_object_class_install_property (gobject_klass, PLOT_PROP_DEFAULT_INTERPOLATION,
+		 g_param_spec_string ("interpolation",
+			_("Default interpolation"),
+			_("Default type of series line interpolation"),
+			"linear",
+			GSF_PARAM_STATIC | G_PARAM_READWRITE | GOG_PARAM_PERSISTENT));
 
 	gog_klass->children_reordered = gog_plot_children_reordered;
 	gog_object_register_roles (gog_klass, roles, G_N_ELEMENTS (roles));
@@ -562,6 +577,7 @@ gog_plot_init (GogPlot *plot, GogPlotClass const *derived_plot_klass)
 	plot->render_before_axes = FALSE;
 	plot->plot_group = NULL;
 	plot->guru_hints = NULL;
+	plot->interpolation = GO_LINE_INTERPOLATION_LINEAR;
 }
 
 GSF_CLASS_ABSTRACT (GogPlot, gog_plot,
diff --git a/goffice/graph/gog-series-impl.h b/goffice/graph/gog-series-impl.h
index eaa1b1d..aefb640 100644
--- a/goffice/graph/gog-series-impl.h
+++ b/goffice/graph/gog-series-impl.h
@@ -85,11 +85,15 @@ struct _GogSeries {
 	gboolean	   has_legend;
 	unsigned   	   num_elements;
 	GList		  *overrides;  /* GogSeriesElement (individual points) */
+
+	GOLineInterpolation	interpolation;
 };
 
 typedef struct {
 	GogStyledObjectClass base;
 
+	gboolean	has_interpolation;
+
 	GType		series_element_type;
 
 	/* Virtuals */
diff --git a/goffice/graph/gog-series.c b/goffice/graph/gog-series.c
index 4bdda7f..2593f0f 100644
--- a/goffice/graph/gog-series.c
+++ b/goffice/graph/gog-series.c
@@ -41,6 +41,7 @@
 #include <gtk/gtkhbox.h>
 #include <gtk/gtkspinbutton.h>
 #include <gtk/gtkcheckbutton.h>
+#include <gtk/gtkcombobox.h>
 #endif
 
 #include <string.h>
@@ -238,7 +239,8 @@ static GObjectClass *series_parent_klass;
 
 enum {
 	SERIES_PROP_0,
-	SERIES_HAS_LEGEND
+	SERIES_PROP_HAS_LEGEND,
+	SERIES_PROP_INTERPOLATION
 };
 
 static gboolean
@@ -308,7 +310,7 @@ gog_series_set_property (GObject *obj, guint param_id,
 	gboolean b_tmp;
 
 	switch (param_id) {
-	case SERIES_HAS_LEGEND :
+	case SERIES_PROP_HAS_LEGEND :
 		b_tmp = g_value_get_boolean (value);
 		if (series->has_legend ^ b_tmp) {
 			series->has_legend = b_tmp;
@@ -316,6 +318,10 @@ gog_series_set_property (GObject *obj, guint param_id,
 				gog_plot_request_cardinality_update (series->plot);
 		}
 		break;
+	case SERIES_PROP_INTERPOLATION:
+		series->interpolation = go_line_interpolation_from_str (g_value_get_string (value));
+		break;
+
 	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
 		 return; /* NOTE : RETURN */
 	}
@@ -330,9 +336,13 @@ gog_series_get_property (GObject *obj, guint param_id,
 	GogSeries *series = GOG_SERIES (obj);
 
 	switch (param_id) {
-	case SERIES_HAS_LEGEND :
+	case SERIES_PROP_HAS_LEGEND :
 		g_value_set_boolean (value, series->has_legend);
 		break;
+	case SERIES_PROP_INTERPOLATION:
+		g_value_set_string (value, go_line_interpolation_as_str (series->interpolation));
+		break;
+
 	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
 		 break;
 	}
@@ -369,6 +379,13 @@ cb_show_in_legend (GtkToggleButton *b, GObject *series)
 }
 
 static void
+cb_line_interpolation_changed (GtkComboBox *box, GogSeries *series)
+{
+	series->interpolation = gtk_combo_box_get_active (box);
+	gog_object_emit_changed (GOG_OBJECT (series), FALSE);
+}
+
+static void
 gog_series_populate_editor (GogObject *gobj,
 			    GogEditor *editor,
 		   GogDataAllocator *dalloc,
@@ -380,6 +397,7 @@ gog_series_populate_editor (GogObject *gobj,
 	unsigned i, row = 0;
 	gboolean has_shared = FALSE;
 	GogSeries *series = GOG_SERIES (gobj);
+	GogSeriesClass *series_class = GOG_SERIES_GET_CLASS (series);
 	GogDataset *set = GOG_DATASET (gobj);
 	GogSeriesDesc const *desc;
 	GogDataType data_type;
@@ -447,6 +465,24 @@ gog_series_populate_editor (GogObject *gobj,
 
 	(GOG_OBJECT_CLASS(series_parent_klass)->populate_editor) (gobj, editor, dalloc, cc);
 
+	if (series_class->has_interpolation) {
+		GladeXML *gui;
+		GtkWidget *widget, *line_box;
+
+		gui = go_libglade_new ("gog-series-prefs.glade", "interpolation_prefs", GETTEXT_PACKAGE, cc);
+		if (gui != NULL) {
+			line_box = gog_editor_get_extension_widget (editor, "line_box");
+			widget = glade_xml_get_widget (gui, "interpolation_prefs");
+			gtk_box_pack_start (GTK_BOX (line_box), widget, FALSE, FALSE, 0);
+			widget = glade_xml_get_widget (gui, "interpolation_combo");
+			gtk_combo_box_set_active (GTK_COMBO_BOX (widget), series->interpolation);
+			g_signal_connect (widget, "changed",
+					  G_CALLBACK (cb_line_interpolation_changed), series);
+			g_object_set_data_full (G_OBJECT (widget), "gui", gui, 
+						(GDestroyNotify) g_object_unref);  
+		}
+	}
+
 	gog_editor_set_store_page (editor, &series_pref_page);
 }
 #endif
@@ -503,6 +539,7 @@ gog_series_class_init (GogSeriesClass *klass)
 	gobject_klass->finalize		= gog_series_finalize;
 	gobject_klass->set_property	= gog_series_set_property;
 	gobject_klass->get_property	= gog_series_get_property;
+	klass->has_interpolation	= FALSE;
 
 #ifdef GOFFICE_WITH_GTK
 	gog_klass->populate_editor	= gog_series_populate_editor;
@@ -514,12 +551,18 @@ gog_series_class_init (GogSeriesClass *klass)
 
 	gog_object_register_roles (gog_klass, roles, G_N_ELEMENTS (roles));
 
-	g_object_class_install_property (gobject_klass, SERIES_HAS_LEGEND,
+	g_object_class_install_property (gobject_klass, SERIES_PROP_HAS_LEGEND,
 		g_param_spec_boolean ("has-legend", 
 			_("Has-legend"),
 			_("Should the series show up in legends"),
 			TRUE,
 			GSF_PARAM_STATIC | G_PARAM_READWRITE | GOG_PARAM_PERSISTENT));
+        g_object_class_install_property (gobject_klass, SERIES_PROP_INTERPOLATION,
+		 g_param_spec_string ("interpolation",
+			_("Interpolation"),
+			_("Type of line interpolation"),
+			"linear",
+			GSF_PARAM_STATIC | G_PARAM_READWRITE | GOG_PARAM_PERSISTENT));
 }
 
 static void
@@ -531,6 +574,7 @@ gog_series_init (GogSeries *series)
 	series->values = NULL;
 	series->index = -1;
 	series->acceptable_children = 0;
+	series->interpolation = GO_LINE_INTERPOLATION_LINEAR;
 }
 
 static void
diff --git a/goffice/graph/gog-style-prefs.glade b/goffice/graph/gog-style-prefs.glade
index bc63b03..ef5366b 100644
--- a/goffice/graph/gog-style-prefs.glade
+++ b/goffice/graph/gog-style-prefs.glade
@@ -422,103 +422,6 @@
 	      <property name="fill">False</property>
 	    </packing>
 	  </child>
-
-	  <child>
-	    <widget class="GtkLabel" id="interpolation-lbl">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">&lt;b&gt;Interpolation&lt;/b&gt;</property>
-	      <property name="use_underline">False</property>
-	      <property name="use_markup">True</property>
-	      <property name="justify">GTK_JUSTIFY_LEFT</property>
-	      <property name="wrap">False</property>
-	      <property name="selectable">False</property>
-	      <property name="xalign">0</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
-	      <property name="ypad">0</property>
-	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-	      <property name="width_chars">-1</property>
-	      <property name="single_line_mode">False</property>
-	      <property name="angle">0</property>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">False</property>
-	      <property name="fill">False</property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkAlignment" id="alignment8">
-	      <property name="visible">True</property>
-	      <property name="xalign">0.5</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xscale">1</property>
-	      <property name="yscale">1</property>
-	      <property name="top_padding">6</property>
-	      <property name="bottom_padding">0</property>
-	      <property name="left_padding">18</property>
-	      <property name="right_padding">0</property>
-
-	      <child>
-		<widget class="GtkHBox" id="interp-hbox">
-		  <property name="visible">True</property>
-		  <property name="homogeneous">False</property>
-		  <property name="spacing">12</property>
-
-		  <child>
-		    <widget class="GtkLabel" id="interp-type-lbl">
-		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">_Type:</property>
-		      <property name="use_underline">True</property>
-		      <property name="use_markup">False</property>
-		      <property name="justify">GTK_JUSTIFY_LEFT</property>
-		      <property name="wrap">False</property>
-		      <property name="selectable">False</property>
-		      <property name="xalign">0</property>
-		      <property name="yalign">0.460000008345</property>
-		      <property name="xpad">0</property>
-		      <property name="ypad">0</property>
-		      <property name="mnemonic_widget">interpolation-box</property>
-		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-		      <property name="width_chars">-1</property>
-		      <property name="single_line_mode">False</property>
-		      <property name="angle">0</property>
-		    </widget>
-		    <packing>
-		      <property name="padding">0</property>
-		      <property name="expand">False</property>
-		      <property name="fill">False</property>
-		    </packing>
-		  </child>
-
-		  <child>
-		    <widget class="GtkComboBox" id="interpolation-box">
-		      <property name="visible">True</property>
-		      <property name="items" translatable="yes">Linear
-Spline
-Step at start
-Step at end
-Step at center
-Step to average</property>
-		      <property name="add_tearoffs">False</property>
-		      <property name="focus_on_click">True</property>
-		    </widget>
-		    <packing>
-		      <property name="padding">0</property>
-		      <property name="expand">True</property>
-		      <property name="fill">True</property>
-		    </packing>
-		  </child>
-		</widget>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">False</property>
-	      <property name="fill">True</property>
-	    </packing>
-	  </child>
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
diff --git a/goffice/graph/gog-style.c b/goffice/graph/gog-style.c
index 79aab6e..17865ec 100644
--- a/goffice/graph/gog-style.c
+++ b/goffice/graph/gog-style.c
@@ -288,17 +288,19 @@ cb_line_color_changed (GOSelector *selector,
 }
 
 static void
-line_init (StylePrefState *state, gboolean enable)
+line_init (StylePrefState *state, gboolean enable, GogEditor *editor)
 {
 	GogStyle *style = state->style;
 	GogStyle *default_style = state->default_style;
 	GtkWidget *w, *table;
 
+	w = glade_xml_get_widget (state->gui, "line_box");
 	if (!enable) {
-		gtk_widget_hide (glade_xml_get_widget (state->gui, "line_box"));
+		gtk_widget_hide (w);
 		return;
 	}
 
+	gog_editor_add_extension_widget (editor, w);
 	table = glade_xml_get_widget (state->gui, "line_table");
 
 	/* DashType */
@@ -325,43 +327,6 @@ line_init (StylePrefState *state, gboolean enable)
 	gtk_widget_show_all (table);
 }
 
-
-/************************************************************************/
-
-static void
-cb_line_interpolation_changed (GtkComboBox *box, StylePrefState const *state)
-{
-	GogStyle *style = state->style;
-
-	g_return_if_fail (style != NULL);
-
-	style->interpolation.type = gtk_combo_box_get_active (box);
-	style->interpolation.auto_type = FALSE;
-	set_style (state);
-}
-
-static void
-interp_init (StylePrefState *state, gboolean enable)
-{
- 	GogStyle *style = state->style;
-	GtkWidget *w;
-
-	if (enable) {
- 		w = glade_xml_get_widget (state->gui, "interpolation-box");
- 		gtk_combo_box_set_active (GTK_COMBO_BOX (w), style->interpolation.type);
- 		g_signal_connect (G_OBJECT (w),
- 				  "changed",
- 				  G_CALLBACK (cb_line_interpolation_changed), state);
- 	} else {
- 		w = glade_xml_get_widget (state->gui, "interpolation-lbl");
- 		gtk_widget_hide (w);
- 		w = glade_xml_get_widget (state->gui, "interp-hbox");
- 		gtk_widget_hide (w);
- 	}
-}
-
-/************************************************************************/
-
 static void cb_fill_background_color (GOSelector *selector, StylePrefState *state);
 static void cb_fill_foreground_color (GOSelector *selector, StylePrefState *state);
 
@@ -1026,8 +991,7 @@ gog_style_populate_editor (GogStyle *style,
 	gog_editor_add_page (editor, w, _("Style"));
 	
 	outline_init 	 (state, enable & GOG_STYLE_OUTLINE);
-	line_init    	 (state, enable & GOG_STYLE_LINE);
-	interp_init		 (state, enable & GOG_STYLE_INTERPOLATION);
+	line_init    	 (state, enable & GOG_STYLE_LINE, editor);
 	fill_init    	 (state, enable & GOG_STYLE_FILL);
 	marker_init  	 (state, enable & GOG_STYLE_MARKER);
 	font_init    	 (state, enable & GOG_STYLE_FONT, editor, cc);
@@ -1122,7 +1086,6 @@ gog_style_assign (GogStyle *dst, GogStyle const *src)
 	dst->marker = src->marker;
 	dst->marker.mark = go_marker_dup (src->marker.mark);
 	dst->font    = src->font;
-	dst->interpolation    = src->interpolation;
 
 	if (GOG_FILL_STYLE_IMAGE == dst->fill.type)
 		dst->fill.image.filename = g_strdup (dst->fill.image.filename);
@@ -1366,29 +1329,6 @@ gog_style_line_sax_save (GsfXMLOut *output, char const *name,
 }
 
 static void
-gog_style_interpolation_load (xmlNode *node, GogStyle *style)
-{
-	char *str;
-	str = xmlGetProp (node, "type");
-	if (str != NULL) {
-		style->interpolation.type = go_line_interpolation_from_str (str);
-		style->interpolation.auto_type= FALSE;
-		xmlFree (str);
-	}
-}
-
-static void
-gog_style_interpolation_sax_save (GsfXMLOut *output, GogStyle const *style)
-{
-	if (style->interpolation.auto_type)
-		return;
-	gsf_xml_out_start_element (output, "interpolation");
-	gsf_xml_out_add_cstr_unchecked (output, "type",
-		go_line_interpolation_as_str (style->interpolation.type));
-	gsf_xml_out_end_element (output);
-}
-
-static void
 gog_style_gradient_sax_save (GsfXMLOut *output, GogStyle const *style)
 {
 	gsf_xml_out_start_element (output, "gradient");
@@ -1679,8 +1619,6 @@ gog_style_persist_dom_load (GogPersist *gp, xmlNode *node)
 			gog_style_line_load (ptr, &style->outline);
 		else if (strcmp (ptr->name, "line") == 0)
 			gog_style_line_load (ptr, &style->line);
-		else if (strcmp (ptr->name, "interpolation") == 0)
-			gog_style_interpolation_load (ptr, style);
 		else if (strcmp (ptr->name, "fill") == 0)
 			gog_style_fill_load (ptr, style);
 		else if (strcmp (ptr->name, "marker") == 0)
@@ -1719,16 +1657,6 @@ gog_style_sax_load_line (GsfXMLIn *xin, xmlChar const **attrs)
 }
 
 static void
-gog_style_sax_load_interpolation (GsfXMLIn *xin, xmlChar const **attrs)
-{
-	GogStyle *style = GOG_STYLE (xin->user_state);
-	if (0 == strcmp (attrs[0], "type")) {
-		style->interpolation.type = go_line_interpolation_from_str (attrs[1]);
-		style->interpolation.auto_type = FALSE;
-	}
-}
-
-static void
 gog_style_sax_load_fill_pattern (GsfXMLIn *xin, xmlChar const **attrs)
 {
 	GogStyle *style = GOG_STYLE (xin->user_state);
@@ -1846,8 +1774,6 @@ gog_style_persist_sax_save (GogPersist const *gp, GsfXMLOut *output)
 		gog_style_line_sax_save (output, "outline", &style->outline);
 	if (style->interesting_fields & GOG_STYLE_LINE)
 		gog_style_line_sax_save (output, "line", &style->line);
-	if (style->interesting_fields & GOG_STYLE_INTERPOLATION)
-		gog_style_interpolation_sax_save (output, style);
 	if (style->interesting_fields & GOG_STYLE_FILL)
 		gog_style_fill_sax_save (output, style);
 	if (style->interesting_fields & GOG_STYLE_MARKER)
@@ -1873,10 +1799,6 @@ gog_style_persist_prep_sax (GogPersist *gp, GsfXMLIn *xin, xmlChar const **attrs
 					 -1, "outline", 
 					 GSF_XML_NO_CONTENT, FALSE, FALSE, 
 					 &gog_style_sax_load_line, NULL, 1),
-		GSF_XML_IN_NODE_FULL 	(STYLE, STYLE_INTERPOLATION, 
-					 -1, "interpolation", 
-					 GSF_XML_NO_CONTENT, FALSE, FALSE, 
-					 &gog_style_sax_load_interpolation, NULL, 0),
 		GSF_XML_IN_NODE 	(STYLE, STYLE_FILL, 
 					 -1, "fill", 
 					 GSF_XML_NO_CONTENT, 
@@ -1978,7 +1900,6 @@ gog_style_force_auto (GogStyle *style)
 	style->outline.auto_color =
 	style->line.auto_dash =
 	style->line.auto_color =
-	style->interpolation.auto_type =
 	style->fill.auto_fore =
 	style->fill.auto_back =
 	style->font.auto_scale =
diff --git a/goffice/graph/gog-style.h b/goffice/graph/gog-style.h
index d89596e..690c601 100644
--- a/goffice/graph/gog-style.h
+++ b/goffice/graph/gog-style.h
@@ -94,10 +94,6 @@ struct _GogStyle {
 
 	GogStyleLine	outline, line;
 	struct {
-		GOLineInterpolation type;
-		gboolean 	 auto_type;
-	} interpolation;
-	struct {
 		GogFillStyle	type;
 		gboolean	auto_fore, auto_back;	/* share between pattern and gradient */
 		gboolean	invert_if_negative;	/* placeholder for XL */
diff --git a/plugins/plot_xy/gog-xy.c b/plugins/plot_xy/gog-xy.c
index 7d00afe..8226e3c 100644
--- a/plugins/plot_xy/gog-xy.c
+++ b/plugins/plot_xy/gog-xy.c
@@ -277,15 +277,6 @@ gog_xy_set_property (GObject *obj, guint param_id,
 		xy->default_style_has_lines = g_value_get_boolean (value);
 		break;
 	}
-	case GOG_XY_PROP_USE_SPLINES:
-		if (g_value_get_boolean (value))
-			xy->interpolation = GO_LINE_INTERPOLATION_SPLINE;
-		break;
-	case GOG_XY_PROP_INTERPOLATION: {
-		char const *s = g_value_get_string (value);
-		xy->interpolation = go_line_interpolation_from_str (s);;
-		break;
-	}
 	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
 		 break;
 	}
@@ -302,12 +293,6 @@ gog_xy_get_property (GObject *obj, guint param_id,
 	case GOG_XY_PROP_DEFAULT_STYLE_HAS_LINES:
 		g_value_set_boolean (value, xy->default_style_has_lines);
 		break;
-	case GOG_XY_PROP_USE_SPLINES:
-		g_value_set_boolean (value, xy->interpolation == GO_LINE_INTERPOLATION_SPLINE);
-		break;
-	case GOG_XY_PROP_INTERPOLATION:
-		g_value_set_string (value, go_line_interpolation_as_str (xy->interpolation));
-		break;
 	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
 		 break;
 	}
@@ -336,18 +321,6 @@ gog_xy_plot_class_init (GogPlotClass *plot_klass)
 			_("Should the default style of a series include lines"),
 			TRUE, 
 			GSF_PARAM_STATIC | G_PARAM_READWRITE | GOG_PARAM_PERSISTENT));
-	g_object_class_install_property (gobject_klass, GOG_XY_PROP_USE_SPLINES,
-		g_param_spec_boolean ("use-splines", 
-			_("Use splines"),
-			_("Should the plot use splines instead of linear interpolation"),
-			FALSE, 
-			GSF_PARAM_STATIC | G_PARAM_READWRITE | GOG_PARAM_PERSISTENT));
-	g_object_class_install_property (gobject_klass, GOG_XY_PROP_INTERPOLATION,
-		g_param_spec_string  ("interpolation", 
-			_("Interpolation"),
-			_("Interpolation type (none, linear, spline or step) with variant, if any"),
-			"none", 
-			GSF_PARAM_STATIC | G_PARAM_READWRITE | GOG_PARAM_PERSISTENT));
 	gog_klass->type_name	= gog_xy_plot_type_name;
 
 	{
@@ -693,11 +666,6 @@ gog_xy_color_plot_set_property (GObject *obj, guint param_id,
 	case GOG_XY_COLOR_PROP_DEFAULT_STYLE_HAS_LINES:
 		map->default_style_has_lines = g_value_get_boolean (value);
 		break;
-	case GOG_XY_COLOR_PROP_INTERPOLATION: {
-		char const *s = g_value_get_string (value);
-		map->interpolation = go_line_interpolation_from_str (s);;
-		break;
-	}
 	case GOG_XY_COLOR_PROP_HIDE_OUTLIERS:
 		map->hide_outliers = g_value_get_boolean (value);
 		break;
@@ -719,9 +687,6 @@ gog_xy_color_plot_get_property (GObject *obj, guint param_id,
 	case GOG_XY_COLOR_PROP_DEFAULT_STYLE_HAS_LINES:
 		g_value_set_boolean (value, map->default_style_has_lines);
 		break;
-	case GOG_XY_COLOR_PROP_INTERPOLATION:
-		g_value_set_string (value, go_line_interpolation_as_str (map->interpolation));
-		break;
 	case GOG_XY_COLOR_PROP_HIDE_OUTLIERS:
 		g_value_set_boolean (value, map->hide_outliers);
 		break;
@@ -755,12 +720,6 @@ gog_xy_color_plot_class_init (GogPlotClass *plot_klass)
 			_("Should the default style of a series include lines"),
 			TRUE, 
 			GSF_PARAM_STATIC | G_PARAM_READWRITE | GOG_PARAM_PERSISTENT));
-	g_object_class_install_property (gobject_klass, GOG_XY_COLOR_PROP_INTERPOLATION,
-		g_param_spec_string  ("interpolation", 
-			_("Interpolation"),
-			_("Interpolation type (none, linear, spline or step) with variant, if any"),
-			"none", 
-			GSF_PARAM_STATIC | G_PARAM_READWRITE | GOG_PARAM_PERSISTENT));
 	g_object_class_install_property (gobject_klass, GOG_XY_COLOR_PROP_HIDE_OUTLIERS,
 		g_param_spec_boolean  ("hide-outliers", 
 			_("hide-outliers"),
@@ -1042,7 +1001,7 @@ gog_xy_view_render (GogView *view, GogViewAllocation const *bbox)
 					gog_axis_map_to_view (y_map, y_vals[i]):
 					go_nan;
 			}
-			switch (style->interpolation.type) {
+			switch (series->base.interpolation) {
 			case GO_LINE_INTERPOLATION_LINEAR: {
 				ArtVpath *path;
 				path = go_line_build_vpath (x_splines, y_splines, n);
@@ -1070,7 +1029,7 @@ gog_xy_view_render (GogView *view, GogViewAllocation const *bbox)
 				if (n == i)
 					break;
 				path = art_new (ArtVpath,
-					((style->interpolation.type <= GO_LINE_INTERPOLATION_STEP_END)?
+					((series->base.interpolation <= GO_LINE_INTERPOLATION_STEP_END)?
 					2 * n + 1: 3 * n + 1));
 				path[0].code = ART_MOVETO;
 				path[0].x = x_splines[i];
@@ -1088,7 +1047,7 @@ gog_xy_view_render (GogView *view, GogViewAllocation const *bbox)
 						path[j].x = x_splines[i];
 						path[j++].y = y_splines[i];
 						b = FALSE;
-					} else switch (style->interpolation.type) {
+					} else switch (series->base.interpolation) {
 					case GO_LINE_INTERPOLATION_STEP_START:
 						path[j].code = ART_LINETO;
 						path[j].x = x_splines[i];
@@ -1487,17 +1446,11 @@ gog_xy_series_init_style (GogStyledObject *gso, GogStyle *style)
 		if (!plot->default_style_has_lines &&
 			style->line.auto_dash)
 			style->line.dash_type = GO_LINE_NONE;
-
-		if (style->interpolation.auto_type)
-			style->interpolation.type = plot->interpolation;
 	} else {
 		GogXYColorPlot const *plot = GOG_XY_COLOR_PLOT (series->plot);
 		if (!plot->default_style_has_lines &&
 			style->line.auto_dash)
 			style->line.dash_type = GO_LINE_NONE;
-
-		if (style->interpolation.auto_type)
-			style->interpolation.type = plot->interpolation;
 	}
 }
 
@@ -1640,6 +1593,7 @@ gog_xy_series_class_init (GogStyledObjectClass *gso_klass)
 	};
 	GogObjectClass *gog_klass = (GogObjectClass *)gso_klass;
 	GObjectClass *gobject_klass = (GObjectClass *) gso_klass;
+	GogSeriesClass *series_klass = (GogSeriesClass *) gso_klass;
 
 	series_parent_klass = g_type_class_peek_parent (gso_klass);
 	gog_klass->update	= gog_xy_series_update;
@@ -1654,6 +1608,7 @@ gog_xy_series_class_init (GogStyledObjectClass *gso_klass)
 	gog_klass->populate_editor	= gog_xy_series_populate_editor;
 #endif
 	gso_klass->init_style		= gog_xy_series_init_style;
+	series_klass->has_interpolation = TRUE;
 
 	gog_object_register_roles (gog_klass, roles, G_N_ELEMENTS (roles));
 

Attachment: gog-series-prefs.glade
Description: application/glade

_______________________________________________
gnumeric-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnumeric-list

Reply via email to