Commit b43b1f8a authored by Morten Welinder's avatar Morten Welinder
Browse files

SheetObjectGraph: tell the sheet object about the anchor size.

It's used for image output, see #507.
parent f58a0001
2021-01-28 Morten Welinder <terra@gnome.org>
* src/sheet-object-graph.c (gnm_sog_bounds_changed): Make sure to
tell the graph about the new size.
(gnm_sog_set_sheet): Tell the graph object about the initial size.
(sheet_object_graph_set_gog): Ditto.
* src/number-match.c (format_match_decimal_number_with_locale): If
the thousands separator is a space character, allow plain space
also.
......
......@@ -26,6 +26,7 @@ Morten:
* Fix ods import problem with irregular sheet sizes.
* Fix ods import problem with crazy named expressions. [#557]
* Allow plain space as 1000s separator in FR locale.
* Fix graph size problem affecting image output. [#507]
--------------------------------------------------------------------------
Gnumeric 1.12.48
......
......@@ -520,12 +520,31 @@ gnm_sog_foreach_dep (SheetObject *so,
sog_data_foreach_dep (so, ptr->data, func, user);
}
static void
sog_update_graph_size (SheetObjectGraph *sog)
{
double coords[4];
SheetObject *so = GNM_SO (sog);
if (sog->graph == NULL || so->sheet == NULL)
return;
sheet_object_position_pts_get (so, coords);
gog_graph_set_size (sog->graph,
fabs (coords[2] - coords[0]),
fabs (coords[3] - coords[1]));
}
static gboolean
gnm_sog_set_sheet (SheetObject *so, Sheet *sheet)
{
SheetObjectGraph *sog = GNM_SO_GRAPH (so);
if (sog->graph != NULL)
if (sog->graph != NULL) {
sog_datas_set_sheet (sog, sheet);
sog_update_graph_size (sog);
}
return FALSE;
}
......@@ -551,14 +570,8 @@ gnm_sog_bounds_changed (SheetObject *so)
SheetObjectGraph *sog = GNM_SO_GRAPH (so);
/* If it has not been realized there is no renderer yet */
if (sog->renderer != NULL) {
double coords [4];
if (so->sheet->sheet_type == GNM_SHEET_DATA) {
sheet_object_position_pts_get (so, coords);
gog_graph_set_size (sog->graph, fabs (coords[2] - coords[0]),
fabs (coords[3] - coords[1]));
}
}
if (sog->renderer != NULL)
sog_update_graph_size (sog);
}
static void
......@@ -697,6 +710,8 @@ sheet_object_graph_set_gog (SheetObject *so, GogGraph *graph)
g_object_set (sog->renderer, "model", graph, NULL);
else
sog->renderer = gog_renderer_new (sog->graph);
sog_update_graph_size (sog);
}
static void
......
......@@ -1753,7 +1753,6 @@ sheet_object_write_image (SheetObject const *so, char const *format, double reso
GNM_SO_IMAGEABLE_CLASS (so)->write_image (so, format, resolution,
output, err);
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment