Ticket #26256: gnucash-2.2.9-goffice.patch

File gnucash-2.2.9-goffice.patch, 6.5 KB (added by chris.schwemmer@…, 14 years ago)
  • src/gnome-utils/gnc-html-graph-gog.c

     
    4646#ifndef GTKHTML_USES_GTKPRINT
    4747#    include <goffice/graph/gog-renderer-gnome-print.h>
    4848#endif
    49 #include <goffice/graph/gog-style.h>
     49/* everything inside the following #ifndef can be safely removed when gnucash
     50requires libgoffice >= 0.7.5, the contents of the #else block must stay. */
     51#ifndef GOG_TYPE_GRAPH
     52#       define GOG_TYPE_GRAPH GOG_GRAPH_TYPE
     53#       define GO_TYPE_PLUGIN_LOADER_MODULE GO_PLUGIN_LOADER_MODULE_TYPE
     54#       define GOG_TYPE_RENDERER GOG_RENDERER_TYPE
     55#       include <goffice/graph/gog-style.h>
     56#       define GOStyle GogStyle
     57#       define go_styled_object_get_style gog_styled_object_get_style
     58#       define GO_STYLED_OBJECT GOG_STYLED_OBJECT
     59#       define GO_STYLE_FILL_PATTERN GOG_FILL_STYLE_PATTERN
     60#       define go_style_set_text_angle gog_style_set_text_angle
     61#else
     62#       include <goffice/utils/go-style.h>
     63#       include <goffice/utils/go-styled-object.h>
     64#endif
     65#ifndef GO_COLOR_FROM_GDK
     66#       define GO_COLOR_FROM_GDK GDK_TO_UINT
     67#endif
    5068#include <goffice/graph/gog-styled-object.h>
    5169#include <goffice/graph/gog-plot.h>
    5270#include <goffice/graph/gog-series.h>
     
    98116  libgoffice_init();
    99117 
    100118  /* Initialize plugins manager */
    101   go_plugins_init (NULL, NULL, NULL, NULL, TRUE, GO_PLUGIN_LOADER_MODULE_TYPE);
     119  go_plugins_init (NULL, NULL, NULL, NULL, TRUE, GO_TYPE_PLUGIN_LOADER_MODULE);
    102120
    103121  gnc_html_register_object_handler( "gnc-guppi-pie", handle_piechart );
    104122  gnc_html_register_object_handler( "gnc-guppi-bar", handle_barchart );
     
    189207  gog_object_update (GOG_OBJECT (graph));
    190208
    191209#if defined(HAVE_GOFFICE_0_5)
    192   renderer = GOG_RENDERER (g_object_new (GOG_RENDERER_TYPE,
     210  renderer = GOG_RENDERER (g_object_new (GOG_TYPE_RENDERER,
    193211                                         "model", graph,
    194212                                         NULL));
    195213  update_status = gog_renderer_update (renderer, eb->width, eb->height);
     
    229247                           GogObject **out_chart,
    230248                           GogPlot **out_plot)
    231249{
    232   *out_graph = g_object_new(GOG_GRAPH_TYPE, NULL);
     250  *out_graph = g_object_new(GOG_TYPE_GRAPH, NULL);
    233251  *out_chart = gog_object_add_by_name(*out_graph, "Chart", NULL);
    234252  *out_plot = gog_plot_new_by_name(plot_type_name);
    235253  if (!*out_plot)
     
    363381  }
    364382  gog_object_add_by_name(chart, "Legend", NULL);
    365383
    366   GOG_STYLED_OBJECT(graph)->style->outline.width = 5;
    367   GOG_STYLED_OBJECT(graph)->style->outline.color = RGBA_BLACK;
     384#ifdef GO_COLOR_BLACK
     385        GOG_STYLED_OBJECT(graph)->style->line.width = 5;
     386        GOG_STYLED_OBJECT(graph)->style->line.color = GO_COLOR_BLACK;
     387#else
     388  GO_STYLED_OBJECT(graph)->style->outline.width = 5;
     389  GO_STYLED_OBJECT(graph)->style->outline.color = RGBA_BLACK;
     390#endif
    368391
    369392  series = gog_plot_new_series(plot);
    370393  labelData = go_data_vector_str_new((char const * const *)labels, datasize, NULL);
     
    401424  GogObject *graph, *chart;
    402425  GogPlot *plot;
    403426  GogSeries *series;
    404   GogStyle *style;
     427  GOStyle *style;
    405428  GOData *label_data, *slice_data;
    406429  int data_rows, data_cols;
    407430  double *data = NULL;
     
    489512      gog_series_set_dim (series, 1, slice_data, NULL);
    490513      go_data_emit_changed (GO_DATA (slice_data));
    491514
    492       style = gog_styled_object_get_style (GOG_STYLED_OBJECT (series));
    493       style->fill.type = GOG_FILL_STYLE_PATTERN;
     515      style = go_styled_object_get_style (GO_STYLED_OBJECT (series));
     516      style->fill.type = GO_STYLE_FILL_PATTERN;
    494517      if (gdk_color_parse (col_colors[i], &color)) {
    495518           style->fill.auto_back = FALSE;
    496            go_pattern_set_solid (&style->fill.pattern, GDK_TO_UINT (color));
     519           go_pattern_set_solid (&style->fill.pattern, GO_COLOR_FROM_GDK (color));
    497520      } else {
    498521           g_warning("cannot parse color [%s]", col_colors[i]);
    499522      }
     
    503526  if (rotate_row_labels) {
    504527    GogObject *object = gog_object_get_child_by_role (
    505528      chart, gog_object_find_role_by_name (chart, "X-Axis"));
    506     style = gog_styled_object_get_style (GOG_STYLED_OBJECT (object));
    507     gog_style_set_text_angle (style, 90.0);
     529    style = go_styled_object_get_style (GO_STYLED_OBJECT (object));
     530    go_style_set_text_angle (style, 90.0);
    508531  }
    509532
    510533  set_chart_titles_from_hash (chart, eb);
     
    526549  GogPlot *plot;
    527550  GogSeries *series;
    528551  GOData *sliceData;
    529   GogStyle *style;
     552  GOStyle *style;
    530553  int datasize;
    531554  double *xData, *yData;
    532555  gchar *marker_str, *color_str;
     
    556579  }
    557580
    558581  series = gog_plot_new_series( plot );
    559   style = gog_styled_object_get_style(GOG_STYLED_OBJECT(series));
     582  style = go_styled_object_get_style(GO_STYLED_OBJECT(series));
    560583
    561584  sliceData = go_data_vector_val_new( xData, datasize, NULL );
    562585  gog_series_set_dim( series, 0, sliceData, NULL );
     
    588611    GdkColor color;
    589612    if (gdk_color_parse(color_str, &color)) {
    590613      style->marker.auto_outline_color = FALSE;
    591       go_marker_set_outline_color(style->marker.mark, GDK_TO_UINT(color));
     614      go_marker_set_outline_color(style->marker.mark, GO_COLOR_FROM_GDK(color));
    592615      style->line.auto_color = FALSE;
    593       style->line.color = GDK_TO_UINT(color);
     616      style->line.color = GO_COLOR_FROM_GDK(color);
    594617    } else {
    595618      g_warning("cannot parse color [%s]", color_str);
    596619    }
     
    602625    go_marker_set_fill_color(style->marker.mark,
    603626                             go_marker_get_outline_color(style->marker.mark));
    604627  } else {
    605     GogStyle *chart_style =
    606       gog_styled_object_get_style(GOG_STYLED_OBJECT(chart));
     628    GOStyle *chart_style =
     629      go_styled_object_get_style(GO_STYLED_OBJECT(chart));
    607630
    608     if (chart_style->fill.type == GOG_FILL_STYLE_PATTERN
     631    if (chart_style->fill.type == GO_STYLE_FILL_PATTERN
    609632        && chart_style->fill.pattern.pattern == GO_PATTERN_SOLID) {
    610633      style->marker.auto_fill_color = FALSE;
    611634      go_marker_set_fill_color(style->marker.mark,
    612635                               chart_style->fill.pattern.back);
    613     } else if (chart_style->fill.type == GOG_FILL_STYLE_PATTERN
     636    } else if (chart_style->fill.type == GO_STYLE_FILL_PATTERN
    614637               && chart_style->fill.pattern.pattern
    615638               == GO_PATTERN_FOREGROUND_SOLID) {
    616639      style->marker.auto_fill_color = FALSE;
     
    639662{
    640663  GogGraph *graph = GOG_GRAPH(g_object_get_data(G_OBJECT(eb), "graph"));
    641664#    ifdef HAVE_GOFFICE_0_5
    642   GogRenderer *rend = g_object_new(GOG_RENDERER_TYPE, "model", graph, NULL);
     665  GogRenderer *rend = g_object_new(GOG_TYPE_RENDERER, "model", graph, NULL);
    643666#    else
    644667  GogRendererCairo *rend = g_object_new(GOG_RENDERER_CAIRO_TYPE, "model", graph,
    645668                                        "cairo", cr, "is-vector", TRUE, NULL);