From 84b622c62267f77c15afa89eee1a4e1ff58b734d Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Sat, 27 Sep 2014 22:18:34 +0200 Subject: [PATCH] Make chart/image/icon size parameters for the XSLT; the chart depends on them Almost all sizes depend on $image_size or $icon_size now --- src/ag-chart.c | 10 ++- src/ag-chart.h | 8 +- src/resources/ui/chart-default.xsl | 115 ++++++++++++++++++++--------- 3 files changed, 95 insertions(+), 38 deletions(-) diff --git a/src/ag-chart.c b/src/ag-chart.c index e5eff28..b59cfb7 100644 --- a/src/ag-chart.c +++ b/src/ag-chart.c @@ -1754,13 +1754,19 @@ ag_chart_create_svg(AgChart *chart, return NULL; } - params = g_new0(gchar *, 5); + params = g_new0(gchar *, 11); params[0] = "rendering"; params[1] = (rendering) ? "'yes'" : "'no'"; params[2] = "additional-css"; css = ag_display_theme_to_css(theme); params[3] = g_strdup_printf("\"%s\"", css); g_free(css); + params[4] = "chart-size"; + params[5] = g_strdup_printf("%d", AG_CHART_DEFAULT_RING_SIZE); + params[6] = "image-size"; + params[7] = "0"; + params[8] = "icon-size"; + params[9] = g_strdup_printf("%d", AG_CHART_DEFAULT_ICON_SIZE); // libxml2 messes up the output, as it prints decimal floating point // numbers in a localized format. It is not good in locales that use a @@ -1774,6 +1780,8 @@ ag_chart_create_svg(AgChart *chart, xsltFreeStylesheet(xslt_proc); xmlFreeDoc(doc); g_free(params[3]); + g_free(params[5]); + g_free(params[9]); g_free(params); // Now, svg_doc contains the generated SVG file diff --git a/src/ag-chart.h b/src/ag-chart.h index fc0397a..440369a 100644 --- a/src/ag-chart.h +++ b/src/ag-chart.h @@ -26,6 +26,9 @@ #include "ag-db.h" #include "ag-display-theme.h" +#define AG_CHART_DEFAULT_RING_SIZE 600 +#define AG_CHART_DEFAULT_ICON_SIZE 30 + G_BEGIN_DECLS typedef enum { @@ -63,7 +66,10 @@ struct _AgChartClass { GsweMomentClass parent_class; }; -typedef void (*AgChartSaveImageFunc)(AgChart *, GFile *, AgDisplayTheme *, GError **); +typedef void (*AgChartSaveImageFunc)(AgChart *, + GFile *, + AgDisplayTheme *, + GError **); GType ag_chart_get_type(void) G_GNUC_CONST; diff --git a/src/resources/ui/chart-default.xsl b/src/resources/ui/chart-default.xsl index 96d8459..eb4c947 100644 --- a/src/resources/ui/chart-default.xsl +++ b/src/resources/ui/chart-default.xsl @@ -15,13 +15,53 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -35,22 +75,25 @@ planet planet- rotate(, 0, 0) - - + + - - + + translate(, ) rotate(, , ) #_tmpl - - - rotate(180, , ) - - + + + + rotate(180, , ) + + + scale() + @@ -151,24 +194,24 @@ - + - + - + - - + + @@ -183,8 +226,8 @@ - - + + @@ -211,8 +254,8 @@ - - + + @@ -251,8 +294,8 @@ - - + + @@ -543,40 +586,40 @@ - rotate(-15,0,0) translate(,-) rotate(90,,) + rotate(-15,0,0) translate(,-) rotate(90,,) scale() - rotate(-45,0,0) translate(,-) rotate(90,,) + rotate(-45,0,0) translate(,-) rotate(90,,) scale() - rotate(-75,0,0) translate(,-) rotate(90,,) + rotate(-75,0,0) translate(,-) rotate(90,,) scale() - rotate(-105,0,0) translate(,-) rotate(90,,) + rotate(-105,0,0) translate(,-) rotate(90,,) scale() - rotate(-135,0,0) translate(,-) rotate(90,,) + rotate(-135,0,0) translate(,-) rotate(90,,) scale() - rotate(-165,0,0) translate(,-) rotate(90,,) + rotate(-165,0,0) translate(,-) rotate(90,,) scale() - rotate(-195,0,0) translate(,-) rotate(90,,) + rotate(-195,0,0) translate(,-) rotate(90,,) scale() - rotate(-225,0,0) translate(,-) rotate(90,,) + rotate(-225,0,0) translate(,-) rotate(90,,) scale() - rotate(-255,0,0) translate(,-) rotate(90,,) + rotate(-255,0,0) translate(,-) rotate(90,,) scale() - rotate(-285,0,0) translate(,-) rotate(90,,) + rotate(-285,0,0) translate(,-) rotate(90,,) scale() - rotate(-315,0,0) translate(,-) rotate(90,,) + rotate(-315,0,0) translate(,-) rotate(90,,) scale() - rotate(-345,0,0) translate(,-) rotate(90,,) + rotate(-345,0,0) translate(,-) rotate(90,,) scale()