goffice r2286 - in trunk: . goffice goffice/graph



Author: emmanuel
Date: Tue Dec  9 17:39:06 2008
New Revision: 2286
URL: http://svn.gnome.org/viewvc/goffice?rev=2286&view=rev

Log:
2008-12-07  Emmanuel Pacaud <emmanuel pacaud lapp in2p3 fr>

	Add an optional dependency to GMathml, for equation support. It's
	disabled by default.

	* configure.in: gmathml check.
	* goffice/goffice.c: Declare GogEquationType.
	* goffice/graph/Makefile.am: Conditionally build gog-equation.[ch]
	* goffice/graph/gog-equation.[ch]: new.
	* goffice/graph/gog-equation-prefs.c: new.
	* goffice/graph/gog-chart.c: add GogEquation to the possible chart
	children.
	* goffice/graph/gog-renderer.c (gog_renderer_draw_equation): new.

Added:
   trunk/goffice/graph/gog-equation-prefs.glade
   trunk/goffice/graph/gog-equation.c
   trunk/goffice/graph/gog-equation.h
Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/goffice/goffice.c
   trunk/goffice/graph/Makefile.am
   trunk/goffice/graph/goffice-graph.h
   trunk/goffice/graph/gog-chart.c
   trunk/goffice/graph/gog-renderer.c
   trunk/goffice/graph/gog-renderer.h

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Tue Dec  9 17:39:06 2008
@@ -109,11 +109,28 @@
 	libglade-2.0		>= 2.3.6
 "
 
+dnl ***********************
+dnl Should we use gmathml ?
+dnl ***********************
+
+goffice_with_gmathml=false
+AC_ARG_WITH(gtk, [  --with-gmathml          Build with gmathml use])
+if test "x$with_gmathml" = xyes; then
+	PKG_CHECK_MODULES(GMathml, gmathml >= 0.0.1)
+	goffice_with_gmathml=true
+fi
+if test "x$goffice_with_gmathml" = "xtrue" ; then
+	AC_DEFINE(GOFFICE_WITH_GMATHML, 1, [Define if GMathml is used])
+	goffice_reqs="$goffice_reqs gmathml >= 0.0.1 "
+fi
+
+AM_CONDITIONAL(GOFFICE_WITH_GMATHML, $goffice_with_gmathml)
+
 dnl *******************
 dnl Should we use gconf ?
 dnl *******************
 goffice_with_gconf=true
-AC_ARG_WITH(gtk, [  --without-gconf           Build without gconf use])
+AC_ARG_WITH(gtk, [  --without-gconf         Build without gconf use])
 if test "x$with_gconf" = xno; then
 	ui_msg="None (Gconf disabled by request)"
 	goffice_with_gconf=false

Modified: trunk/goffice/goffice.c
==============================================================================
--- trunk/goffice/goffice.c	(original)
+++ trunk/goffice/goffice.c	Tue Dec  9 17:39:06 2008
@@ -56,6 +56,10 @@
 #undef STRICT
 #endif
 
+#ifdef GOFFICE_WITH_GMATHML
+#include <goffice/graph/gog-equation.h>
+#endif
+
 int goffice_graph_debug_level = 0;
 
 static char const *libgoffice_data_dir   = GOFFICE_DATADIR;
@@ -138,6 +142,9 @@
 	(void) GOG_LABEL_TYPE;
 	(void) GOG_GRID_TYPE;
 	(void) GOG_GRID_LINE_TYPE;
+#ifdef GOFFICE_WITH_GMATHML
+	(void) GOG_EQUATION_TYPE;
+#endif
 	(void) GOG_ERROR_BAR_TYPE;
 	(void) GOG_REG_EQN_TYPE;
 	(void) GOG_SERIES_LINES_TYPE;

Modified: trunk/goffice/graph/Makefile.am
==============================================================================
--- trunk/goffice/graph/Makefile.am	(original)
+++ trunk/goffice/graph/Makefile.am	Tue Dec  9 17:39:06 2008
@@ -99,6 +99,12 @@
 	gog-series-prefs.glade		\
 	gog-3d-box-prefs.glade
 
+if GOFFICE_WITH_GMATHML
+  libgoffice_graph_la_SOURCES += gog-equation.c
+  libgoffice_graph_la_HEADERS += gog-equation.h
+  dist_glade_DATA += gog-equation-prefs.glade
+endif
+
 include $(top_srcdir)/goffice.mk
 
 LIB_PUBLIC_HDRS = $(libgoffice_graph_la_HEADERS)

