Clean up include files and code related to goffice. Includes patch by Johannes Engel.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18107 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Phil Longstaff 2009-06-06 16:48:58 +00:00
parent 93fa6773fb
commit 8bd0bdd89a
2 changed files with 1 additions and 111 deletions

View File

@ -87,15 +87,8 @@ static void draw_print_cb(GtkHTMLEmbedded *eb, cairo_t *cr, gpointer graph);
static void draw_print_cb(GtkHTMLEmbedded *eb, GnomePrintContext *context, gpointer graph); static void draw_print_cb(GtkHTMLEmbedded *eb, GnomePrintContext *context, gpointer graph);
#endif #endif
static gboolean create_basic_plot_elements(const char *plot_type, GogObject **out_graph, GogObject **out_chart, GogPlot **out_plot);
static double * read_doubles(const char * string, int nvalues); static double * read_doubles(const char * string, int nvalues);
static void set_chart_titles_from_hash(GogObject *chart, gpointer eb);
static void set_chart_titles(GogObject *chart, const char *title, const char* sub_title);
static void set_chart_axis_labels_from_hash(GogObject *chart, gpointer eb);
static void set_chart_axis_labels(GogObject *chart, const char *x_axis_label, const char* y_axis_label);
void void
gnc_html_graph_gog_gtkhtml_init( void ) gnc_html_graph_gog_gtkhtml_init( void )
{ {
@ -190,86 +183,6 @@ add_pixbuf_graph_widget( GtkHTMLEmbedded *eb, GdkPixbuf* buf )
G_CALLBACK (draw_print_cb), NULL); G_CALLBACK (draw_print_cb), NULL);
} }
static gboolean
create_basic_plot_elements(const char *plot_type_name,
GogObject **out_graph,
GogObject **out_chart,
GogPlot **out_plot)
{
*out_graph = g_object_new(GOG_TYPE_GRAPH, NULL);
*out_chart = gog_object_add_by_name(*out_graph, "Chart", NULL);
*out_plot = gog_plot_new_by_name(plot_type_name);
if (!*out_plot)
{
// FIXME - log betterer; should probably use GError?
g_warning("gog: unable to load %s plugin", plot_type_name);
return FALSE;
}
gog_object_add_by_name(*out_chart, "Plot", GOG_OBJECT(*out_plot) );
return TRUE;
}
static void
set_chart_titles_from_hash(GogObject *chart, gpointer eb)
{
set_chart_titles(chart,
(const char *)gnc_html_get_embedded_param(eb, "title"),
(const char *)gnc_html_get_embedded_param(eb, "subtitle"));
}
static void
set_chart_titles(GogObject *chart, const char *title, const char* sub_title)
{
gchar *my_sub_title, *total_title;
GOData *title_scalar;
GogObject *tmp;
if (sub_title)
my_sub_title = g_strdup_printf("%s(%s)", title ? " " : "", sub_title);
else
my_sub_title = g_strdup("");
total_title = g_strdup_printf("%s%s", title ? title : "", my_sub_title);
tmp = gog_object_add_by_name(chart, "Title", NULL);
title_scalar = go_data_scalar_str_new(total_title, TRUE);
gog_dataset_set_dim(GOG_DATASET(tmp), 0, title_scalar, NULL);
g_free(my_sub_title);
}
static void
set_chart_axis_labels_from_hash(GogObject *chart, gpointer eb)
{
set_chart_axis_labels(chart,
gnc_html_get_embedded_param(eb, "x_axis_label"),
gnc_html_get_embedded_param(eb, "y_axis_label"));
}
static void
set_chart_axis_labels(GogObject *chart, const char *x_axis_label, const char* y_axis_label)
{
if (x_axis_label != NULL)
{
GogObject *xaxis, *label;
GOData *data;
xaxis = gog_object_get_child_by_role(chart, gog_object_find_role_by_name(chart, "X-Axis"));
label = gog_object_add_by_name(xaxis, "Label", NULL);
data = go_data_scalar_str_new(x_axis_label, FALSE);
gog_dataset_set_dim(GOG_DATASET(label), 0, data, NULL);
}
if (y_axis_label != NULL)
{
GogObject *yaxis, *label;
GOData *data;
yaxis = gog_object_get_child_by_role(chart, gog_object_find_role_by_name(chart, "Y-Axis"));
label = gog_object_add_by_name(yaxis, "Label", NULL);
data = go_data_scalar_str_new(y_axis_label, FALSE);
gog_dataset_set_dim(GOG_DATASET(label), 0, data, NULL);
}
}
/* /*
* Handle the following parameters: * Handle the following parameters:
* title: text * title: text

View File

@ -27,6 +27,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <webkit/webkit.h> #include <webkit/webkit.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include "gnc-ui-util.h" #include "gnc-ui-util.h"
#include "gnc-html-graph-gog.h" #include "gnc-html-graph-gog.h"
@ -34,30 +35,6 @@
#include "gnc-html-graph-gog-extras.h" #include "gnc-html-graph-gog-extras.h"
#include "gnc-html.h" #include "gnc-html.h"
#include "gnc-engine.h" #include "gnc-engine.h"
#include <goffice/goffice.h>
#include <goffice/graph/gog-chart.h>
#include <goffice/graph/gog-graph.h>
#include <goffice/graph/gog-object.h>
#if defined(HAVE_GOFFICE_0_5)
# include <goffice/graph/gog-renderer.h>
#elif defined(GOFFICE_WITH_CAIRO)
# include <goffice/graph/gog-renderer-cairo.h>
#else
# include <goffice/graph/gog-renderer-pixbuf.h>
#endif
#ifndef GTKHTML_USES_GTKPRINT
# include <goffice/graph/gog-renderer-gnome-print.h>
#endif
#include <goffice/graph/gog-style.h>
#include <goffice/graph/gog-styled-object.h>
#include <goffice/graph/gog-plot.h>
#include <goffice/graph/gog-series.h>
#include <goffice/utils/go-color.h>
#include <goffice/utils/go-marker.h>
#include <goffice/graph/gog-data-set.h>
#include <goffice/data/go-data-simple.h>
#include <goffice/app/go-plugin.h>
#include <goffice/app/go-plugin-loader-module.h>
/** /**
* TODO: * TODO: