[goffice] Fixed rows and columns count in GogGraph.



commit 70a07626f0df183352b927fa44cfe76af4e7d6d4
Author: Jean Brefort <jean acer brefort fr>
Date:   Thu Jul 1 22:46:39 2010 +0200

    Fixed rows and columns count in GogGraph.

 ChangeLog                  |    7 +++++++
 NEWS                       |    4 ++++
 goffice/graph/gog-graph.c  |    6 ++++++
 goffice/graph/gog-object.c |    2 ++
 4 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8277334..88946b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-07-01  Jean Brefort  <jean brefort normalesup org>
+
+	* goffice/graph/gog-graph.c (gog_graph_validate_chart_layout): do not
+	take manually placed charts into account when evaluating rows and
+	columns in GogGraph.
+	* goffice/graph/gog-object.c (gog_object_set_position_flags): ditto.
+
 2010-07-01  Morten Welinder  <terra gnome org>
 
 	* goffice/utils/go-glib-extras.c (go_string_replace): New
diff --git a/NEWS b/NEWS
index 83d2b7c..b5f4a69 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,9 @@
 goffice 0.8.8:
 
+Jean:
+	* Do not take manually placed charts into account when evaluating rows and
+	columns in GogGraph.
+
 Morten:
 	* Add go_string_replace function.
 
diff --git a/goffice/graph/gog-graph.c b/goffice/graph/gog-graph.c
index 8efed6c..bdaa876 100644
--- a/goffice/graph/gog-graph.c
+++ b/goffice/graph/gog-graph.c
@@ -433,6 +433,8 @@ gog_graph_validate_chart_layout (GogGraph *graph)
 	/* 1) find the max */
 	max_col = max_row = 0;
 	for (ptr = graph->charts ; ptr != NULL ; ptr = ptr->next) {
+		if (gog_object_get_position_flags (ptr->data, GOG_POSITION_MANUAL))
+			continue;
 		chart = ptr->data;
 		chart->x_pos_actual = chart->x_pos;
 		chart->y_pos_actual = chart->y_pos;
@@ -445,6 +447,8 @@ gog_graph_validate_chart_layout (GogGraph *graph)
 	/* 2) see if we need to contract any cols */
 	for (i = 0 ; i < max_col ; ) {
 		for (ptr = graph->charts ; ptr != NULL ; ptr = ptr->next) {
+			if (gog_object_get_position_flags (ptr->data, GOG_POSITION_MANUAL))
+				continue;
 			chart = ptr->data;
 			if (chart->x_pos_actual <= i && i < (chart->x_pos_actual + chart->cols))
 				break;
@@ -464,6 +468,8 @@ gog_graph_validate_chart_layout (GogGraph *graph)
 	/* 3) see if we need to contract any rows */
 	for (i = 0 ; i < max_row ; ) {
 		for (ptr = graph->charts ; ptr != NULL ; ptr = ptr->next) {
+			if (gog_object_get_position_flags (ptr->data, GOG_POSITION_MANUAL))
+				continue;
 			chart = ptr->data;
 			if (chart->y_pos_actual <= i && i < (chart->y_pos_actual + chart->rows))
 				break;
diff --git a/goffice/graph/gog-object.c b/goffice/graph/gog-object.c
index 0a4bf3c..141c8c0 100644
--- a/goffice/graph/gog-object.c
+++ b/goffice/graph/gog-object.c
@@ -1639,6 +1639,8 @@ gog_object_set_position_flags (GogObject *obj, GogObjectPosition flags, GogObjec
 		return FALSE;
 	}
 	obj->position = (obj->position & ~mask) | (flags & mask);
+	if (GOG_IS_CHART (obj))
+		gog_graph_validate_chart_layout (GOG_GRAPH (obj->parent));
 	gog_object_emit_changed (obj, TRUE);
 	return TRUE;
 }



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