[goffice] Do not allow several 3D plots in a single chart (#591478).



commit 93a33b74d835aecaa20a4563af48852c82e12624
Author: Jean Brefort <jean brefort normalesup org>
Date:   Wed Aug 12 11:00:30 2009 +0200

    Do not allow several 3D plots in a single chart (#591478).

 ChangeLog                 |    5 +++++
 goffice/graph/gog-chart.c |    9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8a73ef9..0fa6d5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-12  Jean Brefort  <jean brefort normalesup org>
+
+	* goffice/graph/gog-chart.c (role_plot_can_add): do not allow several 3D plots an a
+	single chart. (see #591478)
+
 2009-08-11  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/canvas/*: removed *-impl.h files
diff --git a/goffice/graph/gog-chart.c b/goffice/graph/gog-chart.c
index 0a54a44..793491d 100644
--- a/goffice/graph/gog-chart.c
+++ b/goffice/graph/gog-chart.c
@@ -212,6 +212,13 @@ gog_chart_children_reordered (GogObject *obj)
 	gog_chart_request_cardinality_update (chart);
 }
 
+static gboolean
+role_plot_can_add (GogObject *parent, GogObject *child)
+{
+	GogChart *chart = GOG_CHART (parent);
+	return (chart->axis_set & (1 << GOG_AXIS_Z)) == 0 || g_slist_length (chart->plots) == 0;
+}
+
 static void
 role_plot_post_add (GogObject *parent, GogObject *plot)
 {
@@ -443,7 +450,7 @@ static GogObjectRole const roles[] = {
 	  { GOG_AXIS_COLOR } },
 	{ N_("Plot"), "GogPlot",	6,	/* keep the axis before the plots */
 	  GOG_POSITION_SPECIAL, GOG_POSITION_SPECIAL, GOG_OBJECT_NAME_BY_TYPE,
-	  NULL, NULL, NULL, role_plot_post_add, role_plot_pre_remove, NULL, { -1 } },
+	  role_plot_can_add, NULL, NULL, role_plot_post_add, role_plot_pre_remove, NULL, { -1 } },
 	{ N_("Title"), "GogLabel",	10,
 	  GOG_POSITION_COMPASS|GOG_POSITION_ANY_MANUAL, 
 	  GOG_POSITION_N|GOG_POSITION_ALIGN_CENTER, 



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