Modified: trunk/goffice/graph/goffice-graph.h
==============================================================================
--- trunk/goffice/graph/goffice-graph.h	(original)
+++ trunk/goffice/graph/goffice-graph.h	Tue Dec  9 17:39:06 2008
@@ -51,6 +51,7 @@
 typedef struct _GogGrid		GogGrid;
 typedef struct _GogGridLine	GogGridLine;
 typedef struct _GogErrorBar	GogErrorBar;
+typedef struct _GogEquation	GogEquation;
 typedef struct _GogRegCurve	GogRegCurve;
 typedef struct _GogRegEqn	GogRegEqn;
 typedef struct _GogTrendLineType	GogTrendLineType;

Modified: trunk/goffice/graph/gog-chart.c
==============================================================================
--- trunk/goffice/graph/gog-chart.c	(original)
+++ trunk/goffice/graph/gog-chart.c	Tue Dec  9 17:39:06 2008
@@ -42,6 +42,10 @@
 #include <string.h>
 #include <math.h>
 
+#ifdef GOFFICE_WITH_GMATHML
+#include <goffice/graph/gog-equation.h>
+#endif
+
 #ifdef GOFFICE_WITH_GTK
 #include <goffice/gtk/goffice-gtk.h>
 #include <gtk/gtkcombobox.h>
@@ -453,6 +457,13 @@
 	  GOG_POSITION_E|GOG_POSITION_ALIGN_CENTER, 
 	  GOG_OBJECT_NAME_BY_ROLE,
 	  NULL, NULL, NULL, NULL, NULL, NULL, { -1 } },
+#ifdef GOFFICE_WITH_GMATHML
+	{ N_("Equation"), "GogEquation",	11,
+	  GOG_POSITION_COMPASS|GOG_POSITION_ANY_MANUAL,
+	  GOG_POSITION_S|GOG_POSITION_ALIGN_CENTER,
+	  GOG_OBJECT_NAME_BY_ROLE,
+	  NULL, NULL, NULL, NULL, NULL, NULL, { -1 } },
+#endif
 	{ N_("3D-Box"), "Gog3DBox",	1,
 	  GOG_POSITION_SPECIAL, GOG_POSITION_SPECIAL, GOG_OBJECT_NAME_BY_ROLE,
 	  role_3d_box_can_add, role_3d_box_can_remove, NULL, NULL, NULL, NULL, { -1 } }

Added: trunk/goffice/graph/gog-equation-prefs.glade
==============================================================================
--- (empty file)
+++ trunk/goffice/graph/gog-equation-prefs.glade	Tue Dec  9 17:39:06 2008
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--*- mode: xml -*-->
+<glade-interface>
+  <widget class="GtkWindow" id="gog_equation_prefs_window">
+    <property name="visible">True</property>
+    <property name="title" translatable="yes">GogChartPrefs</property>
+    <child>
+      <widget class="GtkVBox" id="gog_equation_prefs">
+        <property name="visible">True</property>
+        <property name="border_width">12</property>
+        <child>
+          <widget class="GtkVBox" id="plot_area_box">
+            <property name="visible">True</property>
+            <property name="spacing">6</property>
+            <child>
+              <widget class="GtkHBox" id="hbox1">
+                <property name="visible">True</property>
+                <property name="spacing">12</property>
+                <child>
+                  <widget class="GtkLabel" id="label54">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">_Equation:</property>
+                    <property name="use_underline">True</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkEntry" id="equation_entry">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </widget>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkCheckButton" id="compact_mode_check">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label" translatable="yes">_Compact mode</property>
+                <property name="use_underline">True</property>
+                <property name="response_id">0</property>
+                <property name="draw_indicator">True</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+        </child>
+      </widget>
+    </child>
+  </widget>
+</glade-interface>

