? omf-install/Makefile ? omf-install/Makefile.in ? omf-install/gnumeric-C.omf ? samples/test.png ? src/cachegrind.out.20764 ? src/callgrind.out.11561 ? src/callgrind.out.full ? src/callgrind.out.without.layout.cache ? src/line_size= ? src/output.pdf ? src/cut-n-paste-code/goffice/graph/.gog-graph.c.swp ? src/cut-n-paste-code/goffice/graph/dim_changed ? src/cut-n-paste-code/pcre/Makefile ? src/cut-n-paste-code/pcre/Makefile.in Index: src/cut-n-paste-code/goffice/graph/gog-chart-impl.h =================================================================== RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/goffice/graph/gog-chart-impl.h,v retrieving revision 1.11 diff -u -r1.11 gog-chart-impl.h --- src/cut-n-paste-code/goffice/graph/gog-chart-impl.h 9 May 2004 05:46:59 -0000 1.11 +++ src/cut-n-paste-code/goffice/graph/gog-chart-impl.h 22 Nov 2004 10:49:14 -0000 @@ -37,7 +37,10 @@ gboolean cardinality_valid; /* use a simple grid layout to position charts within graph */ - unsigned x, y, cols, rows; + unsigned x_pos, y_pos; + unsigned cols, rows; /* if == 0, chart is not positionned */ + /* actual chart position in graph grid after layout validation */ + unsigned x_pos_actual, y_pos_actual; GogObject *grid; GSList *axes; Index: src/cut-n-paste-code/goffice/graph/gog-chart.c =================================================================== RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/goffice/graph/gog-chart.c,v retrieving revision 1.50 diff -u -r1.50 gog-chart.c --- src/cut-n-paste-code/goffice/graph/gog-chart.c 23 Sep 2004 15:55:52 -0000 1.50 +++ src/cut-n-paste-code/goffice/graph/gog-chart.c 22 Nov 2004 10:49:15 -0000 @@ -37,7 +37,11 @@ enum { CHART_PROP_0, - CHART_PROP_CARDINALITY_VALID + CHART_PROP_CARDINALITY_VALID, + CHART_PROP_X_POS, + CHART_PROP_Y_POS, + CHART_PROP_ROWS, + CHART_PROP_COLUMNS }; static GType gog_chart_view_get_type (void); @@ -70,14 +74,61 @@ } static void +gog_chart_set_property (GObject *obj, guint param_id, + GValue const *value, GParamSpec *pspec) +{ + GogChart *chart = GOG_CHART (obj); + gboolean changed = FALSE; + + switch (param_id) { + case CHART_PROP_X_POS: + chart->x_pos = g_value_get_int (value); + changed = TRUE; + break; + case CHART_PROP_Y_POS: + chart->y_pos = g_value_get_int (value); + changed = TRUE; + break; + case CHART_PROP_COLUMNS: + chart->cols = g_value_get_int (value); + changed = TRUE; + break; + case CHART_PROP_ROWS: + chart->rows = g_value_get_int (value); + changed = TRUE; + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec); + return; /* NOTE : RETURN */ + } + + if (changed) { + gog_graph_validate_chart_layout (GOG_GRAPH (GOG_OBJECT (chart)->parent)); + gog_object_emit_changed (GOG_OBJECT (obj), TRUE); + } +} + +static void gog_chart_get_property (GObject *obj, guint param_id, GValue *value, GParamSpec *pspec) { GogChart *chart = GOG_CHART (obj); switch (param_id) { - case CHART_PROP_CARDINALITY_VALID: - g_value_set_boolean (value, chart->cardinality_valid); - break; + case CHART_PROP_CARDINALITY_VALID: + g_value_set_boolean (value, chart->cardinality_valid); + break; + + case CHART_PROP_X_POS: + g_value_set_int (value, chart->x_pos); + break; + case CHART_PROP_Y_POS: + g_value_set_int (value, chart->y_pos); + break; + case CHART_PROP_COLUMNS: + g_value_set_int (value, chart->cols); + break; + case CHART_PROP_ROWS: + g_value_set_int (value, chart->rows); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec); break; @@ -233,12 +284,29 @@ chart_parent_klass = g_type_class_peek_parent (gog_klass); gobject_klass->finalize = gog_chart_finalize; + gobject_klass->set_property = gog_chart_set_property; gobject_klass->get_property = gog_chart_get_property; g_object_class_install_property (gobject_klass, CHART_PROP_CARDINALITY_VALID, g_param_spec_boolean ("cardinality-valid", "cardinality-valid", - "Is the charts cardinality currently vaid", + "Is the charts cardinality currently valid", FALSE, G_PARAM_READABLE)); + g_object_class_install_property (gobject_klass, CHART_PROP_X_POS, + g_param_spec_int ("xpos", "xpos", + "Horizontal chart position in graph grid", + 0, G_MAXINT, 0, G_PARAM_READWRITE | GOG_PARAM_PERSISTENT)); + g_object_class_install_property (gobject_klass, CHART_PROP_Y_POS, + g_param_spec_int ("ypos", "ypos", + "Vertical chart position in graph grid", + 0, G_MAXINT, 0, G_PARAM_READWRITE | GOG_PARAM_PERSISTENT)); + g_object_class_install_property (gobject_klass, CHART_PROP_COLUMNS, + g_param_spec_int ("columns", "columns", + "Number of columns in graph grid", + 1, G_MAXINT, 1, G_PARAM_READWRITE | GOG_PARAM_PERSISTENT)); + g_object_class_install_property (gobject_klass, CHART_PROP_ROWS, + g_param_spec_int ("rows", "rows", + "Number of rows in graph grid", + 1, G_MAXINT, 1, G_PARAM_READWRITE | GOG_PARAM_PERSISTENT)); gog_klass->view_type = gog_chart_view_get_type (); gog_klass->update = gog_chart_update; @@ -249,10 +317,12 @@ static void gog_chart_init (GogChart *chart) { - chart->x = 0; - chart->y = 0; - chart->cols = 0; - chart->rows = 0; + chart->x_pos = + chart->y_pos = + chart->cols = + chart->rows = + chart->x_pos_actual = + chart->y_pos_actual = 0; /* start as true so that we can queue an update when it changes */ chart->cardinality_valid = TRUE; @@ -282,8 +352,8 @@ if (chart->cols <= 0 || chart->rows <= 0) return FALSE; - if (x != NULL) *x = chart->x; - if (y != NULL) *y = chart->y; + if (x != NULL) *x = chart->x_pos; + if (y != NULL) *y = chart->y_pos; if (cols != NULL) *cols = chart->cols; if (rows != NULL) *rows = chart->rows; @@ -305,12 +375,12 @@ { g_return_if_fail (GOG_CHART (chart) != NULL); - if (chart->x == x && chart->y == y && + if (chart->x_pos == x && chart->y_pos == y && chart->cols == cols && chart->rows == rows) return; - chart->x = x; - chart->y = y; + chart->x_pos = x; + chart->y_pos = y; chart->cols = cols; chart->rows = rows; Index: src/cut-n-paste-code/goffice/graph/gog-graph.c =================================================================== RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/goffice/graph/gog-graph.c,v retrieving revision 1.25 diff -u -r1.25 gog-graph.c --- src/cut-n-paste-code/goffice/graph/gog-graph.c 6 Jul 2004 13:19:30 -0000 1.25 +++ src/cut-n-paste-code/goffice/graph/gog-graph.c 22 Nov 2004 10:49:15 -0000 @@ -120,8 +120,9 @@ { GogGraph *graph = GOG_GRAPH (parent); graph->charts = g_slist_prepend (graph->charts, chart); - gog_chart_set_position (GOG_CHART (chart), - 0, GOG_GRAPH (graph)->num_rows, 1, 1); + if (!gog_chart_get_position (GOG_CHART (chart), NULL, NULL, NULL, NULL)) + gog_chart_set_position (GOG_CHART (chart), + 0, GOG_GRAPH (graph)->num_rows, 1, 1); } static void @@ -242,17 +243,19 @@ max_col = max_row = 0; for (ptr = graph->charts ; ptr != NULL ; ptr = ptr->next) { chart = ptr->data; - if (max_col < (chart->x + chart->cols)) - max_col = (chart->x + chart->cols); - if (max_row < (chart->y + chart->rows)) - max_row = (chart->y + chart->rows); + chart->x_pos_actual = chart->x_pos; + chart->y_pos_actual = chart->y_pos; + if (max_col < (chart->x_pos_actual + chart->cols)) + max_col = (chart->x_pos_actual + chart->cols); + if (max_row < (chart->y_pos_actual + chart->rows)) + max_row = (chart->y_pos_actual + chart->rows); } /* 2) see if we need to contract any cols */ for (i = 0 ; i < max_col ; ) { for (ptr = graph->charts ; ptr != NULL ; ptr = ptr->next) { chart = ptr->data; - if (chart->x <= i && i < (chart->x + chart->cols)) + if (chart->x_pos_actual <= i && i < (chart->x_pos_actual + chart->cols)) break; } if (ptr == NULL) { @@ -260,18 +263,18 @@ max_col--; for (ptr = graph->charts ; ptr != NULL ; ptr = ptr->next) { chart = ptr->data; - if (chart->x > i) - (chart->x)--; + if (chart->x_pos_actual > i) + (chart->x_pos_actual)--; } } else - i = chart->x + chart->cols; + i = chart->x_pos_actual + chart->cols; } /* 3) see if we need to contract any rows */ for (i = 0 ; i < max_row ; ) { for (ptr = graph->charts ; ptr != NULL ; ptr = ptr->next) { chart = ptr->data; - if (chart->y <= i && i < (chart->y + chart->rows)) + if (chart->y_pos_actual <= i && i < (chart->y_pos_actual + chart->rows)) break; } if (ptr == NULL) { @@ -279,11 +282,11 @@ max_row--; for (ptr = graph->charts ; ptr != NULL ; ptr = ptr->next) { chart = ptr->data; - if (chart->y > i) - (chart->y)--; + if (chart->y_pos_actual > i) + (chart->y_pos_actual)--; } } else - i = chart->y + chart->rows; + i = chart->y_pos_actual + chart->rows; } changed |= (graph->num_cols != max_col || graph->num_rows != max_row); @@ -533,7 +536,6 @@ { GSList *ptr; double h, w; - unsigned x, y, rows, cols; GogView *child; GogGraph *graph = GOG_GRAPH (view->model); GogViewAllocation tmp, res = *a; @@ -550,12 +552,11 @@ for (ptr = view->children; ptr != NULL ; ptr = ptr->next) { child = ptr->data; if (child->model->position == GOG_POSITION_SPECIAL) { - gog_chart_get_position (GOG_CHART (child->model), - &x, &y, &cols, &rows); - tmp.x = x * w + res.x; - tmp.y = y * h + res.y; - tmp.w = cols * w; - tmp.h = rows * h; + GogChart *chart = GOG_CHART (child->model); + tmp.x = chart->x_pos_actual * w + res.x; + tmp.y = chart->y_pos_actual * h + res.y; + tmp.w = chart->cols * w; + tmp.h = chart->rows * h; gog_view_size_allocate (child, &tmp); } }