Added: trunk/goffice/graph/gog-equation.c
==============================================================================
--- (empty file)
+++ trunk/goffice/graph/gog-equation.c	Tue Dec  9 17:39:06 2008
@@ -0,0 +1,349 @@
+/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * gog-equation.c
+ *
+ * Copyright (C) 2008 Emmanuel Pacaud <emmanuel gnome org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
+ * USA
+ */
+
+#include <gmathmldocument.h>
+#include <gmathmlparser.h>
+
+#include <goffice/goffice-config.h>
+#include <goffice/graph/gog-outlined-object.h>
+#include <goffice/graph/gog-style.h>
+#include <goffice/graph/gog-theme.h>
+#include <goffice/graph/gog-equation.h>
+#include <goffice/utils/go-persist.h>
+
+#include <gsf/gsf-impl-utils.h>
+#include <glib/gi18n-lib.h>
+
+#ifdef GOFFICE_WITH_GTK
+#include <goffice/gtk/goffice-gtk.h>
+#endif
+
+enum {
+	EQUATION_PROP_0,
+	EQUATION_PROP_ITEX,
+	EQUATION_PROP_INLINE_MODE
+};
+
+struct _GogEquation {
+	GogOutlinedObject base;
+
+	char *itex;
+	gboolean inline_mode;
+	GMathmlDocument *mathml;
+};
+
+typedef struct {
+	GogOutlinedObjectClass base;
+} GogEquationClass;
+
+static GObjectClass *equation_parent_klass;
+
+GType gog_equation_view_get_type (void);
+
+#ifdef GOFFICE_WITH_GTK
+
+static void
+cb_equation_entry_changed (GtkEntry *entry, GogEquation *equation)
+{
+	g_object_set (G_OBJECT (equation), "itex", gtk_entry_get_text (entry), NULL);
+}
+static void
+cb_inline_mode_check_toggled (GtkToggleButton *button, GogEquation *equation)
+{
+	g_object_set (G_OBJECT (equation), "inline-mode", gtk_toggle_button_get_active (button), NULL);
+}
+
+static void
+gog_equation_populate_editor (GogObject *obj,
+			      GogEditor *editor,
+			      G_GNUC_UNUSED GogDataAllocator *dalloc,
+			      GOCmdContext *cc)
+{
+	GogEquation *equation = GOG_EQUATION (obj);
+	GladeXML *gui;
+	GtkWidget *widget;
+
+	gui = go_libglade_new ("gog-equation-prefs.glade", "gog_equation_prefs", GETTEXT_PACKAGE, cc);
+	g_return_if_fail (gui != NULL);
+
+	widget = glade_xml_get_widget (gui, "equation_entry");
+	gtk_entry_set_text (GTK_ENTRY (widget), equation->itex);
+	g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (cb_equation_entry_changed), obj);
+
+	widget = glade_xml_get_widget (gui, "compact_mode_check");
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), equation->inline_mode);
+	g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (cb_inline_mode_check_toggled), obj);
+
+
+	widget = glade_xml_get_widget (gui, "gog_equation_prefs");
+
+	gog_editor_add_page (editor, widget, _("Equation"));
+
+	(GOG_OBJECT_CLASS(equation_parent_klass)->populate_editor) (obj, editor, dalloc, cc);
+}
+
+#endif
+
+static void
+gog_equation_update (GogObject *obj)
+{
+	GogEquation *equation = GOG_EQUATION (obj);
+	GMathmlDocument *mathml;
+	char *itex;
+	size_t size;
+	unsigned int i;
+	gboolean is_blank = TRUE;
+
+	size = equation->itex != NULL ? strlen(equation->itex) : 0;
+	for (i = 0; i < size; i++) {
+		if (equation->itex[i] != ' ') {
+		    is_blank = FALSE;
+		    break;
+		}
+	}
+
+	if (equation->inline_mode)
+		itex = g_strdup_printf ("$%s$", equation->itex);
+	else
+		itex = g_strdup_printf ("$$%s$$", equation->itex);
+
+	mathml = gmathml_document_new_from_itex (itex);
+
+	/* Keep the last valid mathml document if the itex -> mathml conversion fails.
+	 * It keep the equation from disappearing when the current equation entry is not a
+	 * well formed itex expression. */
+
+	if (gmathml_document_get_math_element (mathml) != NULL || is_blank) {
+		if (equation->mathml != NULL)
+			g_object_unref (equation->mathml);
+
+		equation->mathml = mathml;
+	} else
+		g_object_unref (mathml);
+
+	g_free (itex);
+}
+
+static void
+gog_equation_set_property (GObject *obj, guint param_id,
+			   GValue const *value, GParamSpec *pspec)
+{
+	GogEquation *equation = GOG_EQUATION (obj);
+
+	switch (param_id) {
+		case EQUATION_PROP_ITEX:
+			g_free (equation->itex);
+			equation->itex = g_value_dup_string (value);
+			break;
+		case EQUATION_PROP_INLINE_MODE:
+			equation->inline_mode = g_value_get_boolean (value);
+			break;
+
+		default:
+			G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
+			return;
+	}
+
+	gog_object_emit_changed (GOG_OBJECT (obj), TRUE);
+	gog_object_request_update (GOG_OBJECT (obj));
+}
+
+static void
+gog_equation_get_property (GObject *obj, guint param_id,
+			   GValue *value, GParamSpec *pspec)
+{
+	GogEquation *equation = GOG_EQUATION (obj);
+
+	switch (param_id) {
+		case EQUATION_PROP_ITEX :
+			g_value_set_string (value, equation->itex);
+			break;
+		case EQUATION_PROP_INLINE_MODE:
+			g_value_set_boolean (value, equation->inline_mode);
+			break;
+
+		default:
+			G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
+			break;
+	}
+}
+
+static void
+gog_equation_init_style (GogStyledObject *gso, GogStyle *style)
+{
+	style->interesting_fields =
+		GOG_STYLE_OUTLINE |
+		GOG_STYLE_FILL |
+		GOG_STYLE_FONT |
+		GOG_STYLE_TEXT_LAYOUT;
+
+	gog_theme_fillin_style (gog_object_get_theme (GOG_OBJECT (gso)),
+				style, GOG_OBJECT (gso), 0, FALSE);
+}
+
+static void
+gog_equation_finalize (GObject *object)
+{
+	GogEquation *equation = GOG_EQUATION (object);
+
+	if (equation->mathml)
+		g_object_unref (equation->mathml);
+	g_free (equation->itex);
+}
+
+static void
+gog_equation_class_init (GogEquationClass *klass)
+{
+	GObjectClass *gobject_klass = (GObjectClass *) klass;
+	GogObjectClass *gog_klass = (GogObjectClass *) klass;
+	GogStyledObjectClass *style_klass = (GogStyledObjectClass *) klass;
+
+	equation_parent_klass = g_type_class_peek_parent (klass);
+
+	gobject_klass->finalize     = gog_equation_finalize;
+	gobject_klass->set_property = gog_equation_set_property;
+	gobject_klass->get_property = gog_equation_get_property;
+#ifdef GOFFICE_WITH_GTK
+	gog_klass->populate_editor  = gog_equation_populate_editor;
+#endif
+	gog_klass->update	    = gog_equation_update;
+
+	g_object_class_install_property (gobject_klass, EQUATION_PROP_ITEX,
+		g_param_spec_string ("itex",
+				     _("Itex markup"),
+				     _("Itex markup string"),
+				     NULL,
+				     GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
+	g_object_class_install_property (gobject_klass, EQUATION_PROP_INLINE_MODE,
+		g_param_spec_boolean ("inline-mode",
+				      _("Inline mode"),
+				      _("Inline mode selection"),
+				      FALSE,
+				      GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
+
+	gog_klass->view_type		= gog_equation_view_get_type ();
+	style_klass->init_style 	= gog_equation_init_style;
+}
+
+static void
+gog_equation_init (GogEquation *equation)
+{
+	equation->itex = NULL;
+	equation->inline_mode = FALSE;
+	equation->mathml = NULL;
+}
+
+GSF_CLASS (GogEquation, gog_equation,
+	   gog_equation_class_init, gog_equation_init,
+	   GOG_OUTLINED_OBJECT_TYPE);
+
+typedef struct {
+	GogOutlinedView		 base;
+
+	GMathmlView 		*mathml_view;
+} GogEquationView;
+
+typedef GogOutlinedViewClass	GogEquationViewClass;
+
+#define GOG_EQUATION_VIEW_TYPE	(gog_equation_view_get_type ())
+#define GOG_EQUATION_VIEW(o)	(G_TYPE_CHECK_INSTANCE_CAST ((o), GOG_EQUATION_VIEW_TYPE, GogEquationView))
+#define IS_GOG_EQUATION_VIEW(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_EQUATION_VIEW_TYPE))
+
+static GogViewClass *equation_view_parent_klass;
+
+static void
+gog_equation_view_size_request (GogView *view,
+				GogViewRequisition const *available,
+				GogViewRequisition *requisition)
+{
+	double height, width;
+	GogEquation *equation;
+	GogEquationView *equation_view;
+
+	equation = GOG_EQUATION (view->model);
+	equation_view = GOG_EQUATION_VIEW (view);
+
+	if (equation->mathml == NULL) {
+		requisition->w = 0.0;
+		requisition->h = 0.0;
+		return;
+	}
+
+	gmathml_view_set_document (equation_view->mathml_view, equation->mathml);
+	gmathml_view_measure (equation_view->mathml_view, &width, &height);
+
+	requisition->w = gog_renderer_pt2r_x (view->renderer, width);
+	requisition->h = gog_renderer_pt2r_y (view->renderer, height);
+}
+
+static void
+gog_equation_view_render (GogView *view,
+			  GogViewAllocation const *bbox)
+{
+	GogEquation *equation;
+	GogEquationView *equation_view;
+
+	equation = GOG_EQUATION (view->model);
+	equation_view = GOG_EQUATION_VIEW (view);
+
+	if (equation->mathml == NULL)
+		return;
+
+	gmathml_view_set_document (equation_view->mathml_view, equation->mathml);
+
+	gog_renderer_draw_equation (view->renderer, equation_view->mathml_view,
+				    view->allocation.x, view->allocation.y);
+}
+
+static void
+gog_equation_view_finalize (GObject *object)
+{
+	GogEquationView *view = GOG_EQUATION_VIEW (object);
+
+	if (view->mathml_view != NULL)
+		g_object_unref (view->mathml_view);
+}
+
+static void
+gog_equation_view_class_init (GogEquationViewClass *gview_klass)
+{
+	GObjectClass *gobject_klass = (GObjectClass *) gview_klass;
+	GogViewClass *view_klass   = (GogViewClass *) gview_klass;
+
+	equation_view_parent_klass = g_type_class_peek_parent (gview_klass);
+
+	gobject_klass->finalize	   = gog_equation_view_finalize;
+	view_klass->size_request   = gog_equation_view_size_request;
+	view_klass->render	   = gog_equation_view_render;
+}
+
+static void
+gog_equation_view_init (GObject *object)
+{
+	GogEquationView *view = GOG_EQUATION_VIEW (object);
+
+	view->mathml_view = gmathml_view_new (NULL, NULL);
+}
+
+GSF_CLASS (GogEquationView, gog_equation_view,
+	   gog_equation_view_class_init, gog_equation_view_init,
+	   GOG_OUTLINED_VIEW_TYPE)
+

Added: trunk/goffice/graph/gog-equation.h
==============================================================================
--- (empty file)
+++ trunk/goffice/graph/gog-equation.h	Tue Dec  9 17:39:06 2008
@@ -0,0 +1,40 @@
+/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * gog-equation.h : 
+ *
+ * Copyright (C) 2008 Emmanuel Pacaud <emmanuel gnome org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
+ * USA
+ */
+
+#ifndef GOG_EQUATION_H
+#define GOG_EQUATION_H
+
+#include <goffice/graph/goffice-graph.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GOG_EQUATION_TYPE		(gog_equation_get_type ())
+#define GOG_EQUATION(o)			(G_TYPE_CHECK_INSTANCE_CAST ((o), GOG_EQUATION_TYPE, GogEquation))
+#define IS_GOG_EQUATION(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_EQUATION_TYPE))
+#define GOG_EQUATION_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GOG_EQUATION_TYPE, GogEquationClass))
+
+GType gog_equation_get_type (void);
+
+G_END_DECLS
+
+#endif /* GOG_EQUATION_H */
+

Modified: trunk/goffice/graph/gog-renderer.c
==============================================================================
--- trunk/goffice/graph/gog-renderer.c	(original)
+++ trunk/goffice/graph/gog-renderer.c	Tue Dec  9 17:39:06 2008
@@ -1392,6 +1392,29 @@
 
 	return 1.0 / rend->scale;
 }
+#ifdef GOFFICE_WITH_GMATHML
+
+void
+gog_renderer_draw_equation (GogRenderer *renderer, GMathmlView *mathml_view, double x, double y)
+{
+	cairo_t *cairo;
+
+	g_return_if_fail (IS_GOG_RENDERER (renderer));
+	g_return_if_fail (GMATHML_IS_VIEW (mathml_view));
+
+	cairo = renderer->cairo;
+
+	cairo_save (cairo);
+
+	cairo_scale (cairo, renderer->scale_x, renderer->scale_y);
+
+	gmathml_view_set_cairo (mathml_view, cairo);
+	gmathml_view_render (mathml_view, x / renderer->scale_x, y / renderer->scale_y);
+
+	cairo_restore (cairo);
+}
+
+#endif
 
 /**
  * gog_renderer_new:

Modified: trunk/goffice/graph/gog-renderer.h
==============================================================================
--- trunk/goffice/graph/gog-renderer.h	(original)
+++ trunk/goffice/graph/gog-renderer.h	Tue Dec  9 17:39:06 2008
@@ -58,6 +58,10 @@
 } GtkAnchorType;
 #endif
 
+#ifdef GOFFICE_WITH_GMATHML
+#include <gmathmlview.h>
+#endif
+
 #include <cairo.h>
 #ifdef CAIRO_HAS_SVG_SURFACE
 #define GOG_RENDERER_CAIRO_WITH_SVG
@@ -149,6 +153,11 @@
 
 GogRenderer 	*gog_renderer_new 		(GogGraph *graph);
 
+#ifdef GOFFICE_WITH_GMATHML
+void		 gog_renderer_draw_equation	(GogRenderer *renderer, GMathmlView *mathml_view,
+						 double x, double y);
+#endif
+
 G_END_DECLS
 
 #endif /* GOG_RENDERER_H */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]